Merge pull request #1711 from aws-lumberyard-dev/Atom/dmcdiar/ATOM-15921
[ATOM-15921] ReflectionProbe cubemaps bake with incorrect exposure value
This commit is contained in:
@@ -96,16 +96,29 @@ namespace AZ
|
||||
|
||||
void ReflectionProbe::Simulate(uint32_t probeIndex)
|
||||
{
|
||||
if (m_buildingCubeMap && m_environmentCubeMapPass->IsFinished())
|
||||
if (m_buildingCubeMap)
|
||||
{
|
||||
// all faces of the cubemap have been rendered, invoke the callback
|
||||
m_callback(m_environmentCubeMapPass->GetTextureData(), m_environmentCubeMapPass->GetTextureFormat());
|
||||
Data::Instance<RPI::ShaderResourceGroup> sceneSrg = m_scene->GetShaderResourceGroup();
|
||||
|
||||
// remove the pipeline
|
||||
m_scene->RemoveRenderPipeline(m_environmentCubeMapPipelineId);
|
||||
m_environmentCubeMapPass = nullptr;
|
||||
if (m_environmentCubeMapPass->IsFinished())
|
||||
{
|
||||
// all faces of the cubemap have been rendered, invoke the callback
|
||||
m_callback(m_environmentCubeMapPass->GetTextureData(), m_environmentCubeMapPass->GetTextureFormat());
|
||||
|
||||
m_buildingCubeMap = false;
|
||||
// remove the pipeline
|
||||
m_scene->RemoveRenderPipeline(m_environmentCubeMapPipelineId);
|
||||
m_environmentCubeMapPass = nullptr;
|
||||
|
||||
// restore exposure
|
||||
sceneSrg->SetConstant(m_iblExposureConstantIndex, m_previousExposure);
|
||||
|
||||
m_buildingCubeMap = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// set exposure to 0.0 while baking the cubemap
|
||||
sceneSrg->SetConstant(m_iblExposureConstantIndex, 0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
// track if we need to update culling based on changes to the draw packets or Srg
|
||||
@@ -283,6 +296,10 @@ namespace AZ
|
||||
const RPI::Ptr<RPI::ParentPass>& rootPass = environmentCubeMapPipeline->GetRootPass();
|
||||
rootPass->AddChild(m_environmentCubeMapPass);
|
||||
|
||||
// store the current IBL exposure value
|
||||
Data::Instance<RPI::ShaderResourceGroup> sceneSrg = m_scene->GetShaderResourceGroup();
|
||||
m_previousExposure = sceneSrg->GetConstant<float>(m_iblExposureConstantIndex);
|
||||
|
||||
m_scene->AddRenderPipeline(environmentCubeMapPipeline);
|
||||
}
|
||||
|
||||
|
||||
@@ -163,6 +163,8 @@ namespace AZ
|
||||
RPI::Ptr<RPI::EnvironmentCubeMapPass> m_environmentCubeMapPass = nullptr;
|
||||
RPI::RenderPipelineId m_environmentCubeMapPipelineId;
|
||||
BuildCubeMapCallback m_callback;
|
||||
RHI::ShaderInputNameIndex m_iblExposureConstantIndex = "m_iblExposure";
|
||||
float m_previousExposure = 0.0f;
|
||||
bool m_buildingCubeMap = false;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user