Sponsored By

Now You Can Choose High-Performing Unity Shaders

Choosing your next shader? Strike the balance between your dream visuals and the performance you take away. Today, I'll give you handy tables so you can see the performance cost of the common unity shaders

Ruben Torres Bonet, Blogger

July 15, 2020

14 Min Read
Game Developer logo in a gray background | Game Developer

[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 The Cost of Your Shaders

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.9 Unlit - Color (1 Variant)

2.10 Unlit - Texture (1 Variant)

2.11 Standard Shader (42 Variants)

2.12 Standard Shader - Specular Setup (42 Variants)

3 Get the Sortable List

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

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

NONE | NONE

1.4

13.0

0.0

0.0

0.3

0.0

0.5

0.5

NONE | UNITY_UI_ALPHACLIP

1.4

13.0

0.0

0.0

0.4

0.0

0.5

0.5

NONE | UNITY_UI_CLIP_RECT

1.4

13.0

0.0

0.0

0.5

0.0

0.8

0.5

NONE | UNITY_UI_ALPHACLIP UNITY_UI_CLIP_RECT

1.4

13.0

0.0

0.0

0.7

0.0

0.8

0.5

Sprite Default Shader (4 Variants)

Vertex Shader

Variant

A

LS

V

T

A

LS

V

T

NONE | NONE

1.4

9.0

0.0

0.0

0.3

0.0

0.5

0.5

NONE | PIXELSNAP_ON

1.5

9.0

0.0

0.0

0.3

0.0

0.5

0.5

ETC1_EXTERNAL_ALPHA | NONE

1.4

9.0

0.0

0.0

0.4

0.0

0.5

1.0

ETC1_EXTERNAL_ALPHA | PIXELSNAP_ON

1.5

9.0

0.0

0.0

0.4

0.0

0.5

1.0

Sky Sphere Example

Unity-Sky-Sphere

Skybox Procedural (3 Variants)

Vertex Shader

Variant

A

LS

V

T

A

LS

V

T

NONE | _SUNDISK_NONE

8.3

9.0

0.0

0.0

0.3

0.0

0.6

0.0

NONE | _SUNDISK_SIMPLE

8.5

11.0

0.0

0.0

0.8

0.0

1.0

0.0

NONE | _SUNDISK_HIGH_QUALITY

8.4

11.0

0.0

0.0

1.7

0.0

1.1

0.0

Skybox Cubemap (1 Variant)

Vertex Shader

Variant

A

LS

V

T

A

LS

V

T

NONE | NONE

1.3

5.0

0.0

0.0

0.6

0.0

0.4

0.5

Skybox 6-Sided (1 Variant)

Vertex Shader

Variant

A

LS

V

T

A

LS

V

T

NONE | NONE (6x)

1.2

6.0

0.0

0.0

0.5

0.0

0.3

0.5

Clearly, the procedural skybox shader is more expensive than its two alternatives.

Unity Alpha Blended Shader

Unity Alpha Blended Shader

Unity Alpha Blended Shader

Mobile - Particles - Alpha Blended (1 Variant)

Vertex Shader

Variant

A

LS

V

T

A

LS

V

T

NONE | NONE

1.1

9.0

0.0

0.0

0.2

0.0

0.5

0.5

Unity Shader Diffuse

Unity Shader Diffuse

Unity Shader Diffuse (Source: Unity)

Mobile - Diffuse (17 Variants)

Vertex Shader

Variant

A

LS

V

T

A

LS

V

T

DIRECTIONAL | NONE

1.8

13.0

0.0

0.0

1.5

0.0

1.0

1.0

DIRECTIONAL LIGHTPROBE_SH | NONE

3.6

15.0

0.0

0.0

1.5

0.0

1.3

1.0

DIRECTIONAL SHADOWS_SCREEN | NONE

2.2

15.0

0.0

0.0

2.0

0.0

1.5

1.5

DIRECTIONAL LIGHTPROBE_SH SHADOWS_SCREEN | NONE

2.7

17.0

0.0

0.0

4.6

0.0

1.8

3.0

DIRECTIONAL VERTEXLIGHT_ON | NONE

1.8

13.0

0.0

0.0

1.5

0.0

1.0

1.0

DIRECTIONAL LIGHTPROBE_SH VERTEXLIGHT_ON | NONE

5.5

15.0

0.0

0.0

1.5

0.0

1.3

1.0

DIRECTIONAL SHADOWS_SCREEN VERTEXLIGHT_ON | NONE

2.2

15.0

0.0

0.0

2.0

0.0

1.5

1.5

DIRECTIONAL LIGHTPROBE_SH SHADOWS_SCREEN VERTEXLIGHT_ON | NONE

5.0

17.0

0.0

0.0

4.6

0.0

1.8

3.0

NONE | NONE

1.8

8.0

0.0

0.0

0.3

0.0

0.4

0.0

NONE | NONE

3.8

15.0

0.0

0.0

0.9

0.0

1.1

1.0

LIGHTPROBE_SH | NONE

3.8

15.0

0.0

0.0

0.9

0.0

1.1

1.0

UNITY_HDR_ON | NONE

3.8

15.0

0.0

0.0

0.5

0.0

1.1

1.0

LIGHTPROBE_SH UNITY_HDR_ON | NONE

3.8

15.0

0.0

0.0

0.5

0.0

1.1

1.0

NONE | NONE

1.8

13.0

0.0

0.0

0.6

0.0

0.6

0.5

LIGHTPROBE_SH | NONE

3.6

15.0

0.0

0.0

0.9

0.0

0.9

0.5

UNITY_HDR_ON | NONE

1.8

13.0

0.0

0.0

0.6

0.0

0.6

0.5

LIGHTPROBE_SH UNITY_HDR_ON | NONE

3.6

15.0

0.0

0.0

0.7

0.0

0.9

0.5

Unity Shader Bumped Diffuse

Unity Shader Bumped Diffuse

Unity Shader Bumped Diffuse (Source: Unity)

Mobile - Bumped Diffuse (17 Variants)

Vertex Shader

Variant

A

LS

V

T

A

LS

V

T

DIRECTIONAL | NONE

2.8

16.0

0.0

0.0

2.2

0.0

1.8

1.5

DIRECTIONAL LIGHTPROBE_SH | NONE

4.5

18.0

0.0

0.0

2.3

0.0

2.0

1.5

DIRECTIONAL SHADOWS_SCREEN | NONE

3.0

18.0

0.0

0.0

2.8

0.0

2.3

2.0

DIRECTIONAL LIGHTPROBE_SH SHADOWS_SCREEN | NONE

3.6

20.0

0.0

0.0

5.2

0.0

2.5

3.5

DIRECTIONAL VERTEXLIGHT_ON | NONE

2.8

16.0

0.0

0.0

2.2

0.0

1.8

1.5

DIRECTIONAL LIGHTPROBE_SH VERTEXLIGHT_ON | NONE

6.3

18.0

0.0

0.0

2.3

0.0

2.0

1.5

DIRECTIONAL SHADOWS_SCREEN VERTEXLIGHT_ON | NONE

3.0

18.0

0.0

0.0

2.8

0.0

2.3

2.0

DIRECTIONAL LIGHTPROBE_SH SHADOWS_SCREEN VERTEXLIGHT_ON | NONE

6.0

20.0

0.0

0.0

5.2

0.0

2.5

3.5

NONE | NONE

2.9

14.0

0.0

0.0

0.8

0.0

1.4

0.5

NONE | NONE

3.8

15.0

0.0

0.0

0.9

0.0

1.1

1.0

LIGHTPROBE_SH | NONE

3.8

15.0

0.0

0.0

0.9

0.0

1.1

1.0

UNITY_HDR_ON | NONE

3.8

15.0

0.0

0.0

0.5

0.0

1.1

1.0

LIGHTPROBE_SH UNITY_HDR_ON | NONE

3.8

15.0

0.0

0.0

0.5

0.0

1.1

1.0

NONE | NONE

2.8

16.0

0.0

0.0

1.3

0.0

1.4

1.0

LIGHTPROBE_SH | NONE

4.5

18.0

0.0

0.0

1.4

0.0

1.6

1.0

UNITY_HDR_ON | NONE

2.8

16.0

0.0

0.0

1.3

0.0

1.4

1.0

LIGHTPROBE_SH UNITY_HDR_ON | NONE

4.5

18.0

0.0

0.0

1.3

0.0

1.6

1.0

As you can see, the bumped diffuse shader is considerably more expensive than the plain diffuse shader.

Unity Unlit Color Shader

Unity Unlit Color Shader

Unity Unlit Color Shader

Unlit - Color (1 Variant)

Vertex Shader

Variant

A

LS

V

T

A

LS

V

T

NONE | NONE

1.2

3.0

0.0

0.0

0.2

0.0

0.0

0.0

Unity Unlit Texture Shader

Unity Unlit Texture Shader

Unity Unlit Texture Shader

Unlit - Texture (1 Variant)

Vertex Shader

Variant

A

LS

V

T

A

LS

V

T

NONE | NONE

1.1

6.0

0.0

0.0

0.1

0.0

0.3

0.5

The unlit shaders are one of the cheapest shaders. The unlit texture variant more than doubles its performance cost.

Unity Standard Shaders

Unity Standard Shaders

Unity Standard Shaders (Source: Unity)

Standard Shader (42 Variants)

Vertex Shader

Variant

A

LS

V

T

A

LS

V

T

DIRECTIONAL | NONE

2.2

22.0

0.0

0.0

7.9

0.0

1.4

2.5

DIRECTIONAL LIGHTPROBE_SH | NONE

3.0

22.0

0.0

0.0

10.4

0.0

1.6

4.0

DIRECTIONAL SHADOWS_SCREEN | NONE

2.4

22.0

0.0

0.0

8.4

0.0

1.9

3.0

DIRECTIONAL LIGHTPROBE_SH SHADOWS_SCREEN | NONE

3.0

22.0

0.0

0.0

11.2

0.0

2.1

4.5

DIRECTIONAL VERTEXLIGHT_ON | NONE

2.2

22.0

0.0

0.0

7.9

0.0

1.4

2.5

DIRECTIONAL LIGHTPROBE_SH VERTEXLIGHT_ON | NONE

4.9

22.0

0.0

0.0

10.4

0.0

1.6

4.0

DIRECTIONAL SHADOWS_SCREEN VERTEXLIGHT_ON | NONE

2.4

22.0

0.0

0.0

8.4

0.0

1.9

3.0

DIRECTIONAL LIGHTPROBE_SH SHADOWS_SCREEN VERTEXLIGHT_ON | NONE

5.4

22.0

0.0

0.0

11.2

0.0

2.1

4.5

POINT | NONE

2.8

22.0

0.0

0.0

5.0

0.0

2.5

1.5

DIRECTIONAL | NONE

2.3

20.0

0.0

0.0

4.4

0.0

2.5

1.0

SPOT | NONE

3.0

22.0

0.0

0.0

5.3

0.0

2.5

2.0

POINT_COOKIE | NONE

2.8

22.0

0.0

0.0

5.3

0.0

2.5

2.0

DIRECTIONAL_COOKIE | NONE

2.9

22.0

0.0

0.0

4.5

0.0

2.5

1.5

SHADOWS_DEPTH SPOT | NONE

3.0

22.0

0.0

0.0

6.3

0.0

2.5

2.5

SHADOWS_DEPTH SHADOWS_SOFT SPOT | NONE

3.0

22.0

0.0

0.0

6.7

0.0

2.5

4.0

DIRECTIONAL SHADOWS_SCREEN | NONE

2.5

20.0

0.0

0.0

4.9

0.0

3.0

1.5

DIRECTIONAL_COOKIE SHADOWS_SCREEN | NONE

2.9

22.0

0.0

0.0

4.9

0.0

3.0

2.0

POINT SHADOWS_CUBE | NONE

2.8

22.0

0.0

0.0

5.8

0.0

2.5

2.0

POINT SHADOWS_CUBE SHADOWS_SOFT | NONE

2.8

22.0

0.0

0.0

6.8

0.0

2.5

3.5

POINT_COOKIE SHADOWS_CUBE | NONE

2.8

22.0

0.0

0.0

6.1

0.0

2.5

2.5

POINT_COOKIE SHADOWS_CUBE SHADOWS_SOFT | NONE

2.8

22.0

0.0

0.0

7.1

0.0

2.5

4.0

NONE | NONE

2.3

20.0

0.0

0.0

1.0

0.0

0.6

1.0

LIGHTPROBE_SH | NONE

2.8

20.0

0.0

0.0

4.0

0.0

1.3

2.5

UNITY_HDR_ON | NONE

2.3

20.0

0.0

0.0

1.0

0.0

0.6

1.0

LIGHTPROBE_SH UNITY_HDR_ON | NONE

2.8

20.0

0.0

0.0

3.6

0.0

1.3

2.5

DIRECTIONAL | NONE

2.4

22.0

0.0

0.0

3.4

0.0

1.4

2.5

DIRECTIONAL LIGHTPROBE_SH | NONE

4.3

22.0

0.0

0.0

3.8

0.0

1.6

2.5

DIRECTIONAL SHADOWS_SCREEN | NONE

2.4

22.0

0.0

0.0

8.4

0.0

1.9

3.0

DIRECTIONAL LIGHTPROBE_SH SHADOWS_SCREEN | NONE

3.0

22.0

0.0

0.0

11.2

0.0

2.1

4.5

DIRECTIONAL VERTEXLIGHT_ON | NONE

2.4

22.0

0.0

0.0

3.4

0.0

1.4

2.5

DIRECTIONAL LIGHTPROBE_SH VERTEXLIGHT_ON | NONE

6.3

22.0

0.0

0.0

3.8

0.0

1.6

2.5

DIRECTIONAL SHADOWS_SCREEN VERTEXLIGHT_ON | NONE

2.4

22.0

0.0

0.0

8.4

0.0

1.9

3.0

DIRECTIONAL LIGHTPROBE_SH SHADOWS_SCREEN VERTEXLIGHT_ON | NONE

5.4

22.0

0.0

0.0

11.2

0.0

2.1

4.5

POINT | NONE

3.3

22.0

0.0

0.0

3.0

0.0

2.5

2.0

DIRECTIONAL | NONE

2.5

20.0

0.0

0.0

2.5

0.0

2.5

1.5

SPOT | NONE

3.3

22.0

0.0

0.0

3.2

0.0

2.5

2.5

POINT_COOKIE | NONE

3.3

22.0

0.0

0.0

3.2

0.0

2.5

2.5

DIRECTIONAL_COOKIE | NONE

3.1

22.0

0.0

0.0

2.8

0.0

2.5

2.0

SHADOWS_DEPTH SPOT | NONE

3.3

22.0

0.0

0.0

2.9

0.0

2.5

2.5

DIRECTIONAL SHADOWS_SCREEN | NONE

2.5

20.0

0.0

0.0

4.9

0.0

3.0

1.5

DIRECTIONAL_COOKIE SHADOWS_SCREEN | NONE

2.9

22.0

0.0

0.0

4.9

0.0

3.0

2.0

POINT SHADOWS_CUBE | NONE

3.3

22.0

0.0

0.0

2.5

0.0

2.5

2.0

POINT_COOKIE SHADOWS_CUBE | NONE

3.3

22.0

0.0

0.0

2.7

0.0

2.5

2.5

Standard Shader - Specular Setup (42 Variants)

Vertex Shader

Variant

A

LS

V

T

A

LS

V

T

DIRECTIONAL | NONE

2.2

22.0

0.0

0.0

7.5

0.0

1.4

2.5

DIRECTIONAL LIGHTPROBE_SH | NONE

3.0

22.0

0.0

0.0

10.3

0.0

1.6

4.0

DIRECTIONAL SHADOWS_SCREEN | NONE

2.4

22.0

0.0

0.0

8.2

0.0

1.9

3.0

DIRECTIONAL LIGHTPROBE_SH SHADOWS_SCREEN | NONE

3.0

22.0

0.0

0.0

11.0

0.0

2.1

4.5

DIRECTIONAL VERTEXLIGHT_ON | NONE

2.2

22.0

0.0

0.0

7.5

0.0

1.4

2.5

DIRECTIONAL LIGHTPROBE_SH VERTEXLIGHT_ON | NONE

4.9

22.0

0.0

0.0

10.3

0.0

1.6

4.0

DIRECTIONAL SHADOWS_SCREEN VERTEXLIGHT_ON | NONE

2.4

22.0

0.0

0.0

8.2

0.0

1.9

3.0

DIRECTIONAL LIGHTPROBE_SH SHADOWS_SCREEN VERTEXLIGHT_ON | NONE

5.4

22.0

0.0

0.0

11.0

0.0

2.1

4.5

POINT | NONE

2.8

22.0

0.0

0.0

4.8

0.0

2.5

1.5

DIRECTIONAL | NONE

2.3

20.0

0.0

0.0

4.3

0.0

2.5

1.0

SPOT | NONE

3.0

22.0

0.0

0.0

4.9

0.0

2.5

2.0

POINT_COOKIE | NONE

2.8

22.0

0.0

0.0

5.0

0.0

2.5

2.0

DIRECTIONAL_COOKIE | NONE

2.9

22.0

0.0

0.0

4.5

0.0

2.5

1.5

SHADOWS_DEPTH SPOT | NONE

3.0

22.0

0.0

0.0

6.0

0.0

2.5

2.5

SHADOWS_DEPTH SHADOWS_SOFT SPOT | NONE

3.0

22.0

0.0

0.0

6.4

0.0

2.5

4.0

DIRECTIONAL SHADOWS_SCREEN | NONE

2.5

20.0

0.0

0.0

4.7

0.0

3.0

1.5

DIRECTIONAL_COOKIE SHADOWS_SCREEN | NONE

2.9

22.0

0.0

0.0

4.7

0.0

3.0

2.0

POINT SHADOWS_CUBE | NONE

2.8

22.0

0.0

0.0

5.6

0.0

2.5

2.0

POINT SHADOWS_CUBE SHADOWS_SOFT | NONE

2.8

22.0

0.0

0.0

6.9

0.0

2.5

3.5

POINT_COOKIE SHADOWS_CUBE | NONE

2.8

22.0

0.0

0.0

5.9

0.0

2.5

2.5

POINT_COOKIE SHADOWS_CUBE SHADOWS_SOFT | NONE

2.8

22.0

0.0

0.0

7.0

0.0

2.5

4.0

NONE | NONE

2.3

20.0

0.0

0.0

0.9

0.0

0.6

1.0

LIGHTPROBE_SH | NONE

2.8

20.0

0.0

0.0

3.8

0.0

1.3

2.5

UNITY_HDR_ON | NONE

2.3

20.0

0.0

0.0

0.9

0.0

0.6

1.0

LIGHTPROBE_SH UNITY_HDR_ON | NONE

2.8

20.0

0.0

0.0

3.4

0.0

1.3

2.5

DIRECTIONAL | NONE

2.4

22.0

0.0

0.0

3.2

0.0

1.4

2.5

DIRECTIONAL LIGHTPROBE_SH | NONE

4.3

22.0

0.0

0.0

3.4

0.0

1.6

2.5

DIRECTIONAL SHADOWS_SCREEN | NONE

2.4

22.0

0.0

0.0

8.2

0.0

1.9

3.0

DIRECTIONAL LIGHTPROBE_SH SHADOWS_SCREEN | NONE

3.0

22.0

0.0

0.0

11.0

0.0

2.1

4.5

DIRECTIONAL VERTEXLIGHT_ON | NONE

2.4

22.0

0.0

0.0

3.2

0.0

1.4

2.5

DIRECTIONAL LIGHTPROBE_SH VERTEXLIGHT_ON | NONE

6.3

22.0

0.0

0.0

3.4

0.0

1.6

2.5

DIRECTIONAL SHADOWS_SCREEN VERTEXLIGHT_ON | NONE

2.4

22.0

0.0

0.0

8.2

0.0

1.9

3.0

DIRECTIONAL LIGHTPROBE_SH SHADOWS_SCREEN VERTEXLIGHT_ON | NONE

5.4

22.0

0.0

0.0

11.0

0.0

2.1

4.5

POINT | NONE

3.3

22.0

0.0

0.0

2.8

0.0

2.5

2.0

DIRECTIONAL | NONE

2.5

20.0

0.0

0.0

2.4

0.0

2.5

1.5

SPOT | NONE

3.3

22.0

0.0

0.0

3.0

0.0

2.5

2.5

POINT_COOKIE | NONE

3.3

22.0

0.0

0.0

3.1

0.0

2.5

2.5

DIRECTIONAL_COOKIE | NONE

3.1

22.0

0.0

0.0

2.6

0.0

2.5

2.0

SHADOWS_DEPTH SPOT | NONE

3.3

22.0

0.0

0.0

2.8

0.0

2.5

2.5

DIRECTIONAL SHADOWS_SCREEN | NONE

2.5

20.0

0.0

0.0

4.7

0.0

3.0

1.5

DIRECTIONAL_COOKIE SHADOWS_SCREEN | NONE

2.9

22.0

0.0

0.0

4.7

0.0

3.0

2.0

POINT SHADOWS_CUBE | NONE

3.3

22.0

0.0

0.0

2.3

0.0

2.5

2.0

POINT_COOKIE SHADOWS_CUBE | NONE

3.3

22.0

0.0

0.0

2.5

0.0

2.5

2.5

We all knew standard shaders are extremely expensive.

From the numbers, it looks as if the specular setup is slightly cheaper than the metallic version.

Car-Crash-Decoration

 

Get the Sortable List

That was a ton of numbers!

These metrics will help you balance the visual quality you want to achieve in your game with your performance requirements.

The lower the GPU cycles your shader takes, the faster it will run.

(I wish we could always run the standard shader... but as you see, its cost is prohibitive for mobile platforms)

To get a free sortable spreadsheet that you can save and keep at hand for quick reference in your projects click here.

It's super handy because you can filter the list by the shaders you want to compare.

Take care,
~Ruben (The Gamedev Guru)

[SPOILER] P.S. In the next post on GPU Performance, I'll dig deeper into the performance world of the standard shaders.

Read more about:

Featured Blogs
Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like