mirror of
https://github.com/ioquake/ioq3.git
synced 2024-11-13 00:24:10 +00:00
OpenGL2: Don't project sun shadows onto nothing
Don't project sun shadows (r_forceSun 1) on to view depth equal to 1.0 (nothing drawn or skybox). This caused a full second shadow of the entire level in tr.screenShadowImage. It would move as the camera far plane changed and rotate/stretch strangely as the camera view changed. It was visible in-game on lightmapped transparent surfaces facing the skybox and happen to overlap the extra shadow of the level. This affected the glass in wop_padship's underwater room.
This commit is contained in:
parent
15f5fe78ad
commit
4c19ff2b55
1 changed files with 7 additions and 2 deletions
|
@ -103,14 +103,19 @@ void main()
|
||||||
|
|
||||||
vec4 shadowpos = u_ShadowMvp * biasPos;
|
vec4 shadowpos = u_ShadowMvp * biasPos;
|
||||||
|
|
||||||
|
if ( depth >= 1.0 - DEPTH_MAX_ERROR )
|
||||||
|
{
|
||||||
|
result = 1.0;
|
||||||
|
}
|
||||||
|
else
|
||||||
#if defined(USE_SHADOW_CASCADE)
|
#if defined(USE_SHADOW_CASCADE)
|
||||||
if (all(lessThan(abs(shadowpos.xyz), vec3(abs(shadowpos.w)))))
|
if (all(lessThan(abs(shadowpos.xyz), vec3(abs(shadowpos.w)))))
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
shadowpos.xyz = shadowpos.xyz * (0.5 / shadowpos.w) + vec3(0.5);
|
shadowpos.xyz = shadowpos.xyz * (0.5 / shadowpos.w) + vec3(0.5);
|
||||||
result = PCF(u_ShadowMap, shadowpos.xy, shadowpos.z);
|
result = PCF(u_ShadowMap, shadowpos.xy, shadowpos.z);
|
||||||
#if defined(USE_SHADOW_CASCADE)
|
|
||||||
}
|
}
|
||||||
|
#if defined(USE_SHADOW_CASCADE)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
shadowpos = u_ShadowMvp2 * biasPos;
|
shadowpos = u_ShadowMvp2 * biasPos;
|
||||||
|
|
Loading…
Reference in a new issue