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_GrabTexturename. 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 }
}
}
}
参考:
UsePass & GrabPass的更多相关文章
- 关于Unity中Shader的基础认识
Shader也叫着色器,是Unity里面比较难的一个点,网上有很多别人写好的shader,我们可以下载下来用或者修改学习. Shader可以做出很多非常不错的效果,因为它是插在渲染管道里面的程序,一来 ...
- Unity3d Shader开发(四)UsePass ,GrabPass ,SubShader Tags
(一)UsePass 命令 使用 来自另一个着色器的命名通道. Syntax 语法 UsePass "Shader/Name" 插入所有来自给定着色器中的给定名字的通道.Shade ...
- 关于Unity中GrabPass截屏的使用和Shader的组织优化
GrabPass截屏 可以用来截屏,截屏后把纹理传给下一个通道使用. 1:使用抓屏通道, GrabPass {} 或 GrabPass { “ 纹理名称”}; 使用GrabPass {}后,可以用_G ...
- (转)GrabPass捕捉屏幕纹理
转自:http://blog.sina.com.cn/s/blog_89d90b7c0102va4m.html 最近在看热扭曲效果,里面用到了GrabPass. 之前看过官方翻译版本的说明http:/ ...
- Unity3d 着色器语法(Shader)
Shader "name" { [Properties] Subshaders [Fallback] } 定义了一个着色器.着色器拥有一个 Properties 的列表.着色器包含 ...
- Shader的语法
Shader "name" { [Properties] Subshaders [Fallback] }(1)Properties:{ Property [Property ... ...
- Unity3d之Shader编程:子着色器、通道与标签的写法 & 纹理混合
一.子着色器 Unity中的每一个着色器都包含一个subshader的列表,当Unity需要显示一个网格时,它能发现使用的着色器,并提取第一个能运行在当前用户的显示卡上的子着色器. 我们知道,子着色器 ...
- 1.4:SubShader
文章著作权归作者所有.转载请联系作者,并在文中注明出处,给出原文链接. 本系列原更新于作者的github博客,这里给出链接. 在了解了渲染流水线之后,我们可以开始SubShader的学习了. 什么是S ...
- Unity Shader 入门精要学习 (冯乐乐 著)
第1篇 基础篇 第1章 欢迎来到Shader的世界 第2章 渲染流水线 第3章 Unity Shader 基础 第4章 学习Shader所需的数学基础 第2篇 初级篇 第5章 开始Unity Shad ...
随机推荐
- maven的pom.xml文件配置说明
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/20 ...
- 从数据库导出数据到excel之List<List<Object>>导出
说明:有时候数据处理为List<List<Object>>更方便 姊妹篇:从数据库导出数据到excel之List<Map<>>导出 兄弟篇:从数据库导出 ...
- 使用distillery 实现版本的动态升级&& 动态降级
备注: distillery 使用很棒的elixir 打包构建工具,下面演示的是升级以及降级 1. 参考项目 https://github.com/rongfengliang/phoenix-r ...
- js写的体彩足球预测分析
最近室友在玩世界杯的预测,我顺手写点分析:下面直接给出代码,很简单的,拷贝代码直接存为html文件就可以了.---------mq0036 说明下:需要你自己去找个Jquery引用到当前页面就可以了 ...
- linux中sar的详细使用
在使用UNIX操作系统的过程中,我们常常会用到各种各样的问题,比如系统运行速度突然变慢,系统容易死机或者主机所带的终端常出现死机,这时我们常常猜测,是硬盘空间太小,还是内存不足?I/O出现瓶颈,或者是 ...
- bzoj 4010 [HNOI2015]菜肴制作——贪心
题目:https://www.lydsy.com/JudgeOnline/problem.php?id=4010 和 bzoj 2535 差不多.因为当前怎么决策与该点后面连的点的标号情况有关,所以按 ...
- bzoj5248(洛谷4363)(2018九省联考)一双木棋
题目:https://www.luogu.org/problemnew/show/P4363 一种考虑状态数的方法:有几个用了k个格子的列,就在第k个0的左边插入几个1: 这也是求不降序列的个数的方法 ...
- Excel不同工作簿之间提取信息
Sub 不同工作簿间提取信息() '用于单个字段信息的提取: Dim w As Workbook, wb1 As Workbook, wb2 As Workbook, wb3 As Workbook ...
- Win10 TensorFlow(gpu)安装详解
Win10 TensorFlow(gpu)安装详解 写在前面:TensorFlow是谷歌基于DistBelief进行研发的第二代人工智能学习系统,其命名来源于本身的运行原理.Tensor(张量)意味着 ...
- 设置VS以管理员身份运行
以vs2013为例 vs右键属性 ----- 找到目标位置如下 "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\ ...