Graphics.Blit produces transparent texture when passing a Material (bug?)

In the shader of the material passed in Graphics.Blit(src, dst, mat), set ZTest to Always.
If your material for some reason needs ZTest LEqual, then make sure the textures being passed to the material have no depth data.
One way is to get a temporary RenderTexture with RenderTexture.GetTemporary(width, height, 0) where 0 = depth.
Then Blit your source texture to the temporary RT with Graphics.Blit(src, tempRT).
Now you can pass it to the material.
Do this to the src tex or RT being passed to the material, as well as to tex or RT being passed to with mat.SetTexture();

I also have seen some people posting that changing ZTest to Always has not solved the issue until they passed a texture with no depth data. So you might want to do both to be sure.

2 Likes