From 80ba01ccf5600b0ff5aebe08d31249efbd46b35c Mon Sep 17 00:00:00 2001 From: aardgoose Date: Sun, 17 Sep 2023 03:19:42 +0100 Subject: [PATCH] negate dpdy only (#26776) Co-authored-by: aardgoose --- examples/jsm/nodes/materials/NodeMaterial.js | 2 +- examples/jsm/renderers/webgpu/nodes/WGSLNodeBuilder.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/jsm/nodes/materials/NodeMaterial.js b/examples/jsm/nodes/materials/NodeMaterial.js index d06eae93f3c321..cbdbc630b68b35 100644 --- a/examples/jsm/nodes/materials/NodeMaterial.js +++ b/examples/jsm/nodes/materials/NodeMaterial.js @@ -199,7 +199,7 @@ class NodeMaterial extends ShaderMaterial { if ( this.flatShading === true ) { const fdx = dFdx( positionView ); - const fdy = dFdy( positionView.negate() ); // use -positionView ? + const fdy = dFdy( positionView ); const normalNode = fdx.cross( fdy ).normalize(); stack.assign( transformedNormalView, normalNode ); diff --git a/examples/jsm/renderers/webgpu/nodes/WGSLNodeBuilder.js b/examples/jsm/renderers/webgpu/nodes/WGSLNodeBuilder.js index 75825698891a8c..8aaafba0ba50fe 100644 --- a/examples/jsm/renderers/webgpu/nodes/WGSLNodeBuilder.js +++ b/examples/jsm/renderers/webgpu/nodes/WGSLNodeBuilder.js @@ -58,7 +58,7 @@ const wgslTypeLib = { const wgslMethods = { dFdx: 'dpdx', - dFdy: 'dpdy', + dFdy: '- dpdy', mod: 'threejs_mod', lessThanEqual: 'threejs_lessThanEqual', inversesqrt: 'inverseSqrt'