Shading masked by incomplete terrain

Started by Kexikus, May 09, 2020, 06:47:40 AM

Previous topic - Next topic

Kexikus

Hi,

I'm currently working on a desert scene which is basically just endless dunes and a few mountains/rocks cropping up. But I've now run into an issue with coloring that scene which is certainly related to the way my scene is set up.

The way it's currently set up is this but I'll also attach the tgd:

I start with creating the mountains from a power fractal fed into a displacement shader using Get Altitude to level everything below 0m so that I only get some rocks/mountains peeking up and a flat terrain inbetween. Then I add two layers of dunes with different sizes to get the desert environment.

Now what I want is this: I want the mountains to have a different color than the dunes and I also want to make use of Hetzens side masking to color the sand dunes based on the direction they're facing. The problem is that I can't just use Altitude constraints for the mountains as they aren't that much higher than the dunes so either I get rock colored dune tops or sand colored mountain bottoms. So I figured I'd just add the dunes as child layers of a surface layer after the shading.
So I have Mountains -> Compute Terrain -> Sand Colors -> Mountain Colors masked by altitude -> Dunes and that's working just fine until I try to add the shading based on surface directions.

I obviously have to add that after the dunes and apart from the problem that this would also color the sides of my mountains again, it also requires a second Compute Terrain after the dune displacement shaders. And adding that breaks the altitude masking of the mountain colors further up the shader chain.

So my general question is of course how to fix that. But I figured the best way would be to somehow derive a mask from the mountains, add the dunes, color the dunes including the direction based coloring and then color the mountains based on that mask derived further up. However, I've been unable to get that mask. So please let me know if you have any idea on how to do that or some other way to achieve my desired result.

Tatooine simplified.tgd

Kexikus

Nevermind, I figured out one solution (although it's probably not the best).

Adding a "Compute Normal" after the Dune Surface Layer and prior to the direction shading did the trick.

Dune

Didn't have time yesterday, but just took a look. Here's one solution, but indeed another setup would maybe be easier. Also use get normal, not get normal in texture. I stretched the Y in the hills fractal too.

Kexikus

Thanks for having a look. That really helped out :)

Dune