Camera’s Depth Texture
【Camera’s Depth Texture】
In Unity a Camera can generate a depth or depth+normals texture. This is a minimalistic G-buffer texture that can be used for post-processing effects or to implement custom lighting models (e.g. light pre-pass). Camera actually builds the depth texture using Shader Replacement feature, so it’s entirely possible to do that yourself, in case you need a different G-buffer setup.
Camera’s depth texture can be turned on using Camera.depthTextureMode variable from script.
There are two possible depth texture modes:
- DepthTextureMode.Depth: a depth texture.
- DepthTextureMode.DepthNormals: depth and view space normals packed into one texture.

[DepthTextureMode.DepthNormals texture]
This builds a screen-sized 32 bit (8 bit/channel) texture, where view space normals are encoded into R&G channels, and depth is encoded in B&A channels. Normals are encoded using Stereographic projection, and depth is 16 bit value packed into two 8 bit channels. UnityCG.cginc include file has a helper function DecodeDepthNormal to decode depth and normal from the encoded pixel value. Returned depth is in 0..1 range.
Camera’s Depth Texture的更多相关文章
- 使用Depth Texture
使用Depth Textures: 可以将depth信息渲染到一张texture,有些效果的制作会需要scene depth信息,此时depth texture就可以派上用场了. Depth Text ...
- u3d_Shader_effects笔记5 第二章 通过UV,进行纹理移动
1.前面心情 公司最近打包,像我等小弟闲着,看代码容易困,没事偷着学shader,不过还是要多交流才行. 2.本文参考 这次参考比较多:由texture uv延伸问题多,主要是不明白变量定义: htt ...
- Rendering with Replaced Shaders
[Rendering with Replaced Shaders] 1.RenderType tag RenderType tag categorizes shaders into several p ...
- shader内置变量
内置变量都在UnityShaderVariables.cginc文件中声明 变换矩阵 All these matrices arefloat4x4 type. Name Value UNITY_MAT ...
- Unity3D图像后处理特效——Depth of Field 3.4
Depth of Field 3.4 is a common postprocessing effect that simulates the properties of a camera lens. ...
- depth and distance
1down votefavorite I'm implementing ominidirectional shadow mapping for point lights. I want to us ...
- Tutorial - Deferred Rendering Shadow Mapping 转
http://www.codinglabs.net/tutorial_opengl_deferred_rendering_shadow_mapping.aspx Tutorial - Deferred ...
- 自制Unity小游戏TankHero-2D(3)开始玩起来
自制Unity小游戏TankHero-2D(3)开始玩起来 我在做这样一个坦克游戏,是仿照(http://game.kid.qq.com/a/20140221/028931.htm)这个游戏制作的.仅 ...
- Shader预处理宏、内置状态变量、多版本编译等
预定义shader预处理宏: Target platform: SHADER_API_OPENGL - desktop OpenGL SHADER_API_D3D9 - Direct3D SHADER ...
随机推荐
- java中线程安全问题
在java中单线程和多线程是什么意思,他们有什么区别,分别的作用是什么? 在一个程序中,这些独立运行的程序片断叫作“线程”(Thread),利用它编程的概念就叫作“多线程处理”.多线程处理一个常见的例 ...
- http状态码status
status——http状态码 1xx 消息 2xx 成功 3xx 重定向 ▪ 301 Moved Permanently 永久重定向——下回不会再找他了 ▪ 302 Move temporarily ...
- lapis 数据库配置
备注: 目前支持 postgresql .mysql (实际使用大家可以尝试用下tidb.CockroachDB) 1. pg数据库配置 // config.lua local config = ...
- 关于浏览器和IIS基础的简单理解
浏览器 输入域名或者IP地址,按回车访问后:发生了什么??IIS是如何工作的?为什么能这么工作?? 1 浏览器和IIS 分别是两个应用程序:浏览器访问网址实际就是 两个应用程序的数据交互往来: ...
- filter权限识别
由于书上的例子弄不出来 自己瞎弄了个简易版的 登陆页面 <%@ page language="java" import="java.util.*" pag ...
- linux文本处理命令 一
1,cut 主要的用途在于将同一行里面的数据进行分解 cut -d ‘分隔符’ -f ‘第几段’ 和-f同时使用 -c 字符区间 截取字符区间 2,grep cut 是在一行讯息当 ...
- [rejected] master -> master (fetch first)(non-fast forward)
git push 时候遇到的错误: hint: Updates were rejected because the tip of your current branch is behind hint: ...
- phpstudy mysql无法启动
在安装好phpstudy后,Apache可以启动,Mysql无法启动. 以管理员的身份运行cmd,然后输入sc delete mysql 即可
- 【转】利用 Apache JMeter 测试 WebSphere 性能
如果您预算紧张并且时间紧迫 —— 或者即使您不是这样 —— 那么,您可能希望考虑使用 JMeter 来对 Web 和其他应用程序进行压力测试.IBM 的 Greg Herringer 详细描述他使用这 ...
- STS - 配置Tomcat 运行路径
背景 今天在一台新机器上面安装开发环境,下载完code以后在STS上配置Tomcat,发现启动以后无法读取到配置文件...启动失败! 七月 , :: 上午 org.apache.catalina.co ...