The Quest 2 has taken up a massive amount of market share within the VR market. It only makes sense to help target and optimize for it!
We look again to Meta for guidance as to what Unity settings work best for the Quest 2. If you’d like to take a look, you can find their configuration guidance here, but I’ll also be going over it in this post. Starting off, let’s switch to the correct platform.
Installing the Android Module
The Quest 2 uses Android as it’s operating system, so in order to deploy and optimize for it, we need to switch to the correct platform. In order to do that, we need to make sure that we have the Android module installed for our current Unity version.
- Navigate to the Unity Hub
- Select Installs on the left hand side
- Locate the version of Unity you’re currently using for your project
- Select the Cog related to the version you’re using -> Add Module
- Select the check marks for Android Build Support, OpenJDK and Android SDK & NDK Tools
- Click continue to install the modules
With that, we have all the Android installations we’ll need to deploy to the Quest 2.
Setting the Target Platform
Now let’s switch to the correct platform in our build settings.
- File -> Build Settings
- Select the Android
- In the bottom right, click Switch Platform
- Texture Compression = ASTC (Adaptive Scalar Texture Compression)
The reason we chose ASTC is due to the fact that it is the most recent format that allows for more flexibility when it comes to compressing our games. In short, a wider range of textures will be able to compress, which will reduce the overall size of our game.
This might take some time to switch over to the new platform, but once done, we’re ready to move onto more specific optimization settings for the Quest 2.
Next, let’s play with the Rendering settings!
Rendering Settings
Changing these settings will help optimize our rendering for the Quest 2!
- Edit -> Project Settings -> Player and look for the “Other Settings” tab
- Under Rendering
- Color Space = Linear
- Graphics APIs – Remove all except for OpenGLES3
- Multithreaded Rendering = True
- Texture compression format = ASTC
- Under Identification
- Minimum API Level = Android 10.0 (API level 29)
- Target API Level = Automatic
- Under Rendering
So what did all that just do?
First we changed the color space to be linear. According to Unity and Meta, this helps produce more realistic rendering. It allows for lights to brighten across shaders linearly as light intensities increase.
Next, we targeted the graphics API OpenGL ES 3.0. Linear color spaces require this graphics API or Vulkan in order to work, but since the Vulkan API’s are still in an experimental phase with the Quest, it’s easier to go with OpenGL ES 3.0 for the time being.
The multithreaded rendering will help improve rendering performance by allowing Unity to separate Graphics API calls into their own rendering thread, which in turn improves performance by taking advantage of a CPUs multiple cores.
We also make sure to set the texture compression to ASTC again here. Although we did set it in the build settings, I’m paranoid and like to make sure it’s set twice.
Last we set the minimum API level to Android 10.0. This isn’t to improve performance. It’s just a requirement by Meta.
Next, let’s play with the configuration settings.
Adjusting Configuration Settings
To fix the configuration settings, we must do the following.
- Edit -> Project Settings -> Player and look for the “Other Settings” tab
- Under Configuration
- Scripted Backend = IL2CPP
- ARMv7 = False
- Armv64 = True
- Install Location = Automatic
- Under Configuration
Last, the install location being set to automatic will allow the operating system decide where is install the application, which another preference from Meta.
Next on the list is fixing how the GPU will render objects in the scene.
Single Pass Stereo rendering
There a few ways the GPU can render objects to a screen. The normal way to render items in VR is by having all objects in a scene be rendered twice for each eye.
The other option is to perform Single Pass Stereo Rendering. This will render an image for both the left and right at the same time. It helps reduce GPU state switching by ping-ponging back and forth with the same object between the left and right eye.
To enable this do the following.
- Edit -> Project Settings -> XR-Pluig-in Management -> Oculus
- Select Android Tab
- Stereo Rendering Mode = Multiview
- Select Android Tab
Last up is the Quality Settings.
Quality Settings
Quality is key in any good VR application and this is how we can get the most out of our Quest 2.
- Edit -> Project Settings -> Quality
- Add Quality Settings
- Pixel Light Count = 1
- Anti – Aliasing = 4x
- Realtime Reflection Probe = True
- Texture Quality = Full Res
- Anisotropic Textures = Per Texture
- Soft Particles = False
- Billboards Face Camera
Now let’s talk about what we’ve done here.
Setting Pixel Light Count to one lets the Unity engine know that our lights in our scene will be more focused on being simple instead of intensely accurate. Realtime lighting is incredibly expensive and this helps put a cap on how much we’re using.
We want Full Resolution for texture so our objects because VR suffers greatly from poor textures.
Anti-aliasing will help reduce the amount of edges we see rendering. We only use 4x to find a balance between quality and performance. We could try 8x, but remember the cost of performance for doing so.
Anisotrpic filtering is involved with how clear textures appear when they are viewed at an angle. By switching this option to “Per texture”, we allow this type of filtering to be determined by each texture. If we chose, Forced On, it would choose the highest anisotrpic level regardless of what the texture was originally set to. Per texture gives us the best option for both quality and performance.
We turn off soft particles for a bit of a performance boost for a small price of having harsher edges on our particle effects.
Conclusion!
That’s it! We’ve set up our project to be optimized for the Quest 2. I’ll dive more into the Universal Render Pipeline and how we can tweek our settings there, but for now! We’re all set.
Pingback: Jaseran Devlog – Setting Up the Project - Brandon Nyman