- Home /
 
Override ColorMask in a surface shader
Hi,
By default surface shaders with #pragma alpha create a pass with Alphatest Greater 0 ZWrite Off ColorMask RGB parameters. However I would like to use ColorMask RGBA because I am rendering in an intermediate RenderTexture and I will have to alpha blend this RenderTexture later.
I tried to add ColorMask RGBA before the definition of the CGPROGRAM but the parameter is overwritten by the default one :
 SubShader {
     ColorMask RGBA
 CGPROGRAM
 #pragma surface surf Lambert alpha
    ...
 ENDCG
 }
 
               is compiled to
 SubShader {
     ColorMask RGBA
 
     Alphatest Greater 0 ZWrite Off ColorMask RGB
     Pass {
         Name "FORWARD"
         ...
 
               Is it possible to change this ? I did not find any #pragma to change that. Thanks
Have you had any success in figuring this out? I'm having the same problem, with my render texture ending up having the alphas of the specular lighting pass or something like that :/
No, I did not get any progress. I think I should mail directly Unity's support, but I did not do it because I no longer need it at the moment.
hm. after some hacking, my issue seems to have gone away. don't know what I did though :p
$$anonymous$$vanteTore, Have you figured out how you have resolved this? I'm facing the same problem. Thank you in advance.
I asked this question to the unity support and they told me that this is not possible at the moment but they forwarded the issue to their dev/artist $$anonymous$$m
Your answer