目录索引
译文
在Unity中,目前有三种已知的渲染管线。我们可以在引擎中找到足以支持最古老版本的内置渲染管线(Built-in RP),除此之外还有通用渲染管线(URP)和高清渲染管线(HDRP),它们属于更为先进的可编程渲染管线(SRP),经过预先优化可以展现出更好的图形性能。
![图片[1]-《Unity着色器圣经》1.1.2 | 渲染管线类型-软件开发学习笔记](https://gamedevfan.cn/wp-content/uploads/2025/05/image-13-1024x324.jpeg)
然而无论我们选择使用哪一种渲染管线,生成在屏幕上的图像都必须经过渲染管线的处理。
一种渲染管线可以有不同的处理路径,这些路径被称为渲染路径;就像第1.0.7节中示例的管线有不止一条完成任务的路径一样。
一条渲染路径对应一系列与照明和着色有关的操作。这样,我们就能以图形方式处理照明场景(例如,带有定向光和球体的场景)。
有哪些渲染路径呢?常见的例子包括 前向渲染、延迟渲染、遗留的延迟渲染 和 遗留的顶点照明渲染,它们各自具有不同的功能与特点。
在 Unity 中,默认的渲染路径是前向渲染,这也是 Unity 的三种渲染管线的初始渲染路径。前向渲染具有更强的显卡兼容性和光照计算限制,这使得它成为一个更优的选择。
需要注意的是,在 URP 中我们只能使用 前向渲染 作为渲染路径,而 HDRP 允许使用 前向渲染 或 延迟渲染 进行照明材质渲染。
![图片[2]-《Unity着色器圣经》1.1.2 | 渲染管线类型-软件开发学习笔记](https://gamedevfan.cn/wp-content/uploads/2025/05/image-12-1024x368.jpeg)
为了理解这个概念,我们假设场景中有一个模型和一束方向光。光线和模型之间的相互作用基于两个要素,它们分别是 :
- 光照特性
- 材质特性
这两个要素之间的相互作用称为光照模型。
基本光照模型相当于将环境光、漫反射和镜面反射三种不同的“光”叠加在一起。
光照计算在着色器中进行,可以采用逐顶点或逐片元的方式进行计算。当通过一个个顶点计算照明时,称为逐顶点照明,在顶点着色器阶段执行光照计算;当通过一个个片元计算照明时,称为逐片元或逐像素照明,在片元着色器阶段执行光照计算。
原文对照
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.
![图片[1]-《Unity着色器圣经》1.1.2 | 渲染管线类型-软件开发学习笔记](https://gamedevfan.cn/wp-content/uploads/2025/05/image-13-1024x324.jpeg)
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.
![图片[2]-《Unity着色器圣经》1.1.2 | 渲染管线类型-软件开发学习笔记](https://gamedevfan.cn/wp-content/uploads/2025/05/image-12-1024x368.jpeg)
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.
暂无评论内容