Skip to content

Conversation

JulienIgnace-Unity
Copy link
Contributor

@JulienIgnace-Unity JulienIgnace-Unity commented Nov 27, 2020

Purpose of this PR

Requires Ono PR: https://ono.unity3d.com/unity/unity/pull-request/123697/_/terrain/getactiveterrainsnoalloc

When using OnDemand reflection probes, unwanted performance spikes were occuring. This PR aims at improving this by doing several things:

  • Removed some GCAllocs in probe internal creation code
  • Stopped cleaning up cameras used for probes to avoid reallocating them and their volume stack (which was very costly)
  • Stopped updating the volume system for Lighting Override when it's not used
  • Disable cleaning up of terrain camera data for probe cameras (this is what requires C++ change)

This should improve https://fogbugz.unity3d.com/f/cases/1293225/


Testing status

Tested the small repro project provided in the fogbugz case.
Spikes should be much improved. There should still be smaller spikes because we do render the probe regularly (so 6 more camera renders) but antyhing else than rendering should be mostly gone.
It might be worth testing Detail Renderer (is that even supported in HDRP?) as it may have been impacted by the C++ change.
Also, checking the original user project would be good.

@Unity-Technologies/gfx-qa-hdrp here's a link to an editor with the C++ changes required to run the HDRP branch: https://bokken-artifacts-ui.bf.unity3d.com/katana-production/proj0-Build_WindowsEditor/39048765_11_01_2021_22_20_11_+0000/build/ZippedForTeamCity.zip

Disabled ApplyMaterialPropertyDrawers when rendering HDRP to avoid unwanted perf spikes
@github-actions github-actions bot added the HDRP label Nov 27, 2020
@github-actions
Copy link

It appears that you made a non-draft PR!
Please convert your PR to draft (button on the right side of the page)
and cancel any jobs that started on Yamato.
See the PR template for more information.
Thank you!

@JulienIgnace-Unity JulienIgnace-Unity marked this pull request as draft November 27, 2020 13:08
Copy link
Contributor

@TomasKiniulis TomasKiniulis left a comment

Choose a reason for hiding this comment

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

With the PR there is 40ms improvement, but discussing with Julien it seems that majority of ms time is still taken by "CullScriptable" on user project(https://forum.unity.com/threads/hdrp-enable-camera-is-really-slow.988695/). It still uses up to 175ms which causes frame stutters.

Attaching my findings:
EmptyProject with terrain enabled:
image

PR DeepProfile
image
trunk master DeepProfile
image

PR without DeepProfile
image
trunk master without DeepProfile
image

JulienIgnace-Unity and others added 13 commits December 16, 2020 16:03
… into hd/improve-ondemand-probe-perf

# Conflicts:
#	com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs
Co-authored-by: Sebastien Lagarde <sebastien@unity3d.com>
* Not checking NdotL since it's not really valid for area lights (We have multiple valid light directions, not one)

* Changelog

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>
#3035)

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>
* Fixed ShaderGraph decal draw order

* Updated changelog

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>
* Fixed access to invalid Contexts references after exiting playmode.

* Fixed comparison gizmo after playmode.

* Fixes from PR feedback
… conserving specular color option for the specular input parametrization (similar to case 1257050) (#3060)
…phics into hd/improve-ondemand-probe-perf

# Conflicts:
#	com.unity.render-pipelines.high-definition/Runtime/Lighting/ProbeVolume/ProbeVolumeLighting.cs
#	com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Camera/HDCamera.cs
@JulienIgnace-Unity JulienIgnace-Unity marked this pull request as ready for review January 12, 2021 13:10
@github-actions github-actions bot added the SRP label Jan 12, 2021
@JulienIgnace-Unity JulienIgnace-Unity changed the base branch from master to hd/bugfix January 12, 2021 13:21
Copy link
Contributor

@TomasKiniulis TomasKiniulis left a comment

Choose a reason for hiding this comment

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

Looks good now! Testing the user project TryCull() method goes down from 180ms to 20ms!
trunk master
image (3)
PR
image (5)

Adding a lot more additional details on terrain does not cause a significant spike anymore.

Base automatically changed from hd/bugfix to master January 14, 2021 10:52
… into hd/improve-ondemand-probe-perf

# Conflicts:
#	com.unity.render-pipelines.high-definition/CHANGELOG.md
#	com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs
@sebastienlagarde
Copy link
Contributor

@sebastienlagarde
Copy link
Contributor

… into hd/improve-ondemand-probe-perf

# Conflicts:
#	com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs
… into hd/improve-ondemand-probe-perf

# Conflicts:
#	com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs
@sebastienlagarde sebastienlagarde merged commit f52392a into master May 7, 2021
@sebastienlagarde sebastienlagarde deleted the hd/improve-ondemand-probe-perf branch May 7, 2021 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants