Coming in 3.2: mobile graphics optimizations
Last week, we started talking about Unity 3.2 by giving you a look at one of the updated Standard Assets. We’ll have more to show soon, but in the meantime we wanted to tell you about some of the optimizations that have been made to deliver great looking high-performance graphics on iOS and Android.
Precision of Shader Computations
Unity 3.2 makes much better use of different precision shader computations in OpenGL ES 2.0 shaders. This alone results in a 50%-150% speed increase on more complex shaders. Our GLSL Translator & Optimizer has been extended so that float/half/fixed types in Cg map to highp/mediump/lowp precision in GLSL, and we’ve updated all built-in shaders to use appropriate precision.
We’ve made several tweaks to make normal mapping faster. On desktops, we use “DXT5nm” compression for normal maps, where two normal components are stored and third is computed in the shader – this works great because it allows using DXT5 on the normalmaps. However, the extra computation is not very good for mobile platforms, so we’ve changed the normal map compression scheme there. We’ve also implement assembly optimized skinning for normal mapped meshes — this is now 4x faster than before.
Unity 3.2 will ship with new shaders that are optimized variants of existing built-in shaders. You’ll be able to find them under the “Mobile” category (but they work on other platforms as well!). These new shaders have a few limitations, but the upside is increased performance — the Mobile/Bumped Specular, for example, is 5.2x faster than the Bumped Specular currently shipping in Unity 3.1 (tested on iOS).
There are a number of other improvements that make Unity-created mobile content run faster in 3.2. For example, we’ve optimized the internals of the OpenGL ES 2.0 renderer for lower CPU overhead. We’ve also changed how Unity handles alpha-testing so that those objects are rendered after all fully opaque ones. These and other tweaks and adjustments are all designed to help you get the most out of your mobile game.