landscape grass distribution and world position functions

Hi there!

I’m trying to come up with some material functions that I can use to control distribution and shading of landscape grass output. I wanna use the same function in the landscape material (grass output - distribution) and in the foliage material (base color - variation shading), eg to influence grass distribution and shading in “dry patches” of the landscape.

Playing around with this I noticed that the landscape grass output seems to interpret world position differently than the rest of the shader:

The landscape in this debug scene is a 7x7, at 0,0,0 with 100,100,100 scale.

Is this a bug or a feature? Any idea how to control grass distribution, so it correlates to the shader function?
Any help appreciated!


So looks like this is a workaround: use WorldPosition in the foliage shader, and use landscape coords in the grass output. The landscape shader can use either of them. This works as long as the landscape is in 0,0,0 position and has 100,100,100 scale. Since the units in the landscape coords are in meters vs cm in WorldPos, you’ll have to multiply by 100. Also make sure to set the z-pos value to 0, since using landscape coords is 2-dimensional.

Does anyone have a better solution for using the same function in all 3: foliage-shader, landscape-shader, grass-output?!



Thanks or sharing, @mstummer ,

I have an idea: what about if you try with a Component Mask node, cheking R and G, and putting it after the world position node (of your first post). Or if it doesn’t work, putting thar same Mask node in a different location.


I sugggest you get and load the kite demo. They use a similar method and you can see how they do it to match it exaclty.