> For the complete documentation index, see [llms.txt](https://www.omnishade.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.omnishade.io/documentation/optimization-tips.md).

# 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.  <mark style="color:red;">This can have a big impact on larger projects, so be sure to do this!</mark>
* In the shader file, you can remove lines starting with `#pragma multi_compile` on shader features your project doesn't need to reduce the generated variants, which significantly reduces build time and variants.  For example, `_SCREEN_SPACE_OCCLUSION` , `_LIGHT_COOKIES` , or `_LIGHT_LAYERS` , `_SHADOWS_SOFT`  and so on, see [Unity shader stripping](https://docs.unity3d.com/6000.0/Documentation/Manual/urp/shader-stripping.html). &#x20;
* <mark style="color:purple;">**(Pro feature)**</mark>**&#x20;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.&#x20;
* 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.
* <mark style="color:purple;">**(Pro feature)**</mark> 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).
* If your project has no need to support OpenGL ES 2, you can completely remove the Fallback subshader section in the shader file to reduce the memory size.
* Finally, general Unity [drawcall batching tips](https://docs.unity3d.com/Manual/optimizing-draw-calls.html) are always good to review.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://www.omnishade.io/documentation/optimization-tips.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
