Get an 20% OFF using the RELEASE code on your book purchase. For a limited time.

Introduction to the shader programming language

3.1.4. SubShader Tags

This post is also available in…

Tags are labels that show how and when our shaders are processed. 

Like a GameObject tag, these can be used to recognize how a shader will be rendered or what graphic behaviour a group of them will have. 

The syntax for all Tags is as follows:

Tags 
{
    "TagName1" = "TagValue1" 
    "TagName2" = "TagValue2"
}

Tags can be written in two different fields, either within the SubShader or inside the Pass. All this depends on the result we want to obtain. If we write a tag inside the SubShader it will affect all the passes that are included in the shader, but if we write it inside the Pass, it will only affect the selected pass. 

The “Queue” is a Tag that we use more frequently since it allows us to define how the surface of the object will look. By default, all surfaces are defined as “opaque”, that is, they do not have transparency.

If we look at our USB_simple_color shader, we will find the following line of code inside the SubShader, which defines an opaque surface for our shader.

SubShader
{
    Tags { “RenderType” = “Opaque” }
    LOD 100

    Pass {} ...
}

Follow us to stay informed about all the latest news, updates, and more.

Join the group to share your experiences with other developers.

Subscribe to our channel and keep learning game dev!

jettelly-logo

Jettelly Team

We are a team of indie developers with more than 9 years of experience in video games. As an independent studio, we have developed Nom Noms in which we published with Hyperbeard in 2019. We are currently developing The Unity Shader Bible.

Follow us on our social networks.