Introduction 简介
What is Unreal Engine 5.6?什么是 Unreal Engine 5.6?
Unreal Engine 5.6 is Epic Games' flagship real-time rendering and game engine, used in AAA games, film-quality cinematics, architectural visualization, and simulation. At its core, UE 5.6 ships three revolutionary rendering technologies — Nanite, Lumen, and Virtual Shadow Maps — that fundamentally change how real-time content is created and rendered. Understanding how these systems work at the source code level gives you a decisive advantage: you can debug rendering issues no tool can explain, extend the engine for custom effects, and make architectural decisions grounded in first principles rather than guesswork.
Unreal Engine 5.6 是 Epic Games 的旗舰实时渲染与游戏引擎,被用于 AAA 游戏、电影级过场动画、建筑可视化和仿真领域。 其核心搭载了三项革命性渲染技术——Nanite、Lumen 和Virtual Shadow Maps——从根本上改变了实时内容的创作和渲染方式。 理解这些系统在源码层面的工作原理能带来决定性优势:你可以调试任何工具都无法解释的渲染问题、为自定义效果扩展引擎, 并基于第一性原理而非猜测做出架构决策。
The Three Renderers — One Engine, Multiple Pipelines三大渲染器 — 一个引擎,多条管线
UE 5.6 does not have a single monolithic rendering path. Instead it has three distinct renderer classes that share common infrastructure but implement fundamentally different GPU strategies:
UE 5.6 没有单一的整体渲染路径。它有三个不同的渲染器类,共享公共基础设施,但实现根本不同的 GPU 策略:
The deferred renderer is the focus of most articles in this series. It is by far the most complex (its main Render() function is ~2300 lines and orchestrates 12 distinct render stages), but also the most powerful — it is the path used for all PC and console shipping titles in UE5.
延迟渲染器是本系列大多数文章的关注焦点。它是目前最复杂的(其主 Render() 函数约 2300 行, 编排 12 个不同的渲染阶段),但也是最强大的——它是 UE5 中所有 PC 和主机发行项目使用的路径。
Next-Gen Technologies — The Three Pillars次世代核心技术 — 三大支柱
UE 5.x's landmark technologies all solve the same fundamental problem: how do you render film-quality visuals in real time without crushing artists under technical constraints?
UE 5.x 的标志性技术都在解决同一个根本问题:如何在不给美术师施加技术约束的情况下实时渲染电影级画质?
| Technology技术 | The old constraint it removes消除的旧约束 | How如何实现 |
|---|---|---|
| Nanite | Polygon budget per mesh, multiple LOD levels, draw call overhead每个网格的多边形预算、多个 LOD 级别、绘制调用开销 | Virtualizes geometry into a cluster hierarchy (BVH/DAG); renders only screen-pixel-sized triangles via GPU-driven culling and a software rasterizer将几何体虚拟化为 Cluster 层级(BVH/DAG);通过 GPU 驱动剔除和软件光栅器仅渲染屏幕像素大小的三角形 |
| Lumen | Baked lightmaps, fixed-sky probes, no real-time indirect lighting for dynamic geometry烘焙光照贴图、固定天空探针、动态几何体无法实时间接光照 | Maintains a Surface Cache (dynamic low-res atlas of direct lighting); traces rays via Mesh SDF + Screen Probes + optional Hardware RT to compute indirect bounces every frame维护表面缓存(直接光照的动态低分辨率图集);每帧通过 Mesh SDF + 屏幕探针 + 可选硬件光追计算间接反弹 |
| Virtual Shadow Maps | Fixed-resolution cascaded shadow maps, visible seams at cascade boundaries, separate shadow map per light固定分辨率级联阴影贴图、级联边界可见接缝、每个光源独立阴影贴图 | Gives each light a virtual 16K×16K shadow atlas; allocates 128×128 texel pages on demand; caches static geometry pages across frames为每个光源提供虚拟 16K×16K 阴影图集;按需分配 128×128 纹素页面;跨帧缓存静态几何体页面 |
The Infrastructure Layer — What Everything Runs On基础设施层 — 所有技术的运行基础
Beneath Nanite, Lumen, and VSM lies an equally important infrastructure that most engineers first encounter as an obstacle before understanding it as a powerful tool:
在 Nanite、Lumen 和 VSM 之下,有一套同样重要的基础设施,大多数工程师最初将其视为障碍, 后来才理解它是一个强大的工具:
- RDG (Render Dependency Graph): UE's frame-level GPU task graph. Every render pass is registered declaratively with its resource reads/writes. RDG automatically inserts barriers, culls unused passes, merges adjacent render passes, and schedules async compute. Understanding RDG is the single most important prerequisite for reading any UE rendering code.
- RDG(渲染依赖图):UE 的帧级 GPU 任务图。每个渲染 Pass 以声明方式注册其资源读写。RDG 自动插入屏障、剔除未使用的 Pass、合并相邻渲染 Pass,并调度异步计算。理解 RDG 是阅读任何 UE 渲染代码最重要的前提条件。
- Three-Thread Model: Game Thread → Render Thread → RHI Thread. UE's rendering is always one frame behind the game logic. Understanding the thread boundaries is essential to avoid race conditions when extending the engine.
- 三线程模型:Game Thread → Render Thread → RHI Thread。UE 的渲染始终落后游戏逻辑一帧。理解线程边界对于在扩展引擎时避免竞争条件至关重要。
- Shader System: FShader type hierarchy, permutation domains, FHLSLMaterialTranslator that converts Material Expression graphs to HLSL, and the ShaderMap caching system (DDC).
- Shader 系统:FShader 类型层级、排列组合域、将材质表达式图转换为 HLSL 的 FHLSLMaterialTranslator,以及 ShaderMap 缓存系统(DDC)。
- GPUScene: A GPU-side structured buffer holding all primitive data, enabling GPU-driven instance culling without CPU readback.
- GPUScene:保存所有图元数据的 GPU 侧结构化缓冲区,无需 CPU 回读即可实现 GPU 驱动的实例裁剪。
How to Read This Series如何阅读本系列
Each article in this series traces a specific area of the rendering codebase from the top down: starting with the high-level function call that triggers the system, then diving into the data structures and GPU shaders that do the actual work. Every claim is tied to a specific source file and line number in UE 5.6.
本系列每篇文章都自上而下追踪渲染代码库的特定区域:从触发系统的高级函数调用开始,然后深入到完成实际工作的数据结构和 GPU 着色器。 每个论断都与 UE 5.6 中的特定源文件和行号相关联。
Prerequisites前置知识
- C++ fluency: UE uses heavy template metaprogramming, macros, and custom containers. You don't need to know UE's C++ conventions upfront — this series explains them as they appear — but basic C++ is essential.
- C++ 熟练度:UE 大量使用模板元编程、宏和自定义容器。你不需要事先了解 UE 的 C++ 惯例——本系列在出现时会解释它们——但基本 C++ 是必需的。
- Real-time rendering fundamentals: Understanding what a GBuffer is, what a render pass does, what vertex/pixel shaders are, and what "deferred shading" means at a conceptual level.
- 实时渲染基础:理解 GBuffer 是什么、渲染 Pass 做什么、顶点/像素着色器是什么,以及"延迟着色"在概念层面意味着什么。
- GPU architecture awareness: Knowing roughly how a GPU executes draw calls, what a compute shader is, and what VRAM bandwidth means. Knowledge of DirectX 12 or Vulkan is helpful but not required.
- GPU 架构认知:大致了解 GPU 如何执行绘制调用、计算着色器是什么,以及 VRAM 带宽意味着什么。了解 DirectX 12 或 Vulkan 有帮助但非必需。
- UE installed with source access: Engine source at
Engine/Source/and shader source atEngine/Shaders/. All file path references in this series assume UE 5.6. - 安装了带源码访问的 UE:引擎源码位于
Engine/Source/,着色器源码位于Engine/Shaders/。本系列所有文件路径引用均假设 UE 5.6。
Series Map系列地图
01 Pipeline Paradigms01 管线范式
- Deferred Rendering Pipeline延迟渲染管线
- Forward Shading Pipeline前向渲染管线
- Visibility & Culling *(planned)*可见性与裁剪 *(待写)*
- Translucency In Depth *(planned)*半透明渲染深度 *(待写)*
- Decal Rendering *(planned)*Decal 渲染 *(待写)*
02 Infrastructure & Graph02 基础设施与图
- RDG — Render Dependency GraphRDG 渲染依赖图
- Thread Concurrency线程并发
- Screen Space Effects *(planned)*屏幕空间效果 *(待写)*
- Scene Capture & Render Targets *(planned)*场景捕获与渲染目标 *(待写)*
03 Shader Architecture03 Shader 架构
- Shader Compilation & Material TranslationShader 编译与材质翻译
- Post-Processing Pipeline后处理管线
- Material Permutation Explosion *(planned)*材质排列组合爆炸 *(待写)*
- Subsurface Scattering In Depth *(planned)*次表面散射深度 *(待写)*
04 Next-Gen Hardware04 次世代硬件
- Nanite — Virtual GeometryNanite 虚拟几何
- Lumen — Dynamic GILumen 动态全局光照
- Virtual Shadow Maps虚拟阴影贴图
- Distance Field System *(planned)*距离场系统 *(待写)*
- Hair Strands Rendering *(planned)*Hair Strands 渲染 *(待写)*
- GPU Skin Cache *(planned)*GPU 蒙皮缓存 *(待写)*
05 Engine Modding05 引擎魔改
- Custom Shading Model & Substrate自定义着色模型与 Substrate
- Niagara GPU ComputeNiagara GPU 计算
- Custom Depth & Stencil *(planned)*自定义深度与模板 *(待写)*
- ViewExtension — Plugin Injection *(planned)*ViewExtension 插件注入 *(待写)*
- Substrate Advanced *(planned)*Substrate 高级用法 *(待写)*
06 Profiling06 性能分析
- Profiling — Insights, RDG & Hardware Profilers性能分析全景
- Memory & VRAM Optimization *(planned)*内存与 VRAM 优化 *(待写)*
07 Scene Features *(planned)*07 场景渲染功能 *(待写)*
- Landscape RenderingLandscape 渲染
- Water Rendering水面渲染
- LOD & HLOD SystemLOD 与 HLOD 系统
08 Character Rendering *(planned)*08 角色渲染 *(待写)*
- Hair Strands Deep DiveHair Strands 深度解析
- Skin Rendering皮肤渲染
- Cloth & Simulation布料与仿真