In unity I’m using CG Shaders and I want to fade objects in. There’s a slight problem/pop-in/glitch when going from a shader that has depth testing enabled to a shader that has alpha blending on.
From the pragma flags in a CGPROGRAM I can only enable/disable alpha blending, but this turns off depth testing. I want to keep depth testing on, so my fading is smooth (and I only get the front faces of objects rendered, not backfaces too, like it seems to be the default when blending is on). All the other standard “shader” flags like ZTest do not seem to affect shaders written with CGPROGRAMs, nor does ZTest configure wether depth testing is on or off.
Another question I’d have is if I can control the color mask ?(i.e. glColorMask).
Is there any other way to control render states besides shaders ?