Merge Terrains by Slope?

Started by WAS, December 04, 2019, 03:23:21 PM

Previous topic - Next topic

WAS

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.

N-drju

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?
"This year - a factory of semiconductors. Next year - a factory of whole conductors!"

Dune

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?

WAS

#3
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.

Tangled-Universe

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.

WAS

#5
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.

Kevin F

Did I dream it or was there a reply to this topic here this morning from Matt?

WAS

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.

Dune

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.

mhaze

#9
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

Dune

That takes two compute terrains, but you can delete both and get the same result. Which is faster.

mhaze

Yeah just noticed that >:( ! Lots of potential in the technique though.

Dune


WAS

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.

bobbystahr

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.
something borrowed,
something Blue.
Ring out the Old.
Bring in the New
Bobby Stahr, Paracosmologist