Page 1 of 2

Procedural grass

Posted: 04 Feb 2019, 22:06
by Ravenwing
So I've been thinking about this since noticing the grass in Red Dead Redemption 2. It struck me because of how natural it looked as the grass near roads gradually got longer and denser the further from the road you got.

Is there a typical technique games use for this? It would be great when we eventually add support for this for it to be easily integrated but also extendable to new textures and mods etc. I'm imagining a greyscale map that is paired with each terrain texture. This would dictate the height and/or density of the grass that gets generated. This would allow us to create sparse grass in the ashlands and lush grass in the grazelands while also tapering off at roads as the two textures get blended together. Is this a plausible way of doing it?

How would we account for different types of grass? Perhaps a color map to determine the average color and the density by an alpha channel?

If maps like this are the easiest way of doing this, it would also be cool to have maps for things like mud or puddles for when it rains. Thought I'd throw these out there and see what other people thought.

Re: Procedural grass

Posted: 05 Feb 2019, 02:56
by Ravenwing
Apparently that is basically how it would be done: viewtopic.php?f=6&t=5049&p=54084#p54084

My questions about using a color map to procedurally modify the color still stands though, as well as using a map for weather related things like rain puddles.

Re: Procedural grass

Posted: 05 Feb 2019, 17:46
by AnyOldName3
I think in Fallout 4, wetness-from-rain stuff is done by a material swap, so provided you're okay with puddles being a texture rather than extra geometry, something similar could work in OpenMW.

Re: Procedural grass

Posted: 07 Feb 2019, 05:07
by Ravenwing
Oh that’s absolutely how I expect it would be done. Extra geometry sounds like too much work, especially when puddles could work so easily in textures. Perhaps this would be a switch like light up windows, but instead of time of day, use weather. For that matter we could implement snow in much the same way. Is there a simple way to fade between textures? Having puddles pop-in would rather ruin the effect.

Another thought occurs, would it be possible to add the actual water shader to a map? That way any ripples and rain drop effects we add to the shaded would come for free.

Are there other texture maps that are common in games with interesting visual effects?

Re: Procedural grass

Posted: 07 Feb 2019, 07:07
by wareya
Ravenwing wrote: 07 Feb 2019, 05:07 Is there a simple way to fade between textures?
The current way that terrain rendering works (additive blending over a black base) should make this possible to implement for terrain.

Re: Procedural grass

Posted: 08 Feb 2019, 02:45
by silentthief
Has anyone checked out Morrowind Mesh Generator? It's a utility (kind of a misnomer - doesn't *make* meshes, it places them for you)
readme help file wrote: This program allows you to place meshes over the Morrowind landscape
with specific meshes being placed on specific ground textures.
This allows you to put a texture down on the landscape, and the program will put meshes/objects there.
Bringing this up as this allows for placement of grass (or other plantlife) on predetermined textures

Thought it might be worth a look

ST

Re: Procedural grass

Posted: 08 Feb 2019, 17:01
by Ravenwing
wareya wrote: 07 Feb 2019, 07:07 The current way that terrain rendering works (additive blending over a black base) should make this possible to implement for terrain.
Interesting, never knew that's how it worked. What I meant to ask was is there a way of fading out one texture and fading in another in it's place (maybe that's what you mean too). This wouldn't necessarily look right, but seems the simplest way of implementing things like puddles. I still need to try out the glowing windows PR, so maybe this will answer my question.
silentthief wrote: 08 Feb 2019, 02:45 This allows you to put a texture down on the landscape, and the program will put meshes/objects there.
Bringing this up as this allows for placement of grass (or other plantlife) on predetermined textures

Thought it might be worth a look
Sounds like Oblivion's forest generating feature, which I honestly really liked. I understand it wasn't the best for making a really nice game world, but that's because the randomness of nature isn't actually something that's necessarily enjoyable to walk through. Although in terms of grass, as the linked thread states, there are more benefits to real-time batching than preplacing.

Re: Procedural grass

Posted: 08 Feb 2019, 17:58
by AnyOldName3
Speedtree has been used to make some pretty good forests outside of Oblivion, just Oblivion didn't make use of its full potential (as that requires more human intervention and processing time).

Re: Procedural grass

Posted: 09 Feb 2019, 03:31
by wareya
Ravenwing wrote: 08 Feb 2019, 17:01
wareya wrote: 07 Feb 2019, 07:07 The current way that terrain rendering works (additive blending over a black base) should make this possible to implement for terrain.
Interesting, never knew that's how it worked. What I meant to ask was is there a way of fading out one texture and fading in another in it's place (maybe that's what you mean too). This wouldn't necessarily look right, but seems the simplest way of implementing things like puddles. I still need to try out the glowing windows PR, so maybe this will answer my question.
I made a PR (that got merged) to change it to work that way because the previous method was very ugly and didn't look how vanilla looked.

> What I meant to ask was is there a way of fading out one texture and fading in another in it's place (maybe that's what you mean too).

This is what I mean should be possible to implement now that terrain textures are blended additively.

Re: Procedural grass

Posted: 10 Feb 2019, 05:35
by Ravenwing
wareya wrote: 09 Feb 2019, 03:31 This is what I mean should be possible to implement now that terrain textures are blended additively.
Hooray! Seems like this would be useful in other situations as well. Realized that Akortunov's window lighting is in a separate branch and not a PR so I won't be able to test it with an artifact. Can anyone report on this who has been able to test it out? It's not terrain, but I'd still be interested to know.
AnyOldName3 wrote: 08 Feb 2019, 17:58 Speedtree has been used to make some pretty good forests outside of Oblivion, just Oblivion didn't make use of its full potential (as that requires more human intervention and processing time).
I had no idea that Speedtree did anything besides single trees at a time. Are there any reputable FOSS alternatives, even if they're not nearly as good?