Skip to content

Light improvements#32

Draft
filipppavlov wants to merge 5 commits into
mainfrom
light-improvements
Draft

Light improvements#32
filipppavlov wants to merge 5 commits into
mainfrom
light-improvements

Conversation

@filipppavlov

Copy link
Copy Markdown

Several changes to point/spot lights to make them more configurable. These changes are based on requests from lighting artists.

  • Add a "lighting quality" setting to the EveSpaceSceneRenderDriver with possible values "low", "medium", and "high". Light instances have a filter that allows disabling them in certain light quality settings. The filter only exists on Tr2Light descendants; all other lights (for example, lights on boosters) are enabled regardless of the setting.
  • Add "scaleBrightness" flag to Tr2Light descendants: when the setting is "on", the brightness of the light is scaled by its radius (the old behavior); when it is "off", the brightness and radius are independent and can be tweaked separately. The default value is exposed as a Trinity setting "scaleLightBrightnessByRadiusDefault", which itself defaults to "on" to maintain backwards compatibility. The setting can be modified from Python code when loading Trinity (for example, 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.
  • Change shadow quality on Tr2Light to a bit filter to allow finer-grain control over which lights are casting shadows under which shadow quality settings.
  • Add light falloff type setting to the Tr2Light: a choice between inverse and inverse square falloff. Again, the default is the inverse falloff for backwards compatibility. Note that this change needs a corresponding change in shaders when unpacking light flags on GPU.
  • Slightly change debug visualizations for lights: use wireframe shape instead of a fill, and add light name.

Copilot AI review requested due to automatic review settings July 23, 2026 16:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 LightingQuality setting on EveSpaceSceneRenderDriver, and per-light lighting-quality filtering for Tr2Light descendants.
  • Add scaleBrightness control for Tr2Light descendants / 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 thread trinity/EnumFilter.h
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 thread trinity/Tr2LightManager.h
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 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants