Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/jsm/tsl/display/FXAANode.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ class FXAANode extends TempNode {
const se = SampleLuminanceOffset( texSize, uv, 1.0, 1.0 );
const sw = SampleLuminanceOffset( texSize, uv, - 1.0, 1.0 );

const highest = max( max( max( max( s, e ), n ), w ), m );
const lowest = min( min( min( min( s, e ), n ), w ), m );
const highest = max( s, e, n, w, m );
const lowest = min( s, e, n, w, m );
const contrast = highest.sub( lowest );

return { m, n, e, s, w, ne, nw, se, sw, highest, lowest, contrast };
Expand Down
16 changes: 8 additions & 8 deletions examples/jsm/tsl/display/SMAANode.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,11 +321,11 @@ class SMAANode extends TempNode {
// Calculate left and top deltas:
const Cleft = this.textureNode.sample( vOffset0.xy ).rgb.toVar();
let t = abs( C.sub( Cleft ) );
delta.x = max( max( t.r, t.g ), t.b );
delta.x = max( t.r, t.g, t.b );

const Ctop = this.textureNode.sample( vOffset0.zw ).rgb.toVar();
t = abs( C.sub( Ctop ) );
delta.y = max( max( t.r, t.g ), t.b );
delta.y = max( t.r, t.g, t.b );

// We do the usual threshold:
const edges = step( threshold, delta.xy ).toVar();
Expand All @@ -336,26 +336,26 @@ class SMAANode extends TempNode {
// Calculate right and bottom deltas:
const Cright = this.textureNode.sample( vOffset1.xy ).rgb.toVar();
t = abs( C.sub( Cright ) );
delta.z = max( max( t.r, t.g ), t.b );
delta.z = max( t.r, t.g, t.b );

const Cbottom = this.textureNode.sample( vOffset1.zw ).rgb.toVar();
t = abs( C.sub( Cbottom ) );
delta.w = max( max( t.r, t.g ), t.b );
delta.w = max( t.r, t.g, t.b );

// Calculate the maximum delta in the direct neighborhood:
let maxDelta = max( max( max( delta.x, delta.y ), delta.z ), delta.w ).toVar();
let maxDelta = max( delta.x, delta.y, delta.z, delta.w ).toVar();

// Calculate left-left and top-top deltas:
const Cleftleft = this.textureNode.sample( vOffset2.xy ).rgb.toVar();
t = abs( C.sub( Cleftleft ) );
delta.z = max( max( t.r, t.g ), t.b );
delta.z = max( t.r, t.g, t.b );

const Ctoptop = this.textureNode.sample( vOffset2.zw ).rgb.toVar();
t = abs( C.sub( Ctoptop ) );
delta.w = max( max( t.r, t.g ), t.b );
delta.w = max( t.r, t.g, t.b );

// Calculate the final maximum delta:
maxDelta = max( max( maxDelta, delta.z ), delta.w );
maxDelta = max( maxDelta, delta.z, delta.w );

// Local contrast adaptation in action:
edges.xy.mulAssign( vec2( step( float( 0.5 ).mul( maxDelta ), delta.xy ) ) );
Expand Down
4 changes: 2 additions & 2 deletions examples/jsm/tsl/display/TRAAPassNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,8 @@ class TRAAPassNode extends PassNode {
const currentWeight = float( 0.05 ).toVar();
const historyWeight = currentWeight.oneMinus().toVar();

const compressedCurrent = currentColor.mul( float( 1 ).div( ( max( max( currentColor.r, currentColor.g ), currentColor.b ).add( 1.0 ) ) ) );
const compressedHistory = clampedHistoryColor.mul( float( 1 ).div( ( max( max( clampedHistoryColor.r, clampedHistoryColor.g ), clampedHistoryColor.b ).add( 1.0 ) ) ) );
const compressedCurrent = currentColor.mul( float( 1 ).div( ( max( currentColor.r, currentColor.g, currentColor.b ).add( 1.0 ) ) ) );
const compressedHistory = clampedHistoryColor.mul( float( 1 ).div( ( max( clampedHistoryColor.r, clampedHistoryColor.g, clampedHistoryColor.b ).add( 1.0 ) ) ) );

const luminanceCurrent = luminance( compressedCurrent.rgb );
const luminanceHistory = luminance( compressedHistory.rgb );
Expand Down
2 changes: 1 addition & 1 deletion src/nodes/functions/material/getParallaxCorrectNormal.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const getParallaxCorrectNormal = /*@__PURE__*/ Fn( ( [ normal, cubeSize, cubePos
rbminmax.y = nDir.y.greaterThan( float( 0 ) ).select( rbmax.y, rbmin.y );
rbminmax.z = nDir.z.greaterThan( float( 0 ) ).select( rbmax.z, rbmin.z );

const correction = min( min( rbminmax.x, rbminmax.y ), rbminmax.z ).toVar();
const correction = min( rbminmax.x, rbminmax.y, rbminmax.z ).toVar();
const boxIntersection = positionWorld.add( nDir.mul( correction ) ).toVar();
return boxIntersection.sub( cubePos );

Expand Down
2 changes: 1 addition & 1 deletion src/nodes/materialx/lib/mx_noise.js
Original file line number Diff line number Diff line change
Expand Up @@ -1004,7 +1004,7 @@ export const mx_worley_distance_1 = /*@__PURE__*/ Fn( ( [ p_immutable, x_immutab

If( metric.equal( int( 3 ) ), () => {

return max( max( abs( diff.x ), abs( diff.y ) ), abs( diff.z ) );
return max( abs( diff.x ), abs( diff.y ), abs( diff.z ) );

} );

Expand Down