Performance tips and tricks for mobile devices
Table of Contents
Open GL ES 1.1 vs 2.0ShiVa's mobile engines come in two flavors, or rather: two different APIs, Open GL ES 1.1 and 2.0 - both can be useful, and each can be better than the other in certain circumstances.
Open GL ES 2.0Version 2.0 is the one you should use by default. It supports shaders, multiple layers of textures, post processing, everything you would expect from a modern graphics engine. Games running in Open GL ES 2.0 mode will look like their unexported counterparts in the ShiVa Editor.
LimitationsThere is some overhead for OpenGLES 2.0 on SGX hardware. On older hardware, even the simplest ES 2.0 shader works better using the ES 1.1 pipeline. This is not the case on Adreno, Tegra or comparable GPUs.
Only directional dynamic shadows are supported in OpenGL ES 2.0, and only with one cascade, no PCF, no screen space blur. Normal attenuation is supported but adds some additional shader instructions.
Post processing effects like motion blur require a 32bit output buffer, which can be selected in the Authoring Tool for most mobile platforms.
Performance TipsLimit your lights per object. Vertex lighting is faster than per pixel lighting. Also, specular lighting and Fresnel are performance killers.
Avoid excessive use of alpha belnding and transparency whenever possible. If you have to use transparency/alpha,
- uncheck "use z shell" when possible
- avoid using "alpha ref"/"transparency threshold" (leave it at 0)
- uncheck "depth write" when possible
On PowerVR chipsets, 1 bit alpha is as slow as 8 bits alpha (unlike PCs).
Use Texture Compression as much as possible. As for texture filtering, the fastest mode is "Nearest" (with mipmaps), then "bilinear" (again with mipmaps).
Open GL ES 1.1This can be considered a fallback mode, since it offers much less visual effects than ES 2.0 - however it runs much faster and is sometimes the only option on very old hardware, especially in the Android world.
LimitationsTextures need to have an aspect ratio of 1:1 (square) and a power of two (e.g. 8x8, 16x16, 64x64; 64x128 f.i. is bad) with a minimum size of 8x8 and a maximum size of 1024x1024. You can only have 2 textures per material, either color + shadowmap or Effect Map 0 and 1 blended together by "modulate" or "saturate" only. Transparency/alpha is possible, but not recommended for performance reasons. TextureClips and texture modifiers (scrolling/scaling) are accepted. Texture filtering mode defaults to bilinear mipmapped.
Effects like normal mapping, specular mapping, environment/sphere mapping, reflection, refraction are not possible. Fog works.
Up to 8 dynamic lights per scene can be handled by the hardware, while "receive per vertex" is the only accepted material setting. No dynamic shadows allowed. You can fake dynamic shadows with a flat black (transparent) sprite that lies flat on the ground if needed. Static shadows are no problem, but remember the 2 textures per material limit, and the shadowmap takes one of these slots.
Camera view distance is unlimited, but relies on a 16bit z-buffer, so be careful: Keep the range as small as possible to avoid z-fighting (sawtooth effect on overlapping surfaces).
Our recommendation for the maximum amount of polygons visible at the same time is 7.000, limited by 24Mb texture + vertex buffer memory.