WORK WITH HARDWARE LIMITATION – Baking Shadow and reducing Draw calls
To optimize the performance on Google Pixel, we used forward rendering with MSAA without shadow. As a side effect, we have to bake the shadow if we want the scene to look more realistic.
Instead of using Unity’s own lightmap, I did several tests and decided to bake shadow and ambient occlusion in Maya and compose them together in Photoshop. It gave me more artistic control.
After several playtest, when our experience got more complete, we found that heating of the device became a big issue. Google Pixel would lag if it heats up too much. The way to fix it is to reduce draw calls. It is usually the most expensive part of the application.
After some research, I found there’re several ways to reduce draw calls:
- Texture Atlases, which was too late for us to use at that time
- In our code, do not make an instance of a material: use sharedmaterial instead.
- Mark object as Static and use Static/Dynamic Batching
We used Daydream’s Performance Hub to monitor the heating up and Unity’s Frame Debugger to monitor the draw calls. It drops a lot after we did the modification and we were able to run our experience for 40 minutes, which is about one class’s time.