Page cover image

Optimization Tips

  • To reduce shader memory and size, be sure to configure your Shader Stripping settings under Project Settings->Graphics. Set the Lightmap Modes and Fog Modes to only what you need. For example, if you do not use exponential fog or baked lighting, removing them will reduce the shader size. This can have a big impact on larger projects, so be sure to do this!

  • (Pro feature) Shader Stripping flags are available on a per-material basis. This is an advanced feature for larger projects I recommend touching only if you know what you are doing. It provides hints to the shader stripping process during the build process to optimize the build size and memory of the shader. For example, if you have Fog enabled on a project-wide setting, but then know that fog is not needed on a certain material, you can select Fog Disabled and the fog variants for that material will not be generated. If an incompatible setting is detected, an error color will be output. It's a good idea to make an actual build to verify the results when using these stripping flags, as they only work on builds. That said, on a major project, these flags can help squeeze every ounce of performance.

  • If your game is running slowly, the first thing to try is disabling some of the features. OmniShade is fast, but in the sense that it calculates only the minimal it ever needs. If you enable too many effects, it will slow down. Also, some features are enabled by default for general usage, but every enabled feature costs a little performance so disable what you don't need.

  • On lower end devices, using many textures and layers, or the contrast settings can impact performance. It is worth considering whether it's possible to pre-flatten the effects into fewer textures, rather than blending them in real-time in the shader.

  • (Pro feature) On OpenGL ES 2 devices, such as iPhone 5 and below, the shader falls back to a minimal subset of features, intended to preserve the original look. You can toggle this from Menu->Tools->OmniShade->Switch To Fallback. If want to control this from code, you can call OmniShade.SetNormalShader() or OmniShade.SetFallbackShader(). And if you are a little shader-savvy, you can tweak the features enabled/disabled in the fallback shader by adjusting the shader keywords. The main limitation for OmniShade with GL ES2 is 8 interpolators (up to TEXCOORD7).

  • Finally, general Unity drawcall batching tips are always good to review.

Last updated