The introduction of mobile AR means the arrival of more accessible devices, and for developers, a broader range of consumers to target. The good news is that you're "already ready." A stable of universal techniques and best practices can help reduce draw calls and maximize performance without sacrificing fidelity across Gear VR, Oculus Go, and Project Santa Cruz. We'll start with an overview of the devices and basic considerations, and go step by step through the process of reviewing and optimizing textures, scene geometry, and lighting. Attendees interested in Project Santa Cruz will also benefit from an introduction to Unity's profiling workflow.
Gabor Szauer - Oculus
16. Renders model twice
First render is the model
projected onto plane
No self shadowing
Same limitations as blob
shadows, but looks better
Planar Projection
Shadows
17. Environment should not be lit
in real time
Bake lighting / shadow maps
4096 is a pretty good size
These settings are very
project dependent.
Bake Lighting Data
19. Sample light map to make moving
object kind of match lighting
Start with a recast down, then:
Renderer.lightmapIndex
LightmapData.lightmapColor
RaycastHit.lightmapCoord
Sample light map
for shadow value
34. Try to get Render Texture
Switches down to 0 if
possible
* Not possible if using
real time shadows
Reduce Resolves
35. Avoid Using Post Effects
Add quad in front of camera
Fade quad to fade scene
Screen Fade
36. VR.WaitForGPU = Wait for Vsynch
If you are making frame rate, there
should be a few milliseconds
of VR.WaitForGPU
Frame Times:
30 FPS = 33.3 ms
60 FPS = 16.6 ms
72 FPS = 13.8 ms
Reading the profiler
43. Example: Frame Breakdown
A single frame takes 21.2 ms and waits 12 ms for the next vsynch
The current total frame duration is 33.3 ms
To run at 60 FPS, the frame needs to finish in 16.6 ms
To hit the 60FPS mark, at least 5.2 ms has to be optimized away from this frame
* This example assumes everything runs on one thread to make it easy to read
44. CPU or GPU Bound?
If the frame rate improved, the game was GPU Bound If the frame rate dod not improve, the game was CPU Bound
To determine if a game is CPU or GPU bound: Don't render anything!
46. If the game is GPU bound, it
can be Vertex of Fill bound.
To determine which, change
render scale to something
small, like 0.01
Did performance improve?
Yes - Fill / Fragment Bound
No - Vertex Bound
GPU Bound
48. Simplify meshes which contain
too many vertices
Consider combining meshes to
reduce draw calls
Cull invisible meshes and
enable LOD on meshes
Vertex Bound
49. Rinse and Repeat
Disable all rendering.
Did performance improve?
GPU or CPU
Bound
No CPU Bound Use instrumented profiler
GPU BoundYes
Vertex or Fill
Bound?
Set render scale to 0.01
Did performance improve?
No
Yes Fill Bound
Vertex Bound
Simplify Shaders
Simplify Geometry
Combine Geometry
Reduce Draw Calls