From 15197c30401a0fe2a67134a41c71a6abc9b1cf1f Mon Sep 17 00:00:00 2001 From: Ben Wallis Date: Thu, 15 Sep 2022 10:05:12 +0100 Subject: [PATCH] Revert "Added experimental BetterAA shader" This reverts commit 03e8eb42ad2207d6634bfa0cfacbcc2efd9373bf. --- assets/voxygen/shaders/antialias/fxaa.glsl | 10 ++---- assets/voxygen/shaders/postprocess-frag.glsl | 36 +------------------- voxygen/src/render/mod.rs | 2 -- 3 files changed, 3 insertions(+), 45 deletions(-) diff --git a/assets/voxygen/shaders/antialias/fxaa.glsl b/assets/voxygen/shaders/antialias/fxaa.glsl index 7fe89a77e7..24ffe84cb9 100644 --- a/assets/voxygen/shaders/antialias/fxaa.glsl +++ b/assets/voxygen/shaders/antialias/fxaa.glsl @@ -124,14 +124,8 @@ vec4 aa_apply(texture2D tex, sampler smplr, vec2 fragCoord, vec2 resolution) { mediump vec2 v_rgbSE; mediump vec2 v_rgbM; - #ifdef EXPERIMENTAL_BETTERAA - float fxaa_scale = textureSize(sampler2D(tex, smplr), 0).x / 900.0; - #else - float fxaa_scale = FXAA_SCALE; - #endif - - vec2 scaled_fc = fragCoord * fxaa_scale; - vec2 scaled_res = resolution * fxaa_scale; + vec2 scaled_fc = fragCoord * FXAA_SCALE; + vec2 scaled_res = resolution * FXAA_SCALE; //compute the texture coords texcoords(scaled_fc, scaled_res, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM); diff --git a/assets/voxygen/shaders/postprocess-frag.glsl b/assets/voxygen/shaders/postprocess-frag.glsl index 9050f64e96..85616fe6ea 100644 --- a/assets/voxygen/shaders/postprocess-frag.glsl +++ b/assets/voxygen/shaders/postprocess-frag.glsl @@ -22,7 +22,6 @@ #include #include #include -#include layout(set = 1, binding = 0) uniform texture2D t_src_color; @@ -44,34 +43,6 @@ uniform texture2D t_src_bloom; layout(location = 0) out vec4 tgt_color; -#ifdef EXPERIMENTAL_BETTERAA - vec4 clever_aa_apply(texture2D tex, sampler smplr, vec2 fragCoord, vec2 resolution) { - uvec2 src_sz = textureSize(sampler2D(tex, smplr), 0).xy; - /* vec4 interp = texture(sampler2D(tex, smplr), fragCoord / resolution); */ - /* vec4 interp = textureBicubic(tex, smplr, fragCoord * src_sz / resolution); */ - vec4 interp = aa_apply(tex, smplr, fragCoord, resolution); - vec4 original = texelFetch(sampler2D(tex, smplr), ivec2(fragCoord / resolution * src_sz), 0); - - vec4 closest = vec4(0.0); - float closest_dist = 100000.0; - for (int i = -1; i < 2; i ++) { - for (int j = -1; j < 2; j ++) { - ivec2 rpos = ivec2(i, j); - - vec4 texel = texelFetch(sampler2D(tex, smplr), ivec2(fragCoord / resolution * src_sz) + rpos, 0); - - float dist = distance(interp.rgb, texel.rgb); - if (dist < closest_dist) { - closest = texel; - closest_dist = dist; - } - } - } - - return mix(closest, interp, 0.0); - } -#endif - vec3 rgb2hsv(vec3 c) { vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g)); @@ -238,12 +209,7 @@ void main() { } #endif - #ifdef EXPERIMENTAL_BETTERAA - vec4 aa_color = clever_aa_apply(t_src_color, s_src_color, sample_uv * screen_res.xy, screen_res.xy); - #else - vec4 aa_color = aa_apply(t_src_color, s_src_color, sample_uv * screen_res.xy, screen_res.xy); - #endif - + vec4 aa_color = aa_apply(t_src_color, s_src_color, sample_uv * screen_res.xy, screen_res.xy); #ifdef EXPERIMENTAL_SOBEL vec3 s[8]; diff --git a/voxygen/src/render/mod.rs b/voxygen/src/render/mod.rs index 2f498ac047..fd118aaa36 100644 --- a/voxygen/src/render/mod.rs +++ b/voxygen/src/render/mod.rs @@ -482,6 +482,4 @@ pub enum ExperimentalShader { NoRainbows, /// Make objects appear wet when appropriate. Wetness, - /// An attempt at better anti-aliasing (requires FXAA). - BetterAA, }