Skip to content

Fix culling of reflection probes that change position #121

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 4 commits into from
Apr 15, 2020
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 @@ -529,6 +529,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed various object leaks in HDRP.
- Fixed compile error with XR SubsystemManager.
- Fix for assertion triggering sometimes when saving a newly created lit shader graph (case 1230996)
- Fixed culling of planar reflection probes that change position (case 1218651)

### Changed
- Color buffer pyramid is not allocated anymore if neither refraction nor distortion are enabled
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ internal HDProbeCullState PrepareCull(Camera camera)
if (m_PlanarProbeCullingGroup == null)
return default;

RemoveDestroyedProbes(m_PlanarProbes, m_PlanarProbeBounds, ref m_PlanarProbeCount);
UpdateBoundsAndRemoveDestroyedProbes(m_PlanarProbes, m_PlanarProbeBounds, ref m_PlanarProbeCount);

m_PlanarProbeCullingGroup.targetCamera = camera;
m_PlanarProbeCullingGroup.SetBoundingSpheres(m_PlanarProbeBounds);
Expand Down Expand Up @@ -286,7 +286,7 @@ static void RemoveDestroyedProbes(List<HDProbe> probes)
}
}

static void RemoveDestroyedProbes(PlanarReflectionProbe[] probes, BoundingSphere[] bounds, ref int count)
static void UpdateBoundsAndRemoveDestroyedProbes(PlanarReflectionProbe[] probes, BoundingSphere[] bounds, ref int count)
{
for (int i = 0; i < count; ++i)
{
Expand All @@ -297,6 +297,11 @@ static void RemoveDestroyedProbes(PlanarReflectionProbe[] probes, BoundingSphere
probes[count - 1] = null;
--count;
}

if (probes[i])
{
bounds[i] = probes[i].boundingSphere;
}
}
}

Expand Down