📗

How Does Unreal Engine 5.2 Render a Cube

image
✒️Author : ‘God_of_pen’ Luo Dingli
Before we start

Data Structure and Relationships on the CPU Side

Let's first focus on the important data structures related to rendering.

In this section, I will briefly introduce the transformation process between them and how they are ultimately converted into data for rendering.

Asset and Game WorldRender DataRender ProxyMesh BatchesMesh Draw CommandsRHI Command ListGPU RenderingFrom Material to ShadersFrom Render Data to Shader InputsA Short Summary

Process of One Pass

In the previous section, you have already learned about important data structures. Therefore, in this section, we will delve into how data is transformed in a Pass.

In this section, we will cover more details, including how rendering instructions are cached and how objects are culled.

Load Static Mesh DataFrom Render Proxy to Mesh BatchesFrom Mesh Batch to Mesh Draw CommandsFrom Mesh Draw Commands to RHI CommandsCacheCullingSetup Mesh PassExam : Try to draw a cube by yourselfDispatch Draw CommandsVertex Shader of Depth PrepassData Structure on GPU

Deferred Renderer

In the previous section, we delved into the workings of a Pass. Building upon that, we will now further discuss the deferred renderer of the Unreal Engine, which is composed of multiple Passes.

In this section, we will focus more on the GPU aspect and discuss how different Passes are rendered and how their data is exchanged. This will answer the question of how the color of a pixel on the screen is determined.

The global map of the rendering

Base Pass

Base Pass

Shadow Rendering with Virtual Shadow Map

Introduction to Virtual Shadow MappingPage Allocation, Culling and RasterizerPage Allocation DetailsShadow Mask Buffer Rendering

Direct Lighting

The Theory of LightingPoint Light Rendering

Indirect Lighting with Lumen

Lumen OverviewParallel with GPU

Surface Cache: Mesh Cards

Cards in the LumenLumen Scene UpdateDirect Lighting InjectionIndirect lighting with Radiosity

Radiance Cache with Screen & World Probes

Screen Probe Placement and Importance SamplingScreen, Mesh, Voxel TraceFilter Radiance of Screen ProbesConvert to IrradianceShort Range AO with Bent NormalIntegrateUpdate Radiance Cache

Lumen Reflections

Lumen Reflections

Compose

Composite

Post Processing

Temporal Super ResolutionMotion BlurBloomTone Mapping
EndingReferencesSpecial Thanks

Piece of content was written with ChatGPT and Notion AI.

  • ChatGPT is mainly used for analyzing and organizing a portion of the shader code to reduce the complexity of manually analyzing huge shader code files.
    • This includes generating Python code for HLSL code in order to simulate intermediate results on the CPU.
    • The outputs from ChatGPT are reviewed and verified by the author.
  • Notion AI is used to polish the author's English writing to overcome the author's non-native English speaker limitations.