Dear All,
I want to display the contours on a landscape. I kinda know how to go about this in general, however, I am rather unfamiliar with the material editor and I fall at the first step.
How I'd go about it is:
(1) Get the z component of the world position for each position on the landscape.
(2) Calculate modulus of z by my contour separation.
(3) Clamp 1.0 to 0.99 to 1.0 and everything else to 0.
(4) Use this value for alpha and combine with a diffuse of the color I want for my contours.
This should produce contours, albeit not ones of constant thickness when viewed from above.
My question is, how do I get the z component of the world position? This would be easy in HLSL but isn't obvious in the material editor. I am guessing that worldPosition outputs a float3 vector, how to extract just the z component as a float?
Many thanks!
I want to display the contours on a landscape. I kinda know how to go about this in general, however, I am rather unfamiliar with the material editor and I fall at the first step.
How I'd go about it is:
(1) Get the z component of the world position for each position on the landscape.
(2) Calculate modulus of z by my contour separation.
(3) Clamp 1.0 to 0.99 to 1.0 and everything else to 0.
(4) Use this value for alpha and combine with a diffuse of the color I want for my contours.
This should produce contours, albeit not ones of constant thickness when viewed from above.
My question is, how do I get the z component of the world position? This would be easy in HLSL but isn't obvious in the material editor. I am guessing that worldPosition outputs a float3 vector, how to extract just the z component as a float?
Many thanks!
Comment