fog tweaks, fix TAAU breaking the nether

yar
This commit is contained in:
Xonk
2023-06-10 16:49:06 -04:00
parent 3cda692d97
commit 2e7d464b14
13 changed files with 135 additions and 73 deletions

View File

@ -341,7 +341,7 @@ void ScreenSpace_SSS(inout float sss, vec3 fragpos, vec2 noise, vec3 normal){
float rd = mulfov2 * 0.1;
vec2 acc = -(TAA_Offset*(texelSize/2))*RENDER_SCALE ;
vec2 acc = -(TAA_Offset*(texelSize/2)) ;
// int seed = (frameCounter%40000)*2 + (1+frameCounter);
// float randomDir = fract(R2_samples(seed).y + noise.x ) * 1.61803398874 ;
@ -355,10 +355,10 @@ void ScreenSpace_SSS(inout float sss, vec3 fragpos, vec2 noise, vec3 normal){
// vec2 sp = tapLocation_alternate(j, 0.0, 7, 20, randomDir);
vec2 sampleOffset = sp*rd;
ivec2 offset = ivec2(gl_FragCoord.xy + sampleOffset*vec2(viewWidth,viewHeight*aspectRatio)*RENDER_SCALE);
ivec2 offset = ivec2(gl_FragCoord.xy + sampleOffset*vec2(viewWidth,viewHeight*aspectRatio));
if (offset.x >= 0 && offset.y >= 0 && offset.x < viewWidth*RENDER_SCALE.x && offset.y < viewHeight*RENDER_SCALE.y ) {
vec3 t0 = toScreenSpace(vec3(offset*texelSize+acc+0.5*texelSize,texelFetch2D(depthtex1,offset,0).x) * vec3(1.0/RENDER_SCALE, 1.0) );
if (offset.x >= 0 && offset.y >= 0 && offset.x < viewWidth && offset.y < viewHeight ) {
vec3 t0 = toScreenSpace(vec3(offset*texelSize+acc+0.5*texelSize,texelFetch2D(depthtex1,offset,0).x) );
vec3 vec = t0.xyz - fragpos;
float dsquared = dot(vec,vec);

View File

@ -3,6 +3,7 @@
#extension GL_EXT_gpu_shader4 : enable
#include "/lib/settings.glsl"
#include "/lib/res_params.glsl"
const int noiseTextureResolution = 32;
@ -31,7 +32,9 @@ varying vec2 texcoord;
flat varying float exposureA;
flat varying float tempOffsets;
uniform sampler2D colortex3;
uniform sampler2D colortex0;
uniform sampler2D colortex5;
uniform sampler2D colortex6;
uniform sampler2D depthtex0;
uniform vec2 texelSize;
@ -247,9 +250,7 @@ vec3 closestToCamera5taps(vec2 texcoord, sampler2D depth)
dmin = dmin.z > dtl.z? dtl : dmin;
dmin = dmin.z > dbl.z? dbl : dmin;
dmin = dmin.z > dbr.z? dbr : dmin;
#ifdef TAA_UPSCALING
dmin.xy = dmin.xy/RENDER_SCALE;
#endif
return dmin;
}
const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.),
@ -287,12 +288,7 @@ vec3 TAA_hq(){
if (previousPosition.x < 0.0 || previousPosition.y < 0.0 || previousPosition.x > 1.0 || previousPosition.y > 1.0)
return smoothfilter(colortex3, adjTC + offsets[framemod8]*texelSize*0.5).xyz;
#ifdef TAA_UPSCALING
vec3 albedoCurrent0 = smoothfilter(colortex3, adjTC + offsets[framemod8]*texelSize*0.5).xyz;
// Interpolating neighboorhood clampling boundaries between pixels
vec3 cMax = texture2D(colortex0, adjTC).rgb;
vec3 cMin = texture2D(colortex6, adjTC).rgb;
#else
vec3 albedoCurrent0 = texture2D(colortex3, adjTC).rgb;
vec3 albedoCurrent1 = texture2D(colortex3, adjTC + vec2(texelSize.x,texelSize.y)).rgb;
vec3 albedoCurrent2 = texture2D(colortex3, adjTC + vec2(texelSize.x,-texelSize.y)).rgb;
@ -306,7 +302,7 @@ vec3 TAA_hq(){
vec3 cMax = max(max(max(albedoCurrent0,albedoCurrent1),albedoCurrent2),max(albedoCurrent3,max(albedoCurrent4,max(albedoCurrent5,max(albedoCurrent6,max(albedoCurrent7,albedoCurrent8))))));
vec3 cMin = min(min(min(albedoCurrent0,albedoCurrent1),albedoCurrent2),min(albedoCurrent3,min(albedoCurrent4,min(albedoCurrent5,min(albedoCurrent6,min(albedoCurrent7,albedoCurrent8))))));
albedoCurrent0 = smoothfilter(colortex3, adjTC + offsets[framemod8]*texelSize*0.5).rgb;
#endif
#ifndef NO_CLIP
vec3 albedoPrev = max(FastCatmulRom(colortex5, previousPosition.xy,vec4(texelSize, 1.0/texelSize), 0.75).xyz, 0.0);

View File

@ -54,9 +54,11 @@ void main() {
#endif
normalMat = vec4(normalize(gl_NormalMatrix *gl_Normal),1.0);
#ifdef TAA_UPSCALING
gl_Position.xy = gl_Position.xy * RENDER_SCALE + RENDER_SCALE * gl_Position.w - gl_Position.w;
#endif
// #ifdef TAA_UPSCALING
// gl_Position.xy = gl_Position.xy * RENDER_SCALE + RENDER_SCALE * gl_Position.w - gl_Position.w;
// #endif
#ifdef TAA
gl_Position.xy += offsets[framemod8] * gl_Position.w*texelSize;
#endif