Planetside Software Forums

General => Terragen Discussion => Topic started by: james adamson on January 20, 2020, 10:46:35 AM

Title: Grass in between fake stones and surface cracks
Post by: james adamson on January 20, 2020, 10:46:35 AM
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.
Title: Re: Grass in between fake stones and surface cracks
Post by: cyphyr on January 20, 2020, 11:50:20 AM
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.
Title: Re: Grass in between fake stones and surface cracks
Post by: Tangled-Universe on January 20, 2020, 12:06:40 PM
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.
Title: Re: Grass in between fake stones and surface cracks
Post by: WAS on January 20, 2020, 12:42:16 PM
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.
Title: Re: Grass in between fake stones and surface cracks
Post by: Tangled-Universe on January 20, 2020, 12:49:48 PM
The way I described it ensures there's no underlying surface geometry for the fake stones at that particular position in the network.
Title: Re: Grass in between fake stones and surface cracks
Post by: Tangled-Universe on January 20, 2020, 12:51:39 PM
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.
Title: Re: Grass in between fake stones and surface cracks
Post by: WAS on January 20, 2020, 12:54:38 PM
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
Title: Re: Grass in between fake stones and surface cracks
Post by: WAS on January 20, 2020, 01:03:51 PM
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.
Title: Re: Grass in between fake stones and surface cracks
Post by: Matt on January 20, 2020, 02:55:50 PM
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?
Title: Re: Grass in between fake stones and surface cracks
Post by: WAS on January 20, 2020, 02:57:58 PM
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.
Title: Re: Grass in between fake stones and surface cracks
Post by: WAS on January 20, 2020, 03:06:37 PM
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.
Title: Re: Grass in between fake stones and surface cracks
Post by: WAS on January 20, 2020, 03:13:58 PM
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.