Download

Modifying a material with world position and a mask?

Hello! I have a noise texture that I use with my landscape material to make some variations in my grass colors.
Now I would like to do the same with my foliage grass, so that I the grass gets color variations with the same mask at the same scaled as the landscape so that they match.
I imagine I should be able to use the mask scaled up to the same size as if used by the landscape and color the grass based on a combination of the world position relative to the mask. But I cannot quite see the setup before me. Any ideas?

Alright, so I *think *I’m onto something here:


I’m subtracting the position of the landscape to offset the world position, dividing it by the size of the landscape to spread it out over the area (multiplied by 0.496, as my landscape is at 49.6% scale).

As you can see, I am now generating brown spots based on my noise mask, the same as my landscape. However, I cannot quite get the colourization and the positioning of the noise to match the noise of the terrain.

I have also multiplied the scale the noise of the landscape by 0.001 (which uses landscape coords at a value of 1), and I’m not sure how to recreate this scale in the grass.

Here’s an example with the noise as pink, just to make it clearer:

It’s close, but not quite there.

I did it!