1.1.2 | 渲染管線類型

目錄索引

本系列與知乎同名翻譯同步更新,原文鏈接:https://zhuanlan.zhihu.com/p/646121988
如有任何翻譯錯誤,歡迎在評論區(qū)踹我:)!
原文對照
As we already know, there are three types of render pipelines in Unity. By default, we can find a?Built-in RP?that corresponds to the oldest engine belonging to the software, on the other hand,?Universal RP?and?High Definition RP?belong to a type of render pipeline called?Scriptable RP, which is more up-to-date and has been pre-optimized for better graphics performance.

Regardless of the rendering pipeline, if we want to generate an image on the screen, we have to travel through the "pipeline".
A pipeline can have different processing paths. These are known as?render paths; as if the example pipe in section 1.0.7 had more than one way to reach its destination.
A rendering path corresponds to a series of operations related to lighting and shading objects. This allows us to graphically process an illuminated scene (e.g. a scene with directional light and a Sphere).
Examples of these paths are?forward?rendering,?deferred shading,?legacy deferred?and?legacy vertex lit. Each of these has different capabilities and performance characteristics.
In Unity, the default rendering path corresponds to?forward rendering; this is the initial path for the three types of pipeline render that are included in Unity. This is because it has greater graphics card compatibility and a lighting calculation limit, making it a more optimized process.
Please note that in Universal RP, we can only use?forward?as a rendering path, whereas High Definition RP allows illuminated material rendering using either?forward?or?deferred?shading.

To understand this concept, we are going to suppose that we have an "object" and a "direct light" in a scene. The interaction between the light and the object is based on two points, they are.
1. Lighting characteristics.
2. Material characteristics.
The interaction between these two elements is called the?lighting model.
The basic lighting model corresponds to the sum of three different properties, which are ambient color, diffuse reflection and specular reflection.
The lighting calculation is carried out within the shader, this can be carried out per-vertex or per fragment. When the illumination is calculated by vertex it is called per-vertex lighting and is performed in the?vertex shader stage, likewise, when it is calculated per fragment it is called per-fragment or per-pixel shader and is performed in the?fragment shader stage.

譯文
在Unity中,目前有三種已知的渲染管線。我們可以在引擎中找到足以支持最古老版本的內(nèi)置渲染管線(Built-in RP),除此之外還有通用渲染管線(URP)和高清渲染管線(HDRP),它們屬于更為先進的可編程渲染管線(SRP),經(jīng)過預先優(yōu)化可以展現(xiàn)出更好的圖形性能。

然而無論我們選擇使用哪一種渲染管線,生成在屏幕上的圖像都必須經(jīng)過渲染管線的處理。
一種渲染管線可以有不同的處理路徑,這些路徑被稱為渲染路徑;就像第1.0.7節(jié)中示例的管線有不止一條完成任務的路徑一樣。
一條渲染路徑對應一系列與照明和著色有關的操作。這樣,我們就能以圖形方式處理照明場景(例如,帶有定向光和球體的場景)。
有哪些渲染路徑呢?常見的例子包括?前向渲染、延遲渲染、遺留的延遲渲染?和?遺留的頂點照明渲染,它們各自具有不同的功能與特點。
在 Unity 中,默認的渲染路徑是前向渲染,這也是 Unity 的三種渲染管線的初始渲染路徑。前向渲染具有更強的顯卡兼容性和光照計算限制,這使得它成為一個更優(yōu)的選擇。
需要注意的是,在 URP 中我們只能使用?前向渲染?作為渲染路徑,而 HDRP 允許使用?前向渲染?或?延遲渲染?進行照明材質(zhì)渲染。

為了理解這個概念,我們假設場景中有一個模型和一束方向光。光線和模型之間的相互作用基于兩個要素,它們分別是 :
光照特性
材質(zhì)特性
這兩個要素之間的相互作用稱為光照模型。
基本光照模型相當于將環(huán)境光、漫反射和鏡面反射三種不同的“光”疊加在一起。
光照計算在著色器中進行,可以采用逐頂點或逐片元的方式進行計算。當通過一個個頂點計算照明時,稱為逐頂點照明,在頂點著色器階段執(zhí)行光照計算;當通過一個個片元計算照明時,稱為逐片元或逐像素照明,在片元著色器階段執(zhí)行光照計算。