Hey there,
I’m having a really weird issue trying to blend 2 normals in a surface shader, as soon as i assign the result to the normal property of my output:
This works:
fixed3 normal0 = UnpackNormal(tex2D(_TexBump1, IN.uv_Tex1));
fixed3 normal1 = UnpackNormal(tex2D(_TexBump2, IN.uv_Tex2));
o.Normal = normal0;
o.Normal += normal0;
This works too:
fixed3 normal0 = UnpackNormal(tex2D(_TexBump1, IN.uv_Tex1));
fixed3 normal1 = UnpackNormal(tex2D(_TexBump2, IN.uv_Tex2));
o.Normal = normal1;
o.Normal += normal1;
This doesn’t work, and actually produces a compile time error!
fixed3 normal0 = UnpackNormal(tex2D(_TexBump1, IN.uv_Tex1));
fixed3 normal1 = UnpackNormal(tex2D(_TexBump2, IN.uv_Tex2));
o.Normal = normal0;
o.Normal += normal1;
The error is as follow:
- Target level displays as SM4.0 (it correctly displays as 5.0 in the other 2 cases)
- I get “program frag_surf , variable ‘surfIN’ used without having been initialized”
- as well as "program frag_surf , ‘distance’ : implicit truncation of . . .
None of those errors seem related at all to those 2 lines but the shader goes from rendering just fine to not working and having compile errors just from changing that, add normal0 to itself, works , add normal 1 to itself, works, add both together and the world crashes in other unrelated places!
Any help is most welcome.