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 }
}
}
}

  

参考:

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

UsePass & GrabPass的更多相关文章

  1. 关于Unity中Shader的基础认识

    Shader也叫着色器,是Unity里面比较难的一个点,网上有很多别人写好的shader,我们可以下载下来用或者修改学习. Shader可以做出很多非常不错的效果,因为它是插在渲染管道里面的程序,一来 ...

  2. Unity3d Shader开发(四)UsePass ,GrabPass ,SubShader Tags

    (一)UsePass 命令 使用 来自另一个着色器的命名通道. Syntax 语法 UsePass "Shader/Name" 插入所有来自给定着色器中的给定名字的通道.Shade ...

  3. 关于Unity中GrabPass截屏的使用和Shader的组织优化

    GrabPass截屏 可以用来截屏,截屏后把纹理传给下一个通道使用. 1:使用抓屏通道, GrabPass {} 或 GrabPass { “ 纹理名称”}; 使用GrabPass {}后,可以用_G ...

  4. (转)GrabPass捕捉屏幕纹理

    转自:http://blog.sina.com.cn/s/blog_89d90b7c0102va4m.html 最近在看热扭曲效果,里面用到了GrabPass. 之前看过官方翻译版本的说明http:/ ...

  5. Unity3d 着色器语法(Shader)

    Shader "name" { [Properties] Subshaders [Fallback] } 定义了一个着色器.着色器拥有一个 Properties 的列表.着色器包含 ...

  6. Shader的语法

    Shader "name" { [Properties] Subshaders [Fallback] }(1)Properties:{ Property [Property ... ...

  7. Unity3d之Shader编程:子着色器、通道与标签的写法 & 纹理混合

    一.子着色器 Unity中的每一个着色器都包含一个subshader的列表,当Unity需要显示一个网格时,它能发现使用的着色器,并提取第一个能运行在当前用户的显示卡上的子着色器. 我们知道,子着色器 ...

  8. 1.4:SubShader

    文章著作权归作者所有.转载请联系作者,并在文中注明出处,给出原文链接. 本系列原更新于作者的github博客,这里给出链接. 在了解了渲染流水线之后,我们可以开始SubShader的学习了. 什么是S ...

  9. Unity Shader 入门精要学习 (冯乐乐 著)

    第1篇 基础篇 第1章 欢迎来到Shader的世界 第2章 渲染流水线 第3章 Unity Shader 基础 第4章 学习Shader所需的数学基础 第2篇 初级篇 第5章 开始Unity Shad ...

随机推荐

  1. BZOJ1495 [NOI2006]网络收费

    题意 传送门 MY市NS中学,大概是绵阳市南山中学. 分析 参照Maxwei_wzj的题解. 因为成对的贡献比较难做,我们尝试把贡献算到每一个叶子节点上.我们发现按照题目中的收费方式,它等价于对于每棵 ...

  2. __all__ 作用, 相当于导入*

    它是一个string元素组成的list变量,定义了当你使用 from <module> import * 导入某个模块的时候能导出的符号(这里代表变量,函数,类等) 参考文章: http: ...

  3. tidb 集群扩容

    1. tidb 新增节点 a. 编辑 inventory.ini [tidb_servers] 10.0.230.14 10.0.230.15 10.10.230.20 b. 初始化新增节点 ansi ...

  4. MySQL的安装配置教程

    1. 官网下载ZIP压缩版本(本人电脑是64位的) x64bit MySQL Community 2. 解压到E:\SoftwareFiles\mysql-5.7.11-winx64 3. 在E:\S ...

  5. The SDK platform-tools version ((21)) is too old to check APIs compiled with API 23

    android studio是个坑爹的工具,每次打开文件头都出现如上错误提示. 解决方法: Update your android sdk platform-tools to the revision ...

  6. 3、MR开发入门

    1.预先准备2个文件file1.txt和file2.txt.文件内容为网页上摘下,不具有代表性,只为举例. file1.txt内容为: With this setup, whenever you ch ...

  7. O/R映射及OID方案

    一.O/R映射层基本介绍 O/R映射层是持久层的一个特例,它的数据模型是对象模型(Object),存储模型是关系模型(Relational),cmp和Hibernate是对象模型到关系模型之间转换的两 ...

  8. JAVA-Unit03: SQL(基础查询) 、 SQL(关联查询)

    Unit03: SQL(基础查询) . SQL(关联查询) 列别名 当SELECT子句中查询的列是一个函数 或者表达式时,那么查询出来的结果集 中对应的该字段的名字就是这个函数或者 表达式的名字.为此 ...

  9. Spring Boot和Spring cloud

    微服务框架SpringBoot简单验证 首先摘录部分IBM网站部分内容对框架做一个简单说明 http://www.ibm.com/developerworks/cn/java/j-lo-spring- ...

  10. 算法题:求一个序列S中所有包含T的子序列(distinct sub sequence)

    题: 给定一个序列S以及它的一个子序列T,求S的所有包含T的子序列.例: S = [1, 2, 3, 2, 4] T = [1, 2, 4] 则S的所有包含T的子序列为: [1, 2, 3, 2, 4 ...