Transparent diffuse shader problem

I discovered a problem in my game where using the Transparent/diffuse shader on my tile grid, while putting a fog of war plane over it with alpha settings, 'caused some areas of the grid to show through. I can fix it by simply changing to transparrent/cutout/diffuse. But that would not work for other graphics that i will need the same effect on.

After reading up about the problem I discovered it’s because transparent/diffuse doesn’t use z-buffering, and hence i will need a different shader that does.

I tried implementing the transparent/diffuse zwrite from Unity - Manual: ShaderLab: commands

but it quite simply didn’t work, nothing changed.

Effectively I need a transparent diffuse shader that uses zwrite. I have 0 experience when it comes to shaders so I don’t know how difficult or easy this would be to write. I have searched through a few links and followed their guide on getting it to work but none of them have =/.

Sounds like a similar problem to this Problem with transparent planes behind each other - Unity Answers. One transparent layer that needs to be “on top” of another. Setting the renderqueue will tell Unity to always draw the Fog on top, even if the tile grid looks closer.

There’s no Z-writing in it, but I’m guessing that since you don’t know what Z is and didn’t post the link that said you needed it, you aren’t going to miss it :slight_smile: