Skip to content

Fix issue with OnDemand directional shadow map being corrupted when reflection probe are updated same frame #4812

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

Merged
merged 5 commits into from
Jun 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -235,6 +235,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed the double sided option moving when toggling it in the material UI (case 1328877).
- Fixed volumetric fog in planar reflections.
- Fixed error with motion blur and small render targets.
- Fixed issue with on-demand directional shadow maps looking broken when a reflection probe is updated at the same time.

### 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 @@ -160,8 +160,8 @@ While you are in the Unity Editor, HDRP updates shadow maps whenever you modify
- SetShadowResolutionOverride()
- SetShadowUpdateMode() or shadowUpdateMode. In this case, HDRP only refreshes the cached shadow maps if the mode changes between Every Frame and not Every Frame).


Be aware that anything that is view-dependent is likely to create problems with cached shadow maps because HDRP does not automatically update them as the main view moves. A non-obvious example of this is tessellation. Because tessellation factor is view-dependent, the geometry that the main camera sees might mismatch the geometry that HDRP rendered into the cached shadow map. If this visibly occurs, trigger a request for HDRP to update the Light's shadow map. To do this, make sure the Light's **Update Mode** is set to **On Demand** and call `RequestShadowMapRendering`.
Another non obvious scenario is when multiple views are available, the light will be updated only for a single view therefore causing the other views to have incorrect results. To avoid a common scenario in which the described artifact will occur, HDRP will not mark a shadow request as completed when performed from reflection probes with view dependent shadows and waiting until a non-reflection camera triggers a shadow update.



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2287,7 +2287,8 @@ internal int UpdateShadowRequest(HDCamera hdCamera, HDShadowManager manager, HDS

manager.UpdateShadowRequest(shadowRequestIndex, shadowRequest, updateType);

if (needToUpdateCachedContent)
if (needToUpdateCachedContent && (lightType != HDLightType.Directional ||
hdCamera.camera.cameraType != CameraType.Reflection))
{
// Handshake with the cached shadow manager to notify about the rendering.
// Technically the rendering has not happened yet, but it is scheduled.
Expand Down