diff --git a/panda/src/pgraphnodes/shaderGenerator.cxx b/panda/src/pgraphnodes/shaderGenerator.cxx index a11f1648cd..26aaabdd98 100644 --- a/panda/src/pgraphnodes/shaderGenerator.cxx +++ b/panda/src/pgraphnodes/shaderGenerator.cxx @@ -1015,12 +1015,12 @@ synthesize_shader(const RenderState *rs) { text << "\t l_eye_normal.xyz *= tsnormal.z;\n"; text << "\t l_eye_normal.xyz += l_tangent * tsnormal.x;\n"; text << "\t l_eye_normal.xyz += l_binormal * tsnormal.y;\n"; - text << "\t l_eye_normal.xyz = normalize(l_eye_normal.xyz);\n"; - } else { - text << "\t // Correct the surface normal for interpolation effects\n"; - text << "\t l_eye_normal.xyz = normalize(l_eye_normal.xyz);\n"; } } + if (_need_eye_normal) { + text << "\t // Correct the surface normal for interpolation effects\n"; + text << "\t l_eye_normal.xyz = normalize(l_eye_normal.xyz);\n"; + } if (_out_aux_normal) { text << "\t // Output the camera-space surface normal\n"; text << "\t o_aux.rgb = (l_eye_normal.xyz*0.5) + float3(0.5,0.5,0.5);\n";