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 ...
随机推荐
- openresty 使用 log_by_lua 发送日志到 syslog-ng
1. 安装 opm get p0pr0ck5/lua-resty-logger-socket 2. 使用 location lua_by_lua_block log_by_lu ...
- laravel的auth用户认证的例子
参考http://www.cnblogs.com/yjf512/p/4042356.html 需要注意的是,生成的测试数据,password部分必须用laravel自带的hash一下 Hash::ma ...
- 手动封装OpenCV1.0的IplImage读取保存功能遇到的小问题
最近准备重新学习图像处理的知识,主要目的是自己实现一遍图像处理的算法,所以除了读取.保存图像外的操作都自己写,没想到直接封装OpenCV的读取.保存功能的第一步就出错.关键代码如下 void MyIm ...
- css 字体英文对照
宋体: SimSun 黑体: SimHei 华文细黑: STHeiti Light [STXihei] 华文黑体: STHeiti 微软雅黑: Microsoft YaHei 微软正黑体: Micro ...
- idea 类注释,方法注释设置
类头注释:打开file->setting->Editor->Filr and Code Templates->Includes->File Header 直接在右边的文件 ...
- 二、Spark在Windows下的环境搭建
由于Spark是用Scala来写的,所以Spark对Scala肯定是原生态支持的,因此这里以Scala为主来介绍Spark环境的搭建,主要包括四个步骤,分别是:JDK的安装,Scala的安装,Spar ...
- ROS6.16开始支持802.11ac了,扫盲下
Wi-Fi的5G频段与802.11AC背后那些事儿本文章来自某路由论坛,作者为张导,本人转载,原地址http://bbs.hiwifi.com/thread-9086-1-1.html 曾几何时,大家 ...
- vscode新版1.31.1使用代码检查工具ESlint支持VUE
1.VSCODE中安装ESlint省略 2.菜单文件->首选项->设置->扩展->ESLint 打钩:Eslint:Auto Fix On Save 点击此链接:在settin ...
- http的含义
HTTP是超文本传输协议,是客户端浏览器或其他程序与Web服务器之间的应用层通信协议.在Internet上的Web服务器上存放的都是 超文本信息,客户机需要通过HTTP协议传输所要访问的超文本信息.H ...
- UISegmentedControl-iOS
//建立UISegmentedControl的数组 NSArray *segmentedArray = [NSArray arrayWithObjects:@"线下培训",@&qu ...