Unity3d shader official tutorial translation (12) -- shader Syntax: pass mark

Source: Internet
Author: User
Shaderlab Syntax: Pass tags

Passes use tags to tell how and when they until CT to be rendered to the rendering engine.

Pass uses a tag to tell the rendering engine when to render the desired effect.

Syntax Tags {"Tagname1" = "value1" "tagname2"
= "Value2" }
Specifies Tagname1To have Value1, Tagname2To have Value2. You can have as your tags as you like.
Specify Tagname1The value is value1. Tagname2Is Value2. you can specify the tag you want.

Details details

Tags are basically key-value pairs. Inside a pass tags are used to control which
Role this pass has in the lighting pipeline (ambient, vertex, pixel vertex etc .) and some other options. note that the following tags recognized by unity 'must be inside pass section and not inside subshader!

Tags are basically key-value pairs. The internal pass label is used to control the role and other options of this pass in the illumination pipeline (Environment Illumination, vertex illumination, pixel illumination, etc. Note that the following tags must be recognized by unity in the pass segment rather than in the subshader.

Lightmode tag lighting mode tag

LightmodeTag defines pass 'role in the lighting pipeline. See render
Pipeline for details. These tags are rarely used manually; most often shaders that need to interact with lighting are written as surface
Shaders and then all those details are taken care.

LightmodeDefines the pass role in the lighting pipeline. See render pipeline for more details. These labels are rarely used manually. In most cases, the shader that needs to interact with the light is written as the surface.
Shaders then links to those details.

Possible values for lightmode tag are:

Available lightmode labels include:

  • Always: Always rendered; no lighting is applied. Always render. No lighting application.
  • Forwardbase: Used in forward rendering, ambient,
    Main directional light and vertex/SH lights are applied. Ambient Light, mainly oriented light, vertex/SH is applied.
  • Forwardadd: Used in forward rendering; Additive
    Per-pixel lights are applied, one pass per light. Additional pixel-by-pixel illumination is applied. One pass for each illumination.
  • Prepassbase: Used in deferred lighting, renders
    Normals & specular exponent. render normal/mirror index.
  • Prepassfinal: Used in deferred lighting, renders
    Final color by combining textures, Lighting & emission. The final color that combines texture, illumination, and self-illumination.
  • Vertex: Used in vertex extends rendering when object is
    Not lightmapped; all vertex lights are applied. Use vertex illumination rendering when the object does not have illumination ing. All vertex illumination is applied.
  • Vertexlmrgbm: Used in vertex extends rendering when object
    Is lightmapped; on platforms where lightmap is rgbm encoded. Use vertex illumination rendering when the object has illumination ing. The illumination ing on the platform is rgbm encoding.
  • Vertexlm: Used in vertex extends rendering when object
    Is lightmapped; on platforms where lightmap is double-LDR encoded (generally mobile platforms & old Dekstop GPUs). Use vertex illumination rendering when the object has illumination ing. On the platform, the light ing is double-LDR encoding (mobile platform, and vintage GPU ).
  • Shadowcaster: Renders object as shadow Caster. render the object as a shadow setter.
  • Shadowcollector: Gathers object's shadows into screen-space buffer for forward rendering path. collects object shadows into the screen space buffer for the forward rendering path.
Requireoptions tag

A pass can indicate that it shoshould only be rendered when some external conditions are met. This is done by usingRequireoptionsTag, whose value is a string of space separated options. Currently the options supported by unity are:

This pass is rendered only when some additional conditions are met. This is done by using the requireoptions tag, whose values are a string separated by spaces. Currently supported by unity3d:

  • Softvegetation: Render this pass only if soft vegetation is on in quality
    Settings. If rendering soft vegetation is enabled in quality settings, pass can be rendered.
See also

Subshaders can be given tags as well, see subshader tags.

For more information about the tags that subshaders can use, see subshader tags.

 

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.