[Read the original post here]
There are many shaders in Unity.
When choosing your next shader, you need to strike the balance between your dream visuals and the performance you take away.
But how much performance do your shaders steal?
Well, in my previous post I showed you a simple process to measure the performance cost of your shaders.
But today I'm doing something different.
Today, I'll give you handy tables so you can see the performance cost of the commonly used Unity shaders.
Yes, now you can make informed decisions in your game‚
Shader-Cost-Thumbnail-v3
Table of Contents
1 How to Read These Performance Numbers
2.1 UI Default Shader (4 Variants)
2.2 Sprite Default Shader (4 Variants)
2.3 Skybox Procedural (3 Variants)
2.4 Skybox Cubemap (1 Variant)
2.5 Skybox 6-Sided (1 Variant)
2.6 Mobile - Particles - Alpha Blended (1 Variant)
2.7 Mobile - Diffuse (17 Variants)
2.8 Mobile - Bumped Diffuse (17 Variants)
2.10 Unlit - Texture (1 Variant)
2.11 Standard Shader (42 Variants)
2.12 Standard Shader - Specular Setup (42 Variants)
How to Read These Performance Numbers
Here's a few notes regarding these numbers:
I did not include all variants, as most shaders can well have 1k+ variants.
I simplified the variant term as a concatenation of the shader's Global Keyword and Local Keyword.
The numbers represent the total number of GPU shader unit cycles as estimated by Mali Offline Compiler for OpenGL ES 3 for a modern mobile platform.
I'm using Unity default graphic settings regarding hardware tiers.
In the original post: The red number shows the hardware bottleneck for each shader variant.
These numbers do not account for your current GPU pipeline state, such as caching.
And here's the legend:
A = Arithmetic operations (e.g. sum, multiply, etc.)
LS = Load/Store operations (e.g. loading parameters from buffers)
V = Varying operations (i.e. the cost spent in the shader unit varying interpolator)
T = Texture operations (e.g. fetching + sampling)
By the way, I suggest reading this on desktop...
Reading this on mobile will only hurt your eyesight.
I know because I tried. And my eyes still hurt after two days.
the-gamedev-guru-logo-me-transparent-small
The Cost of Your Shaders
UI Default Shader (4 Variants)
Vertex Shader
Variant | A | LS | V | T | A | LS | V | T |
---|---|---|---|---|---|---|---|---|