In this blog we wanted to get a little bit more technical about some of the necessary considerations we had while trying to make 1600. Let's start with ambitions and expectations because largely on this project we set our own limits. 1600 had the opportunity to be seen by many, used as an educational project in schools, and would be considered a legacy project from the Obama administration. So from the outset we knew we wanted this to look better than anything people had ever seen before in mobile AR and secondly we really wanted to push the narrative potential of the medium by exploring a more film-like story with lots of characters and animation.
These high expectations were met with technical limitations; more specifically building an app that would work on the most recent mobile phones. Obviously when working with mobile applications, one is GPU bound, and so reducing the number of draw calls is of utmost importance. In cases like with this 1600 where the creative direction also requires a lot of moving elements, it becomes a technical juggling act to ensure everything runs smoothly on older devices.
Although the style used in the app might seem deceptively simple, there's actually quite a lot of stuff going on and in order to get everything moving on screen we made extensive use of the dynamic batching feature in Unity. For those that might not know, dynamic batching works in such a way that if you have lot of models that share a material and the individual meshes are of sufficiently low complexity, Unity will dynamically pick them up and send them to the graphics card in a single batch. The magic number that your models must have is less than 900 vertex attributes. With most meshes that means you have to keep your vertex count less than 300, as 300 verts + 300 UVs + 300 normals = 900. It's also important that the material uses a single pass shader.
We made a custom shader for the project so we had the flexibility of tweaking the look of the whole project easily. The shader went through a few iterations to account for creative changes but ultimately it ended up being quite simple. It uses a dot product for front, right and up combined with a colour for each direction that is changed for each season. A bit like a lambert shader with 3 directional lights shining on it. The shadows on the white house are baked, the ground has a simple AO bake and the characters have little blob shadow meshes that are positioned onto the floor below them with a raycast. This way there are no shadows being cast by lights and thus a lot less draw calls than one might normally have. There are actually no lights in the scene whatsoever, everything is done in the shader.
Like any project you need to give deep consideration about how you will make your assets, and with 1600 the ability to have that high-end visual render coupled with the amount of movement is really a testament to these optimization processes which were conceived from the design stage.