So far I have established a recipe for getting repeatable performance metrics, have taken baseline metrics on the island scene, have seen that they were initially far from the required goals, especially in terms of number of draw calls, but have managed to reduce that number by almost 70% by removing some unnecessary objects from the scene and by using culling techniques.
We achieved a substantial improvement in the last post by “baking” occlusion data, in other words by performing a lot of geometric calculations ahead of time instead of at runtime. We can similarly improve performance by “baking” or precomputing lighting effects such as shadows, as explained in the Unity Manual. This improves the number of draw calls by more than half, from 1690 to 754.
Now let’s try something very obvious. In fact, some people may have tried this first. The island asset has a default Quality Setting of Ultra on PC. What would be the effect of lowering this? I defined a new quality level called “VR quality” which differs from the Ultra settings in a number of ways, all of which should improve performance and the expense of graphics quality. In particular:
- Texture Quality is reduced from full to quarter resolution.
- Using only hard shadows rather than hard and soft.
- Medium rather than high resolution shadows.
- A much smaller shadow distance.
When I tried this I was surprised by the results. The metrics were almost identical to the previous test, even with these changes in quality values. I do not know the reason for this. Perhaps the baked lighting resulted in most of the benefit already, so that these changed quality settings had little additional impact on performance. If any readers have more insight on this, please leave comments below this post.
Frames per Second | CPU time | GPU time | draw calls / frame | triangles / frame | vertices / frame | dropped frames | |
---|---|---|---|---|---|---|---|
Goal | 90 consistently | at most 11 ms | at most 11 ms | 50 - 100 | 1-2M | 1-2M | rare, maybe a few at scene transitions |
Baseline | 90 but with downward spikes | 11.11 ms | 7.48 ms | 5619 | 1.6M | 1.8M | some during spikes |
Fewer Objects | 90 but with downward spikes | 11.12 ms | 7.89 ms | 4353 | 1.1M | 1.2M | some during spikes |
Culling | 90 with very occasional downward spikes | 11.11 ms | 8.02 ms | 1690 | 459K | 532K | some during spikes |
Baked Lighting | 90 with very occasional downward spikes | 11.12 ms | 7.99 ms | 754 | 191K | 219K | some during spikes |
Reduced Quality Settings | 90 with a spike at startup | 11.11 ms | 8.19 ms | 734 | 181K | 206K | during spike |
The current number of draw calls, 734, although reduced from the original 5619, is still not as low as the value of 100 recommended by Oculus. There are still a couple of things to try, to be explained in the next post…