Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions trinity/Eve/SpaceObject/EveSpaceObject2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -538,10 +538,14 @@ void EveSpaceObject2::UpdateSyncronous( const EveUpdateContext& updateContext )
// Particle Systems
// Get the reference position
Vector3d referencePosition( 0.0, 0.0, 0.0 );
IEveReferencePointPtr refObject( BlueCastPtr( m_ballPosition ) );
if( refObject )
if( m_referencePointSource != m_ballPosition.p )
{
refObject->GetReferencePoint( &referencePosition, time );
m_referencePointSource = m_ballPosition.p;
m_referencePoint = BlueCastPtr( m_ballPosition );
Comment on lines +541 to +544
}
if( m_referencePoint )
{
m_referencePoint->GetReferencePoint( &referencePosition, time );
}

if( m_previousPosition.x != UNINITIALIZED_POSITION )
Expand Down Expand Up @@ -2149,13 +2153,13 @@ void EveSpaceObject2::RefreshDamageLocatorMask( const LocatorStructureList* dama

void EveSpaceObject2::UpdateDamageLocatorFilter()
{
TRINITY_STATS_ZONE( __FUNCTION__ );

if( m_damageFilterState == DamageFilterState::Idle )
{
return;
}

TRINITY_STATS_ZONE( __FUNCTION__ );

if( !m_damageLocatorAutoFilterEnabled && !m_damageLocatorFilterRequested )
{
m_damageLocatorEnabled.clear();
Expand Down
2 changes: 2 additions & 0 deletions trinity/Eve/SpaceObject/EveSpaceObject2.h
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,8 @@ BLUE_CLASS( EveSpaceObject2 ) :
// It would be really, really nice not to have to hold on to the ball twice
// but we can't do it without writing another interface, or linking to destiny
ITriVectorFunctionPtr m_ballPosition;
ITriVectorFunction* m_referencePointSource = nullptr;
IEveReferencePointPtr m_referencePoint;
ITriQuaternionFunctionPtr m_ballRotation;
ITriQuaternionFunctionPtr m_modelRotation;
ITriVectorFunctionPtr m_modelTranslation;
Expand Down
54 changes: 35 additions & 19 deletions trinity/Tr2VolumetricsRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,22 @@
#include "include/TriMath.h"
#include "Utilities/Vector4d.h"

namespace
{
const BlueSharedString RtShadowTechniqueName = BlueSharedString( "RtShadow" );
const BlueSharedString RtSceneParameterName = BlueSharedString( "RtShadowScene" );
const BlueSharedString Noise3DTextureParameterName = BlueSharedString( "Noise3DTexture" );
const BlueSharedString FroxelOutputParameterName = BlueSharedString( "RtFroxelOutputTexture" );
const BlueSharedString ShadowsOptionName = BlueSharedString( "SHADOWS" );
const BlueSharedString ShadowsEnabledOption = BlueSharedString( "SHADOWS_ENABLED" );
const BlueSharedString ShadowsDisabledOption = BlueSharedString( "SHADOWS_DISABLED" );
const BlueSharedString GodRayNoiseOptionName = BlueSharedString( "GOD_RAY_NOISE" );
const BlueSharedString GodRayNoiseEnabledOption = BlueSharedString( "GOD_RAY_NOISE_ENABLED" );
const BlueSharedString GodRayNoiseDisabledOption = BlueSharedString( "GOD_RAY_NOISE_DISABLED" );
const BlueSharedString FogNoiseOptionName = BlueSharedString( "FOG_NOISE" );
const BlueSharedString FogNoiseEnabledOption = BlueSharedString( "FOG_NOISE_ENABLED" );
const BlueSharedString FogNoiseDisabledOption = BlueSharedString( "FOG_NOISE_DISABLED" );
}

Tr2VolumetricsRenderer::FogViewDependentResources::FogViewDependentResources( bool temporalFroxels ) :
useTemporalFroxels( temporalFroxels )
Expand Down Expand Up @@ -692,15 +708,15 @@ Tr2GpuResourcePool::Texture Tr2VolumetricsRenderer::RenderFog(
if( shadowType == SHADOWS_RAYTRACED )
{
uint32_t techniqueIndex;
if( !resources.rtCalculateFroxels->GetShaderStateInterface()->GetTechniqueIndex( BlueSharedString( "RtShadow" ), techniqueIndex ) )
if( !resources.rtCalculateFroxels->GetShaderStateInterface()->GetTechniqueIndex( RtShadowTechniqueName, techniqueIndex ) )
{
CCP_LOGERR( "Failed to get technique index for raytraced froxel fog shadows!" );
return {};
}

BlueSharedStringW rayGenName;
BlueSharedStringW missName;
m_pipelineManager.AddLibrary( rayGenName, missName, resources.rtCalculateFroxels, BlueSharedString( "RtShadow" ) );
m_pipelineManager.AddLibrary( rayGenName, missName, resources.rtCalculateFroxels, RtShadowTechniqueName );

Tr2RtPipelineStateAL pipelineState = m_pipelineManager.GetPipelineState( renderContext );

Expand All @@ -713,20 +729,20 @@ Tr2GpuResourcePool::Texture Tr2VolumetricsRenderer::RenderFog(
Tr2RtLocalMaterialDescriptionAL material;
material.SetConstants( Tr2Renderer::GetPerObjectVSStartRegister(), m_fogConstantBuffer );

TRINITY_STATS_ZONE( "Create shader table" );
m_shaderTableDesc.AddRayGenShader( rayGenName.c_str(), material );
m_shaderTableDesc.AddMissShader( missName.c_str(), material );

Tr2RtShaderTableAL shadowShaderTable;
shadowShaderTable.Create( m_shaderTableDesc, pipelineState, renderContext.GetPrimaryRenderContext() );
{
TRINITY_STATS_ZONE( "Create shader table" );
m_shaderTableDesc.AddRayGenShader( rayGenName.c_str(), material );
m_shaderTableDesc.AddMissShader( missName.c_str(), material );
m_rtShadowShaderTable.Create( m_shaderTableDesc, pipelineState, renderContext.GetPrimaryRenderContext() );
}

resources.rtCalculateFroxels->SetOption( BlueSharedString( "GOD_RAY_NOISE" ), BlueSharedString( m_froxelFogSettings.godRayNoiseIntensity.value > 0.0f ? "GOD_RAY_NOISE_ENABLED" : "GOD_RAY_NOISE_DISABLED" ) );
resources.rtCalculateFroxels->SetOption( BlueSharedString( "FOG_NOISE" ), BlueSharedString( m_froxelFogSettings.fogNoiseIntensity.value > 0.0f ? "FOG_NOISE_ENABLED" : "FOG_NOISE_DISABLED" ) );
resources.rtCalculateFroxels->SetOption( GodRayNoiseOptionName, m_froxelFogSettings.godRayNoiseIntensity.value > 0.0f ? GodRayNoiseEnabledOption : GodRayNoiseDisabledOption );
resources.rtCalculateFroxels->SetOption( FogNoiseOptionName, m_froxelFogSettings.fogNoiseIntensity.value > 0.0f ? FogNoiseEnabledOption : FogNoiseDisabledOption );

resources.rtCalculateFroxels->SetParameter( BlueSharedString( "Noise3DTexture" ), m_froxel3DNoise );
resources.rtCalculateFroxels->SetParameter( BlueSharedString( "RtFroxelOutputTexture" ), fogFroxels );
resources.rtCalculateFroxels->SetParameter( Noise3DTextureParameterName, m_froxel3DNoise );
resources.rtCalculateFroxels->SetParameter( FroxelOutputParameterName, fogFroxels );

resources.rtCalculateFroxels->SetParameter( BlueSharedString( "RtShadowScene" ), raytracingGeometry );
resources.rtCalculateFroxels->SetParameter( RtSceneParameterName, raytracingGeometry );
renderContext.SetRtPipelineState( pipelineState, rayGenName.c_str() );
resources.rtCalculateFroxels->ApplyMaterialDataForRtState( techniqueIndex, renderContext );
renderContext.UseAccelerationStructure( raytracingGeometry->GetTLAS() );
Expand All @@ -736,17 +752,17 @@ Tr2GpuResourcePool::Texture Tr2VolumetricsRenderer::RenderFog(
renderContext.UseResources( Tr2UseResourceDestination::COMPUTE, Tr2GpuUsage::SHADER_RESOURCE, raytracingGeometry->GetBindlessResources() );
}

renderContext.DispatchRays( pipelineState, shadowShaderTable, rayGenName.c_str(), width, height, depth );
renderContext.DispatchRays( pipelineState, m_rtShadowShaderTable, rayGenName.c_str(), width, height, depth );
}
else
{
//Otherwise, just use a plain compute shader.
resources.calculateFroxels->SetOption( BlueSharedString( "SHADOWS" ), BlueSharedString( shadowType == SHADOWS_CASCADED ? "SHADOWS_ENABLED" : "SHADOWS_DISABLED" ) );
resources.calculateFroxels->SetOption( BlueSharedString( "GOD_RAY_NOISE" ), BlueSharedString( m_froxelFogSettings.godRayNoiseIntensity.value > 0.0f ? "GOD_RAY_NOISE_ENABLED" : "GOD_RAY_NOISE_DISABLED" ) );
resources.calculateFroxels->SetOption( BlueSharedString( "FOG_NOISE" ), BlueSharedString( m_froxelFogSettings.fogNoiseIntensity.value > 0.0f ? "FOG_NOISE_ENABLED" : "FOG_NOISE_DISABLED" ) );
resources.calculateFroxels->SetOption( ShadowsOptionName, shadowType == SHADOWS_CASCADED ? ShadowsEnabledOption : ShadowsDisabledOption );
resources.calculateFroxels->SetOption( GodRayNoiseOptionName, m_froxelFogSettings.godRayNoiseIntensity.value > 0.0f ? GodRayNoiseEnabledOption : GodRayNoiseDisabledOption );
resources.calculateFroxels->SetOption( FogNoiseOptionName, m_froxelFogSettings.fogNoiseIntensity.value > 0.0f ? FogNoiseEnabledOption : FogNoiseDisabledOption );

resources.calculateFroxels->SetParameter( BlueSharedString( "Noise3DTexture" ), m_froxel3DNoise );
resources.calculateFroxels->SetParameter( BlueSharedString( "RtFroxelOutputTexture" ), fogFroxels );
resources.calculateFroxels->SetParameter( Noise3DTextureParameterName, m_froxel3DNoise );
resources.calculateFroxels->SetParameter( FroxelOutputParameterName, fogFroxels );

Tr2Renderer::RunComputeShader( resources.calculateFroxels, wgX, wgY, wgZ, renderContext );
}
Expand Down
1 change: 1 addition & 0 deletions trinity/Tr2VolumetricsRenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ BLUE_CLASS( Tr2VolumetricsRenderer ) :

Tr2RaytracingPipelineStateManager m_pipelineManager;
Tr2RtShaderTableDescriptionAL m_shaderTableDesc;
Tr2RtShaderTableAL m_rtShadowShaderTable;

private:
struct FogViewDependentResources
Expand Down
Loading