From dc45b85a543b4c8ad72f69a554ecfe7f0a60c533 Mon Sep 17 00:00:00 2001 From: x2048 Date: Sat, 21 May 2022 16:49:30 +0200 Subject: Improve shadow filters (#12195) * Rewrite shadow filtering for the new distortion * Calculate penumbra radius using a single sample * Avoid peter-panning effect due to filtering of short shadows * Add adaptive filter quality for soft shadows * Avoid sharp shadows on surfaces without normals (e.g. plants) * Increase default and maximum soft shadow radius * Make line numbers in shader errors match the code --- client/shaders/object_shader/opengl_vertex.glsl | 2 ++ 1 file changed, 2 insertions(+) (limited to 'client/shaders/object_shader/opengl_vertex.glsl') diff --git a/client/shaders/object_shader/opengl_vertex.glsl b/client/shaders/object_shader/opengl_vertex.glsl index 6dc25f854..dc9c70cdf 100644 --- a/client/shaders/object_shader/opengl_vertex.glsl +++ b/client/shaders/object_shader/opengl_vertex.glsl @@ -30,6 +30,7 @@ centroid varying vec2 varTexCoord; varying float adj_shadow_strength; varying float f_normal_length; varying vec3 shadow_position; + varying float perspective_factor; #endif varying vec3 eyeVec; @@ -162,6 +163,7 @@ void main(void) 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 * -- cgit v1.2.3