Preparing your DK2 VR application for Oculus CV1
The consumer release of the Oculus Rift is coming soon - in just months not years! Here’s how you can prepare your VR application for CV1 by testing with a DK2.
Note: let’s assume things out of our control – like drivers and the Oculus runtime – don’t improve significantly (they certainly will).
DK2 vs CV1 rendering
The Oculus DK2 has a 1920x1080 display that refreshes at 75fps. However, your VR application is rendering to a much higher resolution eye texture (or render target): 2364x1461. That’s a 1.66x render scale over the native display resolution. We do this to ensure a 1:1 texel to pixel resolution on the display after the distortion warp.
Unlike the DK2, the Oculus CV1 is a 2160x1200 display fixed at 90fps, by default rendering 400 million pixels per second compared to the DK2’s 259 million pixels per second. Using the same 1.66x render scale, I estimate the CV1 has a default 2830x1566 pixel render target.
Jumping from DK2 to CV1, we need to render roughly 1.55 times more pixels per second.
Simulating CV1 rendering performance by using the DK2
Here’s a simple trick to test how well your application will perform on the CV1, without having access to CV1 hardware.
By modifying the render scale, we can render at much higher resolutions. This is great for improving the quality of your application at the tradeoff of performance. By supersampling from a larger render texture, you will get nicer antialiasing and it becomes easier to read text.
To simulate CV1 performance, we can attempt to render 400 million pixels per second on the DK2. For example, a 2954x1800 render texture at 75fps is roughly 400 million pixels per second.
In Unity, we can modify the render scale with
VRSettings.renderScale. The default
1.0f renderScale is a 1:1 texel to pixel ratio, creating a 2402x1464 render texture. If you set the render scale to
1.23f Unity will use a 2954x1800 render texture.
VRSettings.renderScale = 1.23f
If you are able to achieve 75fps at a
1.23f render scale in Unity, you will be able to achieve 90fps on CV1.
I tested this by checking the render target resolutions used in OVRDisplay. There are more factors involved here, but I think this simulates how your application will perform on the CV1 using your existing DK2 hardware. Note, this technique only tests rendering costs. On the CV1, you will have to draw a frame within 11.1 milliseconds in order to maintain 90fps. Testing at 75fps on the DK2 gives you 13.3 milliseconds to draw a frame, therefore not fully replicating how your application will perform on the CV1.
Improving Performance for CV1 with one magical line of code
If you cannot hit 75fps at a
1.23f renderScale, there are dozens of optimizations you can do with your code and assets, from batching and texture atlasing to occlusion culling and more.
One lazy, simple trick is to use a lower resolution render target. While higher resolution render targets provide many visual benefits, it does come at a performance cost. Instead of rendering 400 million pixels per second, you can lower the render scale until you’re able to hit 90fps.
If you can only achieve 75fps on the DK2 and have no time to make any performance optimizations, you can hit 90fps on the CV1 by setting your Unity renderScale to roughly
0.66f. This is just an estimate, but the general principle applies: if you can’t hit 90fps and you don’t want to resort to time warp, lower your render target resolution to trade visual fidelity for performance.
On a related note, my previous blog post covers Unity performance optimization tricks.
If you enjoyed this blog post, you should follow me on Twitter: @dshankar