Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HDRP] Fix white flash with SSR when resetting camera history #5089

Merged
merged 4 commits into from
Jul 9, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions com.unity.render-pipelines.high-definition/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed remapping of depth pyramid debug view
- Fixed an issue with asymmetric projection matrices and fog / pathtracing. (case 1330290).
- Fixed gbuffer depth debug mode for materials not rendered during the prepass.
- Fixed white flash with SSR when resetting camera history (case 1335263).

### Changed
- Changed Window/Render Pipeline/HD Render Pipeline Wizard to Window/Rendering/HDRP Wizard
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,7 @@ RTHandle Allocator(string id, int frameIndex, RTHandleSystem rtHandleSystem)
internal HDAdditionalCameraData.TAAQualityLevel TAAQuality { get; private set; } = HDAdditionalCameraData.TAAQualityLevel.Medium;

internal bool resetPostProcessingHistory = true;
internal bool didResetPostProcessingHistoryInLastFrame = true;

internal bool dithering => m_AdditionalCameraData != null && m_AdditionalCameraData.dithering;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,10 @@ void BeginPostProcessFrame(CommandBuffer cmd, HDCamera camera, HDRenderPipeline
}
}

// If the history was reset in the previous frame, then the history buffers were actually rendered with a neutral EV100 exposure multiplier
var prevExposureTexture = camera.didResetPostProcessingHistoryInLastFrame ? m_EmptyExposureTexture : GetPreviousExposureTexture(camera);
Copy link
Contributor

@FrancescoC-unity FrancescoC-unity Jul 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it'd be cleaner and simpler if we do the branch logic inside GetPreviousExposureTexture itself, in case other user code grab this previous texture

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed!

cmd.SetGlobalTexture(HDShaderIDs._ExposureTexture, GetExposureTexture(camera));
cmd.SetGlobalTexture(HDShaderIDs._PrevExposureTexture, GetPreviousExposureTexture(camera));
cmd.SetGlobalTexture(HDShaderIDs._PrevExposureTexture, prevExposureTexture);
}

if (m_DLSSPass != null)
Expand Down Expand Up @@ -514,6 +516,8 @@ TextureHandle RenderPostProcess(RenderGraph renderGraph,

source = FXAAPass(renderGraph, hdCamera, source);

hdCamera.didResetPostProcessingHistoryInLastFrame = hdCamera.resetPostProcessingHistory;

hdCamera.resetPostProcessingHistory = false;
}

Expand Down