Realtime Rendering 6

1、Lighting computations occur in two phases:

  1)light phase.

    used to compute the light’s direction vector l and irradiance contribution  E^L.

  2)material phaes.

    In the material phase, the BRDF parameters and surface normal.

  The result of the BRDF evaluation is multiplied by a cosine factor and by to produce the outgoing radiance EL.

  Both phases are repeated for each light source and the results are summed to produce the total outgoing radiance for the fragment.

  每个 surface对每个 light source 依次执行上面两个 phase,所有 light source 的计算结果结果最终汇总到一起。

2、 每一个material需要配合各种 light source组合,导致shader非常多。

  Valve抯 Half-Life 2 has 1920 pixel shader combinations.

  Light Type 组合会导致Shader爆炸。

3、让每个material处理所有的 light 会导致效率非常低。

  A long hallway, which is lit by twenty spaced light sources.  if dynamic branches are not employed, then all twenty light sources need to be computed for every pixel.

  loop优化方式是:

  loop over light sources dynamically in the pixel shader. Unfortunately, dynamic branches in the pixel shader perform poorly on many GPUs.

  ubershader、supershader 优化方式:

  write a single large shader that is compiled multiple times, using language features or code preprocessors to create a different specialized version of the shader each time.

  只写一个通用Shader,通过mactro为每一种 light source组合生成相应shader。

4、一种常用策略。

  

5、Multipass Lighting.

  The idea is to process every light in a separate rendering pass. using the hardware's additive blending capabilities to sum the results in the frame buffe

  每个shader的每个 pass 渲染一种 light source type。从而shader与light source type 组合数解耦。

  此法可以解决Shader爆炸的问题。

  但是此种渲染效率并不高。 This is an O(mn) process. 

6、Deferred Shading.

  to perform all visibility testing before performing any lighting computations.  If the fragment is completely covered by some later fragment, all the time spent computing its shade is wasted.  

  用于优化因深度问题而导致的无效渲染的问题。

  A rough front-to-back sort of objects can help minimize this problem, but deferred shading completely resolves it.

   从前向后渲染中以缓解无用渲染问题,但延迟渲染可以完全解决它。

  Be done with a Z-buffer by performing a rendering pass that stores away the attributes of the closest visible surface.  Values saved include the z-depth, normal, texture coordinates, and material parameters.

  These values are saved to multiple render targets accessed by the pixel shader program.  The stored buffers are commonly called G-buffers,short for “geometric buffers

  第一个Pass渲染所有信息到 G-Buffer,包括 z-depth,normal,texture coordinate, material parameter。第一个pass从G-buffer中读取数据,进行渲染。

  Fragment shading is done only once per pixel (per shading program) and so has a predictable upper bound on rendering cost. Geometric transformation is done only once, in the initial pass, and any computations needed for lighting are done only once.

  Fifty or more dynamic lights in a scene can easily be handled by deferred shading;

  延迟渲染中以轻松处理50个以上的灯光。

7、Early Z pass。

  分两步:

  1)performing an initial pass and establishing the Z-buffer.

  2)scene is rendered normally with full shading. 

8、Deferred Shading Zioma变种。

  local light sources are rendered to and stored in buffer. Depth peeling can be used to handle storing the information for overlapping light sources. The scene’s geometry is then rendered, using these stored light representations during shading.

  此法有两个好处:

  1)surface materials are not limited by what is stored in the G-buffer

  2)storing light source descriptions can take considerably less space than storing a full material description. 

