Version: 2021.3
Language : English
Surface Shaders with DX11 / OpenGL Core Tessellation
Writing shaders for different graphics APIs

Optimize Surface Shaders

Surface ShadersA streamlined way of writing shaders for the Built-in Render Pipeline. More info
See in Glossary
are great for writing shadersA program that runs on the GPU. More info
See in Glossary
that interact with lighting. However, their default options are tuned to cover a broad number of general cases. Tweak these for specific situations to make shaders run faster or at least be smaller:

  • The halfasview for Specular shader types is even faster. The half-vector (halfway between lighting direction and view vector) is computed and normalized per vertex, and the lighting function receives the half-vector as a parameter instead of the view vector.
  • noforwardadd makes a shader fully support one-directional light in Forward renderingA rendering path that renders each object in one or more passes, depending on lights that affect the object. Lights themselves are also treated differently by Forward Rendering, depending on their settings and intensity. More info
    See in Glossary
    only. The rest of the lights can still have an effect as per-vertex lights or spherical harmonics. This is great to make your shader smaller and make sure it always renders in one pass, even with multiple lights present.
  • noambient disables ambient lighting and spherical harmonics lights on a shader. This can make performance slightly faster.

Additional resources

Surface Shaders with DX11 / OpenGL Core Tessellation
Writing shaders for different graphics APIs