Take FXAA samples from half-pixel coordinates to improve quality

(cherry picked from commit dbcc0fa2a6)
This commit is contained in:
clayjohn 2022-09-26 11:47:22 -07:00 committed by Rémi Verschelde
parent 2ab79719b2
commit f1bafe8131
No known key found for this signature in database
GPG key ID: C3336907360768E1
2 changed files with 8 additions and 8 deletions

View file

@ -237,10 +237,10 @@ vec4 apply_fxaa(vec4 color, vec2 uv_interp, vec2 pixel_size) {
const float FXAA_SPAN_MAX = 8.0; const float FXAA_SPAN_MAX = 8.0;
const vec3 luma = vec3(0.299, 0.587, 0.114); const vec3 luma = vec3(0.299, 0.587, 0.114);
vec4 rgbNW = texture2DLod(source, uv_interp + vec2(-1.0, -1.0) * pixel_size, 0.0); vec4 rgbNW = textureLod(source, uv_interp + vec2(-0.5, -0.5) * pixel_size, 0.0);
vec4 rgbNE = texture2DLod(source, uv_interp + vec2(1.0, -1.0) * pixel_size, 0.0); vec4 rgbNE = textureLod(source, uv_interp + vec2(0.5, -0.5) * pixel_size, 0.0);
vec4 rgbSW = texture2DLod(source, uv_interp + vec2(-1.0, 1.0) * pixel_size, 0.0); vec4 rgbSW = textureLod(source, uv_interp + vec2(-0.5, 0.5) * pixel_size, 0.0);
vec4 rgbSE = texture2DLod(source, uv_interp + vec2(1.0, 1.0) * pixel_size, 0.0); vec4 rgbSE = textureLod(source, uv_interp + vec2(0.5, 0.5) * pixel_size, 0.0);
vec3 rgbM = color.rgb; vec3 rgbM = color.rgb;
#ifdef DISABLE_ALPHA #ifdef DISABLE_ALPHA

View file

@ -325,10 +325,10 @@ vec4 apply_fxaa(vec4 color, float exposure, vec2 uv_interp, vec2 pixel_size) {
const float FXAA_SPAN_MAX = 8.0; const float FXAA_SPAN_MAX = 8.0;
const vec3 luma = vec3(0.299, 0.587, 0.114); const vec3 luma = vec3(0.299, 0.587, 0.114);
vec4 rgbNW = textureLod(source, uv_interp + vec2(-1.0, -1.0) * pixel_size, 0.0); vec4 rgbNW = textureLod(source, uv_interp + vec2(-0.5, -0.5) * pixel_size, 0.0);
vec4 rgbNE = textureLod(source, uv_interp + vec2(1.0, -1.0) * pixel_size, 0.0); vec4 rgbNE = textureLod(source, uv_interp + vec2(0.5, -0.5) * pixel_size, 0.0);
vec4 rgbSW = textureLod(source, uv_interp + vec2(-1.0, 1.0) * pixel_size, 0.0); vec4 rgbSW = textureLod(source, uv_interp + vec2(-0.5, 0.5) * pixel_size, 0.0);
vec4 rgbSE = textureLod(source, uv_interp + vec2(1.0, 1.0) * pixel_size, 0.0); vec4 rgbSE = textureLod(source, uv_interp + vec2(0.5, 0.5) * pixel_size, 0.0);
vec3 rgbM = color.rgb; vec3 rgbM = color.rgb;
#ifdef DISABLE_ALPHA #ifdef DISABLE_ALPHA