-
-
Notifications
You must be signed in to change notification settings - Fork 36.3k
TSL: transformDirection operation is incorrect #33309
Copy link
Copy link
Open
Labels
TSLThree.js Shading LanguageThree.js Shading Language
Description
Description
When using the transformDirection operation I believe the inner operation is incorrect.
The generated wgsl code is -
normalize( ( direction * matrix ).xyz )When it shall be -
normalize( ( matrix * direction ).xyz )Function signature -
transformDirection( direction : Node.<(vec2|vec3|vec4)>, matrix : Node.<(mat2|mat3|mat4)> ) : NodeReproduction steps
- Create a node material
- Use transformDirection node
- Display generated wgsl
Code
if ( method === MathNode.TRANSFORM_DIRECTION ) {
// dir can be either a direction vector or a normal vector
// upper-left 3x3 of matrix is assumed to be orthogonal
let tA = aNode;
let tB = bNode;
if ( builder.isMatrix( tA.getNodeType( builder ) ) ) {
tB = vec4( vec3( tB ), 0.0 );
} else {
tA = vec4( vec3( tA ), 0.0 );
}
const mulNode = mul( tA, tB ).xyz; // shall be const mulNode = mul( tB, tA ).xyz;
outputNode = normalize( mulNode );
}Live example
Self explanatory
Screenshots
No response
Version
r183
Device
No response
Browser
No response
OS
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
TSLThree.js Shading LanguageThree.js Shading Language