Skip to content
Merged
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
5 changes: 5 additions & 0 deletions trinity/Eve/EveSpaceScene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1774,6 +1774,11 @@ void EveSpaceScene::RenderReflectionPass( Tr2GpuResourcePool& gpuResourcePool, T
// set the current reflection
GPU_REGION( renderContext, "Reflection" );

m_volumetricsRenderer->SetIsReflectionProbe( true );
ON_BLOCK_EXIT( [&] {
m_volumetricsRenderer->SetIsReflectionProbe( false );
} );

// lower the reflection intensity for the objects rendered into the reflection
// (so the reflections in the reflections don't get brighter and brighter)
// we cap it at 0.8 for no good reason, just felt like a good number to cap the reflection intensity in the reflections
Expand Down
2 changes: 2 additions & 0 deletions trinity/Eve/SpaceObject/Children/EveChildFogVolume.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ EveChildFogVolume::EveChildFogVolume( IRoot* lockobj ) :
m_settings.fogNoiseFrequency = 15.0f;
m_settings.fogNoiseMovementSpeed = Vector3( 0.0f, 0.0f, 0.0f );

m_settings.reflectionIntensity = 1.0f;

// The proper value is set in the UpdateAsyncronous method
m_settings.intensity = 0.0f;
}
Expand Down
2 changes: 2 additions & 0 deletions trinity/Eve/SpaceObject/Children/EveChildFogVolume_Blue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ const Be::ClassInfo* EveChildFogVolume::ExposeToBlue()
VOLUME_ATTRIBUTE_DEFINE( fogNoiseIntensity, "The intensity of the 3D noise used to modify the fog color. Setting this to 0 gives you a uniform fog, while values above 0.0 will add more variation to the fog color, similar to puffy clouds." )
VOLUME_ATTRIBUTE_DEFINE( fogNoiseFrequency, "The frequency of the 3D noise used to modify the fog color. A higher value makes the cloud puffs larger and less detailed, while a smaller value makes the puffs smaller and more numerous. Around 15.0 is a good starting point." )

VOLUME_ATTRIBUTE_DEFINE( reflectionIntensity, "A color multiplier for the reflections of the fog. 1.0 is the default/realistic value, but it can be reduced to achieve less intense reflections." )

MAP_ATTRIBUTE( "boundingSphereCenter", m_boundingSphere.center, "", Be::READ )
MAP_ATTRIBUTE( "boundingSphereRadius", m_boundingSphere.radius, "", Be::READ )
MAP_ATTRIBUTE( "volumes", m_volumes, "", Be::READ | Be::PERSIST )
Expand Down
8 changes: 3 additions & 5 deletions trinity/Tr2VolumetricsRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ Tr2VolumetricsRenderer::Tr2VolumetricsRenderer( IRoot* ) :
}

{
m_testValue = 0.0f;
Matrix4dFromMatrix( m_godRayNoiseMatrix, IdentityMatrix() );
}

Expand Down Expand Up @@ -357,10 +356,6 @@ void Tr2VolumetricsRenderer::UpdateFogSettings( const EveComponentRegistry& regi
return a->priority > b->priority;
} );

//m_froxelFogSettings = OldPriorityBlend( overrides );

//std::vector<ITr2FroxelFogSettings::FroxelFogSettings*> test;

#define FROXEL_ACCUMULATE( setting ) m_froxelFogSettings.setting = PriorityBlend::Accumulate( &ITr2FroxelFogSettings::FroxelFogSettings::setting, overrides )

