Bläddra i källkod

WebGPURenderer: Ensure bump map scale is texture UV scale invariant. (#26958)

sunag 1 år sedan
förälder
incheckning
0f964b7a2b
1 ändrade filer med 3 tillägg och 2 borttagningar
  1. 3 2
      examples/jsm/nodes/display/BumpMapNode.js

+ 3 - 2
examples/jsm/nodes/display/BumpMapNode.js

@@ -48,8 +48,9 @@ const perturbNormalArb = tslFn( ( inputs ) => {
 
 	const { surf_pos, surf_norm, dHdxy } = inputs;
 
-	const vSigmaX = surf_pos.dFdx();
-	const vSigmaY = surf_pos.dFdy();
+	// normalize is done to ensure that the bump map looks the same regardless of the texture's scale
+	const vSigmaX = surf_pos.dFdx().normalize();
+	const vSigmaY = surf_pos.dFdy().normalize();
 	const vN = surf_norm; // normalized
 
 	const R1 = vSigmaY.cross( vN );