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.

参考:file:///C:/Program%20Files%20(x86)/Unity/Editor/Data/Documentation/html/en/Manual/SL-CameraDepthTexture.html

Camera’s Depth Texture的更多相关文章

  1. 使用Depth Texture

    使用Depth Textures: 可以将depth信息渲染到一张texture,有些效果的制作会需要scene depth信息,此时depth texture就可以派上用场了. Depth Text ...

  2. u3d_Shader_effects笔记5 第二章 通过UV,进行纹理移动

    1.前面心情 公司最近打包,像我等小弟闲着,看代码容易困,没事偷着学shader,不过还是要多交流才行. 2.本文参考 这次参考比较多:由texture uv延伸问题多,主要是不明白变量定义: htt ...

  3. Rendering with Replaced Shaders

    [Rendering with Replaced Shaders] 1.RenderType tag RenderType tag categorizes shaders into several p ...

  4. shader内置变量

    内置变量都在UnityShaderVariables.cginc文件中声明 变换矩阵 All these matrices arefloat4x4 type. Name Value UNITY_MAT ...

  5. Unity3D图像后处理特效——Depth of Field 3.4

    Depth of Field 3.4 is a common postprocessing effect that simulates the properties of a camera lens. ...

  6. depth and distance

    1down votefavorite   I'm implementing ominidirectional shadow mapping for point lights. I want to us ...

  7. Tutorial - Deferred Rendering Shadow Mapping 转

    http://www.codinglabs.net/tutorial_opengl_deferred_rendering_shadow_mapping.aspx Tutorial - Deferred ...

  8. 自制Unity小游戏TankHero-2D(3)开始玩起来

    自制Unity小游戏TankHero-2D(3)开始玩起来 我在做这样一个坦克游戏,是仿照(http://game.kid.qq.com/a/20140221/028931.htm)这个游戏制作的.仅 ...

  9. Shader预处理宏、内置状态变量、多版本编译等

    预定义shader预处理宏: Target platform: SHADER_API_OPENGL - desktop OpenGL SHADER_API_D3D9 - Direct3D SHADER ...

随机推荐

  1. Sprint第一个冲刺(第三天)

    一.Sprint介绍 今天我们完成了简单登录界面及美化的任务,完成了此次整个Sprint的百分之十五. 下面是实验截图: 二.Sprint周期 看板: 燃尽图:

  2. asp.net如何判断服务器上的目录或文件是否存在

    asp.net判断服务器上的目录或文件是否存在!(实例) // ======================================================= [判断文件是否存在] u ...

  3. 在一个form中有两个submit,值分别为修改和删除,如何在提交时用js判断submit值为修改还是删除呢

    同一个form里,不管哪个 submit 都是直接提交form表单里的内容. 要达到你的目的,就不能用类型为 submit 的按钮,要用 button,然后加onclick 方法来自定义预处理参数,然 ...

  4. 本地Office Project计划表同步到SharePoint2013任务列表的权限问题

    使用SharePoint做项目管理时,项目任务列表往往比较重要,通常使用任务列表体现项目计划,而这个任务列表经常会根据项目计划的变更而进行调整,但更多时候项目管理者会习惯在本地Project中维护这份 ...

  5. 老齐python-基础3(列表)

    1.定义一个列表 >>> a = [] #创建一个空列表 >>> type(a) #查看数据类型 <class 'list'> >>> ...

  6. "Could not find the main class: org.apache.catalina.startup.Boostrap. Program will exit."

    尝试将 myeclipse中的编译版本修改(如,将1.5修改为1.6)

  7. python 高阶内置函数

    1.lambda 匿名函数 lambda 参数: 返回值 函数名统一都叫lambda. 2.sorted() 排序函数 排序函数 sorted(iterable,key,reverse) key:排序 ...

  8. java代码-----------逻辑运算符、 &&逻辑与 ||或

    总结: && :两者均满足.是true ||: 两者中有一个满足就为true,不然就是false package com.sads; public class shou { publi ...

  9. s=a+aa+aaa+aaaa+aa...a的值,其中a是一个数字。例如2+22+222+2222+22222(此时共有5个数相加),几个数相加由用户控制。

    package com.hanqi; import java.util.*; public class yonghukongzhi { public static void main(String[] ...

  10. pagination实现分页功能

    pagination.js: /** * pagination分页插件 */ ;(function($,window,document,undefined){ //配置参数 var defaults ...