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 ...
随机推荐
- elixir mix开发入门
备注: 简单使用mix 进行项目的生成,同时添加docker 构建支持 1. 生成项目 mix new mydemoproject 输出信息如下: * creating README.md * cre ...
- container-diff 谷歌开源镜像分析工具使用
1. 安装 curl -LO https://storage.googleapis.com/container-diff/latest/container-diff-linux-amd64 & ...
- mysql导入外部sql脚本的方法
版权声明:本文为博主原创文章.未经博主同意不得转载. https://blog.csdn.net/u011043843/article/details/29689853 导入的方法分为两种:一是採用图 ...
- Java变量类型之间的转换
int i; String s="134"; 1)String转换成int i=Integer.parseInt(s); 2)int转换成String(其他类型转String,都可 ...
- Errors running builder 'DeploymentBuilder' on project ' 解决方法
此问题一般发生在Myeclipse 保存文件并自动部署时候. Errors occurred during the build. Errors running builder 'DeploymentB ...
- AT指令(二)
1.常用操作1.1 AT命令解释:检测 Module 与串口是否连通,能否接收 AT 命令:命令格式:AT<CR>命令返回:OK (与串口通信正常) (无返回,与串 ...
- Spring Boot和Spring cloud
微服务框架SpringBoot简单验证 首先摘录部分IBM网站部分内容对框架做一个简单说明 http://www.ibm.com/developerworks/cn/java/j-lo-spring- ...
- eclipse和myeclipse的he user operation is wating问题
近做了一个MyEclipse项目,但是没开始多久就发现了这个问题:只要文件被修改过,不论多小的修改,保存的时候都会跳出一个框框,里面写着the user operation is wating.... ...
- offset()和position()
网上百度都有的说明是 offset():获取匹配元素在当前视口的相对偏移. position():获取匹配元素相对父元素的偏移. 如果单纯写这两句话,这个博客毫无意义 这里我写下他俩的使用情况,希望对 ...
- 使用wifi网卡笔记5---AP模式
使用WIFI网卡的AP功能 1.下载源码 hostapd: http://w1.fi/hostapd/ 2.编译.安装(hostapd依赖于libnl库,需要编译.安装此库) tar xzf host ...