Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade FXAA #5200

Merged
merged 12 commits into from
Apr 13, 2017
3 changes: 0 additions & 3 deletions Source/Scene/FXAA.js
Original file line number Diff line number Diff line change
@@ -141,10 +141,7 @@ define([

if (!defined(this._command)) {
var fs =
'#define FXAA_PC 1\n' +
'#define FXAA_WEBGL_1 1\n' +
'#define FXAA_QUALITY_PRESET ' + this._qualityPreset + '\n' +
'#define FXAA_GREEN_AS_LUMA 1\n' +
FXAA3_11 + '\n' +
FXAAFS;

31 changes: 6 additions & 25 deletions Source/Shaders/PostProcessFilters/FXAA.glsl
Original file line number Diff line number Diff line change
@@ -2,39 +2,20 @@ varying vec2 v_textureCoordinates;

uniform sampler2D u_texture;
uniform vec2 u_fxaaQualityRcpFrame;
uniform float u_fxaaQualitySubpix;
uniform float u_fxaaQualityEdgeThreshold;
uniform float u_fxaaQualityEdgeThresholdMin;

// unused constants, only used on consoles
vec4 fxaaConsolePosPos = vec4(0.0);
vec4 fxaaConsoleRcpFrameOpt = vec4(0.0);
vec4 fxaaConsoleRcpFrameOpt2 = vec4(0.0);
vec4 fxaaConsole360RcpFrameOpt2 = vec4(0.0);
float fxaaConsoleEdgeSharpness = 0.0;
float fxaaConsoleEdgeThreshold = 0.0;
float fxaaConsoleEdgeThresholdMin = 0.0;
vec4 fxaaConsole360ConstDir = vec4(0.0);
const float fxaaQualitySubpix = 0.5;
const float fxaaQualityEdgeThreshold = 0.125;
const float fxaaQualityEdgeThresholdMin = 0.0833;

void main()
{
vec4 color = FxaaPixelShader(
v_textureCoordinates,
fxaaConsolePosPos,
u_texture,
u_texture,
u_texture,
u_fxaaQualityRcpFrame,
fxaaConsoleRcpFrameOpt,
fxaaConsoleRcpFrameOpt2,
fxaaConsole360RcpFrameOpt2,
u_fxaaQualitySubpix,
u_fxaaQualityEdgeThreshold,
u_fxaaQualityEdgeThresholdMin,
fxaaConsoleEdgeSharpness,
fxaaConsoleEdgeThreshold,
fxaaConsoleEdgeThresholdMin,
fxaaConsole360ConstDir);
fxaaQualitySubpix,
fxaaQualityEdgeThreshold,
fxaaQualityEdgeThresholdMin);
float alpha = texture2D(u_texture, v_textureCoordinates).a;
gl_FragColor = vec4(color.rgb, alpha);
}
Loading