Category

Trial By Error

Increase performance for mobile VR

By | Programming, Trial By Error | No Comments

Making sure your application is optimized for VR is much more important than non-VR projects. This is because VR requires 60 – 90 FPS in order to give users a natural experience. If you fall below the 60FPS target than most likely users will start to feel sick.

Optimization

Optimizing your game or experience can vary depending on what is required as an end result. If you are able to make an experience that doesn’t need to be photorealistic, then changing from deferred rendering to forward rendering will save you a bunch of GPU cost. This is a quick cheap way of gaining performance but isn’t ideal if you want to achieve photo realism. Mainly due to the fact that forward rendering uses per-pixel lit mode for the brightest lights then uses per-vertex for up to 4 additional point lights. Every other light is computed as Spherical Harmonics (SH) which are just an approximation. If your goal is to achieve photo realism you will want to go with deferred shading which treats every light source per-pixel.

Baking

Baking is a good way to improve performance in your scene while maintaining the visual quality you need. In order to do this bake out the lighting data in your scene by marking objects as static and enabling global illumination in the enlighten engine. Keep in mind that when an object is marked static it cannot be affected by the physics pipeline. If you are required to have objects which move around in the scene then you will need to ensure that you have all your light probe volumes setup correctly to ensure the indirect lighting affects your dynamic objects.

Baking reflection probes is also a quick way to gain performance. As long as your reflective surfaces don’t need any real-time data (i.e. dynamic object reflections) you should almost always bake this out.

Draw Calls

To reduce the number of draw calls, simply start marking objects which share the same materials as static. This will allow the renderer to batch like materials and reduce the number of draw calls. It is better to use a texture atlas if you have multiple small textures and combine them to a shared material.

 

Occlusion Culling

We now need to start reducing the number of polygons rendered at any given time. Mobile VR is not very friendly when it comes to the number of polygons it can process, and based on today’s technology it is preferred to keep the poly count below 50k. In order to achieve this the first and most important place to start is to get back with your artist and re topologize any high poly art assets and optimize at the mesh level as much as you can. Now once you have your scene set up the way you want we need to enable occlusion culling. This process disables any geometry that is occluded by any other geometry at runtime. In order to see objects which are overdrawn look at the overdraw scene and start marking objects as occluder static, go to the occlusion culling window and make out the occlusion data.

 

Compression

Compress your art assets to the smallest size possible while trying to maintain the quality needed to pull off your scene. I know this kinda goes without saying but you’ll be surprised at how much memory you will save at the cost of minor quality degradation. This obviously depends on how many textures you have in a given scene but, every bit of performance gain counts.

Friends Don’t Let Friends Use Interfaces on MonoBehaviour Objects

By | Programming, Trial By Error | No Comments

Interfaces are great and solve many problems in the world of programming, but recently I have come across a scenario where they cause more harm than good in Unity. I am currently developing a VR zombie shooter game which I will simply call ZNN VR since I have yet to decide on a final name yet. You can read up on the current state of the game here.

The Problem

Since we are targeting Vive and Oculus Touch for ZNN VR  we needed to somehow handle switching between the two. The most obvious answer is to detect which headset is being used and programmatically tell the game to use the appropriate game objects. However, everything external to that should be agnostic about which device we are using so we don’t complicate our code with unnecessary if conditions. Read More

Solved: Samsung GearVR application closed unexpectedly

By | Trial By Error | No Comments

As we were preparing to submit our final build of Acorn Assault VR: The Ride to the Oculus store, we encountered a critical app crash during the app launch process via Oculus Home. The message displayed upon selecting our title from the menu read “Acorn Assault VR: The Ride has closed unexpectedly”, which is not a very useful error message. Instead of trial and error, it was time to configure logcat over TCPIP. This is a much-needed step because you can’t debug your VR title via USB debugging since the port is being used by the VR headset. Here are the step by step instructions on getting adb over tcpip setup: Read More