A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.unity3d.com/Manual/writing-shader-usepass.html below:

Manual: Include a shader pass with the UsePass command

Add a shader pass in a custom shader

Writing HLSL shader programs

Include a shader pass with the UsePass command

The UsePass command inserts a named Pass from another ShaderA program that runs on the GPU. More info
See in Glossary
object. You can use this command to reduce code duplication in shader source files.

Example

This example code creates a Shader objectAn instance of the Shader class, a Shader object is container for shader programs and GPU instructions, and information that tells Unity how to use them. Use them with materials to determine the appearance of your scene. More info
See in Glossary
called ContainsNamedPass, which contains a Pass called ExampleNamedPass.

Shader "Examples/ContainsNamedPass"
{
    SubShader
    {
        Pass
        {    
              Name "ExampleNamedPass"
            
              // The rest of the Pass contents go here.
        }
    }
}

This example code creates a Shader object called UseNamedPass, which uses the named Pass from the example code above.

Shader "Examples/UsesNamedPass"
{
    SubShader
    {
        UsePass "Examples/ContainsNamedPass/EXAMPLENAMEDPASS"
    }
}
Additional resources

Add a shader pass in a custom shader

Writing HLSL shader programs


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4