Striking a delicate balance between beautiful virtual art and smooth performance.
Developing a game for mobile poses a lot of challenges when balancing beautiful art with great performance, especially with mobile VR development. Keeping that framerate buttery smooth is usually a result of programmers and artists digging into the project, making compromises, and eventually coming to a shaky truce.
With our Gear VR title, Hidden Fortune, we had to be innovative with finding efficiencies, and explored several methods to maintain a high performance level while keeping things pretty.
Lighting A World
Because Hidden Fortune is a hidden object game, we needed a lot of fun objects to exist in the game world together. This presented a couple puzzles for the team: how do we create some great assets quickly, and how do we keep the phone from bursting into flame? One proposed solution was to create a shader that would simulate lighting. This would mean no need to create lightmap UVs or troubleshoot lighting issues.
Unfortunately, we found this shader caused some artifacting at certain angles and also made our vibrant world look a bit flat, which is not ideal for a VR game. So we decided to tackle baked lighting. Unity 5.0 had been recently released with a new lighting system for us to learn; as soon as we implemented it, the game looked sweeter in an instant!
Our environment artist quickly created new lightmap UVs for the environment and props that needed them with Unity’s built-in “Generate Lightmap UVs” mesh import setting.
Since players will be collecting these props, we also needed to consider how to deal with any shadows left behind once the object was removed. So we turned off “cast” and “receive” shadows, allowing the ambient light occlusion to do its magic. We also baked objects into one mesh to save on draw calls. Individual objects are enabled when the player is close and trying to find them. This also makes it easier to cull the meshes when the player can’t see them, vastly pumping up performance.
The key was to set up the scene in such a way that all the key environment assets would cast nice shadows, without receiving any from the dynamic trinkets the player would be collecting.
In Full Colour
Below is an overhead shot of Outcast Cove, which provides the setting for Hidden Fortune’s first chapter. We chose an orange colour palette for the lights to compliment the cold blue of the cave’s stone. Note that the lights have some variation (purple, pink, yellow, and orange); this helps bring the scene to life and introduce a touch of magic.
We also use Non-Directional lightmaps, which means we don’t have any shiny specular highlights to worry about. I don’t know about you, but clean, beautiful lightmaps get me excited.
Bringing Illustrations To Life
Another decision we made was to employ the fantastic painting abilities of our concept artist for our characters. The challenge here was seamlessly integrating 2D sprites into a 3D world; with the help of some clever animation and a grounding contact shadow, they started to fit right in.
We will definitely be using everything we learned from playing around with built-in Unity tools and our own tricks for culling and combining objects to keep framerate high without sacrificing art quality. I should mention we used the “Mesh Baker” plugin from the Asset store to combine and atlas our models and textures to reduce their draw calls.This tool was invaluable as it made combining meshes easy as pie.
Between a few clever tricks and Unity’s light baking system, we find ourselves with a game that not only runs like melted chocolate, but is just as delicious.