Set DiffuseProbeGrids to visible when baking textures.
Added an initialization delay before starting the DiffuseProbeGrid texture readbacks, to allow the textures to settle. Signed-off-by: dmcdiar <dmcdiar@amazon.com>
This commit is contained in:
@@ -259,6 +259,12 @@ namespace AZ
|
||||
return true;
|
||||
}
|
||||
|
||||
// if a bake is in progress we need to make this DiffuseProbeGrid visible
|
||||
if (!m_textureReadback.IsIdle())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return m_cullable.m_isVisible;
|
||||
}
|
||||
|
||||
|
||||
+16
-1
@@ -22,7 +22,9 @@ namespace AZ
|
||||
AZ_Assert(m_readbackState == DiffuseProbeGridReadbackState::Idle, "DiffuseProbeGridTextureReadback is already processing a readback request");
|
||||
|
||||
m_callback = callback;
|
||||
m_readbackState = DiffuseProbeGridReadbackState::Irradiance;
|
||||
|
||||
m_remainingInitializationFrames = DefaultNumInitializationFrames;
|
||||
m_readbackState = DiffuseProbeGridReadbackState::Initializing;
|
||||
}
|
||||
|
||||
void DiffuseProbeGridTextureReadback::Update(const AZ::Name& passName)
|
||||
@@ -32,6 +34,19 @@ namespace AZ
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_readbackState == DiffuseProbeGridReadbackState::Initializing)
|
||||
{
|
||||
if (m_remainingInitializationFrames > 0)
|
||||
{
|
||||
// still in the initialization state to allow the irradiance textures to settle, decrement the frame count
|
||||
m_remainingInitializationFrames--;
|
||||
return;
|
||||
}
|
||||
|
||||
// settling complete, move to the irradiance readback state to begin the readback process
|
||||
m_readbackState = DiffuseProbeGridReadbackState::Irradiance;
|
||||
}
|
||||
|
||||
if (m_attachmentReadback.get() && m_attachmentReadback->GetReadbackState() > RPI::AttachmentReadback::ReadbackState::Idle)
|
||||
{
|
||||
// still processing previous request
|
||||
|
||||
+7
@@ -20,6 +20,7 @@ namespace AZ
|
||||
enum class DiffuseProbeGridReadbackState
|
||||
{
|
||||
Idle,
|
||||
Initializing,
|
||||
Irradiance,
|
||||
Distance,
|
||||
Relocation,
|
||||
@@ -39,6 +40,8 @@ namespace AZ
|
||||
void Update(const AZ::Name& passName);
|
||||
void FrameBegin(AZ::RPI::Pass::FramePrepareParams& params);
|
||||
|
||||
bool IsIdle() const { return m_readbackState == DiffuseProbeGridReadbackState::Idle; }
|
||||
|
||||
private:
|
||||
|
||||
DiffuseProbeGrid* m_diffuseProbeGrid = nullptr;
|
||||
@@ -50,6 +53,10 @@ namespace AZ
|
||||
AZ::RPI::AttachmentReadback::ReadbackResult m_distanceReadbackResult;
|
||||
AZ::RPI::AttachmentReadback::ReadbackResult m_relocationReadbackResult;
|
||||
AZ::RPI::AttachmentReadback::ReadbackResult m_classificationReadbackResult;
|
||||
|
||||
// number of frames to delay before starting the texture readbacks, this allows the textures to settle
|
||||
static constexpr int32_t DefaultNumInitializationFrames = 50;
|
||||
int32_t m_remainingInitializationFrames = DefaultNumInitializationFrames;
|
||||
};
|
||||
} // namespace Render
|
||||
} // namespace AZ
|
||||
|
||||
Reference in New Issue
Block a user