mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-11 17:51:04 +00:00
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
This commit is contained in:
parent
a4ef62f5b2
commit
dc45b85a54
9 changed files with 131 additions and 220 deletions
|
@ -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 *
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue