I want to color a terrain according to how steep the slope is at each point. I've read How do I colour a 3D terrain based on its height?. If I could generate a new surface that is the gradient of my terrain (such that height of the new surface corresponds to slope in the original), then I could create that height-based material and apply it to the the original terrain. Is this feasible? Is there a better way to create a slope-based material?
1 Answer
Yeah,, you can actually do it follow this video: https://youtu.be/qSafYNQrodk?t=1330
But here you have a simplified node setup to do it:
The color ramp is used to choose the steepnes you want to select, the white parts are what is selected, so maybe you'll need to inverse the color ramp colours. The "Average Node" of the video is actually the "Vector Math" node with the average option choosed, I don't know why he used it, the simplified node setup that I shared works equally.
How this works? I really don't know, I only know that you use the perpendicular normal axis (in this case the Z) to get the stepness in said axis and the ramp to set the threshold.
With three points (black, white, black) in the color ramp and the ease mode you can customize more the selection.
-
$\begingroup$ I see this requires Cycles. I'm not as familiar with Cycles but my surface is solid black when rendered. I have the following nodes: Geometry.Normal -> Seperate XYZ.Z -> ColorRamp.Color -> Material Output.Surface. Is there some other setup I'm missing? I watched the first part of that video and didn't see anything obvious. $\endgroup$– LombardCommented Dec 8, 2018 at 18:42
-
1$\begingroup$ The color ramp is a selector, like a mask on photoshop, you have to use it like a factor on a mix shader, try this: imgur.com/a/XMIw5Na . And don't forget to add a light. $\endgroup$– Mike GOCommented Dec 8, 2018 at 21:34