Luxar Viewer API Documentation - v2026.9.22
    Preparing search index...
    FXAA_FRAGMENT_SHADER: "\n precision highp float;\n in vec2 vUv;\n out vec4 fragColor;\n\n uniform sampler2D uInput;\n uniform vec2 uResolution;\n\n // Standard FXAA-3.11 quality constants.\n #define FXAA_EDGE_THRESHOLD 0.125\n #define FXAA_EDGE_THRESHOLD_MIN 0.0312\n #define FXAA_SUBPIX_TRIM 0.25\n #define FXAA_SUBPIX_CAP 0.75\n\n float luma(vec3 c) { return dot(c, vec3(0.299, 0.587, 0.114)); }\n\n void main() {\n vec2 inv = 1.0 / uResolution;\n\n vec3 cM = texture(uInput, vUv).rgb;\n vec3 cN = texture(uInput, vUv + vec2( 0.0, -inv.y)).rgb;\n vec3 cS = texture(uInput, vUv + vec2( 0.0, inv.y)).rgb;\n vec3 cE = texture(uInput, vUv + vec2( inv.x, 0.0)).rgb;\n vec3 cW = texture(uInput, vUv + vec2(-inv.x, 0.0)).rgb;\n\n float lM = luma(cM);\n float lN = luma(cN);\n float lS = luma(cS);\n float lE = luma(cE);\n float lW = luma(cW);\n\n float lMin = min(lM, min(min(lN, lS), min(lE, lW)));\n float lMax = max(lM, max(max(lN, lS), max(lE, lW)));\n float range = lMax - lMin;\n\n // Local-contrast early-out.\n if (range < max(FXAA_EDGE_THRESHOLD_MIN, lMax * FXAA_EDGE_THRESHOLD)) {\n fragColor = vec4(cM, 1.0);\n return;\n }\n\n // Sample diagonals for the sub-pixel blend factor.\n vec3 cNW = texture(uInput, vUv + vec2(-inv.x, -inv.y)).rgb;\n vec3 cNE = texture(uInput, vUv + vec2( inv.x, -inv.y)).rgb;\n vec3 cSW = texture(uInput, vUv + vec2(-inv.x, inv.y)).rgb;\n vec3 cSE = texture(uInput, vUv + vec2( inv.x, inv.y)).rgb;\n\n float lNW = luma(cNW);\n float lNE = luma(cNE);\n float lSW = luma(cSW);\n float lSE = luma(cSE);\n\n // Sub-pixel blend factor.\n float lLowpass = (lN + lE + lW + lS) * 0.25;\n float subRange = abs(lLowpass - lM);\n float subPixel = clamp(subRange / range, 0.0, 1.0);\n subPixel = smoothstep(0.0, 1.0, subPixel);\n subPixel = subPixel * subPixel * FXAA_SUBPIX_CAP;\n\n // Edge direction (horizontal vs vertical).\n float edgeH = abs((lNW + lNE) - (lSW + lSE)) + 2.0 * abs(lN - lS);\n float edgeV = abs((lNW + lSW) - (lNE + lSE)) + 2.0 * abs(lE - lW);\n bool horizontal = edgeH >= edgeV;\n\n // Step direction along the edge gradient.\n float lOpp1 = horizontal ? lN : lW;\n float lOpp2 = horizontal ? lS : lE;\n float grad1 = lOpp1 - lM;\n float grad2 = lOpp2 - lM;\n float gradN = abs(grad1);\n float gradP = abs(grad2);\n bool stepUpLeft = gradN >= gradP;\n float gradient = max(gradN, gradP) * 0.25;\n\n vec2 step = horizontal ? vec2(0.0, inv.y) : vec2(inv.x, 0.0);\n if (stepUpLeft) step = -step;\n\n // Single-sample blend along the step.\n vec3 cBlend = texture(uInput, vUv + step * 0.5).rgb;\n\n // Mix in the sub-pixel blend.\n vec3 result = mix(cM, cBlend, subPixel);\n fragColor = vec4(result, 1.0);\n }\n" = ...

    FXAA "Quality" preset. Adapted from Three.js's FXAAShader; rewritten to GLSL ES 3.0 (in/out + texture()) and inlined here to avoid an extra example-import.