Legacy Documentation: Version 5.2
ShaderLab: Legacy BindChannels
ShaderLab: GrabPass

ShaderLab: UsePass

The UsePass command uses named passes from another shader.

Syntax

UsePass "Shader/Name"

Inserts all passes with a given name from a given shader. Shader/Name contains the name of the shader and the name of the pass, separated by a slash character. Note that only first supported subshader is taken into account.

Details

Some of the shaders could reuse existing passes from other shaders, reducing code duplication. For example, you might have a shader pass that draws object outline, and you’d want to reuse that pass in other shaders. The UsePass command does just that - it includes a given pass from another shader. As an example the following command uses the pass with the name “SHADOWCASTER” from the built-in VertexLit shader:

UsePass "VertexLit/SHADOWCASTER"

In order for UsePass to work, a name must be given to the pass one wishes to use. The Name command inside the pass gives it a name:

Name "MyPassName"

Note that internally all pass names are uppercased, so UsePass must refer to the name in uppercase.

ShaderLab: Legacy BindChannels
ShaderLab: GrabPass
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961