mirror of
https://github.com/ioquake/ioq3.git
synced 2024-11-10 07:11:46 +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;
|
||||
|
||||
if ( depth >= 1.0 - DEPTH_MAX_ERROR )
|
||||
{
|
||||
result = 1.0;
|
||||
}
|
||||
else
|
||||
#if defined(USE_SHADOW_CASCADE)
|
||||
if (all(lessThan(abs(shadowpos.xyz), vec3(abs(shadowpos.w)))))
|
||||
{
|
||||
#endif
|
||||
{
|
||||
shadowpos.xyz = shadowpos.xyz * (0.5 / shadowpos.w) + vec3(0.5);
|
||||
result = PCF(u_ShadowMap, shadowpos.xy, shadowpos.z);
|
||||
#if defined(USE_SHADOW_CASCADE)
|
||||
}
|
||||
#if defined(USE_SHADOW_CASCADE)
|
||||
else
|
||||
{
|
||||
shadowpos = u_ShadowMvp2 * biasPos;
|
||||
|
|
Loading…
Reference in a new issue