Skip to content

Commit

Permalink
negate dpdy only (mrdoob#26776)
Browse files Browse the repository at this point in the history
Co-authored-by: aardgoose <angus.sawyer@email.com>
  • Loading branch information
aardgoose and aardgoose committed Sep 17, 2023
1 parent 99d705f commit 80ba01c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion examples/jsm/nodes/materials/NodeMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
2 changes: 1 addition & 1 deletion examples/jsm/renderers/webgpu/nodes/WGSLNodeBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const wgslTypeLib = {

const wgslMethods = {
dFdx: 'dpdx',
dFdy: 'dpdy',
dFdy: '- dpdy',
mod: 'threejs_mod',
lessThanEqual: 'threejs_lessThanEqual',
inversesqrt: 'inverseSqrt'
Expand Down

0 comments on commit 80ba01c

Please sign in to comment.