Procedural Generation, Vegitation Placement

As a basis, So far my generation uses a port of LibNoise, That combines Ridged Multifractal noise (for mountain shapes), flattened Billow(for plains), and some Perlin noise to make the plains a bit more interesting.

That is the gist of my generation basis, as a result it makes some interesting and (i think), pretty terrains.

In terms of placing the texture, I run a Coroutine to iterate over each “Chunk”/terrain to check the slope/steepness and paint a grass texture if the slope is less than a limit. Following that iteration, I iterate over the terrain to place the trees and bushes in the green areas. This results in the stone mounds, and the green/flattened areas.

THE ISSUE
Steepness is the only thing I check in terms of placing grass details, and it causes the issues seen in this picture…

My Question
What would be another way to check for a smoother area of grass? Should I add a “Nearby” check (Check around within 2 units for other grass)?

Or is there simply a better way to procedurally place these features other than relying on slope calculations?

I would like the grass to end up near other vegitation, but feel like placing grass decal based on placed trees and bushes may be a bit overkill.(But may possibly be the solution.) Placing grass based on bushes/trees would look like this…

So Unity Community! Your thoughts please!

Casually inserting another picture for good fun, and as a side question.

With the ridgees on the mountains they are green as well. My texture painting uses the following formulas…

            //[0] is Grass
            //[1] is dirt
            //[2] is stone
                splatWeights[0] = 4.0f - (Mathf.Max(steepness - 5f, 0f) / 8f);

                //Texture[1] (dirt/grass), Grass will fade to dirt at higher altitudes
                splatWeights[1] = 4.0f - splatWeights[0];

                if(splatWeights[1] > splatWeights[0]){
                    splatWeights[1] += 0.5f;
                }
                // (Stone/Cliff) is stronger at higher altitudes, and steeper terrain
                // maxHeight-200 - height-200 / maxHeight-200, Gets fractional distance between
                //            200 and maxheight
                // multiply by strength of 5

                if(height > 200){
                    splatWeights[2] = 5.0f * ((height - 200) / (terrainData.size.y - 200));
                }

I normalize the values at the end of computing the strengths. But my question is what would be a good way of removing the green on the mountains? Boosting the strength (5.0f)? A side effect is it turns my valleys more into a grey, which is undesirable

So I may have answered my own initial question, “How to make grass placement ‘prettier’”. I think I’m just going to do a few passes of Cellular Automata after I place grass near other details. Cellular Automata is usually used to make more realistic cave shapes. So this should make for decent patches of grass and will bring in the shape towards the middle. This will remove the odd grass lines as well as make for nicer shapes of grass!

As for the texture painting of grass, I tried boosting the strength of the Stone texture, and it made it look a bit better but not removing the issue entirely. Which is fine considering grass grows on cliffs sometimes. :wink:

SO, off to Cellular Automata!

Not really my area of expertise but…

I think picture 2 looks crappy with your strips of grass, while picture 3 looks great! I don’t know what a cellular automata is but I’m not sure you need it.

As for the grassy bits on the sides of mountains, I agree that any flat surface will tend to grow some vegetation but the type and amount is usually affected by altitude. Perhaps you could include an altitude in your vegetation placement algorithm.

Yeah, I feel like Cellular will be a bit overkill, while creating steady results like picture 3, it would be another 4-5 iterations over the terrain simply to smooth grass patches out.

But yeah picture 2 is the issue I’m aiming to remove, and relying on the slope of terrain causes that issue at points unfortunately.

But thanks for leaving a comment on this!

The cheapest solution to two is to simply add some random offset to each piece of grass.

Ah so it would become patches instead of lines, that makes sense too. But I’d like to fully remove the lines or patches in general. Trying to peal back the tiny/ugly issues in the generation before I proceed and make more =D

I’ll post a picture when I got it ironed out

I’m stiiiiiiiiiiiiiiiiiill waiting…