ARM® Guide to Unity Enhancing Your Mobile Games

Version 2.1


Table of Contents

Preface
About this book
Typographic conventions
Additional reading
Feedback
Feedback on this product
Feedback on content
1 Introduction
1.1 About Unity
1.2 About Mali GPUs
1.3 About optimization in Unity
1.4 About the Ice Cave demo
2 Optimizing Applications
2.1 The optimization process
2.2 Unity quality settings
3 Profiling Your Application
3.1 About profiling
3.2 Profiling with the Unity profiler
3.3 The Unity Frame Debugger
4 Optimization Lists
4.1 Application processor optimizations
4.2 GPU optimizations
4.2.1 Miscellaneous GPU optimizations
4.2.2 Lightmaps and light probes
4.2.3 ASTC texture compression
4.2.4 Mipmapping
4.2.5 Skyboxes in Unity
4.2.6 Shadows in Unity
4.2.7 Occlusion Culling
4.2.8 Use OnBecameVisible()and OnBecomeInvisible() callbacks
4.2.9 Specify the rendering order
4.2.10 Use depth pre-pass
4.3 Asset optimizations
4.4 Optimizing with the Mali Offline Shader Compiler
4.4.1 About the Mali Offline Shader Compiler
4.4.2 Measuring Unity shaders with the Mali Offline Shader Compiler
4.4.3 Analyzing statistics from the Mali Offline Shader Compiler
4.4.4 About the Mali GPU pipelines
4.4.5 Additional techniques for reducing pipeline cycles
5 Global Illumination in Unity with Enlighten
5.1 About Enlighten
5.2 The structure of Enlighten
5.2.1 Pre compute
5.2.2 Real-time solver
5.2.3 Baking light maps
5.3 Setting up a scene with Enlighten
6 Advanced Graphics Techniques
6.1 Custom shaders
6.1.1 About custom shaders
6.1.2 Shader structure
6.1.3 Compilation Directives
6.1.4 Includes
6.1.5 The OpenGL ES 3.0 graphics pipeline
6.1.6 Vertex shaders
6.1.7 Vertex shader input
6.1.8 Vertex shader output and varyings
6.1.9 Fragment Shaders
6.1.10 Providing data to shaders
6.1.11 Debugging shaders in Unity
6.2 Implementing reflections with a local cubemap
6.2.1 History of reflection implementations
6.2.2 Generating correct reflections with a local cubemap
6.2.3 Shader Implementation
6.2.4 Filtering cubemaps
6.2.5 Ray-box intersection algorithm
6.2.6 Source code for editor script to generate cubemaps
6.3 Dynamic soft shadows based on local cubemaps
6.3.1 About dynamic soft shadows based on local cubemaps
6.3.2 Generating shadow cubemaps
6.3.3 Rendering shadows
6.3.4 Combining cubemap shadows with a shadow map
6.3.5 Results of the cubemap shadow technique
6.4 Refraction based on local cubemaps
6.4.1 About refractions
6.4.2 Refraction implementations
6.4.3 About refractions based on local cubemaps
6.4.4 Preparing the cubemap
6.4.5 Shader implementation
6.5 Specular effects in the Ice Cave demo

Release Information

Document History
Issue Date Confidentiality Change
0100-00 05 September 2014 Non-Confidential First release
0200-00 23 June 2015 Non-Confidential First release
0201-00 28 July 2015 Non-Confidential First release

Non-Confidential Proprietary Notice

This document is protected by copyright and other related rights and the practice or implementation of the information contained in this document may be protected by one or more patents or pending patent applications. No part of this document may be reproduced in any form by any means without the express prior written permission of ARM. No license, express or implied, by estoppel or otherwise to any intellectual property rights is granted by this document unless specifically stated.
Your access to the information in this document is conditional upon your acceptance that you will not use or permit others to use the information for the purposes of determining whether implementations infringe any third party patents.
THIS DOCUMENT IS PROVIDED “AS IS”. ARM PROVIDES NO REPRESENTATIONS AND NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY, SATISFACTORY QUALITY, NON-INFRINGEMENT OR FITNESS FOR A PARTICULAR PURPOSE WITH RESPECT TO THE DOCUMENT. For the avoidance of doubt, ARM makes no representation with respect to, and has undertaken no analysis to identify or understand the scope and content of, third party patents, copyrights, trade secrets, or other rights.
This document may include technical inaccuracies or typographical errors.
TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL ARM BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL, PUNITIVE, OR CONSEQUENTIAL DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF ANY USE OF THIS DOCUMENT, EVEN IF ARM HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
This document consists solely of commercial items. You shall be responsible for ensuring that any use, duplication or disclosure of this document complies fully with any relevant export laws and regulations to assure that this document or any portion thereof is not exported, directly or indirectly, in violation of such export laws. Use of the word “partner” in reference to ARM’s customers is not intended to create or refer to any partnership relationship with any other company. ARM may make changes to this document at any time and without notice.
If any of the provisions contained in these terms conflict with any of the provisions of any signed written agreement covering this document with ARM, then the signed written agreement prevails over and supersedes the conflicting provisions of these terms. This document may be translated into other languages for convenience, and you agree that if there is any conflict between the English version of this document and any translation, the terms of the English version of the Agreement shall prevail.
Copyright © [2014, 2015], ARM Limited or its affiliates. All rights reserved.
ARM Limited. Company 02557590 registered in England.
110 Fulbourn Road, Cambridge, England CB1 9NJ.
LES-PRE-20349

Confidentiality Status

This document is Non-Confidential. The right to use, copy and disclose this document may be subject to license restrictions in accordance with the terms of the agreement entered into by ARM and the party that ARM delivered this document to.
Unrestricted Access is an ARM internal classification.

Product Status

The information in this document is Final, that is for a developed product.

Web Address

Non-ConfidentialPDF file icon PDF versionARM 100140_0201_00_en
Copyright © 2014, 2015 ARM. All rights reserved.