首页 > 其他 > 详细

Realtime Rendering 6

时间:2018-06-16 13:01:56      阅读:202      评论:0      收藏:0      [点我收藏+]

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.

 

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、一种常用策略。

  技术分享图片

 

Realtime Rendering 6

原文:https://www.cnblogs.com/tekkaman/p/9190234.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!