Many RTS games display distances (range attack, moving distance, sight, and so on) by drawing a circle around the selected unit. If the terrain is flat, this can be done simply by stretching a quad with the texture of a circle. If that's not the case, the quad will most likely be clipped behind a hill or another piece of geometry. This recipe will show you how to create a shader that allows you to draw circles around an object of arbitrary complexity. If you want to be able to move or animate your circle, we will need both a shader and C# script.
The following screenshot shows an example of drawing a circle in a hilly region using a shader:
![](https://static.packt-cdn.com/products/9781788396233/graphics/assets/35441fdc-acf3-43c7-8889-ebb25ca0475b.png)