Unity3d shader official tutorial translation (15th) -- shader syntax usepass

Source: Internet
Author: User
Tags uppercase letter
Shaderlab Syntax: usepass

The usepass command uses Named passes from another shader.

The usepass command can call the named passes in 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.
Insert the named pass. shader/name in the specified shader to include the shader name and the pass name. They are separated by a slash.
Details details

Some of the shaders cocould reuse existing passes from other shaders, downcing code duplication. for example, in most pixel shaders the ambient or vertex lighting passes are the same as in the corresponding vertexlit shaders. the usepass command does just
That-it should des a given pass from another shader. As an example the following command uses the pass with the name "base" from the builtin specular shader:

Some shader can reuse some existing pass in other shader to reduce code duplication. For example, in the shader of most pixel illumination, the pass of environment illumination and vertex illumination is the same as the shader of the corresponding vertex illumination. At this time, the usepass command takes effect. For example, the following example uses this command from the built-inSpecularThe shader calls a light named "base.

    UsePass "Specular/BASE"

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:

To enable the usepass command to work, you must give the pass a name you want. The name command in pass can give pass a name:

 

Name"Mypassname"


 

Note that internally all pass names are uppercased, so usepass must refer to the nameIn uppercase.

Note that all pass names must start with an uppercase letter, so the pass name referenced by the usepass command must be in uppercase.

 

Original at www.j2megame.com. For more information, see.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.