Skip to content

Commit 58c66cc

Browse files
EricCorleoneslackmoehrlexunyi0
authored
翻译渲染管线 (cocos#1641)
* 翻译渲染管线 * Apply suggestions from code review Co-authored-by: Slack-Moehrle <[email protected]> Co-authored-by: yufang.wu <[email protected]> * Update en/render-pipeline/overview.md Co-authored-by: Slack-Moehrle <[email protected]> * Apply suggestions from code review Co-authored-by: yufang.wu <[email protected]> * 一些修改 * Apply suggestions from code review Co-authored-by: Slack-Moehrle <[email protected]> Co-authored-by: yufang.wu <[email protected]>
1 parent c6723c2 commit 58c66cc

File tree

12 files changed

+170
-67
lines changed

12 files changed

+170
-67
lines changed

en/SUMMARY.md

+4
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,10 @@
306306
- [AssetManager for Hot Update](advanced-topics/hot-update-manager.md)
307307
- [Dynamic Atlas](advanced-topics/dynamic-atlas.md)
308308
- [Engine Customization Workflow](advanced-topics/engine-customization.md)
309+
- [Render Pipeline](render-pipeline/overview.md)
310+
- [Built-in Pipeline](render-pipeline/builtin-pipeline.md)
311+
- [Custom Pipeline](render-pipeline/user-pipeline.md)
312+
- [Post-Processing](render-pipeline/post-process.md)
309313
- [The Tutorial for JSB 2.0](advanced-topics/JSB2.0-learning.md)
310314
- [JavaScript to Java Reflection](advanced-topics/java-reflection.md)
311315
- [JavaScript to Objective-C Reflection](advanced-topics/oc-reflection.md)

en/advanced-topics/index.md

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
- [AssetManager](hot-update-manager.md)
66
- [Dynamic Atlas](dynamic-atlas.md)
77
- [Engine Customization Workflow](engine-customization.md)
8+
- [Render Pipeline](../render-pipeline/overview.md)
9+
- [Built-in Pipeline](../render-pipeline/builtin-pipeline.md)
10+
- [Custom Pipeline](../render-pipeline/user-pipeline.md)
11+
- [Post-Processing](../render-pipeline/post-process.md)
812
- [The Tutorial for JSB 2.0](JSB2.0-learning.md)
913
- [JavaScript to Java Reflection](java-reflection.md)
1014
- [JavaScript to Objective-C Reflection](oc-reflection.md)
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Built-in Render Pipeline
2+
3+
The built-in render pipeline uses forward rendering. Forward rendering renders each object in the scene in turn, calculating the lighting for each object as it is rendered. In the built-in render pipeline, there will only be one parallel light in effect for a scene. Each object can only receive 2 point light sources and 2 spotlights, and if it is out of range, the sources will be sorted by distance and the two closest sources will be taken.
4+
5+
The built-in render pipeline contains a **ForwardFlow**, which contains a **ForwardStage**. Two **RenderQueues** are set in the ForwardStage:
6+
- The first one is used for rendering opaque objects, sorted from near to far from the camera.
7+
- The second one is used for rendering translucent objects, sorted from far to near from the camera.

en/render-pipeline/overview.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Render Pipeline (Experimental)
2+
3+
RenderPipeline is used to control the rendering process of a scene, including lighting management, object culling, render object sorting, render target switching, etc. Since each stage can be handled differently and optimally for different projects, it is difficult to achieve optimal results with a uniform approach to the rendering process for different types of projects. The customizable render pipeline is used to provide more flexible control over each stage in the rendered scene, allowing for deeper optimization solutions for different projects.
4+
5+
Among the customizable render pipelines, one can choose to use the engine's built-in render pipeline, which uses the forward render pipeline. Please refer to the [Built-in Pipeline](builtin-pipeline.md) documentation for details.
6+
7+
Developers can also create a new render pipeline asset to extend the render pipeline themselves. In the render pipeline asset you can manage each stage of the rendering process and then set each parameter in the editor.
8+
9+
The customizable render pipeline currently includes the following features:
10+
11+
[Custom Pipeline](user-pipeline.md)
12+
13+
[Post-Processing](post-process.md)

en/render-pipeline/post-process.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Post-Processing
2+
3+
To create a new post-processing effect, create a new RenderFlow script and set its type to POSTPROCESS. The production process is the same as other RenderFlow, but RenderPipeline does not automatically perform post-processing, it is necessary to set the `flows` property in the Camera to specify which post-processing to perform.

en/render-pipeline/user-pipeline.md

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Custom Render Pipelines
2+
3+
To create a custom render pipeline, first create a new RenderPipeline asset in the **Assets** panel, then create a RenderPipeline script, and then select the corresponding RenderPipeline script in the Pipeline asset to edit the corresponding properties.
4+
5+
RenderFlow and RenderStage are created and edited in the same way. In the created Pipeline script, add properties and make them editable in the **Inspector** panel just like any other user script, but note that it is not an option to drag and drop entities in the scene, as the RenderPipeline is not bound to a specific scene.
6+
7+
## Properties and methods in RenderPipeline
8+
9+
- `flows`: The RenderFlow contained in the RenderPipeline.
10+
11+
- `renderTextures`: the RenderTextures that can be created when the RenderPipeline is started.
12+
13+
- `name`: the name of the RenderTexture, which can be obtained by the `getRenderTexture` function of the RenderPipeline after creation.
14+
- `type`: the type of the RenderTexture.
15+
- `viewType`: the corresponding TextureView type of the RenderTexture.
16+
- `usage`: the binding type of the RenderTexture, used to determine whether it is `color` or `depth_stencil`.
17+
- `formate`: the channel format of the RenderTexture.
18+
- `width`: width of the RenderTexture, -1 means the width of the window.
19+
- `height`: height of the RenderTexture, -1 means the height of the window.
20+
21+
- `framebuffers`: the FrameBuffer that can be created when RenderPipeline starts.
22+
23+
- `name`: the name of the FrameBuffer, it can be retrieved by the `getFrameBuffer` function of RenderPipeline after creation.
24+
- `renderPass`: the ID of the RenderPass configured in the RenderPipeline.
25+
- `colorViews`: TextureView bound to the ColorAttachment, specifying the RenderTexture configured in the RenderPipeline.
26+
- `depthStencilView`: TextureView bound to DepthStencilAttachment. specifies the RenderTexture configured in the RenderPipeline.
27+
- `renderPasses`: the RenderPasses that can be created when the RenderPipeline is started.
28+
- `index`: ID of the RenderPass, which can be obtained by the `getRenderPass` function of the RenderPipeline.
29+
- `colorAttachments`: the description of the ColorAttachment, the operation of the ColorAttachment when drawing the FrameBuffer.
30+
- `depthStencilAttachment`: the description of the DepthStencilAttachment, the operation of the DepthStencilAttachment when drawing the FrameBuffer.
31+
32+
- `getTextureView` (name: string), `getRenderTexture` (name: string): get the RenderTexture configured in renderTextures.
33+
- `getFrameBuffer` (name: string): get the FrameBuffer configured in `framebuffers`.
34+
- `getRenderPass` (stage: number): get the RenderPass configured in renderPasses.
35+
- `initialize` (info: IRenderPipelineInfo): initialize function for creating a RenderPipeline by script, the RenderPipeline must be initialized before it can be used.
36+
- `activate` (root: Root): initialization function used when loading a RenderPipeline through an asset.
37+
- `render` (view: RenderView): logic for rendering the scene.
38+
- `updateUBOs` (view: RenderView): update the global UniformBuffer.
39+
- `sceneCulling` (view: RenderView): scene culling, renderable objects are saved in `_renderObjects` after culling.
40+
41+
## Properties and methods in RenderFlow
42+
43+
- `name`: the name of the RenderFlow.
44+
- `priority`: the order of execution of the RenderFlow in the RenderPipeline.
45+
- `type`: the type of the RenderFlow.
46+
- `SCENE`: used to draw the scene, this type will be executed for each camera.
47+
- `POSTPROCESS`: post-processing, this type is specified separately for each camera.
48+
- `UI`: used to draw the UI.
49+
- `stages`: RenderStage included in RenderFlow.
50+
51+
## Properties and methods in RenderStage
52+
53+
- `name`: the name of the RenderStage.
54+
- `priority`: the order of execution of the RenderStage in the RenderFlow.
55+
- `frameBuffer`: the FrameBuffer that the RenderStage will draw to, should be set to the FrameBuffer configured in the RenderPipeline, or set to `window` to indicate that the default FrameBuffer is used.
56+
- `renderQueues`: render queue, used to control the rendering order of objects.
57+
- `isTransparent`: marks whether the render queue is semi-transparent.
58+
- `sortMode`: <br>`FRONT_TO_BACK`: sort from front to back; <br>`BACK_TO_FRONT`: sort from back to front.
59+
- `stages`: specifies which passes in the render queue render material, should be specified as the `phase` in the `pass`.
60+
- `sortRenderQueue()`: sort the render queue.
61+
- `executeCommandBuffer` (view: RenderView): execute the render command.

zh/SUMMARY.md

+3
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,9 @@
302302
- [引擎定制工作流程](advanced-topics/engine-customization.md)
303303
- [网页预览定制工作流程](editor/preview/browser.md)
304304
- [渲染管线](render-pipeline/overview.md)
305+
- [内置管线](render-pipeline/builtin-pipeline.md)
306+
- [自定义管线](render-pipeline/user-pipeline.md)
307+
- [后期处理](render-pipeline/post-process.md)
305308
- [JSB 2.0 使用指南](advanced-topics/JSB2.0-learning.md)
306309
- [JSB 手动绑定](advanced-topics/jsb-manual-binding.md)
307310
- [JSB 自动绑定](advanced-topics/jsb-auto-binding.md)

zh/advanced-topics/index.md

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
- [引擎定制工作流程](engine-customization.md)
88
- [网页预览定制工作流程](../editor/preview/browser.md)
99
- [渲染管线](../render-pipeline/overview.md)
10+
- [内置管线](../render-pipeline/builtin-pipeline.md)
11+
- [自定义管线](../render-pipeline/user-pipeline.md)
12+
- [后期处理](../render-pipeline/post-process.md)
1013
- [JSB 2.0 使用指南](JSB2.0-learning.md)
1114
- [JSB 手动绑定](jsb-manual-binding.md)
1215
- [JSB 自动绑定](jsb-auto-binding.md)
+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# 内置渲染管线
22

3-
内置渲染管线使用的是前向渲染。前向渲染会依次渲染场景中的每个物体,在渲染每个物体时计算其光照。在内置渲染管线中,一个场景只会有一个平行光生效,每个物体只能接受2个点光源和2个聚光灯,如果超出范围,则会对光源按距离排序,取最近的两个光源。
3+
目前内置渲染管线使用的是 **前向渲染**。前向渲染会依次渲染场景中的每个物体,在渲染每个物体时计算其光照。在内置渲染管线中,一个场景只会有一个平行光生效,每个物体只能接受 2 个点光源和 2 个聚光灯,如果超出范围,则会按距离对光源进行排序,取最近的两个光源。
44

5-
内置渲染管线包含一个ForwardFlow,ForwardFlow中包含一个ForwardStage。在ForwardStage里设置了两个RenderQueue,第一个用于渲染不透明物体,按离摄像机从近到远排序,第二个用于半透明物体渲染,按离摄像机从远到近排序。
5+
内置渲染管线包含一个 ForwardFlow,ForwardFlow 中包含一个 ForwardStage。在 ForwardStage 里设置了两个 RenderQueue:
6+
- 第一个用于渲染不透明物体,按离摄像机从近到远排序
7+
- 第二个用于半透明物体渲染,按离摄像机从远到近排序。

zh/render-pipeline/overview.md

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
# Render Pipeline Overview (Experimental)
2-
RenderPipeline用于控制场景的渲染流程,包括光照管理、物体剔除、渲染物体排序、渲染目标切换等。由于每个阶段对于不同项目来说可以有不同的优化处理方式,所以用统一的方法来处理不同类型项目的渲染流程很难达到最优化的结果。可定制化的渲染管线用于对渲染场景中的每个阶段进行更灵活的控制,可以针对不同的项目做更深层次的优化方案。
1+
# 渲染管线 (Experimental)
32

4-
在可定制化的渲染管线中,你可以选择使用引擎内置的渲染管线,内置管线使用的是前向渲染管线。你也可以创建一个新的渲染管线资源,用以自行扩展渲染管线。在渲染管线资源中你可以管理渲染流程中每个阶段的工作,然后可以在编辑器中对各个参数进行设置
3+
RenderPipeline 用于控制场景的渲染流程,包括光照管理、物体剔除、渲染物体排序、渲染目标切换等。由于每个阶段对于不同项目来说可以有不同的优化处理方式,所以用统一的方法来处理不同类型项目的渲染流程很难达到最优化的结果。可定制化的渲染管线用于对渲染场景中的每个阶段进行更灵活的控制,可以针对不同的项目做更深层次的优化方案
54

6-
目前可定制化渲染管线包括以下功能:
5+
在可定制化的渲染管线中,可以选择使用引擎内置的渲染管线,内置管线使用的是前向渲染管线。详情请参考 [内置管线](builtin-pipeline.md)
6+
7+
开发者也可以创建一个新的渲染管线资源,用以自行扩展渲染管线。在渲染管线资源中你可以管理渲染流程中每个阶段的工作,然后可以在编辑器中对各个参数进行设置。
78

8-
[内置管线](builtin-pipeline.md)
9+
目前可定制化渲染管线包括以下功能:
910

10-
[自定义管线](user-pipeline.md)
11+
- [自定义管线](user-pipeline.md)
1112

12-
[后期处理](post-process.md)
13+
- [后期处理](post-process.md)

zh/render-pipeline/post-process.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# 后期处理
22

3-
要新建一个后期处理需要新建一个RenderFlow脚本,然后将其type设为POSTPROCESS。制作流程与其它RenderFlow相同,但RenderPipeline不会自动执行后期处理,需要在Camera中设置flows属性来指定执行哪些后期处理
3+
要新建一个后期处理需要新建一个 RenderFlow 脚本,然后将其 type 设为 POSTPROCESS。制作流程与其它 RenderFlow 相同,但 RenderPipeline 不会自动执行后期处理,需要在 Camera 中设置 flows 属性来指定执行哪些后期处理

0 commit comments

Comments
 (0)