diff --git a/mp/src/game/client/clientshadowmgr.cpp b/mp/src/game/client/clientshadowmgr.cpp index 12aea406a..208ebf328 100644 --- a/mp/src/game/client/clientshadowmgr.cpp +++ b/mp/src/game/client/clientshadowmgr.cpp @@ -2626,6 +2626,13 @@ void CClientShadowMgr::BuildFlashlight( ClientShadowHandle_t handle ) VPROF_BUDGET( "CClientShadowMgr::BuildFlashlight", VPROF_BUDGETGROUP_SHADOW_DEPTH_TEXTURING ); + // Don't project the flashlight if the frustum AABB is not in our view + Vector mins, maxs; + CalculateAABBFromProjectionMatrix(shadow.m_WorldToShadow, &mins, &maxs); + + if(engine->CullBox(mins, maxs)) + return; + bool bLightModels = r_flashlightmodels.GetBool(); bool bLightSpecificEntity = shadow.m_hTargetEntity.Get() != NULL; bool bLightWorld = ( shadow.m_Flags & SHADOW_FLAGS_LIGHT_WORLD ) != 0; diff --git a/sp/src/game/client/clientshadowmgr.cpp b/sp/src/game/client/clientshadowmgr.cpp index 6470bfca4..6647fbdf8 100644 --- a/sp/src/game/client/clientshadowmgr.cpp +++ b/sp/src/game/client/clientshadowmgr.cpp @@ -2623,6 +2623,13 @@ void CClientShadowMgr::BuildFlashlight( ClientShadowHandle_t handle ) VPROF_BUDGET( "CClientShadowMgr::BuildFlashlight", VPROF_BUDGETGROUP_SHADOW_DEPTH_TEXTURING ); + // Don't project the flashlight if the frustum AABB is not in our view + Vector mins, maxs; + CalculateAABBFromProjectionMatrix(shadow.m_WorldToShadow, &mins, &maxs); + + if(engine->CullBox(mins, maxs)) + return; + bool bLightModels = r_flashlightmodels.GetBool(); bool bLightSpecificEntity = shadow.m_hTargetEntity.Get() != NULL; bool bLightWorld = ( shadow.m_Flags & SHADOW_FLAGS_LIGHT_WORLD ) != 0;