[unity] ShaderGraph realizes contour and elevation gradient coloring

[unity] ShaderGraph realizes contour and elevation gradient coloring

The realization idea of ​​the contour line

method one:

Obtain the height (y) value of the vertex through the Position node, remove the height value from the equal height distance and take the remainder, and set the output boundary (step) of the remainder

Method Two:

Subtract the rounding of the y value from the y value, multiply the difference and the difference, and set the output boundary (step)

The Idea of ​​Elevation Gradient Coloring

simple assignment method

Use Gradient (gradient node) to directly assign values ​​​​with y values

Although this method is convenient, the Gradient node cannot be opened, and the color cannot be dynamic

Difference Gradient Assignment Method

Taking three colors as an example, the core node used is Lerp, which maps the height of the terrain to 0-1, and the mapped value becomes the difference of the gradient

final overlay

overall arrangement

Guess you like

Origin blog.csdn.net/dxs1990/article/details/132142172