FROXEL_ACCUMULATE( thickness );
Expand All @@ -381,6 +376,8 @@ void Tr2VolumetricsRenderer::UpdateFogSettings( const EveComponentRegistry& regi
FROXEL_ACCUMULATE( fogNoiseFrequency );
FROXEL_ACCUMULATE( fogNoiseMovementSpeed );

FROXEL_ACCUMULATE( reflectionIntensity );

if( m_logBlending )
{
//Replace the thickness with a logarithmically interpolated one, making the transition from 0 thickness more graceful.
Expand Down Expand Up @@ -1063,6 +1060,7 @@ void Tr2VolumetricsRenderer::PopulatePerFrameData( FroxelPerFrameData& data )
data.EnvironmentIntensity = m_froxelFogSettings.environmentIntensity.value;

data.EnvironmentG = environmentG;
data.FogMultiplier = m_isReflectionProbe ? std::clamp( m_froxelFogSettings.reflectionIntensity.value, 0.0f, 1.0f ) : 1.0f;

for( int32_t i = 0; i < m_planets.size(); i++ )
{
Expand Down
27 changes: 24 additions & 3 deletions trinity/Tr2VolumetricsRenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ BLUE_INTERFACE( ITr2FroxelFogSettings ) :
PriorityBlend::Attribute<float> fogNoiseFrequency = 0.0f;
PriorityBlend::Attribute<Vector3> fogNoiseMovementSpeed = Vector3( 0.0f, 0.0f, 0.0f );

PriorityBlend::Attribute<float> reflectionIntensity = 1.0f;

PriorityBlend::Attribute<double> logThickness = 0.0;
};
virtual FroxelFogSettings* GetFroxelFogSettings() = 0;
Expand Down Expand Up @@ -107,6 +109,11 @@ BLUE_CLASS( Tr2VolumetricsRenderer ) :
static Tr2GpuResourcePool::Texture GetEmptyFogTexture( Tr2GpuResourcePool & gpuResourcePool );
void UpdateFogEnvironmentMap( Tr2RenderContext & renderContext );

void SetIsReflectionProbe( bool isReflectionProbe )
{
m_isReflectionProbe = isReflectionProbe;
}

void UpdateVariableStore();
void SetPlanets( const CcpMath::Sphere* planets, size_t planetCount );
void SetSunAngle( float angle );
Expand All @@ -127,7 +134,7 @@ BLUE_CLASS( Tr2VolumetricsRenderer ) :
float EnvironmentIntensity;

float EnvironmentG;
float _pad0;
float FogMultiplier;
float _pad1;
float _pad2;

Expand Down Expand Up @@ -199,6 +206,7 @@ BLUE_CLASS( Tr2VolumetricsRenderer ) :
bool m_logBlending;
double m_logBlendingSmoothness;
ITr2FroxelFogSettings::FroxelFogSettings m_froxelFogSettings;
bool m_isReflectionProbe;

float m_gameBackClip;

Expand All @@ -208,7 +216,6 @@ BLUE_CLASS( Tr2VolumetricsRenderer ) :
double m_godRayNoiseAnimation;
Vector3d m_fogNoiseMovement;

float m_testValue;
double m_godRayNoiseMatrix[16];

FogViewDependentResources m_fogResources;
Expand Down Expand Up @@ -277,7 +284,21 @@ BLUE_CLASS( Tr2VolumetricsRenderer ) :
CcpMath::Sphere planets[2];
};

void UpdatePerObjectData( FogPerObjectData * data, const Matrix& view, const Matrix& projection, const Matrix& viewLast, const Matrix& projectionLast, const Vector3d& origin, const Vector3d& originShift, const Vector3& sunDirection, const Color& sunColor, uint32_t width, uint32_t height, uint32_t depth, const Vector3& jitter, const Tr2ShadowMap* cascadedShadowMap );
void UpdatePerObjectData(
FogPerObjectData * data,
const Matrix& view,
const Matrix& projection,
const Matrix& viewLast,
const Matrix& projectionLast,
const Vector3d& origin,
const Vector3d& originShift,
const Vector3& sunDirection,
const Color& sunColor,
uint32_t width,
uint32_t height,
uint32_t depth,
const Vector3& jitter,
const Tr2ShadowMap* cascadedShadowMap );

Tr2ConstantBufferAL m_fogConstantBuffer;

Expand Down
7 changes: 7 additions & 0 deletions trinity/Tr2VolumetricsRenderer_Blue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,13 @@ const Be::ClassInfo* Tr2VolumetricsRenderer::ExposeToBlue()
":jessica-group: Froxel Fog",
Be::READ )

MAP_ATTRIBUTE(
"reflectionIntensity",
m_froxelFogSettings.reflectionIntensity.value,
"A color multiplier for the reflections of the fog. \n"
":jessica-group: Froxel Fog",
Be::READ )


MAP_ATTRIBUTE(
"logBlending",
Expand Down
Loading