Reduce displacement over distance

Started by james adamson, February 04, 2020, 12:35:10 PM

Previous topic - Next topic

james adamson

Hi all. How would I go about reducing a displacement over a certain distance? I have a painted shader and displacement generating a gorge. I would like the gorge to gently rise up from a valley floor over a specified distance but am struggling with simple/painted shaders to get the correct result.
Cheers in advance.
James.

WAS

You could use the distance shader as mask for a surface layer, check better displacement continuity, and than use the offset function in the displacement. This will offset everything in the mask.

Tangled-Universe

You can also use a distance shader directly as function input of a displacement shader.

WAS

Quote from: Tangled-Universe on February 04, 2020, 03:16:29 PMYou can also use a distance shader directly as function input of a displacement shader.

Though wouldn't that just be displacement, not gradually reducing displacement already in scene?

WAS

Here's a even simpler version with a distance shader and just the mask of your displacement PF. But if it is a displacement shader you'll need a surface layer, which at that point you might as well just use a Surface Layer's displacement function and the mask of the layer. Coverage can often yield better results. Just remember better displacement continuity under surface layer effects if your displacement PF is using it.

You can do the same with Simple Shapes like in the default scene of Terragen in different locations.

Dune

Or do something like this....

Matt

Quote from: WAS on February 05, 2020, 12:27:16 AMJust remember better displacement continuity under surface layer effects if your displacement PF is using it.

That option in the Surface Layer only applies to altitude and slope constraints. The constraints use an exp() function, and this option switches between a fast approximation and a slower accurate version. If you're not using those then it makes no difference.
Just because milk is white doesn't mean that clouds are made of milk.

Matt

Just because milk is white doesn't mean that clouds are made of milk.

Tangled-Universe

Quote from: WAS on February 05, 2020, 12:17:25 AM
Quote from: Tangled-Universe on February 04, 2020, 03:16:29 PMYou can also use a distance shader directly as function input of a displacement shader.

Though wouldn't that just be displacement, not gradually reducing displacement already in scene?

Yes I see what you mean and I forgot that he wants to apply that only to the gorge, thus a gorge-mask is needed. My bad.

You suggested
Quote"You could use the distance shader as mask for a surface layer, check better displacement continuity, and than use the offset function in the displacement. This will offset everything in the mask."

If you set it up exactly like you described here then you basically have a gradient based on distance shader and that is masked by the same gradient.
The offset is the displacement factor.
In that case using a displacement shader directly uses node less.
That's where my reply came from.

However, neither of our 2 suggestions has the mask for the gorge incorporated and thus are Dune's and Matt's suggestions the most useful.

WAS

Quote from: Tangled-Universe on February 05, 2020, 04:55:19 AMIf you set it up exactly like you described here then you basically have a gradient based on distance shader and that is masked by the same gradient.
The offset is the displacement factor.
In that case using a displacement shader directly uses node less.
That's where my reply came from.

However, neither of our 2 suggestions has the mask for the gorge incorporated and thus are Dune's and Matt's suggestions the most useful.

I was actually referring to your idea there, sorry. If that were indeed what he was after. Using surface layers allows your to conveniently pipe things and mask them. Could have disp/offset and child plus masking the surface. The disp function has no mask.

WAS

Quote from: Matt on February 05, 2020, 04:00:27 AM
Quote from: WAS on February 05, 2020, 12:27:16 AMJust remember better displacement continuity under surface layer effects if your displacement PF is using it.

That option in the Surface Layer only applies to altitude and slope constraints. The constraints use an exp() function, and this option switches between a fast approximation and a slower accurate version. If you're not using those then it makes no difference.

Ah I figured it helped with the fuzzy zones of masks with disp when using coverage. Though I'm usually using alt or slope limits coupled here so I can see where I'd need it and think it helps elsewhere.

Figured it helped maintained continuity of PFs through all these make and slope/alts too, since you added this better continuity to PFs at the same time.

james adamson

Thanks peeps.
I will be giving this a go tonight.
I will upload my progress. Do not know where I would be in my steep Terragen learning curve without this forum.
Cheers.
James.

james adamson

Hi all. Thanks for those setups. Very very helpful.
I have a few of questions about your setup matt. 

1.Why have you used complement scalar and not complement colour? What is the difference between the two?
2.Why would negate colour not do the same job?
3.So can I  feed a mask output into any function input?
4. And this is more general, if I then wished to add detail to the sides of my gorge, would I do a compute terrain before doing so? And as your setup as I understand it raises everything around the mask what would be considered the zero ground plane before compute terrain and after compute terrian.
Thanks.
James.

Matt

Quote from: james adamson on February 05, 2020, 04:08:30 PM1.Why have you used complement scalar and not complement colour? What is the difference between the two?

We only need a scalar to mask displacement. Plugging in a colour also works just fine, but it's not necessary. Terragen's node network will happily switch between colours and scalars, but because shaders output colour that's what you'll see used as a mask most of the time. Scalars might be slightly quicker in some cases, but you'll only notice it if you have really complex networks of function nodes. If you're building complex function node networks it may be useful to think about this distinction.

Quote2.Why would negate colour not do the same job?

"Negate" and "complement" are kinds of inverse, but they're different. Negate turns positive values into negative values (e.g. 0.5 becomes -0.5), but we want the mask to contain values between 0 and 1. We want x to become 1-x. In Terragen's language that is called the complement. We don't call it "inverse" because that is yet another function which is defined as 1/x.

Quote3.So can I  feed a mask output into any function input?

Yes. Some function inputs expect a colour, some expect a vector and some expect a scalar. But you can plug any kind of function or shader data into these inputs and it will convert to what it expects using a set of rules. The rules are designed to make it easy to use data from different sources without needing special conversion nodes, but if you want to know the conversion rules they are here:
https://planetside.co.uk/wiki/index.php?title=Node_Input_Type_Conversion

Quote4. And this is more general, if I then wished to add detail to the sides of my gorge, would I do a compute terrain before doing so?

Yes.

QuoteAnd as your setup as I understand it raises everything around the mask what would be considered the zero ground plane before compute terrain and after compute terrian.

I didn't know what you'd want to do with the surrounding area, but I based the setup on the idea that the terrain would be at 0 near the bottom of the gorge and at the "outlet" which I imagined in your description. And I imagined it carving out of a higher plateau. But I didn't take care of what would be behind the camera. You may want to chain multiple Simple Shape Shaders together to extend the 0-elevation area. Or perhaps it needs a different setup altogether.
Just because milk is white doesn't mean that clouds are made of milk.

james adamson

Thanks for taking the time to explain all that.
A big help. And yes your setup does exactly what I was after. With your suggestion and the others provided I have more than enough
to play with on this shot.
Thanks.
James.