Unity Graphics (Unity 图形渲染 ) 官方教程文档笔记系列之十

Unity Graphics (Unity 图形渲染 )
- Everything for Lighting and Rendering in Unity
- 主要涉及到光照与渲染方面的知识

本文档主要是对Unity官方教程的个人理解与总结(其实以翻译记录为主:>)
仅作为个人学习使用,不得作为商业用途,欢迎转载,并请注明出处。
文章中涉及到的操作都是基于 Unity2018.3版本
参考链接:https://unity3d.com/cn/learn/tutorials/s/graphics


下面是将要介绍的章节,黑体是本次内容:

  • Introduction to Lighting and Rendering
    介绍光照和渲染
  • Precomputed Realtime GI (Realtime Global Illumination)(10)
    预处理实时全局光照(10)
  • Rendering and Shading
    渲染与着色
  • Cameras and Effects
    相机与效果
  • Geometry in Unity
    几何体

8.Understanding Clusters

了解群集

Up to this point we have discussed Precomputed Realtime GI in terms of Charts. Reducing or otherwise optimizing the number of Charts in our Scene limits the number of operations such as lightmap compositing and packing required during the precompute. This benefits precompute performance and is a broad approach to reducing the size of the data set required by Unity’s Precomputed Realtime GI solution.
到目前为止,我们已经讨论了基于图表的预计算实时GI。减少或优化图表的数量可减少在预计算期间所需的光照图合成和打包等操作的数量。这有利于预计算性能,并且可以减少Unity预计算实时GI解决方案所需的数据集大小,是一种广泛的方法。

Modifying Clusters is a finer-grained approach which will allow us to reduce the number of operations needed during later tasks in Unity’s precompute process. An additional benefit of reducing the number of Clusters is that run time performance will also be improved.
修改群集是一种更细粒度的方法,它将允许我们在Unity的预计算过程中减少后面任务所需的操作量。减少群集数量的另一个好处是,运行时性能也将得到改善。

When generating the Scene’s lighting solution using Precomputed Realtime GI, Unity simplifies the calculations required by working on a voxelized ‘proxy’ of the Static Scene. These voxels are called Clusters. Clusters are effectively surface patches (small tiles) mapped onto Static geometry which we use for lighting. Clusters are stored in a hierarchical relationships and are used for the complex irradiance calculations needed when precomputing Unity’s diffuse global illumination solution. Note that although Clusters are mapped in a similar way to Charts, the two are actually independent.
当使用预计算实时GI生成场景光照解决方案时,Unity使用静态场景的体素化“代理”简化了所需要的计算。这些体素被称为群集。群集实际上是映射到我们用于照明的静态几何体的有效表面块(小块)。群集被存储在层次关系中,用于预计算Unity的漫反射全局光照解决方案所需要的复杂辐照度计算。请注意,尽管群集以类似于图表的方式映射,但两者实际上是独立的。


The Clustering Scene draw mode can be used to visualize the size of clusters generated by Unity’s Precomputed Realtime GI.
场景绘制模式:群集被用于可视化群集的大小,这是由Unity预计算实时GI生成的。

Clusters sample the albedo of the Static geometry to which they are mapped. Then, during the Light Transport stage of the precompute, the relationship between these Clusters is calculated so that light can be propagated throughout the Cluster network. Unity generates this low resolution approximation of the Static Scene in order to simplify the amount of lighting data which needs to be updated during run time in order to deliver global illumination at interactive frame rates with the limitations of current hardware.
群集对它们映射的静态几何体的反射率(漫反射)进行采样。然后,在预计算的光照传输阶段,计算了这些群集之间的关系,以便在整个群集网络中传播光照。Unity生成了近似静态场景的低分辨率,以简化在运行时需要更新的光照数据量,以便在合适的帧率和限制在当前硬件水平的情况下提供全局光照。

Illustration showing how the lighting value of Cluster X is related to the value of nearby Clusters (Image courtesy of Geomerics).
插图显示了群集X与附近群集的值相关的照明值(图片由Geomerics提供)。

Once the precompute has been completed, ambient (skybox) lighting along with light positions, intensities and colors can then be modified without needing to restart the precompute process. These lighting changes will bounce and permeate throughout the Cluster network, taking into consideration the underlying albedo and emission of the Scene’s materials in the eventual output.
一旦预计算完成,环境光(天空盒)伴随光的位置、强度和颜色就可以被修改,而且不需要重新启动预计算过程。这些光照变化将在整个群集网络中碰撞和透过,在最终输出时,还要考虑到场景材质本来的漫反射和自发光。

Following this initial bounce, updated lighting results can then be applied to the Clusters themselves. Following each iteration, lit Clusters will be sampled into the corresponding lightmap texture before finally being used by shaders within the Scene.
随着最初的碰撞之后,更新的光照结果可以应用到群集本身。随着每次迭代,在最终被场景中的着色器使用之前,光照群集将被取样到相应的光照图纹理中。

As this process is performed asynchronously on the CPU, the time it takes to refresh the global illumination solution is bound by the number of available worker threads. If needed, the amount of worker threads can be controlled using the ‘CPU Usage` setting found in the Lighting window.
由于这个过程是在CPU上异步执行的,更新全局光照解决方案所需的时间是由可用的工作线程的数量有关的。如果需要,可以使用在光照窗口中找到的“CPU使用”设置来控制工作线程的数量(未发现设置项)。


The Lit Clustering Scene draw mode shows the Clusters once light has been bounced throughout the Cluster network.
场景绘制模式:光照群集显示了一旦光照在整个群集网络中被碰撞后的群集。

Clusters can be visualized using the Clustering or Lit Clustering Scene draw mode. Using Clustering, the Scene will be overlaid with a diagnostic pattern made up of multicolored squares. The size of each square represents the size of a Cluster when mapped on to the corresponding Static geometry. Each unique color represents a different Cluster within the Scene. Similarly, the Lit Clustering Scene draw mode shows these Clusters once lighting has been bounced throughout the Cluster network and the results written back to the Clusters.
群集可以使用场景群集或光照群集绘制模式进行可视化。使用群集,场景将被由彩色方块组成的特征模式覆盖。当映射到相应的静态几何体时,每个正方形的大小表示一个群集的大小。每一种独立的颜色代表着场景中不同的群集。类似地,光照群集场景绘制模式显示,一旦光照在整个群集网络中被碰撞,结果会被写入到群集中。

Reducing the number of Clusters largely determines how quickly this update occurs and, as a consequence, how interactive Unity’s Precomputed Realtime GI appears on your target platform. More importantly, for the purposes of this tutorial, reducing the number of clusters will improve the time it takes to precompute your lighting. As a result, iteration speeds when lighting your Scene will also improve. We will move onto techniques for reducing the number of Clusters in the following section of the tutorial.
减少群集数量在很大程度上决定了更新生成的速度,从而决定了交互式Unity的实时GI在目标平台上的显示速度。更重要的是,对于本教程的目的,减少群集的数量将减少预计算光照所需的时间。因此,当光照场景时,迭代速度也会提高。在本教程的下一节中,我们将讨论减少群集数量的技术。

你可能感兴趣的:(Tutorials,Graphics,Unity,Graphics,图形渲染,教程文档)