Slope Visualizer?

any good ideas for how to visualize a sloped on terrain like in golf games. tried a few methods, shader tons of errors…never did that before. using a mesh based on terrain data, just getting a solid yellow rectangle at scene canvas origin. at a loss at what to try. would like to make lines that move based on slope. was using a slope dot method. Next up I was thinking of making my greens in blender and figured it might be easier to dynamically render lines on that mesh, just was trying to build entire landscape with terrain for simplicity?

You could do contour lines, this is very much a standard in all city building / engineering / transport games with smooth terrain.

You can then optionally combine this with a dynamic texture showing some triangular icons just to emphasize the downslope direction.

Implementation-wise it’s not exactly trivial to do, demands a lot of know how, but isn’t complicated in theory. Given that you’re new to the concepts, and how regularly I see this feature maybe you can find an asset that does this already.

Here’s an old topic I found for you.

Edit:
some more resources 1 2 3

1 Like

I’d suggest Shader Graph as a more gentle introduction into the world of shaders (assuming you’re using URP or HDRP).
Similar to the contour lines orionsyndrome suggested, you could start with something like this (I’ve seen such heatmap-like visualization in golf games, though with more toned down colors):


This shader graph colors the mesh using colors from a gradient based on the height (vertical distance of a pixel from the origin).
For this, it takes the y-coordinate of the object position, divides it by 2 (because the example mesh has a height of roughly 2 units, thus we get a rescaled y coordinate going from 0 to 1 for pixels from the bottom to the top) and uses that to sample the gradient (here set to “fixed” mode to disable blending between colors).

With a setup like that, you could then easily play around to hone in on the final look, e.g. experiment with different colors, sample a texture instead of a gradient for more control (and better performance, this could also be a quick first test of contour lines that doesn’t involve edge detection by simply using a horizontally striped texture) or calculate UV coordinates based on height to sample different sections of an atlas texture to display different patterns depending on height.

2 Likes

Thank you, sometime yesterday I figured they must be doing it with a shader graph on the material. I spent about 12 hours and with the help of chat figured out how to do it. Created a rectangle grid 2x2, with a transparent split the red over 0.1 to make black transparent. Then using a normal vector, split the y remap and pass to a sample gradient. Blend that to transparent grid, add to base texture. came out pretty frikin close to the real thing.

1 Like