Skip to content

Commit

Permalink
10 > 6 samples, cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
swift502 committed Oct 1, 2024
1 parent 3146aa4 commit 46c2e81
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
8 changes: 4 additions & 4 deletions examples/jsm/shaders/FXAAShader.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ const FXAAShader = {

fragmentShader: /* glsl */`
// FXAA algorithm from NVIDIA, Implemented by Jasper Flick, GLSL port by Dave Hoskins
// https://catlikecoding.com/unity/tutorials/advanced-rendering/fxaa/
// FXAA algorithm from NVIDIA, C# implementation by Jasper Flick, GLSL port by Dave Hoskins
// http://developer.download.nvidia.com/assets/gamedev/files/sdk/11/FXAA_WhitePaper.pdf
// https://catlikecoding.com/unity/tutorials/advanced-rendering/fxaa/
uniform sampler2D tDiffuse;
uniform vec2 resolution;
varying vec2 vUv;
#define EDGE_STEP_COUNT 10
#define EDGE_STEP_COUNT 6
#define EDGE_GUESS 8.0
#define EDGE_STEPS 1.0, 1.5, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 4.0
#define EDGE_STEPS 1.0, 1.5, 2.0, 2.0, 2.0, 4.0
const float edgeSteps[EDGE_STEP_COUNT] = float[EDGE_STEP_COUNT]( EDGE_STEPS );
float _ContrastThreshold = 0.0312;
Expand Down
7 changes: 2 additions & 5 deletions examples/jsm/tsl/display/FXAANode.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ class FXAANode extends TempNode {
const textureNode = this.textureNode.bias( - 100 );
const uvNode = textureNode.uvNode || uv();

const EDGE_STEP_COUNT = float( 10 );
const EDGE_STEP_COUNT = float( 6 );
const EDGE_GUESS = float( 8.0 );
const EDGE_STEPS = uniformArray( [ 1.0, 1.5, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 4.0 ] );
const EDGE_STEPS = uniformArray( [ 1.0, 1.5, 2.0, 2.0, 2.0, 4.0 ] );

const _ContrastThreshold = float( 0.0312 );
const _RelativeThreshold = float( 0.063 );
Expand Down Expand Up @@ -121,8 +121,6 @@ class FXAANode extends TempNode {

} );

// TODO: How to return an object with multiple return values?
// isHorizontal should be bool, not float
return vec4( isHorizontal, pixelStep, oppositeLuminance, gradient );

} );
Expand Down Expand Up @@ -256,7 +254,6 @@ class FXAANode extends TempNode {

} );

// TODO: How to pass structs as parameters?
const pixelBlend = DeterminePixelBlendFactor( lm, ln, le, ls, lw, lne, lnw, lse, lsw, contrast );
const edge = DetermineEdge( texSize, lm, ln, le, ls, lw, lne, lnw, lse, lsw );
const edgeBlend = DetermineEdgeBlendFactor( texSize, lm, edge.x, edge.y, edge.z, edge.w, uv );
Expand Down

0 comments on commit 46c2e81

Please sign in to comment.