diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md
index ef67484ccb4..fc73bc1b665 100644
--- a/com.unity.render-pipelines.high-definition/CHANGELOG.md
+++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md
@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Added new functions that sample the custom buffer in custom passes (CustomPassSampleCustomColor and CustomPassLoadCustomColor) to handle the RTHandleScale automatically.
- Added new panels to Rendering Debugger Display Stats panel, displaying improved CPU/GPU frame timings and bottlenecks.
- Added API to edit diffusion profiles and set IES on lights.
+- Added public API to reset path tracing accumulation, and check its status.
### Fixed
- Fixed decal position when created from context menu. (case 1368987)
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Accumulation/SubFrameManager.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Accumulation/SubFrameManager.cs
index aed917fc501..5636d8a3862 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Accumulation/SubFrameManager.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Accumulation/SubFrameManager.cs
@@ -153,7 +153,7 @@ internal void PrepareNewSubFrame()
foreach (int camID in m_CameraCache.Keys.ToList())
maxIteration = Math.Max(maxIteration, GetCameraData(camID).currentIteration);
- if (maxIteration == m_AccumulationSamples)
+ if (maxIteration >= m_AccumulationSamples)
{
Reset();
}
@@ -264,6 +264,18 @@ public void PrepareNewSubFrame()
m_SubFrameManager.PrepareNewSubFrame();
}
+ ///
+ /// Checks if the multi-frame accumulation is completed for a given camera.
+ ///
+ /// Camera for which the accumulation status is checked.
+ /// true if the accumulation is completed, false otherwise.
+ public bool IsFrameCompleted(HDCamera hdCamera)
+ {
+ int camID = hdCamera.camera.GetInstanceID();
+ CameraData camData = m_SubFrameManager.GetCameraData(camID);
+ return camData.currentIteration >= m_SubFrameManager.subFrameCount;
+ }
+
class RenderAccumulationPassData
{
public ComputeShader accumulationCS;
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/PathTracing.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/PathTracing.cs
index 90c6372674e..5ba14611f88 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/PathTracing.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/PathTracing.cs
@@ -112,12 +112,26 @@ void ReleasePathTracing()
#endif // UNITY_EDITOR
}
- internal void ResetPathTracing()
+ ///
+ /// Resets path tracing accumulation for all cameras.
+ ///
+ public void ResetPathTracing()
{
m_RenderSky = true;
m_SubFrameManager.Reset();
}
+ ///
+ /// Resets path tracing accumulation for a specific camera.
+ ///
+ /// Camera for which the accumulation is reset.
+ public void ResetPathTracing(HDCamera hdCamera)
+ {
+ int camID = hdCamera.camera.GetInstanceID();
+ CameraData camData = m_SubFrameManager.GetCameraData(camID);
+ ResetPathTracing(camID, camData);
+ }
+
internal CameraData ResetPathTracing(int camID, CameraData camData)
{
m_RenderSky = true;