mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Revert "Added experimental BetterAA shader"
This reverts commit 03e8eb42ad
.
This commit is contained in:
parent
8308598512
commit
15197c3040
@ -124,14 +124,8 @@ vec4 aa_apply(texture2D tex, sampler smplr, vec2 fragCoord, vec2 resolution) {
|
|||||||
mediump vec2 v_rgbSE;
|
mediump vec2 v_rgbSE;
|
||||||
mediump vec2 v_rgbM;
|
mediump vec2 v_rgbM;
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL_BETTERAA
|
vec2 scaled_fc = fragCoord * FXAA_SCALE;
|
||||||
float fxaa_scale = textureSize(sampler2D(tex, smplr), 0).x / 900.0;
|
vec2 scaled_res = resolution * FXAA_SCALE;
|
||||||
#else
|
|
||||||
float fxaa_scale = FXAA_SCALE;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
vec2 scaled_fc = fragCoord * fxaa_scale;
|
|
||||||
vec2 scaled_res = resolution * fxaa_scale;
|
|
||||||
|
|
||||||
//compute the texture coords
|
//compute the texture coords
|
||||||
texcoords(scaled_fc, scaled_res, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);
|
texcoords(scaled_fc, scaled_res, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
#include <srgb.glsl>
|
#include <srgb.glsl>
|
||||||
#include <cloud.glsl>
|
#include <cloud.glsl>
|
||||||
#include <random.glsl>
|
#include <random.glsl>
|
||||||
#include <lod.glsl>
|
|
||||||
|
|
||||||
layout(set = 1, binding = 0)
|
layout(set = 1, binding = 0)
|
||||||
uniform texture2D t_src_color;
|
uniform texture2D t_src_color;
|
||||||
@ -44,34 +43,6 @@ uniform texture2D t_src_bloom;
|
|||||||
|
|
||||||
layout(location = 0) out vec4 tgt_color;
|
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) {
|
vec3 rgb2hsv(vec3 c) {
|
||||||
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
|
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));
|
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
|
#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);
|
vec4 aa_color = aa_apply(t_src_color, s_src_color, sample_uv * screen_res.xy, screen_res.xy);
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL_SOBEL
|
#ifdef EXPERIMENTAL_SOBEL
|
||||||
vec3 s[8];
|
vec3 s[8];
|
||||||
|
@ -482,6 +482,4 @@ pub enum ExperimentalShader {
|
|||||||
NoRainbows,
|
NoRainbows,
|
||||||
/// Make objects appear wet when appropriate.
|
/// Make objects appear wet when appropriate.
|
||||||
Wetness,
|
Wetness,
|
||||||
/// An attempt at better anti-aliasing (requires FXAA).
|
|
||||||
BetterAA,
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user