Additional pass in surface shader (enable/disable pass)

Can’t find overview info in docs about this case:

I have surface shader that implements custom Lighting function. After shading I want to render additional semi-transparent pass with custom fragment shader. How to do that?

And one more thing - I want to enable/disable this additional pass from scripts. Looks like tags can be used in this case, but how exactly?

Just write your additional pass after your surface shader code:

Shader {

  SubShader {

      // Surface shader

    Pass {
        // Additional Vert/Frag shader

You can add custom keywords to a shader using the #pragma directive:

#pragma MY_KEYWORD

You can then add conditional code within the shader based on whether the keyword is defined, as:


And you can change the keyword from script, using


(I’ve never personally tried enabling/disabling an entire pass like this, but I guess it would work).