diff options
Diffstat (limited to 'client/shaders/nodes_shader')
-rw-r--r-- | client/shaders/nodes_shader/opengl_fragment.glsl | 288 | ||||
-rw-r--r-- | client/shaders/nodes_shader/opengl_vertex.glsl | 92 |
2 files changed, 188 insertions, 192 deletions
diff --git a/client/shaders/nodes_shader/opengl_fragment.glsl b/client/shaders/nodes_shader/opengl_fragment.glsl index 762a676c6..c4b947e72 100644 --- a/client/shaders/nodes_shader/opengl_fragment.glsl +++ b/client/shaders/nodes_shader/opengl_fragment.glsl @@ -16,10 +16,16 @@ uniform float animationTimer; uniform float f_textureresolution; uniform mat4 m_ShadowViewProj; uniform float f_shadowfar; - varying float normalOffsetScale; + uniform float f_shadow_strength; + uniform vec4 CameraPos; + uniform float xyPerspectiveBias0; + uniform float xyPerspectiveBias1; + varying float adj_shadow_strength; varying float cosLight; varying float f_normal_length; + varying vec3 shadow_position; + varying float perspective_factor; #endif @@ -43,23 +49,7 @@ varying float nightRatio; const float fogStart = FOG_START; const float fogShadingParameter = 1.0 / ( 1.0 - fogStart); - - #ifdef ENABLE_DYNAMIC_SHADOWS -const float bias0 = 0.9; -const float zPersFactor = 0.5; -const float bias1 = 1.0 - bias0 + 1e-6; - -vec4 getPerspectiveFactor(in vec4 shadowPosition) -{ - - float pDistance = length(shadowPosition.xy); - float pFactor = pDistance * bias0 + bias1; - - shadowPosition.xyz *= vec3(vec2(1.0 / pFactor), zPersFactor); - - return shadowPosition; -} // assuming near is always 1.0 float getLinearDepth() @@ -69,16 +59,7 @@ float getLinearDepth() vec3 getLightSpacePosition() { - vec4 pLightSpace; - // some drawtypes have zero normals, so we need to handle it :( - #if DRAW_TYPE == NDT_PLANTLIKE - pLightSpace = m_ShadowViewProj * vec4(worldPosition, 1.0); - #else - float offsetScale = (0.0057 * getLinearDepth() + normalOffsetScale); - pLightSpace = m_ShadowViewProj * vec4(worldPosition + offsetScale * normalize(vNormal), 1.0); - #endif - pLightSpace = getPerspectiveFactor(pLightSpace); - return pLightSpace.xyz * 0.5 + 0.5; + return shadow_position * 0.5 + 0.5; } // custom smoothstep implementation because it's not defined in glsl1.2 // https://docs.gl/sl4/smoothstep @@ -136,23 +117,16 @@ float getHardShadow(sampler2D shadowsampler, vec2 smTexCoord, float realDistance #if SHADOW_FILTER == 2 - #define PCFBOUND 3.5 - #define PCFSAMPLES 64.0 + #define PCFBOUND 2.0 // 5x5 + #define PCFSAMPLES 25 #elif SHADOW_FILTER == 1 - #define PCFBOUND 1.5 - #if defined(POISSON_FILTER) - #define PCFSAMPLES 32.0 - #else - #define PCFSAMPLES 16.0 - #endif + #define PCFBOUND 1.0 // 3x3 + #define PCFSAMPLES 9 #else #define PCFBOUND 0.0 - #if defined(POISSON_FILTER) - #define PCFSAMPLES 4.0 - #else - #define PCFSAMPLES 1.0 - #endif + #define PCFSAMPLES 1 #endif + #ifdef COLORED_SHADOWS float getHardShadowDepth(sampler2D shadowsampler, vec2 smTexCoord, float realDistance) { @@ -169,57 +143,31 @@ float getHardShadowDepth(sampler2D shadowsampler, vec2 smTexCoord, float realDis } #endif -float getBaseLength(vec2 smTexCoord) -{ - float l = length(2.0 * smTexCoord.xy - 1.0); // length in texture coords - return bias1 / (1.0 / l - bias0); // return to undistorted coords -} - -float getDeltaPerspectiveFactor(float l) -{ - return 0.1 / (bias0 * l + bias1); // original distortion factor, divided by 10 -} +#define BASEFILTERRADIUS 1.0 -float getPenumbraRadius(sampler2D shadowsampler, vec2 smTexCoord, float realDistance, float multiplier) +float getPenumbraRadius(sampler2D shadowsampler, vec2 smTexCoord, float realDistance) { - float baseLength = getBaseLength(smTexCoord); - float perspectiveFactor; - - if (PCFBOUND == 0.0) return 0.0; // Return fast if sharp shadows are requested - if (SOFTSHADOWRADIUS <= 1.0) { - perspectiveFactor = getDeltaPerspectiveFactor(baseLength); - return max(2 * length(smTexCoord.xy) * 2048 / f_textureresolution / pow(perspectiveFactor, 3), SOFTSHADOWRADIUS); - } + if (PCFBOUND == 0.0 || SOFTSHADOWRADIUS <= 0.0) + return 0.0; vec2 clampedpos; - float texture_size = 1.0 / (2048 /*f_textureresolution*/ * 0.5); float y, x; - float depth = 0.0; - float pointDepth; - float maxRadius = SOFTSHADOWRADIUS * 5.0 * multiplier; - - float bound = clamp(PCFBOUND * (1 - baseLength), 0.0, PCFBOUND); - int n = 0; - - for (y = -bound; y <= bound; y += 1.0) - for (x = -bound; x <= bound; x += 1.0) { - clampedpos = vec2(x,y); - perspectiveFactor = getDeltaPerspectiveFactor(baseLength + length(clampedpos) * texture_size * maxRadius); - clampedpos = clampedpos * texture_size * perspectiveFactor * maxRadius * perspectiveFactor + smTexCoord.xy; - - pointDepth = getHardShadowDepth(shadowsampler, clampedpos.xy, realDistance); - if (pointDepth > -0.01) { - depth += pointDepth; - n += 1; - } - } - - depth = depth / n; - depth = pow(clamp(depth, 0.0, 1000.0), 1.6) / 0.001; - - perspectiveFactor = getDeltaPerspectiveFactor(baseLength); - return max(length(smTexCoord.xy) * 2 * 2048 / f_textureresolution / pow(perspectiveFactor, 3), depth * maxRadius); + float depth = getHardShadowDepth(shadowsampler, smTexCoord.xy, realDistance); + // A factor from 0 to 1 to reduce blurring of short shadows + float sharpness_factor = 1.0; + // conversion factor from shadow depth to blur radius + float depth_to_blur = f_shadowfar / SOFTSHADOWRADIUS / xyPerspectiveBias0; + if (depth > 0.0 && f_normal_length > 0.0) + // 5 is empirical factor that controls how fast shadow loses sharpness + sharpness_factor = clamp(5 * depth * depth_to_blur, 0.0, 1.0); + depth = 0.0; + + float world_to_texture = xyPerspectiveBias1 / perspective_factor / perspective_factor + * f_textureresolution / 2.0 / f_shadowfar; + float world_radius = 0.2; // shadow blur radius in world float coordinates, e.g. 0.2 = 0.02 of one node + + return max(BASEFILTERRADIUS * f_textureresolution / 4096.0, sharpness_factor * world_radius * world_to_texture * SOFTSHADOWRADIUS); } #ifdef POISSON_FILTER @@ -294,26 +242,23 @@ const vec2[64] poissonDisk = vec2[64]( vec4 getShadowColor(sampler2D shadowsampler, vec2 smTexCoord, float realDistance) { - vec2 clampedpos; - vec4 visibility = vec4(0.0); - float radius = getPenumbraRadius(shadowsampler, smTexCoord, realDistance, 1.5); // scale to align with PCF + float radius = getPenumbraRadius(shadowsampler, smTexCoord, realDistance); if (radius < 0.1) { // we are in the middle of even brightness, no need for filtering return getHardShadowColor(shadowsampler, smTexCoord.xy, realDistance); } - float baseLength = getBaseLength(smTexCoord); - float perspectiveFactor; + vec2 clampedpos; + vec4 visibility = vec4(0.0); + float scale_factor = radius / f_textureresolution; - float texture_size = 1.0 / (f_textureresolution * 0.5); - int samples = int(clamp(PCFSAMPLES * (1 - baseLength) * (1 - baseLength), PCFSAMPLES / 4, PCFSAMPLES)); + int samples = (1 + 1 * int(SOFTSHADOWRADIUS > 1.0)) * PCFSAMPLES; // scale max samples for the soft shadows + samples = int(clamp(pow(4.0 * radius + 1.0, 2.0), 1.0, float(samples))); int init_offset = int(floor(mod(((smTexCoord.x * 34.0) + 1.0) * smTexCoord.y, 64.0-samples))); int end_offset = int(samples) + init_offset; for (int x = init_offset; x < end_offset; x++) { - clampedpos = poissonDisk[x]; - perspectiveFactor = getDeltaPerspectiveFactor(baseLength + length(clampedpos) * texture_size * radius); - clampedpos = clampedpos * texture_size * perspectiveFactor * radius * perspectiveFactor + smTexCoord.xy; + clampedpos = poissonDisk[x] * scale_factor + smTexCoord.xy; visibility += getHardShadowColor(shadowsampler, clampedpos.xy, realDistance); } @@ -324,26 +269,23 @@ vec4 getShadowColor(sampler2D shadowsampler, vec2 smTexCoord, float realDistance float getShadow(sampler2D shadowsampler, vec2 smTexCoord, float realDistance) { - vec2 clampedpos; - float visibility = 0.0; - float radius = getPenumbraRadius(shadowsampler, smTexCoord, realDistance, 1.5); // scale to align with PCF + float radius = getPenumbraRadius(shadowsampler, smTexCoord, realDistance); if (radius < 0.1) { // we are in the middle of even brightness, no need for filtering return getHardShadow(shadowsampler, smTexCoord.xy, realDistance); } - float baseLength = getBaseLength(smTexCoord); - float perspectiveFactor; + vec2 clampedpos; + float visibility = 0.0; + float scale_factor = radius / f_textureresolution; - float texture_size = 1.0 / (f_textureresolution * 0.5); - int samples = int(clamp(PCFSAMPLES * (1 - baseLength) * (1 - baseLength), PCFSAMPLES / 4, PCFSAMPLES)); + int samples = (1 + 1 * int(SOFTSHADOWRADIUS > 1.0)) * PCFSAMPLES; // scale max samples for the soft shadows + samples = int(clamp(pow(4.0 * radius + 1.0, 2.0), 1.0, float(samples))); int init_offset = int(floor(mod(((smTexCoord.x * 34.0) + 1.0) * smTexCoord.y, 64.0-samples))); int end_offset = int(samples) + init_offset; for (int x = init_offset; x < end_offset; x++) { - clampedpos = poissonDisk[x]; - perspectiveFactor = getDeltaPerspectiveFactor(baseLength + length(clampedpos) * texture_size * radius); - clampedpos = clampedpos * texture_size * perspectiveFactor * radius * perspectiveFactor + smTexCoord.xy; + clampedpos = poissonDisk[x] * scale_factor + smTexCoord.xy; visibility += getHardShadow(shadowsampler, clampedpos.xy, realDistance); } @@ -359,65 +301,57 @@ float getShadow(sampler2D shadowsampler, vec2 smTexCoord, float realDistance) vec4 getShadowColor(sampler2D shadowsampler, vec2 smTexCoord, float realDistance) { - vec2 clampedpos; - vec4 visibility = vec4(0.0); - float radius = getPenumbraRadius(shadowsampler, smTexCoord, realDistance, 1.0); + float radius = getPenumbraRadius(shadowsampler, smTexCoord, realDistance); if (radius < 0.1) { // we are in the middle of even brightness, no need for filtering return getHardShadowColor(shadowsampler, smTexCoord.xy, realDistance); } - float baseLength = getBaseLength(smTexCoord); - float perspectiveFactor; - - float texture_size = 1.0 / (f_textureresolution * 0.5); - float y, x; - float bound = clamp(PCFBOUND * (1 - baseLength), PCFBOUND / 2, PCFBOUND); - int n = 0; + vec2 clampedpos; + vec4 visibility = vec4(0.0); + float x, y; + float bound = (1 + 0.5 * int(SOFTSHADOWRADIUS > 1.0)) * PCFBOUND; // scale max bound for soft shadows + bound = clamp(0.5 * (4.0 * radius - 1.0), 0.5, bound); + float scale_factor = radius / bound / f_textureresolution; + float n = 0.0; // basic PCF filter for (y = -bound; y <= bound; y += 1.0) for (x = -bound; x <= bound; x += 1.0) { - clampedpos = vec2(x,y); // screen offset - perspectiveFactor = getDeltaPerspectiveFactor(baseLength + length(clampedpos) * texture_size * radius / bound); - clampedpos = clampedpos * texture_size * perspectiveFactor * radius * perspectiveFactor / bound + smTexCoord.xy; // both dx,dy and radius are adjusted + clampedpos = vec2(x,y) * scale_factor + smTexCoord.xy; visibility += getHardShadowColor(shadowsampler, clampedpos.xy, realDistance); - n += 1; + n += 1.0; } - return visibility / n; + return visibility / max(n, 1.0); } #else float getShadow(sampler2D shadowsampler, vec2 smTexCoord, float realDistance) { - vec2 clampedpos; - float visibility = 0.0; - float radius = getPenumbraRadius(shadowsampler, smTexCoord, realDistance, 1.0); + float radius = getPenumbraRadius(shadowsampler, smTexCoord, realDistance); if (radius < 0.1) { // we are in the middle of even brightness, no need for filtering return getHardShadow(shadowsampler, smTexCoord.xy, realDistance); } - float baseLength = getBaseLength(smTexCoord); - float perspectiveFactor; - - float texture_size = 1.0 / (f_textureresolution * 0.5); - float y, x; - float bound = clamp(PCFBOUND * (1 - baseLength), PCFBOUND / 2, PCFBOUND); - int n = 0; + vec2 clampedpos; + float visibility = 0.0; + float x, y; + float bound = (1 + 0.5 * int(SOFTSHADOWRADIUS > 1.0)) * PCFBOUND; // scale max bound for soft shadows + bound = clamp(0.5 * (4.0 * radius - 1.0), 0.5, bound); + float scale_factor = radius / bound / f_textureresolution; + float n = 0.0; // basic PCF filter for (y = -bound; y <= bound; y += 1.0) for (x = -bound; x <= bound; x += 1.0) { - clampedpos = vec2(x,y); // screen offset - perspectiveFactor = getDeltaPerspectiveFactor(baseLength + length(clampedpos) * texture_size * radius / bound); - clampedpos = clampedpos * texture_size * perspectiveFactor * radius * perspectiveFactor / bound + smTexCoord.xy; // both dx,dy and radius are adjusted + clampedpos = vec2(x,y) * scale_factor + smTexCoord.xy; visibility += getHardShadow(shadowsampler, clampedpos.xy, realDistance); - n += 1; + n += 1.0; } - return visibility / n; + return visibility / max(n, 1.0); } #endif @@ -481,53 +415,59 @@ void main(void) vec4 col = vec4(color.rgb * varColor.rgb, 1.0); #ifdef ENABLE_DYNAMIC_SHADOWS - float shadow_int = 0.0; - vec3 shadow_color = vec3(0.0, 0.0, 0.0); - vec3 posLightSpace = getLightSpacePosition(); + if (f_shadow_strength > 0.0) { + float shadow_int = 0.0; + vec3 shadow_color = vec3(0.0, 0.0, 0.0); + vec3 posLightSpace = getLightSpacePosition(); - float distance_rate = (1 - pow(clamp(2.0 * length(posLightSpace.xy - 0.5),0.0,1.0), 20.0)); - float f_adj_shadow_strength = max(adj_shadow_strength-mtsmoothstep(0.9,1.1, posLightSpace.z ),0.0); + float distance_rate = (1.0 - pow(clamp(2.0 * length(posLightSpace.xy - 0.5),0.0,1.0), 10.0)); + if (max(abs(posLightSpace.x - 0.5), abs(posLightSpace.y - 0.5)) > 0.5) + distance_rate = 0.0; + float f_adj_shadow_strength = max(adj_shadow_strength-mtsmoothstep(0.9,1.1, posLightSpace.z),0.0); + + if (distance_rate > 1e-7) { - if (distance_rate > 1e-7) { - #ifdef COLORED_SHADOWS - vec4 visibility; - if (cosLight > 0.0) - visibility = getShadowColor(ShadowMapSampler, posLightSpace.xy, posLightSpace.z); - else - visibility = vec4(1.0, 0.0, 0.0, 0.0); - shadow_int = visibility.r; - shadow_color = visibility.gba; + vec4 visibility; + if (cosLight > 0.0 || f_normal_length < 1e-3) + visibility = getShadowColor(ShadowMapSampler, posLightSpace.xy, posLightSpace.z); + else + visibility = vec4(1.0, 0.0, 0.0, 0.0); + shadow_int = visibility.r; + shadow_color = visibility.gba; #else - if (cosLight > 0.0) - shadow_int = getShadow(ShadowMapSampler, posLightSpace.xy, posLightSpace.z); - else - shadow_int = 1.0; + if (cosLight > 0.0 || f_normal_length < 1e-3) + shadow_int = getShadow(ShadowMapSampler, posLightSpace.xy, posLightSpace.z); + else + shadow_int = 1.0; #endif - shadow_int *= distance_rate; - shadow_int = clamp(shadow_int, 0.0, 1.0); + shadow_int *= distance_rate; + shadow_int = clamp(shadow_int, 0.0, 1.0); - } + } - // turns out that nightRatio falls off much faster than - // actual brightness of artificial light in relation to natual light. - // Power ratio was measured on torches in MTG (brightness = 14). - float adjusted_night_ratio = pow(max(0.0, nightRatio), 0.6); + // turns out that nightRatio falls off much faster than + // actual brightness of artificial light in relation to natual light. + // Power ratio was measured on torches in MTG (brightness = 14). + float adjusted_night_ratio = pow(max(0.0, nightRatio), 0.6); + + // Apply self-shadowing when light falls at a narrow angle to the surface + // Cosine of the cut-off angle. + const float self_shadow_cutoff_cosine = 0.035; + if (f_normal_length != 0 && cosLight < self_shadow_cutoff_cosine) { + shadow_int = max(shadow_int, 1 - clamp(cosLight, 0.0, self_shadow_cutoff_cosine)/self_shadow_cutoff_cosine); + shadow_color = mix(vec3(0.0), shadow_color, min(cosLight, self_shadow_cutoff_cosine)/self_shadow_cutoff_cosine); + } - if (f_normal_length != 0 && cosLight < 0.035) { - shadow_int = max(shadow_int, 1 - clamp(cosLight, 0.0, 0.035)/0.035); - } + shadow_int *= f_adj_shadow_strength; - shadow_int *= f_adj_shadow_strength; - - // calculate fragment color from components: - col.rgb = - adjusted_night_ratio * col.rgb + // artificial light - (1.0 - adjusted_night_ratio) * ( // natural light - col.rgb * (1.0 - shadow_int * (1.0 - shadow_color)) + // filtered texture color - dayLight * shadow_color * shadow_int); // reflected filtered sunlight/moonlight - // col.r = 0.5 * clamp(getPenumbraRadius(ShadowMapSampler, posLightSpace.xy, posLightSpace.z, 1.0) / SOFTSHADOWRADIUS, 0.0, 1.0) + 0.5 * col.r; - // col.r = adjusted_night_ratio; // debug night ratio adjustment + // calculate fragment color from components: + col.rgb = + adjusted_night_ratio * col.rgb + // artificial light + (1.0 - adjusted_night_ratio) * ( // natural light + col.rgb * (1.0 - shadow_int * (1.0 - shadow_color)) + // filtered texture color + dayLight * shadow_color * shadow_int); // reflected filtered sunlight/moonlight + } #endif #if ENABLE_TONE_MAPPING @@ -547,6 +487,6 @@ void main(void) - fogShadingParameter * length(eyeVec) / fogDistance, 0.0, 1.0); col = mix(skyBgColor, col, clarity); col = vec4(col.rgb, base.a); - + gl_FragColor = col; } diff --git a/client/shaders/nodes_shader/opengl_vertex.glsl b/client/shaders/nodes_shader/opengl_vertex.glsl index d316930b2..d1fba2830 100644 --- a/client/shaders/nodes_shader/opengl_vertex.glsl +++ b/client/shaders/nodes_shader/opengl_vertex.glsl @@ -32,10 +32,14 @@ centroid varying vec2 varTexCoord; uniform float f_shadowfar; uniform float f_shadow_strength; uniform float f_timeofday; + uniform vec4 CameraPos; + varying float cosLight; varying float normalOffsetScale; varying float adj_shadow_strength; varying float f_normal_length; + varying vec3 shadow_position; + varying float perspective_factor; #endif @@ -45,8 +49,38 @@ varying float nightRatio; const vec3 artificialLight = vec3(1.04, 1.04, 1.04); const float e = 2.718281828459; const float BS = 10.0; +uniform float xyPerspectiveBias0; +uniform float xyPerspectiveBias1; +uniform float zPerspectiveBias; #ifdef ENABLE_DYNAMIC_SHADOWS + +vec4 getRelativePosition(in vec4 position) +{ + vec2 l = position.xy - CameraPos.xy; + vec2 s = l / abs(l); + s = (1.0 - s * CameraPos.xy); + l /= s; + return vec4(l, s); +} + +float getPerspectiveFactor(in vec4 relativePosition) +{ + float pDistance = length(relativePosition.xy); + float pFactor = pDistance * xyPerspectiveBias0 + xyPerspectiveBias1; + return pFactor; +} + +vec4 applyPerspectiveDistortion(in vec4 position) +{ + vec4 l = getRelativePosition(position); + float pFactor = getPerspectiveFactor(l); + l.xy /= pFactor; + position.xy = l.xy * l.zw + CameraPos.xy; + position.z *= zPerspectiveBias; + return position; +} + // custom smoothstep implementation because it's not defined in glsl1.2 // https://docs.gl/sl4/smoothstep float mtsmoothstep(in float edge0, in float edge1, in float x) @@ -193,24 +227,46 @@ void main(void) varColor = clamp(color, 0.0, 1.0); #ifdef ENABLE_DYNAMIC_SHADOWS - vec3 nNormal = normalize(vNormal); - cosLight = dot(nNormal, -v_LightDirection); - float texelSize = 767.0 / f_textureresolution; - float slopeScale = clamp(1.0 - abs(cosLight), 0.0, 1.0); - normalOffsetScale = texelSize * slopeScale; - - if (f_timeofday < 0.2) { - adj_shadow_strength = f_shadow_strength * 0.5 * - (1.0 - mtsmoothstep(0.18, 0.2, f_timeofday)); - } else if (f_timeofday >= 0.8) { - adj_shadow_strength = f_shadow_strength * 0.5 * - mtsmoothstep(0.8, 0.83, f_timeofday); - } else { - adj_shadow_strength = f_shadow_strength * - mtsmoothstep(0.20, 0.25, f_timeofday) * - (1.0 - mtsmoothstep(0.7, 0.8, f_timeofday)); + if (f_shadow_strength > 0.0) { + vec3 nNormal; + f_normal_length = length(vNormal); + + /* normalOffsetScale is in world coordinates (1/10th of a meter) + z_bias is in light space coordinates */ + float normalOffsetScale, z_bias; + float pFactor = getPerspectiveFactor(getRelativePosition(m_ShadowViewProj * mWorld * inVertexPosition)); + if (f_normal_length > 0.0) { + nNormal = normalize(vNormal); + cosLight = dot(nNormal, -v_LightDirection); + float sinLight = pow(1 - pow(cosLight, 2.0), 0.5); + normalOffsetScale = 2.0 * pFactor * pFactor * sinLight * min(f_shadowfar, 500.0) / + xyPerspectiveBias1 / f_textureresolution; + z_bias = 1.0 * sinLight / cosLight; + } + else { + nNormal = vec3(0.0); + cosLight = clamp(dot(v_LightDirection, normalize(vec3(v_LightDirection.x, 0.0, v_LightDirection.z))), 1e-2, 1.0); + float sinLight = pow(1 - pow(cosLight, 2.0), 0.5); + normalOffsetScale = 0.0; + z_bias = 3.6e3 * sinLight / cosLight; + } + z_bias *= pFactor * pFactor / f_textureresolution / f_shadowfar; + + shadow_position = applyPerspectiveDistortion(m_ShadowViewProj * mWorld * (inVertexPosition + vec4(normalOffsetScale * nNormal, 0.0))).xyz; + shadow_position.z -= z_bias; + perspective_factor = pFactor; + + if (f_timeofday < 0.2) { + adj_shadow_strength = f_shadow_strength * 0.5 * + (1.0 - mtsmoothstep(0.18, 0.2, f_timeofday)); + } else if (f_timeofday >= 0.8) { + adj_shadow_strength = f_shadow_strength * 0.5 * + mtsmoothstep(0.8, 0.83, f_timeofday); + } else { + adj_shadow_strength = f_shadow_strength * + mtsmoothstep(0.20, 0.25, f_timeofday) * + (1.0 - mtsmoothstep(0.7, 0.8, f_timeofday)); + } } - f_normal_length = length(vNormal); #endif - } |