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. Linux下Apache服务器配置

    Linux下Apache服务器配置 相关包: httpd-2.2.3-29.e15.i386.rpm                 //主程序包 httpd-devel-2.2.3-29.e15.i ...

  2. notepad++运行paython程序

    cmd /k C:\Python30\python.exe "$(FULL_CURRENT_PATH)" & PAUSE & EXIT 添加引用的环境变量

  3. windows获取文件夹下所有文件名的方法

    方法一:tree命令 TREE——显示磁盘目录结构命令 功能:显示指定驱动器上所有目录路径和这些目录下的所有文件名. 格式:TREE [盘符:][\目录] [/F] [/A] 使用说明:使用/F参数时 ...

  4. 在使用windows调用Hadoop 错误 /bin/bash: line 0: fg: no job control一般解决方法

    在使用windows调用Hadoop yarn平台的时候,一般都会遇到如下的错误: 2014-05-28 17:32:19,761 WARN org.apache.hadoop.yarn.server ...

  5. eclipse adt调试出错,不能产出apk问题

    The connection to adb is down, and a severe error has occured http://blog.csdn.net/h7870181/article/ ...

  6. bzoj2748(HAOI2018)音量调节

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=2748 水得不想写.别忘了-1. #include<iostream> #incl ...

  7. mac系统PHP 7.1.12安装xhprof并使用[View Full Callgraph]小记

    前几天从php7.0.x 升级到了php7.2.0版本, 结果装xhprof没有找到能支持对应版本的xhprof 于是又安装了一个php7.1.2的版本(brew install h) 接着安装xhp ...

  8. JAVASE02-Unit012: Unit07: XML语法 、 XML解析

    Unit07: XML语法 . XML解析 emplist.xml <?xml version="1.0" encoding="UTF-8"?> & ...

  9. 安装MySQL-python 的问题

    安装MySQL-python 的问题 1.CentOS下载mysql-devel安装 yum install mysql-devel 2.Ubuntu下不叫mysql-devel,而是叫libmysq ...

  10. android流畅度比Ios差的原因

    Andorid更新了一个版本又一个版本,硬件从单核到双核到四核,系统流畅度总算基本能和iOS持平了.不过人们不禁会问,为什么都是基于Linux,两个系统会差别如此大?为什么iPhone 4用单核处理器 ...