mirror of
https://github.com/X0nk/Bliss-Shader.git
synced 2025-06-26 18:22:33 +08:00
fix mishandling of cloud shadow related toggles. fix clouds not appearing behind translucent things. remove random spaces from shaders.properties
This commit is contained in:
@ -368,9 +368,8 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CLOUDS_SHADOWS
|
Shadows *= GetCloudShadow(playerPos + cameraPosition, WsunVec);
|
||||||
Shadows *= GetCloudShadow(playerPos + cameraPosition, WsunVec);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Direct_lighting = DirectLightColor * NdotL * Shadows;
|
Direct_lighting = DirectLightColor * NdotL * Shadows;
|
||||||
|
|
||||||
|
@ -419,9 +419,7 @@ void main() {
|
|||||||
|
|
||||||
Shadows *= mix(LM_shadowMapFallback, 1.0, shadowMapFalloff2);
|
Shadows *= mix(LM_shadowMapFallback, 1.0, shadowMapFalloff2);
|
||||||
|
|
||||||
#ifdef CLOUDS_SHADOWS
|
Shadows *= GetCloudShadow(feetPlayerPos+cameraPosition, WsunVec);
|
||||||
Shadows *= GetCloudShadow(feetPlayerPos+cameraPosition, WsunVec);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if(isEyeInWater == 1){
|
if(isEyeInWater == 1){
|
||||||
float distanceFromWaterSurface = max(-(feetPlayerPos.y + (cameraPosition.y - waterEnteredAltitude)),0.0) ;
|
float distanceFromWaterSurface = max(-(feetPlayerPos.y + (cameraPosition.y - waterEnteredAltitude)),0.0) ;
|
||||||
|
@ -588,9 +588,8 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
|||||||
// Shadows = mix(LM_shadowMapFallback, Shadows, shadowMapFalloff2);
|
// Shadows = mix(LM_shadowMapFallback, Shadows, shadowMapFalloff2);
|
||||||
Shadows *= mix(LM_shadowMapFallback,1.0,shadowMapFalloff2);
|
Shadows *= mix(LM_shadowMapFallback,1.0,shadowMapFalloff2);
|
||||||
|
|
||||||
#ifdef CLOUDS_SHADOWS
|
Shadows *= GetCloudShadow(feetPlayerPos+cameraPosition, WsunVec);
|
||||||
Shadows *= GetCloudShadow(feetPlayerPos+cameraPosition, WsunVec);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Direct_lighting = DirectLightColor * NdotL * Shadows;
|
Direct_lighting = DirectLightColor * NdotL * Shadows;
|
||||||
|
|
||||||
|
@ -1077,11 +1077,10 @@ void main() {
|
|||||||
|
|
||||||
if(isEyeInWater != 1) SSSColor *= lightLeakFix;
|
if(isEyeInWater != 1) SSSColor *= lightLeakFix;
|
||||||
|
|
||||||
#ifdef CLOUDS_SHADOWS
|
float cloudShadows = GetCloudShadow(feetPlayerPos.xyz + cameraPosition, WsunVec);
|
||||||
float cloudShadows = GetCloudShadow(feetPlayerPos.xyz + cameraPosition, WsunVec);
|
shadowColor *= cloudShadows;
|
||||||
shadowColor *= cloudShadows;
|
SSSColor *= cloudShadow*cloudShadows;
|
||||||
SSSColor *= cloudShadow*cloudShadows;
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1351,16 +1350,13 @@ void main() {
|
|||||||
gl_FragData[0].rgb = clamp(fp10Dither(Background, triangularize(noise_2)), 0.0, 65000.);
|
gl_FragData[0].rgb = clamp(fp10Dither(Background, triangularize(noise_2)), 0.0, 65000.);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// water absorbtion will impact ALL light coming up from terrain underwater.
|
||||||
|
gl_FragData[0].rgb *= Absorbtion;
|
||||||
|
|
||||||
if(translucentMasks > 0.0 && isEyeInWater != 1){
|
if(translucentMasks > 0.0 && isEyeInWater != 1){
|
||||||
|
|
||||||
// water absorbtion will impact ALL light coming up from terrain underwater.
|
|
||||||
gl_FragData[0].rgb *= Absorbtion;
|
|
||||||
|
|
||||||
vec4 vlBehingTranslucents = BilateralUpscale_VLFOG(colortex13, depthtex1, gl_FragCoord.xy - 1.5, ld(z));
|
vec4 vlBehingTranslucents = BilateralUpscale_VLFOG(colortex13, depthtex1, gl_FragCoord.xy - 1.5, ld(z));
|
||||||
|
|
||||||
gl_FragData[0].rgb = gl_FragData[0].rgb * vlBehingTranslucents.a + vlBehingTranslucents.rgb;
|
gl_FragData[0].rgb = gl_FragData[0].rgb * vlBehingTranslucents.a + vlBehingTranslucents.rgb;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -328,9 +328,8 @@ vec4 waterVolumetrics(vec3 rayStart, vec3 rayEnd, float rayLength, vec2 dither,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef VL_CLOUDS_SHADOWS
|
sh *= GetCloudShadow(progressW, WsunVec * lightCol.a);
|
||||||
sh *= GetCloudShadow(progressW, WsunVec * lightCol.a);
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -191,7 +191,7 @@ vec4 waterVolumetrics( vec3 rayStart, vec3 rayEnd, float estEndDepth, float estS
|
|||||||
vec3 sh = vec3(1.0);
|
vec3 sh = vec3(1.0);
|
||||||
|
|
||||||
// do this outside raymarch loop, masking the water surface is good enough
|
// do this outside raymarch loop, masking the water surface is good enough
|
||||||
#if defined VL_CLOUDS_SHADOWS && defined OVERWORLD_SHADER
|
#if defined OVERWORLD_SHADER
|
||||||
sh *= GetCloudShadow(wpos+cameraPosition, WsunVec);
|
sh *= GetCloudShadow(wpos+cameraPosition, WsunVec);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -286,18 +286,19 @@ void main() {
|
|||||||
float noise_1 = R2_dither();
|
float noise_1 = R2_dither();
|
||||||
float noise_2 = blueNoise();
|
float noise_2 = blueNoise();
|
||||||
|
|
||||||
float z0 = texture2D(depthtex0,tc).x;
|
float z0 = texelFetch2D(depthtex0, ivec2((floor(gl_FragCoord.xy - 0.5)/VL_RENDER_RESOLUTION*texelSize)/texelSize), 0 ).x;
|
||||||
|
|
||||||
#ifdef DISTANT_HORIZONS
|
#ifdef DISTANT_HORIZONS
|
||||||
float DH_z0 = texture2D(dhDepthTex,tc).x;
|
float DH_z0 = texelFetch2D(dhDepthTex, ivec2((floor(gl_FragCoord.xy - 0.5)/VL_RENDER_RESOLUTION*texelSize)/texelSize), 0 ).x;//texture2D(dhDepthTex,tc).x;
|
||||||
#else
|
#else
|
||||||
float DH_z0 = 0.0;
|
float DH_z0 = 0.0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
float z = texture2D(depthtex1,tc).x;
|
float z = texelFetch2D(depthtex1, ivec2((floor(gl_FragCoord.xy - 0.5)/VL_RENDER_RESOLUTION*texelSize)/texelSize), 0 ).x;
|
||||||
|
|
||||||
#ifdef DISTANT_HORIZONS
|
#ifdef DISTANT_HORIZONS
|
||||||
float DH_z = texture2D(dhDepthTex1,tc).x;
|
// float DH_z = texture2D(dhDepthTex1,tc).x;
|
||||||
|
float DH_z = texelFetch2D(dhDepthTex1, ivec2((floor(gl_FragCoord.xy - 0.5)/VL_RENDER_RESOLUTION*texelSize)/texelSize), 0 ).x;//texture2D(dhDepthTex,tc).x;
|
||||||
#else
|
#else
|
||||||
float DH_z = 0.0;
|
float DH_z = 0.0;
|
||||||
#endif
|
#endif
|
||||||
@ -355,29 +356,32 @@ void main() {
|
|||||||
vec4 finalVolumetrics = vec4(0.0,0.0,0.0,1.0);
|
vec4 finalVolumetrics = vec4(0.0,0.0,0.0,1.0);
|
||||||
float cloudPlaneDistance = 0.0;
|
float cloudPlaneDistance = 0.0;
|
||||||
|
|
||||||
if(!iswater){
|
#ifdef OVERWORLD_SHADER
|
||||||
#ifdef OVERWORLD_SHADER
|
vec4 VolumetricClouds = GetVolumetricClouds(viewPos1, vec2(noise_1, noise_2), WsunVec, directLightColor, indirectLightColor, cloudPlaneDistance);
|
||||||
vec4 VolumetricClouds = GetVolumetricClouds(viewPos1, vec2(noise_1, noise_2), WsunVec, directLightColor, indirectLightColor,cloudPlaneDistance);
|
|
||||||
|
|
||||||
float atmosphereAlpha = 1.0;
|
float atmosphereAlpha = 1.0;
|
||||||
vec4 VolumetricFog = GetVolumetricFog(viewPos1, WsunVec, vec2(noise_1, noise_2), directLightColor, indirectLightColor, indirectLightColor_dynamic, atmosphereAlpha, VolumetricClouds.rgb,cloudPlaneDistance);
|
vec4 VolumetricFog = GetVolumetricFog(viewPos1, WsunVec, vec2(noise_1, noise_2), directLightColor, indirectLightColor, indirectLightColor_dynamic, atmosphereAlpha, VolumetricClouds.rgb,cloudPlaneDistance);
|
||||||
|
|
||||||
finalVolumetrics.rgb += VolumetricClouds.rgb;
|
finalVolumetrics.rgb += VolumetricClouds.rgb;
|
||||||
#endif
|
finalVolumetrics.a *= VolumetricClouds.a;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined NETHER_SHADER || defined END_SHADER
|
#if defined NETHER_SHADER || defined END_SHADER
|
||||||
vec4 VolumetricFog = GetVolumetricFog(viewPos1, noise_1, noise_2);
|
vec4 VolumetricFog = GetVolumetricFog(viewPos1, noise_1, noise_2);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
finalVolumetrics.rgb = finalVolumetrics.rgb * VolumetricFog.a + VolumetricFog.rgb;
|
finalVolumetrics.rgb = finalVolumetrics.rgb * VolumetricFog.a + VolumetricFog.rgb;
|
||||||
finalVolumetrics.a *= VolumetricFog.a;
|
finalVolumetrics.a *= VolumetricFog.a;
|
||||||
}
|
|
||||||
|
|
||||||
vec4 underwaterVlFog = vec4(0,0,0,1);
|
vec4 underwaterVlFog = vec4(0,0,0,1);
|
||||||
|
|
||||||
float lightleakfix = clamp(lightmap.y + (1-caveDetection),0.0,1.0);
|
float lightleakfix = clamp(lightmap.y + (1-caveDetection),0.0,1.0);
|
||||||
|
|
||||||
if(iswater && isEyeInWater != 1) finalVolumetrics = waterVolumetrics(viewPos0, viewPos1, estimatedDepth, estimatedSunDepth, Vdiff, noise_1, totEpsilon, scatterCoef, indirectLightColor_dynamic, directLightColor, dot(normalize(viewPos1), normalize(sunVec*lightCol.a)) ,lightleakfix);
|
if(iswater && isEyeInWater != 1) {
|
||||||
|
vec4 underWaterFog = waterVolumetrics(viewPos0, viewPos1, estimatedDepth, estimatedSunDepth, Vdiff, noise_1, totEpsilon, scatterCoef, indirectLightColor_dynamic, directLightColor, dot(normalize(viewPos1), normalize(sunVec*lightCol.a)) ,lightleakfix);
|
||||||
|
finalVolumetrics.rgb = finalVolumetrics.rgb * underWaterFog.a*underWaterFog.a + underWaterFog.rgb;
|
||||||
|
finalVolumetrics.a *= underWaterFog.a;
|
||||||
|
}
|
||||||
|
|
||||||
gl_FragData[0] = clamp(finalVolumetrics, 0.0, 65000.0);
|
gl_FragData[0] = clamp(finalVolumetrics, 0.0, 65000.0);
|
||||||
}
|
}
|
||||||
|
@ -206,9 +206,8 @@ vec4 GetVolumetricFog(
|
|||||||
vec3 sh_forClouds = sh;
|
vec3 sh_forClouds = sh;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef VL_CLOUDS_SHADOWS
|
sh *= GetCloudShadow(progressW, sunVector);
|
||||||
sh *= GetCloudShadow(progressW, sunVector);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PER_BIOME_ENVIRONMENT
|
#ifdef PER_BIOME_ENVIRONMENT
|
||||||
float maxDistance = inBiome * min(max(1.0 - length(d*dVWorld.xz)/(32*8),0.0)*2.0,1.0);
|
float maxDistance = inBiome * min(max(1.0 - length(d*dVWorld.xz)/(32*8),0.0)*2.0,1.0);
|
||||||
|
@ -134,25 +134,27 @@ float GetCloudShadow(vec3 playerPos, vec3 sunVector){
|
|||||||
|
|
||||||
vec3 startPosition = playerPos;
|
vec3 startPosition = playerPos;
|
||||||
|
|
||||||
float cloudShadows = 0.0;
|
#ifdef CLOUDS_SHADOWS
|
||||||
|
float cloudShadows = 0.0;
|
||||||
|
|
||||||
#ifdef CloudLayer0
|
#ifdef CloudLayer0
|
||||||
startPosition = playerPos + sunVector / abs(sunVector.y) * max((CloudLayer0_height + 20.0) - playerPos.y, 0.0);
|
startPosition = playerPos + sunVector / abs(sunVector.y) * max((CloudLayer0_height + 20.0) - playerPos.y, 0.0);
|
||||||
cloudShadows = getCloudShape(SMALLCUMULUS_LAYER, 0, startPosition, CloudLayer0_height, CloudLayer0_height+90.0)*dailyWeatherParams1.x;
|
cloudShadows = getCloudShape(SMALLCUMULUS_LAYER, 0, startPosition, CloudLayer0_height, CloudLayer0_height+90.0)*dailyWeatherParams1.x;
|
||||||
#endif
|
#endif
|
||||||
#ifdef CloudLayer1
|
#ifdef CloudLayer1
|
||||||
startPosition = playerPos + sunVector / abs(sunVector.y) * max((CloudLayer1_height + 20.0) - playerPos.y, 0.0);
|
startPosition = playerPos + sunVector / abs(sunVector.y) * max((CloudLayer1_height + 20.0) - playerPos.y, 0.0);
|
||||||
cloudShadows += getCloudShape(LARGECUMULUS_LAYER, 0, startPosition, CloudLayer1_height, CloudLayer1_height+90.0)*dailyWeatherParams1.y;
|
cloudShadows += getCloudShape(LARGECUMULUS_LAYER, 0, startPosition, CloudLayer1_height, CloudLayer1_height+90.0)*dailyWeatherParams1.y;
|
||||||
#endif
|
#endif
|
||||||
#ifdef CloudLayer2
|
#ifdef CloudLayer2
|
||||||
startPosition = playerPos + sunVector / abs(sunVector.y) * max(CloudLayer2_height - playerPos.y, 0.0);
|
startPosition = playerPos + sunVector / abs(sunVector.y) * max(CloudLayer2_height - playerPos.y, 0.0);
|
||||||
cloudShadows += getCloudShape(ALTOSTRATUS_LAYER, 0, startPosition, CloudLayer2_height, CloudLayer2_height)*dailyWeatherParams1.z * (1.0-abs(WsunVec.y));
|
cloudShadows += getCloudShape(ALTOSTRATUS_LAYER, 0, startPosition, CloudLayer2_height, CloudLayer2_height)*dailyWeatherParams1.z * (1.0-abs(WsunVec.y));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
cloudShadows *= CLOUD_SHADOW_STRENGTH;
|
cloudShadows *= CLOUD_SHADOW_STRENGTH;
|
||||||
|
|
||||||
#if defined CloudLayer0 || defined CloudLayer1 || defined CloudLayer2
|
#if defined CloudLayer0 || defined CloudLayer1 || defined CloudLayer2
|
||||||
totalShadow *= exp((cloudShadows*cloudShadows) * -200.0);
|
totalShadow *= exp((cloudShadows*cloudShadows) * -200.0);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return totalShadow;
|
return totalShadow;
|
||||||
|
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user