fix compile error when floodfill gets enabled. fix compile error when TAA is turned off. fix compile error when aerochrome is turned on. re-added "render clouds as fog" setting. fix DOF using wrong depth buffer for CoC. fix cave fog when DH is enabled. fix block breaking effect not having alpha discard. changed "clouds intersect terrain" setting to work better on edges, but work worse everywhere else.

This commit is contained in:
Xonk
2024-06-12 20:56:14 -04:00
parent 4d2a30af6a
commit 04bbc79b89
17 changed files with 169 additions and 75 deletions

View File

@ -117,8 +117,8 @@ void main() {
float materials = normals_and_materials.a;
vec2 PackLightmaps = lightmapCoords;
PackLightmaps.y *= 1.05;
PackLightmaps = min(max(PackLightmaps - 0.001*blueNoise(),0.0)*1.002,1.0);
// PackLightmaps.y *= 1.05;
// PackLightmaps = min(max(PackLightmaps - 0.001*blueNoise(),0.0)*1.002,1.0);
vec4 data1 = clamp( encode(normals.xyz, PackLightmaps), 0.0, 1.0);

View File

@ -252,12 +252,12 @@ float ld(float dist) {
return (2.0 * near) / (far + near - dist * (far - near));
}
vec3 texture2D_POMSwitch(
vec4 texture2D_POMSwitch(
sampler2D sampler,
vec2 lightmapCoord,
vec4 dcdxdcdy
){
return texture2DGradARB(sampler, lightmapCoord, dcdxdcdy.xy, dcdxdcdy.zw).rgb;
return texture2DGradARB(sampler, lightmapCoord, dcdxdcdy.xy, dcdxdcdy.zw);
}
//////////////////////////////VOID MAIN//////////////////////////////
@ -332,12 +332,14 @@ void main() {
}
}
vec3 Albedo = toLinear(texture2D_POMSwitch(texture, adjustedTexCoord.xy, vec4(dcdx,dcdy)));
vec4 Albedo = texture2D_POMSwitch(texture, adjustedTexCoord.xy, vec4(dcdx,dcdy));
#else
vec3 Albedo = toLinear(texture2D(texture, adjustedTexCoord.xy).rgb);
vec4 Albedo = texture2D(texture, adjustedTexCoord.xy);
#endif
if(dot(Albedo.rgb, vec3(0.33333)) < 1.0/255.0) { discard; return; }
Albedo.rgb = toLinear(Albedo.rgb);
if(dot(Albedo.rgb, vec3(0.33333)) < 1.0/255.0 || Albedo.a < 0.01 ) { discard; return; }
gl_FragData[0] = vec4(encodeVec2(vec2(0.5)), encodeVec2(Albedo.rg), encodeVec2(vec2(Albedo.b,0.02)), 1.0);
#endif

View File

@ -1,6 +1,9 @@
#extension GL_ARB_shader_texture_lod : enable
#include "/lib/settings.glsl"
#include "/lib/blocks.glsl"
#include "/lib/entities.glsl"
#include "/lib/items.glsl"
flat varying int NameTags;
@ -415,9 +418,9 @@ void main() {
#ifdef AEROCHROME_MODE
float gray = dot(Albedo.rgb, vec3(0.2, 1.0, 0.07));
if (
blockID == BLOCK_AMETHYST_BUD_MEDIUM || blockID == BLOCK_AMETHYST_BUD_LARGE || blockID == BLOCK_AMETHYST_CLUSTER ||
blockID == BLOCK_SSS_STRONG || blockID == BLOCK_SSS_WEAK ||
blockID >= 10 && blockId < 80
blockID == BLOCK_AMETHYST_BUD_MEDIUM || blockID == BLOCK_AMETHYST_BUD_LARGE || blockID == BLOCK_AMETHYST_CLUSTER
|| blockID == BLOCK_SSS_STRONG || blockID == BLOCK_SSS_WEAK
|| blockID >= 10 && blockID < 80
) {
// IR Reflective (Pink-red)
Albedo.rgb = mix(vec3(gray), aerochrome_color, 0.7);

View File

@ -229,10 +229,9 @@ void main() {
normalMat = vec4(normalize(gl_NormalMatrix * gl_Normal), 1.0);
FlatNormals = normalMat.xyz;
blockID = mc_Entity.x;
// velocity = at_velocity;
blockID = mc_Entity.x ;
if(mc_Entity.x == BLOCK_GROUND_WAVING_VERTICAL || mc_Entity.x == BLOCK_GRASS_SHORT || mc_Entity.x == BLOCK_GRASS_TALL_LOWER || mc_Entity.x == BLOCK_GRASS_TALL_UPPER ) normalMat.a = 0.60;
if(blockID == BLOCK_GROUND_WAVING_VERTICAL || blockID == BLOCK_GRASS_SHORT || blockID == BLOCK_GRASS_TALL_LOWER || blockID == BLOCK_GRASS_TALL_UPPER ) normalMat.a = 0.60;
PORTAL = 0;

View File

@ -515,10 +515,10 @@ void BilateralUpscale_REUSE_Z(sampler2D tex1, sampler2D tex2, sampler2D depth, v
ivec2 pos = ivec2(gl_FragCoord.xy*texelSize + 1);
ivec2 getRadius[4] = ivec2[](
ivec2(-2,-2),
ivec2(-2, 0),
ivec2(-1,-1),
ivec2(-1, 0),
ivec2( 0, 0),
ivec2( 0,-2)
ivec2( 0,-1)
);
#ifdef DISTANT_HORIZONS
@ -729,12 +729,15 @@ void main() {
vec3 albedo = toLinear(vec3(dataUnpacked0.xz,dataUnpacked1.x));
vec3 normal = decode(dataUnpacked0.yw);
vec2 lightmap = min(max(dataUnpacked1.yz - 0.05,0.0)*1.06,1.0);// small offset to hide flickering from precision error in the encoding/decoding on values close to 1.0 or 0.0
vec2 lightmap = dataUnpacked1.yz;
lightmap.xy = min(max(lightmap.xy - 0.05,0.0)*1.06,1.0); // small offset to hide flickering from precision error in the encoding/decoding on values close to 1.0 or 0.0
#if defined END_SHADER || defined NETHER_SHADER
lightmap.y = 1.0;
#endif
// lightmap.y = 0.0;
// if(isDHrange) lightmap.y = pow(lightmap.y,25);
// if(isEyeInWater == 1) lightmap.y = max(lightmap.y, 0.75);
////// --------------- UNPACK MISC --------------- //////
@ -888,7 +891,9 @@ void main() {
#endif
#endif
Background *= 1.0 - exp2(-50.0 * pow(clamp(feetPlayerPos_normalized.y+0.025,0.0,1.0),2.0) ); // darken the ground in the sky.
#ifdef SKY_GROUND
Background *= 1.0 - exp2(-50.0 * pow(clamp(feetPlayerPos_normalized.y+0.025,0.0,1.0),2.0) ); // darken the ground in the sky.
#endif
vec3 Sky = skyFromTex(feetPlayerPos_normalized, colortex4)/30.0 * Sky_Brightness;
Background += Sky;
@ -1226,14 +1231,14 @@ void main() {
gl_FragData[0].rgb = gl_FragData[0].rgb * vlBehingTranslucents.a + vlBehingTranslucents.rgb;
}
#if defined VOLUMETRIC_CLOUDS && defined CLOUDS_INTERSECT_TERRAIN
vec4 Clouds = texture2D_bicubic_offset(colortex0, ((gl_FragCoord.xy + 0.5)*texelSize)*CLOUDS_QUALITY, noise, RENDER_SCALE.x);
// vec4 Clouds = BilateralUpscale_REUSE_Z_clouds(colortex0, colortex12, DH_mixedLinearZ, gl_FragCoord.xy*CLOUDS_QUALITY, texcoord*CLOUDS_QUALITY);
// #if defined VOLUMETRIC_CLOUDS && defined CLOUDS_INTERSECT_TERRAIN
// vec4 Clouds = texture2D_bicubic_offset(colortex0, ((gl_FragCoord.xy + 0.5)*texelSize)*CLOUDS_QUALITY, noise, RENDER_SCALE.x);
// // vec4 Clouds = BilateralUpscale_REUSE_Z_clouds(colortex0, colortex12, DH_mixedLinearZ, gl_FragCoord.xy*CLOUDS_QUALITY, texcoord*CLOUDS_QUALITY);
gl_FragData[1] = texture2D(colortex2, texcoord);
gl_FragData[0].rgb = gl_FragData[0].rgb * Clouds.a + Clouds.rgb;
gl_FragData[1].a = gl_FragData[1].a * pow(Clouds.a,5.0);
#endif
// gl_FragData[1] = texture2D(colortex2, texcoord);
// gl_FragData[0].rgb = gl_FragData[0].rgb * Clouds.a + Clouds.rgb;
// gl_FragData[1].a = gl_FragData[1].a * pow(Clouds.a,5.0);
// #endif
// gl_FragData[0].rgb = vec3(1.0) * clamp(1.0 - filteredShadow.y/1,0,1);
// if(hideGUI > 0) gl_FragData[0].rgb = vec3(1.0) * Shadows;
@ -1267,7 +1272,8 @@ void main() {
if(hideGUI == 0) gl_FragData[0].rgb = vec3(1) * (1.0 - SSAO_SSS.x);
// if(hideGUI == 0) gl_FragData[0].rgb = vec3(1) * filteredShadow.z;//exp(-7*(1-clamp(1.0 - filteredShadow.x,0.0,1.0)));
#endif
// gl_FragData[0].rgb = vec3(1) * lightmap.y;
// if(swappedDepth >= 1.0) gl_FragData[0].rgb = vec3(0.1);
// gl_FragData[0].rgb = vec3(1) * ld(texture2D(depthtex1, texcoord).r);
// if(texcoord.x > 0.5 )gl_FragData[0].rgb = vec3(1) * ld(texture2D(depthtex0, texcoord).r);

View File

@ -107,7 +107,7 @@ void main() {
#if DOF_QUALITY >= 0
/*--------------------------------*/
float z = ld(texture2D(depthtex0, texcoord.st*RENDER_SCALE).r)*far;
float z = ld(texture2D(depthtex1, texcoord.st*RENDER_SCALE).r)*far;
#if MANUAL_FOCUS == -2
float focus = rodExposureDepth.y*far;
#elif MANUAL_FOCUS == -1
@ -120,10 +120,10 @@ void main() {
#ifdef FAR_BLUR_ONLY
pcoc *= float(z > focus);
#endif
float noise = blueNoise()*6.28318530718;
mat2 noiseM = mat2( cos( noise ), -sin( noise ),
sin( noise ), cos( noise )
);
// float noise = blueNoise()*6.28318530718;
// mat2 noiseM = mat2( cos( noise ), -sin( noise ),
// sin( noise ), cos( noise )
// );
vec3 bcolor = vec3(0.);
float nb = 0.0;
vec2 bcoord = vec2(0.0);

View File

@ -13,6 +13,7 @@ uniform sampler2D dhDepthTex;
uniform sampler2D dhDepthTex1;
#endif
uniform sampler2D colortex0;
uniform sampler2D colortex2;
uniform sampler2D colortex3;
// uniform sampler2D colortex4;
@ -81,6 +82,7 @@ float linearizeDepthFast(const in float depth, const in float near, const in flo
#include "/lib/volumetricClouds.glsl"
// #define CLOUDS_INTERSECT_TERRAIN
#include "/lib/overworld_fog.glsl"
#endif
#ifdef NETHER_SHADER
@ -404,6 +406,14 @@ void main() {
#if defined NETHER_SHADER || defined END_SHADER
vec4 VolumetricFog = GetVolumetricFog(viewPos0, noise_1, noise_2);
#endif
#if defined VOLUMETRIC_CLOUDS && defined CLOUDS_INTERSECT_TERRAIN
vec4 Clouds = texture2D(colortex0, (gl_FragCoord.xy*texelSize) / (VL_RENDER_RESOLUTION/CLOUDS_QUALITY));
VolumetricFog.rgb = Clouds.rgb * VolumetricFog.a + VolumetricFog.rgb;
VolumetricFog.a = VolumetricFog.a*Clouds.a;
#endif
gl_FragData[0] = clamp(VolumetricFog, 0.0, 65000.0);

View File

@ -114,7 +114,6 @@ vec4 BilateralUpscale(sampler2D tex, sampler2D depth, vec2 coord, float referenc
ivec2 posDepth = ivec2(coord*VL_RENDER_RESOLUTION) * scaling;
ivec2 posColor = ivec2(coord*VL_RENDER_RESOLUTION);
ivec2 pos = ivec2(gl_FragCoord.xy*texelSize + 1);
ivec2 getRadius[4] = ivec2[](
ivec2(-2,-2),
ivec2(-2, 0),
@ -266,6 +265,10 @@ void main() {
float lightleakfix = clamp(pow(eyeBrightnessSmooth.y/240.,2) ,0.0,1.0);
float lightleakfixfast = clamp(eyeBrightness.y/240.,0.0,1.0);
////// --------------- UNPACK OPAQUE GBUFFERS --------------- //////
// float opaqueMasks = decodeVec2(texture2D(colortex1,texcoord).a).y;
// bool isOpaque_entity = abs(opaqueMasks-0.45) < 0.01;
////// --------------- UNPACK TRANSLUCENT GBUFFERS --------------- //////
vec4 data = texture2D(colortex11,texcoord).rgba;
vec4 unpack0 = vec4(decodeVec2(data.r),decodeVec2(data.g)) ;
@ -292,9 +295,9 @@ void main() {
////// --------------- get volumetrics
#ifdef TOGGLE_VL_FOG
#ifdef DISTANT_HORIZONS
vec4 vl = BilateralUpscale(colortex0, colortex12, gl_FragCoord.xy, sqrt(texture2D(colortex12,texcoord).a/65000.0));
vec4 vl = BilateralUpscale(colortex0, colortex12, gl_FragCoord.xy - 1.5, sqrt(texture2D(colortex12,texcoord).a/65000.0));
#else
vec4 vl = BilateralUpscale(colortex0, depthtex0, gl_FragCoord.xy, frDepth);
vec4 vl = BilateralUpscale(colortex0, depthtex0, gl_FragCoord.xy - 1.5, frDepth);
#endif
#else
vec4 vl = vec4(0,0,0,1);
@ -327,10 +330,12 @@ void main() {
fog *= exp(-10.0 * pow(clamp(np3.y,0.0,1.0)*4.0,2.0));
fog *= caveDetection;
if(swappedDepth >= 1.0 || isEyeInWater != 0) fog = 0.0;
// fog *= lightleakfix;
#ifdef SKY_GROUND
vec3 borderFogColor = skyGroundColor;
#else
@ -350,8 +355,9 @@ void main() {
#ifdef BorderFog
TranslucentShader = mix(TranslucentShader, vec4(0.0), fog);
#endif
color = color*(1.0-TranslucentShader.a) + TranslucentShader.rgb*10.0;
color *= (1.0-TranslucentShader.a);
color += TranslucentShader.rgb*10.0;
}
////// --------------- VARIOUS FOG EFFECTS (behind volumetric fog)
@ -372,7 +378,7 @@ void main() {
float skyhole = pow(clamp(1.0-pow(max(np3.y - 0.6,0.0)*5.0,2.0),0.0,1.0),2);
color.rgb = mix(color.rgb + cavefogCol * caveDetection, cavefogCol, swappedDepth >= 1.0 ? skyhole * caveDetection : 0.0);
color.rgb = mix(color.rgb + cavefogCol * caveDetection, cavefogCol, z >= 1.0 ? skyhole * caveDetection : 0.0);
}
#endif
@ -459,7 +465,6 @@ void main() {
gl_FragData[0].r = bloomyFogMult; // pass fog alpha so bloom can do bloomy fog
gl_FragData[1].rgb = clamp(color.rgb, 0.0,68000.0);
// gl_FragData[1].rgb = vec3(tangentNormals.xy,0.0) ;
// gl_FragData[1].rgb = vec3(1.0) * ld( (data.a > 0.0 ? data.a : texture2D(depthtex0, texcoord).x ) ) ;
// gl_FragData[1].rgb = gl_FragData[1].rgb * (1.0-TranslucentShader.a) + TranslucentShader.rgb*10.0;

View File

@ -456,7 +456,7 @@ void main() {
gl_FragData[0] = clamp(fp10Dither(color, triangularize(interleaved_gradientNoise())), 0.0, 65000.0);
#endif
#else
vec3 color = clamp(fp10Dither(vec4(texture2D(colortex3,taauTC).rgb,1.0), triangularize(interleaved_gradientNoise())).rgb,0.0,65000.);
vec3 color = clamp(fp10Dither(vec4(texture2D(colortex3,texcoord).rgb,1.0), triangularize(interleaved_gradientNoise())).rgb,0.0,65000.);
gl_FragData[0].rgb = color;
#endif
}