Prechádzať zdrojové kódy

Fix normal map handedness in a few examples

A few examples use normal maps that have not been authored with the OpenGL normal map handedness convention. In these cases the normal scale y needs to be negated to get the normal maps to display correctly.
Olli Etuaho 5 rokov pred
rodič
commit
815fac2cbd

+ 3 - 1
examples/misc_controls_fly.html

@@ -83,7 +83,9 @@
 					map: textureLoader.load( "textures/planets/earth_atmos_2048.jpg" ),
 					specularMap: textureLoader.load( "textures/planets/earth_specular_2048.jpg" ),
 					normalMap: textureLoader.load( "textures/planets/earth_normal_2048.jpg" ),
-					normalScale: new THREE.Vector2( 0.85, 0.85 )
+
+					// y scale is negated to compensate for normal map handedness.
+					normalScale: new THREE.Vector2( 0.85, -0.85 )
 
 				} );
 

+ 6 - 2
examples/webgl_materials_physical_clearcoat.html

@@ -120,7 +120,9 @@
 								clearcoat: 1.0,
 								normalMap: normalMap4,
 								clearcoatNormalMap: clearcoatNormaMap,
-								clearcoatNormalScale: new THREE.Vector2( 2.0, 2.0 )
+
+								// y scale is negated to compensate for normal map handedness.
+								clearcoatNormalScale: new THREE.Vector2( 2.0, -2.0 )
 							} );
 							var mesh = new THREE.Mesh( geometry, material );
 							mesh.position.x = - 100;
@@ -136,7 +138,9 @@
 								normalMap: normalMap2,
 								normalScale: new THREE.Vector2( 0.15, 0.15 ),
 								clearcoatNormalMap: clearcoatNormaMap,
-								clearcoatNormalScale: new THREE.Vector2( 2.0, 2.0 )
+
+								// y scale is negated to compensate for normal map handedness.
+								clearcoatNormalScale: new THREE.Vector2( 2.0, -2.0 )
 							} );
 							var mesh = new THREE.Mesh( geometry, material );
 							mesh.position.x = 100;