If you have a VR app, you know how important it is to get the performance right. If your app runs like garbage, users will leave and never return. This means you need to optimize as much as possible, so your app runs smoothly on every device it uses.
Choosing the right platform
The first major decision that you’ll need to make is which platform you want to develop for. The best way to determine the best platform for your needs is by looking at each of its strengths and weaknesses, then using them as a guide for how much time and money you should invest in developing your app.
VR can be either an enhancement or replacement for traditional apps, depending on what kind of experience you’re hoping to achieve. For example, if you are developing an entertainment app or a game, the Unity platform could do well for you. However, you should try Google VR or the Amazon Sumerian developing platform to develop a mobile app for binocular vision.
Picking the right hardware
Choosing the right hardware for your project is an important first step. It’s common to think of this as a choice between developing for PC and developing for mobile, but there are many more options than that. In addition to choosing what kind of device will run your app, you should also consider the form factor of that device: whether it’s a traditional computer, tablet/laptop hybrid, phone/smartphone hybrid (such as an iPhone or Android phone), or something else entirely.
You’ll also need to choose which software development kit (SDK) will work best with your project. There are many SDKs out there; some are free while others charge a license fee or require an annual subscription fee because they include features like analytics or multiplayer chat rooms. While these tools can be incredibly useful when working on large-scale projects where dozens if not hundreds of people need access simultaneously at any given time, they’re only necessary if those features are part of what makes sense within your budget parameters.
Start with a solid foundation
A solid foundation is the first step to a well-performing VR app. It’s important to get this right before you dive into more advanced optimization techniques.
In many cases, a well-designed foundation can lead to performance problems later on.
I’ll use a common example of an application that has problems with its foundation: A game where players can run around in the open world and see other players running around as well. If these players are far enough away from each other, their character models will be too low-poly for the GPU to render correctly; instead, it will show them as black silhouettes because there isn’t enough information for the GPU driver to fill in those pixels with something meaningful.
Shaders are the most important part of your app. They determine how it looks, behaves, and reacts to different inputs. If you have a solid shader code, then you’re already ahead of many other developers in the market.
Your app will use your shaders whether you want them to or not. That means that if there are bugs in your shaders, then those bugs will also appear on other platforms like iOS and Android.
Textures and Textures atlases
In the editor, it is possible to create a texture atlas by dragging multiple images into a single file. This reduces the number of draw calls and textures used in your app.
Creating a texture atlas directly from your code is also possible using Unity’s Texture2D.PackTextures() method. This allows you to specify which images should be packed together into one large image, including where those images are located on disk (which can help save even more space on mobile devices).
Lights and shadows
You can use a lightmap to pre-calculate lighting. A lightmap is an array of values describing how much light bounces off surfaces in the scene, so it’s possible to render objects without calculating the lighting on every pixel. Lightmaps are most useful if you’re creating a game that requires static geometry, but they’re less effective if your game uses dynamic geometry (for example, when objects move around).
A distance field is another way of pre-calculating lighting effects. It’s like storing a 3D grid in your app and using it as an optimization tool for determining what parts of the world are visible from any given point in space. This helps reduce the processing time by only rendering what’s needed on screen at any given moment—saving valuable GPU resources for other tasks like post-processing effects or rendering more detailed textures.
Distance fields aren’t appropriate for all VR apps because they require extra memory and processing power (computationally expensive). However, they’re still worth considering if you need high performance without sacrificing visual fidelity!
More detailed objects replace LOD objects as the user approaches them. LODs can reduce the number of draw calls, polygons, and vertices.
Low-detail models are usually used for faraway objects since they won’t be visible on screen anyway. High-detail models are usually reserved for close-up objects, so it’s best to have a LOD step in between these extremes: low detail at close range and great detail at long range.
LODs should also use texture compression (such as DXT1 instead of DXT5). This can significantly reduce texture size but keep image quality high enough for its intended purpose. Avoiding unnecessary UV seams wherever possible will also improve performance
Optimizing CPU and GPU performance
CPU and GPU performance is critical to the success of your VR app. CPU optimization can be used to reduce latency, while GPU optimization can be used to reduce latency and increase frame rate.
Network optimization is another important aspect of mobile app performance. A typical mobile app can send or receive tens of thousands of messages during its lifetime, and the network will handle a large percentage of these. As such, it’s important to ensure that your applications send only the data they need and minimize any unnecessary network traffic.
These are just some optimizations to consider when building your VR app. There are many more, and we hope this article has given you some ideas! We know a lot of information about optimizing performance for virtual reality games and applications, but finding all of it in one place is challenging. We have helped simplify things by providing a clear overview and specific tips on optimizing each area from start-up time through framerate optimization.