Light improvements#32
Draft
filipppavlov wants to merge 5 commits into
Draft
Conversation
… that lighting artists would have finer control over shadows
…with inv. square falloff; add EnumFilter helper class
There was a problem hiding this comment.
Pull request overview
This PR expands runtime configurability for point/spot lights in Trinity, aimed at giving lighting artists more control while preserving backwards compatibility (via defaults). It introduces a new lighting quality setting, per-light quality/shadow filters, configurable brightness scaling behavior, and an additional falloff mode, plus updates to light debug rendering.
Changes:
- Add
LightingQualitysetting onEveSpaceSceneRenderDriver, and per-light lighting-quality filtering forTr2Lightdescendants. - Add
scaleBrightnesscontrol forTr2Lightdescendants / smart lights, and implement inverse vs inverse-square falloff via a new packed light flag. - Update light debug visualization to use wireframe shapes and display light names.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| trinity/Tr2LightManager.h | Adds LightingQuality, falloff flag, and light-manager API updates for brightness scaling and quality selection. |
| trinity/Tr2LightManager.cpp | Implements packed flag helper, lighting quality setters/getters, and updated brightness scaling behavior. |
| trinity/Lights/Tr2TexturedPointLight_Blue.cpp | Exposes new falloff/quality/shadow-filter and scaleBrightness properties to Blue. |
| trinity/Lights/Tr2SpotLight.cpp | Updates debug rendering style and adds light name label. |
| trinity/Lights/Tr2SpotLight_Blue.cpp | Exposes new falloff/quality/shadow-filter and scaleBrightness properties to Blue. |
| trinity/Lights/Tr2PointLight.cpp | Updates debug rendering style and adds light name label. |
| trinity/Lights/Tr2PointLight_Blue.cpp | Exposes new falloff/quality/shadow-filter and scaleBrightness properties to Blue. |
| trinity/Lights/Tr2Light.h | Introduces falloff type + enum filters for shadow/lighting quality; adds scaleBrightness state. |
| trinity/Lights/Tr2Light.cpp | Registers default brightness-scaling setting; applies lighting-quality filter and falloff flag packing. |
| trinity/Lights/Tr2Light_Blue.cpp | Registers new chooser enums for filters and falloff type. |
| trinity/Lights/Tr2FactionLight.cpp | Updates debug rendering style and adds light name label. |
| trinity/Lights/Tr2FactionLight_Blue.cpp | Exposes new quality/shadow-filter and scaleBrightness properties to Blue. |
| trinity/Eve/SpaceObject/Children/SmartLightSets/EveSmartLightPointLight.h | Adds per-smart-light scaleBrightness control. |
| trinity/Eve/SpaceObject/Children/SmartLightSets/EveSmartLightPointLight.cpp | Initializes scaleBrightness default and forwards it into light-manager submission. |
| trinity/Eve/SpaceObject/Children/SmartLightSets/EveSmartLightPointLight_Blue.cpp | Exposes scaleBrightness to Blue for smart lights. |
| trinity/Eve/EveSpaceSceneRenderDriver.h | Adds lighting-quality setting to render driver settings. |
| trinity/Eve/EveSpaceSceneRenderDriver.cpp | Applies lighting quality to the light manager during render execution. |
| trinity/Eve/EveSpaceSceneRenderDriver_Blue.cpp | Exposes LightingQuality enum and attribute to Blue. |
| trinity/Eve/EveSpaceScene.cpp | Removes light-manager setup from BeginRender (now handled by render driver). |
| trinity/EnumFilter.h | Adds a reusable enum-bit-filter helper used by lighting/shadow filters. |
| trinity/CMakeLists.txt | Adds EnumFilter.h to build sources. |
Comments suppressed due to low confidence (2)
trinity/EnumFilter.h:34
- EnumFilter::operator| currently tries to construct an EnumFilter from a raw bitmask (m_filter | other.m_filter), but the class has no constructor that accepts StorageType. With enum class types this won’t compile because the only non-copy constructor takes Enum.
EnumFilter operator|( const EnumFilter& other ) const
{
return EnumFilter( m_filter | other.m_filter );
}
trinity/EnumFilter.h:47
- HasBit() builds the test bit with
1 << StorageType(value)(int shift base). This has the same undefined-behavior risk as the other bit operations when StorageType is wider than int.
bool HasBit( Enum value ) const
{
CCP_ASSERT_M( uint64_t( value ) < 8 * sizeof( StorageType ), "Enum value out of range for the chosen storage type" );
return ( m_filter & StorageType( 1 << StorageType( value ) ) ) != 0;
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+19
to
+29
| EnumFilter( Enum value ) : m_filter( StorageType( 1 << StorageType( value ) ) ) | ||
| { | ||
| CCP_ASSERT_M( uint64_t( value ) < 8 * sizeof( StorageType ), "Enum value out of range for the chosen storage type" ); | ||
| } | ||
|
|
||
| EnumFilter& operator|=( Enum value ) | ||
| { | ||
| CCP_ASSERT_M( uint64_t( value ) < 8 * sizeof( StorageType ), "Enum value out of range for the chosen storage type" ); | ||
| m_filter |= StorageType( 1 << StorageType( value ) ); | ||
| return *this; | ||
| } |
Comment on lines
22
to
+26
| rotation( 0.0f, 0.0f, 0.0f, 1.0f ), | ||
| innerAngle( 0.0f ), | ||
| outerAngle( 0.0f ), | ||
| falloff( uint8_t( LightFalloffType::INVERSE ) ), | ||
| lightingQuality( EnumFilter<LightingQuality>::AllBits() ), |
Comment on lines
213
to
216
| uint32_t nextFrameShadowQuality; // bitmask, collecting ShadowQualities during the current frame | ||
| ShadowQuality m_currentSpaceSceneShadowQuality; | ||
| LightingQuality m_lightingQuality; | ||
| uint64_t m_currentFrameCounter; |
| } | ||
|
|
||
| lightManager.AddLight( pointLightData ); | ||
| lightManager.AddLight( pointLightData, m_scaleBrightness ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Several changes to point/spot lights to make them more configurable. These changes are based on requests from lighting artists.
trinity.settings.SetValue("scaleLightBrightnessByRadiusDefault", False). Just like the lighting quality filter, this setting only exists on Tr2Light descendant classes (and smart lights). All other light sources still use the default "on" setting.