1 / 22

GOTTA GO FAST

GOTTA GO FAST. Diagnosing Performance Problems in Unity3D Richard Fine @ London Unity User Group August 2013. Why?. Uh. What?. Sufficiently high overall framerate Ideally 60+ FPS on desktop platforms 30+ FPS on console and mobile Smooth framerate

metea
Download Presentation

GOTTA GO FAST

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. GOTTA GO FAST • Diagnosing Performance Problems in Unity3D • Richard Fine @ London Unity User Group August 2013

  2. Why? • Uh...

  3. What? • Sufficiently high overall framerate • Ideally 60+ FPS on desktop platforms • 30+ FPS on console and mobile • Smooth framerate • Lower, smoother framerate > higher, uneven framerate • Responsive, wait-free experience

  4. Sidebar: FPS • Avoid it - use seconds per frame instead • 30FPS -> 25FPS drop vs 60FPS -> 50FPS drop: • Real times: • 30FPS: 33.3ms 25FPS: 40ms +6.6ms/frame • 60FPS: 16.6ms 50FPS: 20ms +3.3ms/frame • Actually only half the extra work being done!

  5. When? • Integrate it into development • Identify frametime targets/budgets • Run experiments on the target hardware • Impacts development speed

  6. How? • Do fewer things • Do crappier things • Do more than one thing at a time • Do things over multiple frames

  7. Where? • Need to know where to focus your efforts • Efficient use of dev time • Bottleneck principle

  8. Tool #1: Stats Window • Available in all versions of Unity • Quick overview of (mostly graphics) stats • Most important numbers at the top: • Main Thread time • Render Thread time

  9. Time Thread times? Wot? Physics Scripts Culling Render Submission Draw Calls Actual Rendering Main Thread Render Thread GPU

  10. Physics Scripts Time Culling Render Submission Draw Calls Actual Rendering Physics Scripts Culling Render Submission Draw Calls Actual Rendering Physics Scripts Culling Render Submission Draw Calls Actual Rendering

  11. Physics Time Physics Scripts Culling Render Submission Draw Calls ActualRendering Actual Rendering

  12. Physics Time Physics Scripts Culling Render Submission Draw Calls ActualRendering Physics Scripts Culling Render Submission Draw Calls ActualRendering

  13. Physics Time Physics Scripts Culling Render Submission Draw Calls ActualRendering Physics Scripts Wait... Culling Render Submission Draw Calls ActualRendering

  14. Physics Time Physics Scripts Culling Render Submission Draw Calls ActualRendering Physics Scripts Wait... Culling Render Submission Draw Calls ActualRendering

  15. Pick your battleground Physics • If you’re Main Thread bound: • ‘Main Thread’ highest in Stats window • Focus on Physics or user scripts • Having tons of active objects can cause this too • Layer-based culling isn’t fast! Scripts Culling Render Submission Draw Calls Actual Rendering Main Thread Render Thread GPU

  16. Pick your battleground Physics • If you’re Render Thread bound: • ‘Renderer’ highest in Stats window • Too many draw calls and/or complex materials • “Classic” Unity optimization advice - atlas materials, batch objects, improve culling, etc Scripts Culling Render Submission Draw Calls Actual Rendering Main Thread Render Thread GPU

  17. Pick your battleground Physics • If you’re GPU bound: • Shows as Main Thread time, due to the wait. (Sometimes). • Too many vertices, triangles, fragments... • See if it goes away when you change GPU workload • Classic GPU advice: fewer polys, smaller textures, etc Scripts Culling Render Submission Draw Calls Actual Rendering Main Thread Render Thread GPU

  18. Tool #2: Unity Profiler • In-depth breakdown of where time is being spent • Shows other resource levels • Unity Pro only

  19. Demo: Unity Profiler

  20. Unity Profiler Notes • Prefer builds over in-editor profiling for subtle timings • Deep Profiling distorts times heavily • Look into adding in-build capture + load into Editor

  21. In Conclusion... • Understand where the work is being done • Learn what ‘normal’ looks like • Experiment • Check frequently to help isolate when it changed • You can go deeper...

  22. Any Questions? Richard Fine 2013 rfine@tbrf.net @Superpig

More Related