Explorar el Código

Merge pull request #13791 from donmccurdy/bug-perturbNormal2Arb-doubleside

Fix perturbNormal2Arb() + DoubleSide
Mr.doob hace 7 años
padre
commit
0317e8eb51

+ 2 - 0
src/renderers/shaders/ShaderChunk/normalmap_pars_fragment.glsl

@@ -16,6 +16,8 @@
 		vec2 st1 = dFdy( vUv.st );
 		vec2 st1 = dFdy( vUv.st );
 
 
 		float scale = sign( st1.t * st0.s - st0.t * st1.s ); // we do not care about the magnitude
 		float scale = sign( st1.t * st0.s - st0.t * st1.s ); // we do not care about the magnitude
+		scale *= float( gl_FrontFacing ) * 2.0 - 1.0;
+
 		vec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );
 		vec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );
 		vec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );
 		vec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );
 		vec3 N = normalize( surf_norm );
 		vec3 N = normalize( surf_norm );