From 56ed3bdf4928119b94df34d2edb0a92ef25ba8d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93lafur=20=C3=9E=C3=B3r=20Gunnarsson?= Date: Thu, 1 Oct 2026 09:23:51 +0000 Subject: [PATCH 1/2] Update Tr2LightManager.cpp Fixing an issue where volumetric lights can pop out of reflections if the lights are not visible from the camera frustum --- trinity/Tr2LightManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trinity/Tr2LightManager.cpp b/trinity/Tr2LightManager.cpp index a1ee62bce..063f4326d 100644 --- a/trinity/Tr2LightManager.cpp +++ b/trinity/Tr2LightManager.cpp @@ -343,7 +343,7 @@ void Tr2LightManager::AddLight( PerLightData& data ) { return; } - if( !m_frustum.IsSphereVisible( reinterpret_cast( &data.position ) ) ) + if( ( data.flags & FLAG_IS_VOLUMETRIC ) == 0 && !m_frustum.IsSphereVisible( reinterpret_cast( &data.position ) ) ) { return; } From bf2df6f3f99703aa572fe33a8db23ceedd4b5fe5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93lafur=20=C3=9E=C3=B3r=20Gunnarsson?= Date: Mon, 5 Oct 2026 10:06:54 +0000 Subject: [PATCH 2/2] Adjust volumetric light size handling Refactors `Tr2LightManager::AddLight` to treat volumetric lights explicitly. Non-volumetric lights still use frustum visibility checks, while volumetric lights now use the estimated pixel-size path instead of the standard across-frustum calculation so their cutoff and fading behavior are handled more appropriately. --- trinity/Tr2LightManager.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/trinity/Tr2LightManager.cpp b/trinity/Tr2LightManager.cpp index 063f4326d..dfbc733eb 100644 --- a/trinity/Tr2LightManager.cpp +++ b/trinity/Tr2LightManager.cpp @@ -339,16 +339,21 @@ void Tr2LightManager::AddLight( PerLightData& data ) } float brightness = std::max( std::max( data.color.x, data.color.y ), data.color.z ); + if( brightness <= 0 || data.radius <= 0 ) { return; } - if( ( data.flags & FLAG_IS_VOLUMETRIC ) == 0 && !m_frustum.IsSphereVisible( reinterpret_cast( &data.position ) ) ) + + bool isVolumetric = ( data.flags & FLAG_IS_VOLUMETRIC ) != 0; + const Vector4* sphere = reinterpret_cast( &data.position ); + + if( !isVolumetric && !m_frustum.IsSphereVisible( sphere ) ) { return; } + float size = isVolumetric ? m_frustum.GetPixelSizeAccrossEst( sphere ) : m_frustum.GetPixelSizeAccross( sphere ); - float size = m_frustum.GetPixelSizeAccross( reinterpret_cast( &data.position ) ); if( size > m_adjustedCutoff ) { float dimming = std::min( ( size - m_adjustedCutoff ) / FADE_SIZE, 1.f );