Oculus Performance in Unity Part 4: Fewer Objects

In the last three posts I explained how I have set up tools for performance measurements and have defined a process or recipe for getting fairly consistent and repeatable measurements. In this and the next series of posts, I will try performance improvements, one approach per post, and measure the extent to which it helped achieve the performance goals for Oculus.

As before, I am using the Hand-Painted Island Pack from the Unity Asset Store as the test case. This is one of the environments for my Sharkferno game, and I am working to improve the performance of this game.

For this and each post of this series, I will first describe the change I will make before actually trying it. I will speculate the type of performance improvements that I hope will be achieved. I will then run the change, measure the performance, and report the results. I will write posts like this until the performance goals are achieved within a comfortable margin, or I give up. Hopefully the latter will not happen. 🙂

This post will start with a very simple change. The island scene has many objects. I would like to remove the trees to give the island a less dense look and provide a better view to action that would otherwise be occluded by trees. I will also remove the plants; they are not critical for game play, and I had noticed in the previous posts that frames-per-second suffer when the camera is close to plants.

These changes are easily made by disabling the Trees and Plants parent objects in the Hierarchy.

A single checkbox disables all the Plants in the island scene.

My hope is that disabling the Trees and Plants will reduce the numbers of triangles, vertices, and draw calls.

I tried this using the process described in the previous post. Here are the results:

Frames per SecondCPU timeGPU timedraw calls / frametriangles / framevertices / framedropped frames
Goal90 consistentlyat most 11 msat most 11 ms50 - 1001-2M1-2Mrare, maybe a few at scene transitions
Baseline90 but with downward spikes11.11 ms7.48 ms56191.6M1.8Msome during spikes
Fewer Objects90 but with downward spikes11.12 ms7.89 ms43531.1M1.2Msome during spikes

As expected, this did reduce the numbers of triangles, vertices, and draw calls, although not as drastically as I had hoped. So, this is one step in the right direction, but more improvements will be needed. I repeated the test three times, and each had similar results. One detail that I noticed, which I had been incorrect about, is that the plants on the ground are part of the terrain, not the plant objects. (The latter are actually on top of the high cliffs.) This may partially explain the only modest gains by disabling the Tree and Plant objects.

The good news is that we have a process in place for trying a change and easily measuring its effect on performance. In the next post I will try some changes to quality settings.