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 ...
随机推荐
- 一步步用python制作游戏外挂【转】
转自:http://www.cnblogs.com/xsmhero/archive/2013/01/03/2842973.html 玩过电脑游戏的同学对于外挂肯定不陌生,但是你在用外挂的时候有没有想过 ...
- normalizr api 转换类库使用
1. 项目初始化 yarn init yarn add normalizr 项目结构 app.js package.json user.json 2. 使用 a. app.js const userj ...
- 我的 SONY MP3 NWZ-B105F
我的 SONY MP3 NWZ-B105F 只有 2GB 的容量,好像2007年出来的,现在还可以开机和播放. 使用的 SigmaTel 的方案 BGA 的封装,1.1inch 屏幕竟然是彩屏,锂电池 ...
- springboot注册bean失败
启动的主类应该放在和其他包一样的目录,不能放在一个目录里面
- Linux服务器运维安全策略经验分享
http://jxtm.jzu.cn/?p=3692 大家好,我是南非蚂蚁,今天跟大家分享的主题是:线上Linux服务器运维安全策略经验.安全是IT行业一个老生常谈的话题了,从之前的“棱镜门”事件中折 ...
- 选择排序算法-python实现
#-*- coding: UTF-8 -*- import numpy as np def SelectSort(a): for i in xrange(0,a.size): min = a[i] p ...
- 1103 Integer Factorization
题意:给出一个正整数N,以及k,p,要求把N分解成k个因式,即N=n1^p + n2^p + ... + nk^p.要求n1,n2,...按降序排列,若有多个解,则选择n1+n2+...+nk最大的, ...
- Java 连接数据库及字符编码
通过JDBC方式连接MYSQL数据库: public static Connection getConnection(){ String username="root" ; Str ...
- 简单IOCP例子
使用IOCP模型编程的优点 ① 帮助维持重复使用的内存池.(与重叠I/O技术有关) ② 去除删除线程创建/终结负担. ③ 利于管理,分配线程,控制并发,最小化的线程上下文切换. ④ 优化线程调度,提高 ...
- mysql清理连接
关闭指定ip的连接: for i in $(mysql -uusername -ppassword -Bse "select * from information_schema.proces ...