From ca4fe94ecf456bf08b5f1fe778151c12f5334f94 Mon Sep 17 00:00:00 2001 From: singlecoder Date: Thu, 8 Aug 2024 11:48:12 +0800 Subject: [PATCH] docs: update render order (#2319) --- docs/en/graphics/renderer/order.md | 30 +++++++++++------------------- docs/zh/graphics/renderer/order.md | 14 +++----------- 2 files changed, 14 insertions(+), 30 deletions(-) diff --git a/docs/en/graphics/renderer/order.md b/docs/en/graphics/renderer/order.md index 1abbc9eb3..3b97394ec 100644 --- a/docs/en/graphics/renderer/order.md +++ b/docs/en/graphics/renderer/order.md @@ -20,11 +20,11 @@ The queue to which the renderer is assigned is determined by whether the rendere ```mermaid flowchart TD - A[渲染数据进入队列] --> B{是否透明} - B -->|是| C[透明渲染队列] - B -->|否| D{透明裁剪的阈值是否大于零} - D -->|是| E[透明裁剪渲染队列] - D -->|否| F[非透明渲染队列] + A[Enter render element to queue] --> B{is transparent} + B -->|Y| C[Transparent render queue] + B -->|N| D{Is the transparent clipping threshold greater than zero} + D -->|Y| E[AlphaTest render queue] + D -->|N| F[Opaque render queue] ``` ## Determination Rules @@ -33,31 +33,23 @@ The determination rules for render order in Galacean are as follows: ```mermaid flowchart TD - A[渲染数据排序] --> B{渲染器优先级} - B -->|不相等| C[返回比较结果] - B -->|相等| D{是否来自相同渲染器} - D -->|不相同| E{渲染器组件包围盒与相机的距离} - D -->|相同| F[根据材质优先级返回比较结果] - E -->|不相等| G[返回比较结果] - E -->|想等| H[根据 ID 返回比较结果] + A[Sort render element] --> B{Renderer's priority} + B -->|Not equal| C[Return result] + B -->|Equal| D{Distance from Renderer Component Bounding Box to Camera} + D -->|Not equal| E[Return result] + D -->|Equal| F[Return result] ``` ### Renderer Priority The engine provides the `priority` property for the renderer to modify the render order in the render queue. The default value is 0. **The smaller the priority (it can be negative), the higher the rendering priority**. -### Material Priority - -The engine provides the `priority` property for the material to modify the render order of different render data from the same renderer in the render queue. The default value is 0. **The smaller the priority (it can be negative), the higher the rendering priority**. - ### Distance from Renderer Component Bounding Box to Camera The calculation method of the distance from the renderer component bounding box to the camera depends on the [camera](/en/docs/graphics/camera/camera/) type. In an orthographic camera, it is the distance from the center of the renderer bounding box to the camera along the camera view direction. In a perspective camera, it is the direct distance from the center of the renderer bounding box to the camera position. -Distance to Camera Diagram +Distance to Camera Diagram > It should be noted that in different render queues, the rules for the impact of distance on render order are different. In the opaque render queue and alpha test render queue, the render order is **from near to far**, while in the transparent render queue, the render order is **from far to near**. -### Stability -Currently, when different renderers have the same `renderer priority` and the same `distance from the renderer component bounding box to the camera`, Galacean ensures the stability of the render order through **`renderer.instanceId`**, but the render order within the **same renderer** cannot be guaranteed to be stable. diff --git a/docs/zh/graphics/renderer/order.md b/docs/zh/graphics/renderer/order.md index 94dbe1942..e6f77b0dd 100644 --- a/docs/zh/graphics/renderer/order.md +++ b/docs/zh/graphics/renderer/order.md @@ -35,21 +35,15 @@ Galacean 中对渲染顺序的判定规则如下: flowchart TD A[渲染数据排序] --> B{渲染器优先级} B -->|不相等| C[返回比较结果] - B -->|相等| D{是否来自相同渲染器} - D -->|不相同| E{渲染器组件包围盒与相机的距离} - D -->|相同| F[根据材质优先级返回比较结果] - E -->|不相等| G[返回比较结果] - E -->|想等| H[根据 ID 返回比较结果] + B -->|相等| D{渲染器组件包围盒与相机的距离} + D -->|不相同| E[返回比较结果] + D -->|相同| F[返回比较结果] ``` ### 渲染器优先级 引擎为渲染器提供了 `priority` 属性用于修改渲染队列中的渲染顺序,默认值为 0 ,**priority 越小(可以为负数),渲染的优先级越高**。 -### 材质优先级 - -引擎为材质提供了 `priority` 属性用于修改来自同一渲染器不同渲染数据在渲染队列中的渲染顺序,默认值为 0 ,**priority 越小(可以为负数),渲染的优先级越高**。 - ### 渲染器组件包围盒到相机的距离 渲染器组件包围盒到相机距离的计算方式取决于[相机](/docs/graphics/camera/camera/)的类型。在正交相机中,是渲染器包围盒中心点与摄像机沿着摄像机视图方向的距离,在透视相机中,是渲染器包围盒中心点与摄像机位置的直接距离。 @@ -58,6 +52,4 @@ flowchart TD > 需要注意的是,不同渲染队列中,距离对渲染顺序的影响规则是不同的,在非透明渲染队列和透明裁剪渲染队列中中,渲染的顺序都是**由近到远**,而在透明渲染队列中,渲染的顺序则为**由远到近**。 -### 稳定性 -目前不同渲染器在`渲染器优先级`与`渲染器组件包围盒到相机的距离`都相同的情况下,Galacean 通过 **`renderer.instanceId`** 保证渲染排序的稳定性,但**相同渲染器**中无法保证渲染顺序的稳定。