I’ve been attempting to make a vertical linear gradient apply to a landscape based on height, much like digital elevation models are rendered for GIS work but have been unable to do so. I’ve also come across the strange behavior depicted in the image. Why does this occur and what is the best way to apply a vertical gradient to a landscape since the approaches that work for other object types do not seem to produce the desired result?
What are you on about exactly? And,
How do you suppose to go from X and Y of a texture to Z with-out reading in a Z value out of something???
WPS > Mask > B
Normalize
Plug into lerp.
When applied to an object, say a cube, this approach creates a vertical gradient. Why does it create a horizontal one when applied to a landscape?
That linear gradient you are using uses the uv’s of the object.
So depending on how the object uv’s are placed/rotated you will have the gradient behave differently. In the case of the cube for example if every face is stretched to the uv limits and rotated
the same way the sides will show the gradient as you described.
A landscape is simply a heavily subdivided square with x-y coordinates.
So as Host has explained you need to use the World position masked from B which is the Z component, Normalize to get a 0-1 black to white gradient to plug into a lerp
Yep.
And the solid color probably makes sense, as you don’t really know what the original high and low values actually are.
Because the landscape dips below 0, you probably need to Max Range or do something similar based on a custom scalar for height and it’s negative value for the opposite.
Maybe this.
Wpo > B > max range clamped.
Scalar for height in A,
-1 * scalar height in B.
(The outputs should always be 0 to 1)
Then you adjust the scalar in the instance to match your highest peak (Values In CM).
See how that works.
If you are looking at the heightmap, may as well note that it’s PNG16 - with the highest value being 65535. Sea level being 65535/2 and the absolute lowest being 0. These values are scaled by the map Z scale at a specific ratio.
Look up the docs since for once I managed to get epic to update something with useful info.
Point being, you can calculate your highest possible peak mathematically - maybe even within the material itself.
If I am understanding this properly the output at a value of 1 is the highest possible peak and a 0 is the lowest possible valley, but in my use case I am interested in the highest realized peak getting a value of 1 and the lowest realized valley getting a value of 0. I apologize if I have misunderstood what I am looking at. Thank you for your patient responses.