Planetside Software Forums

General => Terragen Discussion => Topic started by: WAS on December 04, 2019, 03:23:21 PM

Title: Merge Terrains by Slope?
Post by: WAS on December 04, 2019, 03:23:21 PM
I seem to recall having done this before but I can't seem to find the project. When I try to recreate I'm not getting it working. I'm trying to use a merge shader between a rough, and smooth terrain, and mix by slopes. I tried a surface layer and distribution shader but it seems to be switching between the two terrain. Even if I use a surface layer fed tex coords from the base terrains, with a solid visible map that it should read, it doesn't seem to be mixing between the two.
Title: Re: Merge Terrains by Slope?
Post by: N-drju on December 05, 2019, 01:38:45 AM
I'd do it differently.

What if you just create a slope (peak) with mild displacement, mask it, then use the same mask, albeit "diluted" by a PF, to make rough features here and there?
Title: Re: Merge Terrains by Slope?
Post by: Dune on December 05, 2019, 01:51:21 AM
That is because you don't have a slope calculated at the time of merging. Needs a compute terrain. Why not use the smooth as base terrain and add the rough terrain after a compute and slope mask?
Title: Re: Merge Terrains by Slope?
Post by: WAS on December 05, 2019, 01:53:54 PM
Quote from: Dune on December 05, 2019, 01:51:21 AMThat is because you don't have a slope calculated at the time of merging. Needs a compute terrain. Why not use the smooth as base terrain and add the rough terrain after a compute and slope mask?

Well ultimately they are heightmaps going to be used, not the default scene. This should be plenty possible. Especially considering it's the same functions being used in other software to do this exact same thing, mixing displacement with a mixer map. Additionally utilizing a smooth form, and adding displacement even for TG terrains wouldn't give me the same displacement shapes having to re-apply over the terrain at different amplitudes (especially in their stretched forms at 2000m+)


I've tried both texture coordinates and compute terrain, both do not work. Additionally, you'd think forcing a sloped map with a surface layer would have the data present for the shader read as a 2d/3d map... similar to issues with other shaders not accepting mapped input like it's invisible these days.

Even used after a compute terrain, to do some basic slope keying, it's not accurate and goes all over the place when using merge shader.
Title: Re: Merge Terrains by Slope?
Post by: Tangled-Universe on December 06, 2019, 01:25:07 PM
So which slope is the key for the mixing? The first? The second? Both? Both would be the mix itself...chicken and the egg...is my first thought when reading this.
Title: Re: Merge Terrains by Slope?
Post by: WAS on December 06, 2019, 01:33:14 PM
Quote from: Tangled-Universe on December 06, 2019, 01:25:07 PMSo which slope is the key for the mixing? The first? The second? Both? Both would be the mix itself...chicken and the egg...is my first thought when reading this.

Yooou didn't looked at the TGD, so your ignorance is forgiven. That's the point of the compute terrain/texture coordinates or surface layer....

The first, rough, one....

It's also weird you'd think chickens and eggs and not the method used in terrain generation, wm, wc, Gaea, etc, all have similar combiner/mixers used like this religiously based on maps from previous nodes or image maps.
Title: Re: Merge Terrains by Slope?
Post by: Kevin F on December 10, 2019, 02:43:28 PM
Did I dream it or was there a reply to this topic here this morning from Matt?
Title: Re: Merge Terrains by Slope?
Post by: WAS on December 10, 2019, 07:28:26 PM
Not sure. I'm also confused about the general methodology too. I seem to remember this being possible in the past, being even suggested to mix terrain types. And I'm still very curious why Terragen cannot handle dummy compute setups to achieve things outside the scope of the terrains compute terrain. Such as contour shaders, mixers, masks, etc. This should be possible. You can mix these compute terrains into the final flow but not use one as data for masks or special inputs like contour or other shaders.  I feel it should be looked into.
Title: Re: Merge Terrains by Slope?
Post by: Dune on December 11, 2019, 03:14:48 AM
There was a reply, stating that you indeed need a compute terrain to get slope data first, before being able to merge on slope data (like I said earlier). There was a schedule too, but can't remember what.
Title: Re: Merge Terrains by Slope?
Post by: mhaze on December 11, 2019, 05:56:28 AM
Mixed-Terrains.jpg
This seems to produce the required effect - Note in the merge shader, choose by altitude is set to highest raise. Te smoothness is varied by playing with the displacement roughness in the Smooth fractal Terrain shader. displacement offset also has interesting effects.
 Micks_Terrain Mixing.tgd
Title: Re: Merge Terrains by Slope?
Post by: Dune on December 11, 2019, 08:20:37 AM
That takes two compute terrains, but you can delete both and get the same result. Which is faster.
Title: Re: Merge Terrains by Slope?
Post by: mhaze on December 11, 2019, 09:50:18 AM
Yeah just noticed that >:( ! Lots of potential in the technique though.
Title: Re: Merge Terrains by Slope?
Post by: Dune on December 11, 2019, 10:40:10 AM
Certainly.
Title: Re: Merge Terrains by Slope?
Post by: WAS on December 11, 2019, 11:06:14 AM
Quote from: mhaze on December 11, 2019, 05:56:28 AMMixed-Terrains.jpg
This seems to produce the required effect - Note in the merge shader, choose by altitude is set to highest raise. Te smoothness is varied by playing with the displacement roughness in the Smooth fractal Terrain shader. displacement offset also has interesting effects.
 Micks_Terrain Mixing.tgd

I think the Terminator between types is a little strong but certain better than just doing it by highest like I tried. I'll take a look here in a bit.
Title: Re: Merge Terrains by Slope?
Post by: bobbystahr on December 11, 2019, 01:20:22 PM
Quote from: mhaze on December 11, 2019, 05:56:28 AMMixed-Terrains.jpg
This seems to produce the required effect - Note in the merge shader, choose by altitude is set to highest raise. Te smoothness is varied by playing with the displacement roughness in the Smooth fractal Terrain shader. displacement offset also has interesting effects.
 Micks_Terrain Mixing.tgd

Good one, will play with this later bearing in mind your discoveries....thanks for sharing.