Making sure roads are always drawn on top of terrain

Godot Version

4.3

Question

Hey, all, I have been implementing catlikecoding’s hex map tutorials in Godot. It’s been a great way for me to learn Godot.

I have currently been working on implementing roads. Everything works great, but I am trying to figure out what small rendering issue.

Right now, since the roads are at the same elevation as the terrain, often times you get this effect where the roads are “clipped” or only partially visible. See the image below:

I’d like to fix this. One thing I could do is just raise the elevation of the roads to be slightly above the terrain. But, in catlikecoding’s tutorials, he actually fixes the issue by changing the drawing order in the shader.

Since his shaders are in Unity, they are a bit different from Godot’s shaders. Here is the specific pieces he puts into his road shader to get the roads to always be drawn on top of the terrain:

		Tags {
			"RenderType"="Opaque"
			"Queue" = "Geometry+1"
		}
		LOD 200
		Offset -1, -1

He says the “Queue” line puts the roads in a later render queue than the terrain. He also says the “Offset” line affects the depth test so that the roads are treated as if they were closer to the camera than they actually are.

Link to the tutorial itself if you want to take a look at his stuff: Hex Map 7

Anyway, I’m curious what options are available to me in Godot’s shading language to be able to get this same result?

Thanks for any help you can provide!

You probably want to disable depth testing, if it’s a standard material then it will be a check box in “Transparency”, a glsl shader add render_mode depth_test_disabled;