mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-13 21:40:11 +00:00
Make shaders pick the correct shadow cascade level and blend near cascade edges.
This commit is contained in:
parent
1b30d47d7f
commit
aa68af4f8b
@ -124,8 +124,19 @@ void main()
|
|||||||
|
|
||||||
float shadowing = 1.0;
|
float shadowing = 1.0;
|
||||||
#if SHADOWS
|
#if SHADOWS
|
||||||
|
bool doneShadows = false;
|
||||||
@foreach shadow_texture_unit_index @shadow_texture_unit_list
|
@foreach shadow_texture_unit_index @shadow_texture_unit_list
|
||||||
shadowing *= shadow2DProj(shadowTexture@shadow_texture_unit_index, shadowSpaceCoords@shadow_texture_unit_index).r;
|
if (!doneShadows)
|
||||||
|
{
|
||||||
|
vec2 shadowXY = shadowSpaceCoords@shadow_texture_unit_index.xy / shadowSpaceCoords@shadow_texture_unit_index.w;
|
||||||
|
if (all(lessThan(shadowXY, vec2(1.0, 1.0))) && all(greaterThan(shadowXY, vec2(0.0, 0.0))))
|
||||||
|
{
|
||||||
|
shadowing *= shadow2DProj(shadowTexture@shadow_texture_unit_index, shadowSpaceCoords@shadow_texture_unit_index).r;
|
||||||
|
|
||||||
|
if (all(lessThan(shadowXY, vec2(0.95, 0.95))) && all(greaterThan(shadowXY, vec2(0.05, 0.05))))
|
||||||
|
doneShadows = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@endforeach
|
@endforeach
|
||||||
#endif // SHADOWS
|
#endif // SHADOWS
|
||||||
|
|
||||||
|
@ -76,8 +76,19 @@ void main()
|
|||||||
|
|
||||||
float shadowing = 1.0;
|
float shadowing = 1.0;
|
||||||
#if SHADOWS
|
#if SHADOWS
|
||||||
|
bool doneShadows = false;
|
||||||
@foreach shadow_texture_unit_index @shadow_texture_unit_list
|
@foreach shadow_texture_unit_index @shadow_texture_unit_list
|
||||||
shadowing *= shadow2DProj(shadowTexture@shadow_texture_unit_index, shadowSpaceCoords@shadow_texture_unit_index).r;
|
if (!doneShadows)
|
||||||
|
{
|
||||||
|
vec2 shadowXY = shadowSpaceCoords@shadow_texture_unit_index.xy / shadowSpaceCoords@shadow_texture_unit_index.w;
|
||||||
|
if (all(lessThan(shadowXY, vec2(1.0, 1.0))) && all(greaterThan(shadowXY, vec2(0.0, 0.0))))
|
||||||
|
{
|
||||||
|
shadowing *= shadow2DProj(shadowTexture@shadow_texture_unit_index, shadowSpaceCoords@shadow_texture_unit_index).r;
|
||||||
|
|
||||||
|
if (all(lessThan(shadowXY, vec2(0.95, 0.95))) && all(greaterThan(shadowXY, vec2(0.05, 0.05))))
|
||||||
|
doneShadows = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@endforeach
|
@endforeach
|
||||||
#endif // SHADOWS
|
#endif // SHADOWS
|
||||||
|
|
||||||
|
@ -168,9 +168,19 @@ void main(void)
|
|||||||
|
|
||||||
#if SHADOWS
|
#if SHADOWS
|
||||||
float shadowing = 1.0;
|
float shadowing = 1.0;
|
||||||
|
bool doneShadows = false;
|
||||||
@foreach shadow_texture_unit_index @shadow_texture_unit_list
|
@foreach shadow_texture_unit_index @shadow_texture_unit_list
|
||||||
shadowing *= shadow2DProj(shadowTexture@shadow_texture_unit_index, shadowSpaceCoords@shadow_texture_unit_index).r;
|
if (!doneShadows)
|
||||||
|
{
|
||||||
|
vec2 shadowXY = shadowSpaceCoords@shadow_texture_unit_index.xy / shadowSpaceCoords@shadow_texture_unit_index.w;
|
||||||
|
if (all(lessThan(shadowXY, vec2(1.0, 1.0))) && all(greaterThan(shadowXY, vec2(0.0, 0.0))))
|
||||||
|
{
|
||||||
|
shadowing *= shadow2DProj(shadowTexture@shadow_texture_unit_index, shadowSpaceCoords@shadow_texture_unit_index).r;
|
||||||
|
|
||||||
|
if (all(lessThan(shadowXY, vec2(0.95, 0.95))) && all(greaterThan(shadowXY, vec2(0.05, 0.05))))
|
||||||
|
doneShadows = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|
||||||
float shadow = shadowing;
|
float shadow = shadowing;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user