Grass in between fake stones and surface cracks

Started by james adamson, January 20, 2020, 10:46:35 am

Previous topic - Next topic

james adamson

How would I go about putting grass or moss between my fake stones and clumps of grass growing from cracks in the surface?
Thanks again in advance.
James.

cyphyr

Clue:
Fake stones are Voronoi noise.
Use a Voronoi noise function setup set to the same scale and seed as the fake stones.
You'll probably need a colour adjust to boost the contrast of the Voronoi noise output.

I'm away from my main PC at the moment but I'll post a sample when I get back tomorrow.
www.richardfraser.co.uk
https://www.facebook.com/RichardFraserVFX/
/|\

Ryzen 9 3900X @3.79Ghz, 64Gb (TG4 benchmark 6:20)
i7 5930K @3.5Ghz, 32Gb (TG4 benchmark 13.44)

Tangled-Universe

January 20, 2020, 12:06:40 pm #2 Last Edit: January 20, 2020, 12:14:25 pm by Tangled-Universe
For this example your fake stone shader needs to be a child of a surface layer:

Fake stones shader -> displacement shader to scalar -> Boolean NOT scalar -> use this as a mask for your surface layer downstream.

Explanation:
With the fake stones as a child of a surface layer you will have a couple of benefits:
1) enabling smoothing of the (parent) surface layer will force the layer to use a smoothed version of the terrain as computed per the last compute terrain before the surface layer.
This prevents fake stones from incorporating high frequency details (present in the unsmoothed terrain).
2) you can use a set of separate fractals to give the fake stones unique displacement/colour
3) you can generate masks like this ;)

The displacement shader to scalar converts the displacement of the fake stones to a scalar (a scalar is easiest to think of as a certain (greyscale) value).
The Boolean NOT scalar then converts the output of the displacement shader to scalar to 0 = black for where the stones are and 1 = white where the stones are not.

WAS

Quote from: Tangled-Universe on January 20, 2020, 12:06:40 pmFor this example your fake stone shader needs to be a child of a surface layer:

Fake stones shader -> displacement shader to scalar -> Boolean NOT scalar -> use this as a mask for your surface layer downstream.

Explanation:
With the fake stones as a child of a surface layer you will have a couple of benefits:
1) enabling smoothing of the (parent) surface layer will force the layer to use a smoothed version of the terrain as computed per the last compute terrain before the surface layer.
This prevents fake stones from incorporating high frequency details (present in the unsmoothed terrain).
2) you can use a set of separate fractals to give the fake stones unique displacement/colour
3) you can generate masks like this ;)

The displacement shader to scalar converts the displacement of the fake stones to a scalar (a scalar is easiest to think of as a certain (greyscale) value).
The Boolean NOT scalar then converts the output of the displacement shader to scalar to 0 = black for where the stones are and 1 = white where the stones are not.

What about underlying surface geometry? Disp to scalar will include surface geometry downstream and not be a good mask unless the surface the stones are on is flat.

Tangled-Universe

The way I described it ensures there's no underlying surface geometry for the fake stones at that particular position in the network.

Tangled-Universe

January 20, 2020, 12:51:39 pm #5 Last Edit: January 20, 2020, 03:41:35 pm by Tangled-Universe
Gotta run for my kickboxingclass...quick copy/paste which should explain it

Edit: removed XML and added it as a .tgc file instead for better readability.

WAS

I'll give it a try. But I thought at render time the child is applied to anything underneath, so it includes whatever the surface layer is plugged with in Main

WAS

Here's what I mean. I've asked about this numerous times and wish It worked as a map all on it's own but the fake stones layer is looked at, with the underlying surface because of what it's plugged into or something, which ruins any texturing with a mask from it. If this worked anywhere I'd have so many more stone ideas out, or things like snow on rocks would be easy.

Matt

In your screenshot it is working. What makes you think it isn't? Perhaps you are seeing the terrain displacement and thinking it's the stone displacement?
Just because milk is white doesn't mean that clouds are made of milk.

WAS

Quote from: Matt on January 20, 2020, 02:55:50 pmIn your screenshot it is working. What makes you think it isn't? Perhaps you are seeing the terrain displacement and thinking it's the stone displacement?

It's not terrain. Terrain is a roughness 0.5 (small hills scale 5 leadin 25; disp 5 or 10), and the fake stones are at 0.75 density. To mee it seems obvious the purple colour is offshifted form the stones.

WAS

Oh I see the issue. The boolean mask is inverted. This does seem to actually work to some extent besides the mask being very hard.

WAS

Doing a little more testing, you may have issues while putting cracks on rocks if you don't want them to clip with the stone boundaries with the boolean not scalar mask (inverted). And when I tried using a colour adjust with the disp to scalar I was having issues with parts of the stones not being within the mask (White Point 0.1) when there are pretty steep hills, so may create "blank spots" in texturing. Classic rock inverting is happening on hills too with surface detail really bad.