本文最后一节会介绍的Clustered Forward Rendering虽然也会对空间做划分,但这种运行时的划分更多是基于并行计算了(中间仍可以采用预计算的空间划分加速结构,两者不矛盾)。介绍这一课题时会节选一小段《Siggraph2016 - The Devil is in the Details: idTech 666》的内容,带大家一起看看一下新DOOM中对于这项技术的应用,作为对写本篇初衷的一个呼应。(原文标题就有 idTech 666,具体不知是什么梗)
终于来到本文的“硬菜”,让我们还是回到Doom——《Siggraph2016 - The Devil is in the Details: idTech 666》结合《DOOM (2016) - Graphics Study》。原文其实很多段落展示了渲染的方方面面,我会以翻译原文再加上个人评述的方式来展示其中Clustered Forward Rendering的部分。
The depth test function is set to EQUAL to avoid any useless overdraw computation, thanks to the previous depth pre-pass we know exactly which depth value each pixel is supposed to have.
*之前的步骤已经进行了深度预运算,后续的分块运算都可以基于这个深度缓冲。
In DOOM the camera frustum is divided into 3072 clusters (a 16 x 8 x 24 subdivision), the depth slices being positioned in a logarithmic way along the Z axis.
*划分的集群数量是3072个,深度上的划分是延Z轴以对数的方式进行。
Each cluster can hold up to 256 lights, 256 decals and 256 cubemaps.
the code loops over all the decals / lights of the cluster, calculating and adding their contribution.
*代码循环一个集群中的光照和贴花,计算并汇总它们对总光照的影响。
Clustered-forward rendering is getting some attention recently: it has the nice property of handling more lights than basic forward while being faster than deferred which has to write to / read from several G-Buffers.
评论区
共 9 条评论热门最新