fix fog render scaling in end/nether. fix translucents scaling wrong when TAAU is on. fix tall plants tops waving wrong.

This commit is contained in:
Xonk
2023-08-06 16:14:32 -04:00
parent a4df4d3006
commit 6bea0d3cae
10 changed files with 44 additions and 38 deletions

View File

@ -187,14 +187,14 @@ vec3 rayTrace(vec3 dir,vec3 position,float dither, float fresnel, bool inwater){
float mult = min(min(maxLengths.x,maxLengths.y),maxLengths.z);
vec3 stepv = direction * mult / quality*vec3(RENDER_SCALE,1.0);
vec3 stepv = direction * mult / quality;
vec3 spos = clipPosition*vec3(RENDER_SCALE,1.0) + stepv*dither;
vec3 spos = clipPosition+ stepv*dither;
float minZ = clipPosition.z;
float maxZ = spos.z+stepv.z*0.5;
spos.xy += offsets[framemod8]*texelSize*0.5/RENDER_SCALE;
spos.xy += offsets[framemod8]*texelSize*0.5;
float dist = 1.0 + clamp(position.z*position.z/50.0,0,2); // shrink sample size as distance increases
for (int i = 0; i <= int(quality); i++) {
@ -203,10 +203,10 @@ vec3 rayTrace(vec3 dir,vec3 position,float dither, float fresnel, bool inwater){
float sp = sqrt(texelFetch2D(colortex4,ivec2(spos.xy/texelSize/4),0).w/65000.0);
sp = invLinZ(sp);
if(sp <= max(maxZ,minZ) && sp >= min(maxZ,minZ)) return vec3(spos.xy/RENDER_SCALE,sp);
if(sp <= max(maxZ,minZ) && sp >= min(maxZ,minZ)) return vec3(spos.xy,sp);
#else
float sp = texelFetch2D(depthtex1,ivec2(spos.xy/texelSize),0).r;
if(sp <= max(maxZ,minZ) && sp >= min(maxZ,minZ)) return vec3(spos.xy/RENDER_SCALE,sp);
if(sp <= max(maxZ,minZ) && sp >= min(maxZ,minZ)) return vec3(spos.xy,sp);
#endif
@ -254,9 +254,9 @@ vec3 GGX (vec3 n, vec3 v, vec3 l, float r, vec3 F0) {
/* RENDERTARGETS:2,7,11,14 */
void main() {
if (gl_FragCoord.x * texelSize.x < RENDER_SCALE.x && gl_FragCoord.y * texelSize.y < RENDER_SCALE.y ) {
if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) {
vec2 tempOffset = offsets[framemod8];
vec3 fragpos = toScreenSpace(gl_FragCoord.xyz*vec3(texelSize/RENDER_SCALE,1.0)-vec3(vec2(tempOffset)*texelSize*0.5,0.0));
vec3 fragpos = toScreenSpace(gl_FragCoord.xyz*vec3(texelSize,1.0)-vec3(vec2(tempOffset)*texelSize*0.5,0.0));
gl_FragData[0] = texture2D(texture, lmtexcoord.xy, Texture_MipMap_Bias) * color;
vec3 Albedo = toLinear(gl_FragData[0].rgb);

View File

@ -110,10 +110,7 @@ void main() {
viewVector = ( gl_ModelViewMatrix * Swtich_gl_vertex).xyz;
viewVector = normalize(tbnMatrix * viewVector);
#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;
gl_Position.xy += offsets[framemod8] * gl_Position.w*texelSize;
#endif
}

View File

@ -26,6 +26,7 @@ uniform ivec2 eyeBrightnessSmooth;
#include "/lib/color_transforms.glsl"
#include "/lib/color_dither.glsl"
#include "/lib/projections.glsl"
#include "/lib/res_params.glsl"
#ifdef END_SHADER
#include "/lib/end_fog.glsl"
@ -99,7 +100,7 @@ void waterVolumetrics(inout vec3 inColor, vec3 rayStart, vec3 rayEnd, float estE
void main() {
/* DRAWBUFFERS:0 */
vec2 tc = floor(gl_FragCoord.xy)*2.0*texelSize+0.5*texelSize;
vec2 tc = floor(gl_FragCoord.xy)/VL_RENDER_RESOLUTION*texelSize+0.5*texelSize;
float z = texture2D(depthtex0,tc).x;
vec3 fragpos = toScreenSpace(vec3(tc,z));

View File

@ -119,8 +119,8 @@ void main() {
vec3 std = abs(col - m1) + abs(albedoCurrent1 - m1) + abs(albedoCurrent2 - m1) +
abs(albedoCurrent3 - m1) + abs(albedoCurrent3 - m1) + abs(albedoCurrent4 - m1);
float contrast = 1.0 - luma(std)/5.0;
col = col*(1.0+(SHARPENING+UPSCALING_SHARPNENING)*contrast)
- (SHARPENING+UPSCALING_SHARPNENING)/(1.0-0.5/3.5)*contrast*(m1 - 0.5/3.5*col);
col = col*(1.0+(SHARPENING)*contrast)
- (SHARPENING)/(1.0-0.5/3.5)*contrast*(m1 - 0.5/3.5*col);
#endif
float lum = luma(col);