Making borderline with Shader

Hello! I’m sort of new to shaders in general. But exploring them for a bit gave me a thought that they are exactly what I need. My project is turn-based strategy. Let’s say I have a soldier. By pressing on the unit I would like to show where it can go for one turn. Right now I have this borderline as LineRenderer object. But it’s not a perfect solution as it doesn’t lie on surface ideally. So, I have a bunch of world positions of points to connect in one line. Is there a way how I can draw a line within these vector3 positions on the surface of terrain with help of a shader? As a reference I would like it to look similar to Total War Rome 2 highlighting system. But just line would be also perfect. Any thought provoking info is very much appreciated!

If you have a list of points for the areas border, you could use them to generate a strip of quads (for example, using LineRenderer, or with your own script for lofting a strip of quads along a spline)

Another idea, for a shader-focused approach, assuming you have a mesh corresponding to the highlighted area - is to transform/deform it slightly so it hovers a bit above the terrain - with the borders intersecting the terrain.
Using a depth-based shader, you could highlight the intersection points.
This shader would be similar to a force field, or water fog shader:

  • You will first render the terrain into the depth buffer.
  • When drawing the effect’s mesh, you will be reading the terrain’s depth value - and compare to the effect’s - in order to drive the highlight.

Thank you very much for your reply and your time! So, basically for doing such stuff I need to have some mesh object (like plane), change height of its vertices according to terrain heights and add some additional float value to y axis to make it hover the terrain and then do the precedure which you’ve described?
But there’s no way how I can repaint curtain arrea (which looks like some polygon) of terrain itself without creating mesh object? I’m looking forward to optimising the project in general. I thought shader is the only way for me.