[URP] Fix Gfx.WaitForPresentOnGfxThread Spikes from High Far Clip Plane
Solution
Unity 2021.x - Unity 6.3.x
Published Mon, May 4
Performance degradation occurs during scene transitions, characterized by spikes in the Gfx.WaitForPresentOnGfxThread marker. Despite using SceneSystem to unload your script and entities, the rendering load accumulates, suggesting a bottleneck in how the Camera processes the Far clipping plane.
High Far clipping plane values cause excessive over-rendering and GPU stalls, manifesting as Gfx.WaitForPresentOnGfxThread in the Profiler.
The Gfx.WaitForPresentOnGfxThread bottleneck during scene transitions is primarily caused by a Camera configured with an excessively large Far clipping plane. Setting this value too high forces the GPU to process depth for a massive volume, resulting in overdraw and cumulative rendering load.
To optimize performance, adjust the Far clipping plane:
- Locate the active
Cameracomponent in your script. - In the Inspector, find the Clipping Planes section.
- Lower the Far value to the smallest distance possible for your environment.
- Check if multiple cameras are active, which compounds the Far plane calculations.
Additional Tips
- Use Occlusion Culling to prevent the GPU from processing objects hidden from view.
- Enable the Frame Debugger to see if specific draw calls are hitting the Far plane limit.
- If using VSync,
Gfx.WaitForPresentOnGfxThreadmay also indicate the CPU is waiting for the monitor’s refresh rate.
Related Posts Haven't quite found a solution to your problem? We think these posts might help you.
Content inspired by a Unity discussion post.