zoukankan      html  css  js  c++  java
  • UsePass & GrabPass

    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 supportedsubshader is taken into account.

    [Detail]

      Some of the shaders could reuse existing passes from other shaders, reducing code duplication. 

      

      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:

      

    GrabPass

      GrabPass is a special passtype - it grabs the contents of the screen where the object is about to be drawn into a texture. This texture can be used in subsequent passes to do advanced image based effects.  

      It contains two forms:

    • Just GrabPass { } will grab current screen contents into a texture. The texture can be accessed in further passes by _GrabTexture name. Note: this form of grab pass will do the expensive screen grabbing operation for each object that uses it!
    • GrabPass { "TextureName" } will grab screen contents into a texture, but will only do that once per frame for the first object that uses the given texture name. The texture can be accessed in further passes by the given texture name. This is a more performant way when you have multiple objects using grab pass in the scene.

      Here is an expensive way to invert the colors of what was rendered before:

    Shader "GrabPassInvert" {
        SubShader {
            // Draw ourselves after all opaque geometry
            Tags { "Queue" = "Transparent" }
    
            // Grab the screen behind the object into _GrabTexture
            GrabPass { }
    
            // Render the object with the texture generated above, and invert it's colors
            Pass {
                SetTexture [_GrabTexture] { combine one-texture }
            }
        }
    } 
    View Code  

    参考:

    1、file://localhost/Applications/Unity/Unity.app/Contents/Documentation/Documentation/Components/SL-UsePass.html

    2、file://localhost/Applications/Unity/Unity.app/Contents/Documentation/Documentation/Components/SL-GrabPass.html

  • 相关阅读:
    Delphi 获取时间的年月日
    Tlist删除技巧
    SQL Server 2008 允许远程连接的配置
    initialization & finalization
    display属性(元素转换)
    float 浮动
    盒模型
    行内元素和块级元素水平及垂直居中
    html常用的几个标签
    html基础
  • 原文地址:https://www.cnblogs.com/tekkaman/p/3862627.html
Copyright © 2011-2022 走看看