From fea1ed54804c461b8ee5d5469b06d2349918adbd Mon Sep 17 00:00:00 2001 From: copperpixel <48454166+copperpixel@users.noreply.github.com> Date: Tue, 2 Dec 2025 18:42:07 +0100 Subject: [PATCH 1/2] fix a case of dynamic shadows pokethrough thin surfaces --- src/game/client/clientshadowmgr.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/game/client/clientshadowmgr.cpp b/src/game/client/clientshadowmgr.cpp index 8daa9f65890..257fb822f11 100644 --- a/src/game/client/clientshadowmgr.cpp +++ b/src/game/client/clientshadowmgr.cpp @@ -2192,6 +2192,31 @@ void CClientShadowMgr::ComputeExtraClipPlanes( IClientRenderable* pRenderable, } } + class CTraceFilterShadowReceiversOnly : public CTraceFilter + { + virtual bool ShouldHitEntity( IHandleEntity *pHandleEntity, int fContentsMask ) + { + if ( !StandardFilterRules( pHandleEntity, fContentsMask ) ) + return false; + + C_BaseEntity *pEntity = EntityFromEntityHandle( pHandleEntity ); + if ( pEntity && !pEntity->ShouldReceiveProjectedTextures( SHADOW_FLAGS_PROJECTED_TEXTURE_TYPE_MASK ) ) + return false; + + return true; + } + }; + + // Do a trace to the bbox corner origin. If it hits a shadow receiving brush + // move the corner to be outside it so shadows won't poke-thru thin walls + CTraceFilterShadowReceiversOnly traceFilter; + trace_t tr; + UTIL_TraceLine( pRenderable->GetRenderOrigin(), origin, MASK_SOLID_BRUSHONLY, &traceFilter, &tr ); + if ( tr.fraction < 1.f ) + { + VectorAdd( tr.endpos, tr.plane.normal, origin ); + } + // Now that we have it, create 3 planes... Vector normal; ClearExtraClipPlanes(handle); From ba6050619ddbc082e08b36b7e08be430c1cfaa0a Mon Sep 17 00:00:00 2001 From: copperpixel <48454166+copperpixel@users.noreply.github.com> Date: Tue, 2 Dec 2025 23:38:20 +0100 Subject: [PATCH 2/2] fix wrong shadow mask --- src/game/client/clientshadowmgr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/client/clientshadowmgr.cpp b/src/game/client/clientshadowmgr.cpp index 257fb822f11..c391e16455c 100644 --- a/src/game/client/clientshadowmgr.cpp +++ b/src/game/client/clientshadowmgr.cpp @@ -2200,7 +2200,7 @@ void CClientShadowMgr::ComputeExtraClipPlanes( IClientRenderable* pRenderable, return false; C_BaseEntity *pEntity = EntityFromEntityHandle( pHandleEntity ); - if ( pEntity && !pEntity->ShouldReceiveProjectedTextures( SHADOW_FLAGS_PROJECTED_TEXTURE_TYPE_MASK ) ) + if ( pEntity && !pEntity->ShouldReceiveProjectedTextures( SHADOW_FLAGS_SHADOW ) ) return false; return true;