How to render a grid on non-flat world mesh / terrain

Exactly what the question says. I’m looking to render a grid over my world mesh. It’s not a unity terrain but it could be if I wanted it to be.

Essentially, what call / function should I be using to draw the lines, and is there a clever way of dealing with the height issue?

I need this for two projects, actually. One is a golf game, where the grid is needed in the landing area for the ball and on the putting green. The other is an isometric tiled RPG like final fantasy tactics etc.

If anyone knows of any bre-built scripts that do this that would be great for me to study, I’d also appreciate any advice as I’d like to learn the theory behind it rather than just plugging and playing with a script.

Thanks for your time.

heights: you can move vertices in plane using it’s mesh

explain: you can take standard built-in plane (200 tris) and using mesh, move vertices id different ways. this way you can get any terrain-like surface. more tris - more detailed terrain can be done. also, you can create surface without basing on plane or something. tell if you want to know how to generate mesh procedurally

different painting: shader is the best way to achieve that

explain: the fastest way to make a painting like a terrain is to use vertex colors. each vertex can have it’s own RGBA color. this can be used like a mask. i mean we analyze each channel separately and draw texture based on this color. so, you can use 4 textures to cover you geometry and mix them as you wish

in a complex, if you havn’t reason to don’t use Terrain, use Terrain 8)

tell if you want to know more 8)

The easiest way is to use a projector. It will work on any mesh, including a Unity terrain, and you don’t have to worry about height or anything. The downside is that a projector re-draws everything it touches, so you’d want to be a little careful about using it, but you can use layers to exclude objects that shouldn’t be affected.