Deferred Lighting
Deferred lighting separate lighting from rendering and make lighting a completely image-space technique. This is very different from the forward rendering. At first as the limitation of the hardware, we could make per-object lit by max number of 8 lights at one time, everything (light source setting, materials, texture) must be set up by the render states before rendering; As the hardware become more powerful, we could do additive lighting, one light one pass, all lighting will be blend together. It seems no max number of light source here. If we put too much lighting calculation in the pxiel shader, the situation will become worse. Because of z-test, a lots of pixels that do the lighting calculation need to be discard. But this will be become the advantages of deferred lighting.
In deferred lighting, lights major cast is based on the screen area coverd; all lighting is per-pixel and all surface are lit equally (every objects will use the same light equation); light allows fast hardware Z-Reject. At the other hand, some disadvantages comes along: large frame-buffer size required; At some situation will become high fill-rate (a lots of lights do full screen lighting); It is difficult to support multiple light equation; It is very hard to handle transparncy objects; And hig hardward specification.
Deferred lighting could be adapted to photo-realistic rendering, that could achive very complex visual effects and very high visual quality than the tranditional forward rendering. At the same time, keep the frame rate still high. This the main reason why some latest TV or video games vastly using it.
G-Buffers
The key point of the deferred lighting is the G-Buffers or the image contents. What kind of parameters we should save for geometries in it depends on our light equation. For example, if we do direct lighting with Phong / Blinn Model, usually we need diffuse color, normal, position, diffuse coefficient, specular color, specular coefficient and so on. Choosing of lighting parameters depends on you, you could even ignore and discard some of them. You could discard the specular part, and do not use a dedicated buffer to save the surface position but just save the depth buffer (the postion could be restored by the screen space depth value)(There is such a HDR Deferred rendering sample on the Nvidia site). Here is a comparsion between two implements that I download from beyond3D and Nvidia[HDR Deferred Shading].
After G-buffers created, the light contribution will be calculated and saved into the light buffer. Sometimes, the final result value may beyond 1, you could ignore it and saturate the result with the hardware support or use a high dynamic range buffer to hold it. If you consider to use a HDR buffer, you should find some way to make those HDR display correctly on the LDR monitor. Here comes the tone mapping.
Here are screen shots about those buffer content:
High Dynamic Range (HDR)
Sometimes, using HDR buffers will waste too much memory. Actually we could Encode the HDR value(RGB) and store them into LDR buffers(RGBA). A lots of encoded method could be found on the Internet. Usually, we could use RGBM or RGBE. Some weak hardware like WII perfer to use RGBM encoding, and powerful device like PS3, XBOX360 perfer to use RGBE encoding.
Transparency Objects
There is no cheap solution for tranparency objects in deferred lighting. One way may be fall-back to forward rendering after deferred lighting; Or we could do the color blend with pixel shader in the post-process phase.
Light Optimization
As the deferred lighting is based on the screen space covered, so the best way to improve it is to find the minimal screen space covered. For the directional light, the full screen light shader will be used. For the volume light like point light and spot light, the convex light volume will be used to best enclosed and to find the minimal clip screen area(sphere for point light, frustum for spot light). Here we need to make sure that those light volume will not clip the near and far clip plane at the same time. Otherwise, there will be lighting hole.
Another method, we could use was use stencil buffer to accurately figure out the light screen areas.
Summary
-- Deferred lighting requires more memory. If you consider to use some post-process like blur, tone mapping, depth of field, more memory requried to save the immediate result (some effect could not done just with only one pass).
-- For some reasons, the authors prefer to texture to replace some complex pixel instructions. As you could find out that in those samples the N.L and N.H dot fucntion, light attenuation will be pre-calculated in some textures. Of course this will save some GPU performance. Well, this method is very popular because we could apply very complex light equation in real time. If you check the Unity3D ‘ShadowGun’ sample, you will find a editor generated texture for BRDF. That it is.
-- Currently, more and more engine provide deferred lighting for similar features. Unity and Unreal provide the forward and deferred rendering at the same time.
-- The full source code could be download from here.
Deferred Lighting的更多相关文章
- Unity5 的新旧延迟渲染Deferred Lighting Rendering Path
unity5 的render path ,比4的区别就是使用的新的deferred rendering,之前的4的deferred rendering(其实是light prepass)也被保留了下来 ...
- 渲染路径-Unity5 的新旧推迟渲染Deferred Lighting Rendering Path
Unity5 的新旧延迟渲染Deferred Lighting Rendering Path unity5 的render path ,比4的区别就是使用的新的deferred rendering,之 ...
- unity deferred lighting
不同于硬件的tbdr 软件层把光照放后面计算也有一个tbdr 先说deferred rendering 再说tiled 1.gbuffer出 G0 albedo ---rgb occlusion -- ...
- 渲染路径-Deferred Lighting 延时光照
http://blog.csdn.net/heyuchang666/article/details/51564954 注意: 最后3个步骤注意下 延时光照是有着最高保真度的光照和阴影的渲染路径.如果你 ...
- Deferred Shading 延迟着色(翻译)
原文地址:https://en.wikipedia.org/wiki/Deferred_shading 在3D计算机图形学领域,deferred shading 是一种屏幕空间着色技术.它被称为Def ...
- 前Forward / 延时Deferred
本章节描述了延时光照的渲染路径的细节,如果想了解延迟光照技术,请查阅Deferred Lighting Approaches article. Deferred Lighting is renderi ...
- Deferred Shading,延迟渲染(提高渲染效率,减少多余光照计算)【转】
Deferred Shading,看过<Gems2> 的应该都了解了.最近很火的星际2就是使用了Deferred Shading. 原帖位置: http://blog.csdn.net ...
- Deferred Rendering(二)G-Buffer的组织
先来看一张网上广为流传的<杀戮地带2>典型的Deferred Shading的G-Buffer组织: 这里补充解释下几个点: 不存Position,而由depth和屏幕像素坐标反推出来.參 ...
- Deferred Rendering(三)反锯齿和半透明问题
Deferred 框架下的AA 前面说过Deferred 框架下无法使用硬件AA.这句话不严谨: Deferred Shading在G-Buffer之后,物体几何信息全被抛弃了,导致兴许每一个像素都独 ...
随机推荐
- 类中调用界面ActiveX控件报错当前线程不在单线程单元中因此无法实例化 ActiveX 控件的解决办法
解决办法是Form类中定义一个静态的ActiveX对象,在formload中将界面上的ActiveX对象赋值给新定义的对象,类中访问该静态对象即可. public static AxClientDri ...
- js数组与字符串处理 slice、splice、substring、substr、push、pop、shift、reverse、sort、join、split
数组 方法 1.在数组末尾添加.删除元素 push()方法可以接收任意数量的参数,把它们逐个添加到数组的末尾,并返回修改后数组的长度.改变原数组 pop()方法则从数组末尾移除最后一个元素,减少数组的 ...
- echarts 表格与 div 之间 空白的设置
一. options 图表选项,包含图表实例任何可配置选项: 公共选项 , 组件选项 , 数据选项 {Object} grid 二. grid 直角坐标系内绘图网格 名称 默认值 描述 {number ...
- SpringBoot如何添加拦截器
在web开发的过程中,为了实现登录权限验证,我们往往需要添加一个拦截器在用户的的请求到达controller层的时候实现登录验证,那么SpringBoot如何添加拦截器呢? 步骤如下: 1.继承Web ...
- TextView的跑马灯效果(AS开发实战第二章学习笔记)
TextView的跑马灯效果跑马灯用到的属性与方法说明singleLine 指定文本是否单行显示ellipsize 指定文本超出范围后的省略方式focusable 指定是否获得焦点,跑马灯效果要求设置 ...
- VStudio2015 开发MD风格的windows软件(附上使用第三方库教程)
MD就是Google的一个安卓5.0+好看界面,都知道win下没有,那么就有大牛弄出了C#版的MD 特别说明:开发环境是.net 4.6 下面开始教程喂! 新建一个工程,这些不要我说了吧,如果没一点基 ...
- SpringMVC学习(一)——概念、流程图、源码简析
学习资料:开涛的<跟我学SpringMVC.pdf> 众所周知,springMVC是比较常用的web框架,通常整合spring使用.这里抛开spring,单纯的对springMVC做一下总 ...
- python nose测试
前提: python3 安装nose 结果: nose目录下有子目录tests和mybag,在mybag下新建my_age.py, 内部有Students类,age属性. tests目录下写Sutde ...
- angular2 应用 不同的environment 进行 build/serve
文件目录如下: 命令行使用:ng serve --e=dev/offline/prod build 不同,像上面那样写没用.必须后面再加--prod 如: ng build --e=offline - ...
- Mysql学习---基础操作学习2
基本数据类型 Mysql基本数据类型:二进制,数值[整数,小数].字符串[定长,变长]. 二进制数据.时间和枚举集合 bit[(M)] 二进制位(101001),m表示二进制位的长度(1-64),默认 ...