mirror of
https://github.com/X0nk/Bliss-Shader.git
synced 2025-06-26 18:22:33 +08:00
add water caustics and sunlight absorbtion to translucent stuff when underwater. small NdotL tweak for translucent rendering
This commit is contained in:
@ -568,12 +568,15 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
|||||||
#ifdef OVERWORLD_SHADER
|
#ifdef OVERWORLD_SHADER
|
||||||
vec3 DirectLightColor = lightCol.rgb/2400.0;
|
vec3 DirectLightColor = lightCol.rgb/2400.0;
|
||||||
|
|
||||||
if(isEyeInWater == 1){
|
if(!isWater && isEyeInWater == 1){
|
||||||
float distanceFromWaterSurface = max(-(feetPlayerPos.y + (cameraPosition.y - waterEnteredAltitude)),0.0) ;
|
float distanceFromWaterSurface = cameraPosition.y - waterEnteredAltitude;
|
||||||
DirectLightColor *= exp(-vec3(Water_Absorb_R, Water_Absorb_G, Water_Absorb_B) * distanceFromWaterSurface);
|
float waterdepth = max(-(feetPlayerPos.y + distanceFromWaterSurface),0.0);
|
||||||
|
|
||||||
|
DirectLightColor *= exp(-vec3(Water_Absorb_R, Water_Absorb_G, Water_Absorb_B) * (waterdepth/abs(WsunVec.y)));
|
||||||
|
DirectLightColor *= pow(waterCaustics(feetPlayerPos + cameraPosition, WsunVec)*WATER_CAUSTICS_BRIGHTNESS, WATER_CAUSTICS_POWER);
|
||||||
}
|
}
|
||||||
|
|
||||||
float NdotL = clamp(dot(normal, normalize(WsunVec*mat3(gbufferModelViewInverse))),0.0,1.0); NdotL = clamp((-15 + NdotL*255.0) / 240.0 ,0.0,1.0);
|
float NdotL = clamp((-15 + dot(normal, normalize(WsunVec*mat3(gbufferModelViewInverse)))*255.0) / 240.0 ,0.0,1.0);
|
||||||
float Shadows = 1.0;
|
float Shadows = 1.0;
|
||||||
|
|
||||||
float shadowMapFalloff = smoothstep(0.0, 1.0, min(max(1.0 - length(feetPlayerPos) / (shadowDistance+16),0.0)*5.0,1.0));
|
float shadowMapFalloff = smoothstep(0.0, 1.0, min(max(1.0 - length(feetPlayerPos) / (shadowDistance+16),0.0)*5.0,1.0));
|
||||||
@ -686,7 +689,6 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
|||||||
float f0 = isReflective ? max(specularValues.g, harcodedF0) : specularValues.g;
|
float f0 = isReflective ? max(specularValues.g, harcodedF0) : specularValues.g;
|
||||||
bool isHand = false;
|
bool isHand = false;
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAND
|
#ifdef HAND
|
||||||
isHand = true;
|
isHand = true;
|
||||||
f0 = max(specularValues.g, harcodedF0);
|
f0 = max(specularValues.g, harcodedF0);
|
||||||
@ -708,7 +710,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
vec3 specularReflections = specularReflections(viewPos, normalize(feetPlayerPos), WsunVec, vec3(blueNoise(), vec2(interleaved_gradientNoise_temporal())), worldSpaceNormal, roughness, f0, Albedo, FinalColor*gl_FragData[0].a, DirectLightColor * Shadows, lightmap.y, isHand, reflectance, flashLightSpecularData);
|
vec3 specularReflections = specularReflections(viewPos, normalize(feetPlayerPos), WsunVec, vec3(blueNoise(), vec2(interleaved_gradientNoise_temporal())), worldSpaceNormal, roughness, f0, Albedo, FinalColor*gl_FragData[0].a, DirectLightColor * Shadows, lightmap.y, isHand, isWater, reflectance, flashLightSpecularData);
|
||||||
|
|
||||||
gl_FragData[0].a = gl_FragData[0].a + (1.0-gl_FragData[0].a) * reflectance;
|
gl_FragData[0].a = gl_FragData[0].a + (1.0-gl_FragData[0].a) * reflectance;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user