Skip to content

Commit 72d81c0

Browse files
[HDRP] Fix issue with path tracing when switching between non-persistent cameras (#5246)
* Fix issue with path traceing accumulation when switching between cameras. * Check if camera history is persistent Co-authored-by: sebastienlagarde <[email protected]>
1 parent 1bfc26e commit 72d81c0

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

com.unity.render-pipelines.high-definition/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
335335
- Fixed some of the extreme ghosting in DLSS by using a bit mask to bias the color of particles. VFX tagged as Exclude from TAA will be on this pass.
336336
- Fixed update order in Graphics Compositor causing jumpy camera updates (case 1345566).
337337
- Fixed material inspector that allowed setting intensity to an infinite value.
338+
- Fixed issue when switching between non-persistent cameras when path tarcing is enabled (case 1337843).
338339

339340
### Changed
340341
- Changed Window/Render Pipeline/HD Render Pipeline Wizard to Window/Rendering/HDRP Wizard

com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/PathTracing.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,13 @@ TextureHandle RenderPathTracing(RenderGraph renderGraph, HDCamera hdCamera, Text
361361
int camID = hdCamera.camera.GetInstanceID();
362362
CameraData camData = m_SubFrameManager.GetCameraData(camID);
363363

364+
// Check if the camera has a valid history buffer and if not reset the accumulation.
365+
// This can happen if a script disables and re-enables the camera (case 1337843).
366+
if (!hdCamera.isPersistent && hdCamera.GetCurrentFrameRT((int)HDCameraFrameHistoryType.PathTracing) == null)
367+
{
368+
m_SubFrameManager.Reset(camID);
369+
}
370+
364371
if (!m_SubFrameManager.isRecording)
365372
{
366373
// Check if things have changed and if we need to restart the accumulation

0 commit comments

Comments
 (0)