瀏覽代碼

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

sunag 1 年之前
父節點
當前提交
0f964b7a2b
共有 1 個文件被更改,包括 3 次插入2 次删除
  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 { 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 vN = surf_norm; // normalized
 
 
 	const R1 = vSigmaY.cross( vN );
 	const R1 = vSigmaY.cross( vN );