Realtime Rendering 6的更多相关文章

  1. Rendering pipeline overview(读书笔记1 --- Real-Time rendering)

    1. Rendering pipeline的作用就是在给定的虚拟相机.三维物体.光源.着色方程式.纹理等的条件下产生(渲染)二维图像 2. pipeline包含很多个stage,其效率由最慢的stag ...

  2. Realtime Rendering 1.1

    [Realtime Rendering 1.1] 1.A linear transform is one that preserves vector addition and scalar multi ...

  3. Realtime Rendering 5

    [Real Time Rendering 5] 1.In radiometry, the function that is used to describe how a surface reflect ...

  4. 画面渲染:实时渲染(Real-time Rendering)、离线渲染(Offline Rendering)[转]

    实时渲染(Real-time Rendering) 实时渲染的本质就是图形数据的实时计算和输出.最典型的图形数据源是顶点.顶点包括了位置.法向.颜色.纹理坐标.顶点的权重等.在第一代渲染技术中(198 ...

  5. Real-Time Rendering (2) - 变换和矩阵(Transforms and Matrics)

    http://blog.csdn.net/silangquan/article/details/9970673 提要 在图形的计算中,比如旋转.缩放.平移.投影等操作,矩阵都扮演着极其重要的角色,它是 ...

  6. 基本变换(读书笔记5 --- Real-Time rendering)

    刚体变换 即变换不改变了被变换顶点之间的距离,以及偏手性(不会让左右手坐标系颠倒). 下面的平移变换.旋转变换即属于刚体变换 平移 从一个位置变到另一个位置可以用平移矩阵T来表示,这个矩阵将一个实体变 ...

  7. Shaders(读书笔记4 --- Real-Time rendering)

    1. vertex,pixel以及geometry shaders共享一个programming model,即common-shader core,在GPU架构中的unified shader可以和 ...

  8. Rasterizer Stage(读书笔记3 --- Real-Time rendering)

    rasterizer stage的目标:计算和设置每个像素的颜色.将屏幕空间的二维顶点和每个顶点的shading信息转换为屏幕上的像素. rasterizer stage可以分为几个阶段:triang ...

  9. Geometry Stage in Rendering pipeline (读书笔记2 --- Real-Time rendering)

    Geometry Stage一般包含下面几个阶段 1. Model & View Transform(模型和视图变换) --- 模型空间--> 世界空间 模型变换:每个模型经过模型变换来 ...

随机推荐

  1. Beanutils工具常用方法

      BeanUtils工具是一种方便我们对JavaBean进行操作的工具,是Apache组织下的产品.其主要目的是利用反射机制对JavaBean的属性进行处理. BeanUtils工具一般可以方便ja ...

  2. 输出单个文件中的前 N 个最常出现的英语单词,并将结果输入到文本文件中。程序设计思路。

    将文件内容读取后存入StringBuffer中. 利用函数将段落分割成字符串,按(“,”,“.”,“!”,“空格”,“回车”)分割,然后存入数组中. 遍历数组,并统计每个单词及其出现的次数. 要求出文 ...

  3. 【Excel】绘图案例_常见复合图:簇状图+堆积图+折线图

    前言 最近有朋友让我帮忙用excel画图,老实说我很讨厌用excel画图,点来点去,复杂一些还不能复用,非常繁琐.当然,入门也很简单.需求时不同城市.不同产品的2016和2017销量及环比数据,这应该 ...

  4. eclipse创建maven组合项目

    创建普通maven项目作为父项目: packaging类型选择pom. 创建子项目即可(需要mvn eclipse:eclipse构建为eclipse项目)

  5. 1.Hadoop简单理解与总结。

    1.什么是Hadoop? Hadoop是一种分布式数据和计算的框架.它很擅长存储大量的半结构化的数据集.数据可以随机存放,所以一个磁盘的失败并不会带来数据丢失.Hadoop也非常擅长分布式计算——快速 ...

  6. 42.scrapy爬取数据入库mongodb

    scrapy爬虫采集数据存入mongodb采集效果如图: 1.首先开启服务切换到mongodb的bin目录下 命令:mongod --dbpath e:\data\db 另开黑窗口 命令:mongo. ...

  7. 错误:SyntaxError: Missing parentheses in call to 'print'

    1.Python3编译器使用print函数需加括弧 print(XXX) 而Python 2可以print XXX 2.Python3表示不等只能用"!=" 3.在python3中 ...

  8. Redis位图实现用户签到功能

    场景需求 适用场景如签到送积分.签到领取奖励等,大致需求如下: 签到1天送1积分,连续签到2天送2积分,3天送3积分,3天以上均送3积分等. 如果连续签到中断,则重置计数,每月初重置计数. 当月签到满 ...

  9. Redis set 数据类型

    sadd() smembers sinter:返回集合的交集 sinterstroe:返回交集结果 sunion :去并集 sunionstore  取得并集 smove 从一个set集合移动到另一个 ...

  10. 10款流行的Markdown编辑器,总有一款适合你

    摘要:作为一个开源人,如果你不会使用Markdown语法,那你就OUT了!Markdown 是 2004 年由 John Gruberis 设计和开发的纯文本格式的语法,非常的简单实用. 作为一个开源 ...