18 Optimization Techniques for Mobile and VR
- Thou Shalt Remember the Goal
- Thou Shalt Know Thy Polybudget
- Thou Shalt Know Thy Bottlenecks
- Thou Shalt Have One Mesh to Rule Them All
- Thou Shalt Keep Your Textures Svelte: Keep
- Thou Shalt Bake Thy Lights
- Thou Shalt Use LODs Wisely and Sparingly
- Thou Shalt Cull!
- Thou Shalt Throw Shade(rs)
- Thou Shalt Profile
- Thou Shalt Optimize Scripting
- Thou Shalt Test and Version
- Thou Shalt Recycle!
- Thou Shalt Fake it Rather Than Make it
- (VR Specific) Thou Shalt Not Be Transparent
- (VR Specific) Thou Shalt be Even Stringier than Instructed
- (VR Specific) Thou Shalt Keep Thy Shadows Light
- (VR Specific) Thou Shalt Not Make Thy Players Hurl
Imagine! You just got done producing game assets that could set the red carpet on fire with their gorgeous looks and polish. But oh no! The engineering team kills your buzz, saying you can’t use them or the game will instantly trip and fall. Villains! And yet you can’t ignore them because the last thing you need is a wardrobe (or game) malfunction on the red carpet.
You’ve just produced some very expensive, very heavy digital paperweights.
I’m sure every artist and producer has gone through this terrible feeling in their early days.
But it’s not all doom and gloom! Asset optimization is a thing! It’s like oxygen for mobile and VR games. You don’t particularly notice it when it’s there but its absence can be sickening (literally at times). It allows you to make a head turning, smooth-playing game. And I promise you won’t turn grey by the time it loads.
So what makes VR/Mobile optimization so tricky? Well, simply put, the hardware powering your mobile/VR device isn’t as powerful as it is in PC or consoles. It needs to get a lot of visual bang for its resources. And this optimization jungle gets even twistier when you have a cross platform game.
Confused? Don’t be! We have an optimization ninja sensei who can teach you the basic defense tactics you need to not fall flat on your face in asset optimization. Right here, right now, in this article.
Without further ado, grasshopper, let me introduce our Art Director, Adnan Ayub. He’s been optimizing assets since Saving Private Ryan came out. (Look up when that was, you may be surprised) He’s the man behind projects like board-game-turned-RPG Dungeon Lords, remaking the beautiful interactive environments of Geve for VR and creating training simulations for Leica geosystems.
Are you serious about wanting good looking assets without setting the user’s device on fire? Then listen up!
- Thou Shalt Remember the Goal: This may sound obvious, but stop skipping ahead. Write this following statement out and stick it on the forehead of the coworker who sits across from you: The goal of optimization is to reduce the per frame cost as much as possible both for the CPU and GPU.
- Thou Shalt Know Thy Polybudget: Maintain a target FPS and polybudget for the entire game. This number will be critical from the very beginning to the very end. What style should we use? How many characters can we have? How detailed should each environment be? Know that every decision has an implication for your Polybudget. This number is the Testament. Do not cross it.
- Thou Shalt Know Thy Bottlenecks: It’s important to identify where the bottlenecks lie and optimize those areas first. Performance issues are generally related to two types of hardware: CPU and GPU. Normally, the CPU is more involved with logic, populating the scenes and managing the states while the GPU looks after the texture sampling, shading, rendering etc.
- Thou Shalt Have One Mesh to Rule Them All: Having multiple meshes within single objects is a performance murderer. Try to keep one mesh for per object wherever you can.Also, combine meshes/textures where possible to reduce performance load – it reduces draw calls.
- Thou Shalt Keep Your Textures Svelte: Keep the texture map size as low as possible depending on where they are on the screen and how often they’re seen. For objects that are permanently in the far distance, for example, texture sizes can be significantly lower. Bonus tip: it’s common practice to use texture formats that support MIP texture maps. Having multiple sizes of textures within an image means you can pick the appropriate one based on the distance from the camera. Some game engines do this automatically so go through your engine documentation first.Texture aliasing is also an effective technique to optimize the number of draw calls and therefore the memory used – it involves combing the textures of different objects that use the same material.
- Thou Shalt Bake Thy Lights: Light baking is a common technique that saves a TON of resources by pre-calculating all the real-time lights onto textures directly. Almost all game engines offer this feature. If resources are a concern, always use light baking, especially when it comes to large game levels with lots of lights involved.
- Thou Shalt Use LODs Wisely and Sparingly: LOD is the Level of Detail of a given game object. This technique is used by game engines to reduce performance load by switching between different levels of detail objects for each asset in the game based on the distance from the viewer. Reserve it mostly for large scenes with lots of objects. Using this on small scenes can cause performance load. In a small room where all objects have the same distance relative to the viewer, it’s not effective to use LOD objects.
- Thou Shalt Cull!: Object culling is an effective technique where the camera does not render objects behind other objects. So do a proper setup for object culling based on your game engine settings. In large scenes object culling is a life saver.
- Thou Shalt Throw Shade(rs): Generally, opaque shaders are lighter than transparent ones so keep the number of transparent shaders as low as possible.
- Thou Shalt Profile: Unlike the nasty business at airports, profiling is great in games! It’s used in game editors/engines to identify any indicators that are causing spikes in performance and lowering the FPS. After identification, go in hard and get the culprit. Bonus tip: if your scene is running fine in the editor but sluggish in play mode then the most probable suspect is scripts. But if the opposite is true, individual game objects in the scene probably need optimization. To identify individual assets causing FPS drops turn each object in the scene on and off while monitoring the profiling graphs.
- Thou Shalt Optimize Scripting: Hate to break it to you, but this involves a thorough investigation of the game code architecture and removing or replacing the problematic parts in the scripts. Sorry. No easy skip here.
- Thou Shalt Test and Version: Optimization isn’t something you do at the end of a project, if you’re smart. If you test throughout, you can identify issues as soon as they arise. Trying to fix 6 months worth of errors at once is like looking for a nausea inducing needle in a haystack, in the dark, at zero gravity. It’s not fun.
- Thou Shalt Recycle!: Develop a plan in advance to re-use as many models, materials/textures as possible. Set up rules based on the initial planning and decided draw call limit for how many polygons a mesh can have and how many materials a mesh can use. This is helpful in handling the performance in early stages.
- Thou Shalt Fake it Rather Than Make it: Don’t be tempted to bust your polybudget to add visual flair. Use techniques to fake the visuals. Like, instead of using real-time shadow, fake it with a soft texture blob beneath character. Think of VR content building in terms of early 3D development for mobile devices.
- (VR Specific) Thou Shalt Not Be Transparent: Use transparency only where it’s really needed and wherever possible try to fake it. You’ll thank me later.
- (VR Specific) Thou Shalt be Even Stringier than Instructed: Make sure that you always have extra buffer over the one recommended by the Head Mounted Display manufacturer. This keeps the frame rate in check. HMD Systems are technically rendering two cameras simultaneously, so these systems require really hardcore optimization practices and disciplines. TIP: graphical styles with simple details and shaders and few polygons can often give as convincing a VR experience as realistic graphics that have a much higher rendering cost.
- (VR Specific) Thou Shalt Keep Thy Shadows Light: Large scenes populated with tons of objects have a considerable resource cost when using real-time shadows. Optimize shadows as per the documentation of the editor you are using. For example, in Unreal Engine, consider limiting the Cascades as they can cost a lot of bandwidth Use fake shadows wherever possible
- (VR Specific) Thou Shalt Not Make Thy Players Hurl: Nausea is a common problem ruining the VR experience. But we’ve got it covered!
- Test with a variety of users and don’t rely on developers for simulation sickness test as developers tend to be used to VR headsets, and so experience less sickness compared to the general user.
- A mismatch between the field of view of the camera and the device’s recommended value can also cause discomfort. Use the recommended field of view value from the headset. It’s best to use automatic settings from the SDK.
- Walking Bob effects for camera are not recommended in VR as they cause motion sickness.
- Ditto for camera shake effects.
- Similarly, don’t have your avatar use the stairs as moving up and down quickly can also cause sickness. Instead, use lifts and elevators where applicable.
- Ensure player speed is constant. Gradual acceleration after starting is a bad idea here.
Thanks Adnan! So, are you feeling more hopeful you can have great looking assets in mobile/VR games? Don’t let the limitations of their hardware stop you from getting what you want!
Go ahead try these techniques in your next game. They’ll do wonders!
And if you have a project in mind that’s you know is going to be a beast to optimize but aren’t quite sure what it’ll take, there’s no need for guesswork. Fill out the form below!