Introduction 简介
What is NeoX Engine?什么是 NeoX 引擎?
NeoX is NetEase's proprietary real-time rendering engine, powering titles like "Infinite Lagrange" (无尽的拉格朗日). Unlike commercial engines, NeoX provides complete shader-level control — every rendering technique is implemented through handwritten HLSL shaders, NFX effect files, and SURF material descriptors. This gives artists unprecedented technical freedom but requires deep understanding of the rendering pipeline to use effectively.
This series focuses on the new engine codebase at res_upgrade/shader/.
The new engine reads only its own files; it falls back to res/shader/ only for files that
do not exist in res_upgrade/. Where the old engine differs in a meaningful way,
a Legacy Engine callout is provided.
NeoX 是网易自研的实时渲染引擎,支持《无尽的拉格朗日》等游戏项目。与商业引擎不同,NeoX 提供完整的 Shader 级控制—— 所有渲染技术都通过手写 HLSL 着色器、NFX 效果文件和 SURF 材质描述符实现。这为美术师提供了前所未有的技术自由度, 但需要对渲染管线有深入理解才能有效使用。
本系列以新引擎代码库 res_upgrade/shader/ 为主要分析对象。
新引擎只读取自身目录中的文件;仅当 res_upgrade/ 中不存在某文件时,才回退到 res/shader/。
当旧引擎有值得关注的差异时,会以 旧引擎差异 提示框标出。
res_upgrade/shader/ first; for any file not found there, it falls back to res/shader/. This means the new engine has all features from both directories combined — the ~180 root entries in res/shader/ are all accessible to the new engine via fallback. res_upgrade/shader/ contains only the files that have been replaced or newly added (~21 root entries). The built_in/ directory has been significantly expanded in res_upgrade/ (45 subdirectories vs 35 in res/) with new systems like Virtual Texture, NxParticle, GAEA terrain, deferred decals, fluid, FSR, wind field, etc.
双目录架构:新引擎优先读取 res_upgrade/shader/;对任何其中找不到的文件,回退到 res/shader/。这意味着新引擎拥有两个目录的全部功能——res/shader/ 中约 180 个根条目全部通过回退机制可用。res_upgrade/shader/ 仅包含已被替换或新增的文件(约 21 个根条目)。res_upgrade/ 中 built_in/ 目录大幅扩展(45 个子目录 vs res/ 中 35 个),新增虚拟纹理、NxParticle、GAEA 地形、延迟贴花、流体、FSR、风场等系统。
Core Architecture核心架构
NeoX's rendering architecture is organized around three file types that separate concerns:
NeoX 的渲染架构围绕三种文件类型组织,分离了不同关注点:
This three-tier system decouples material authoring (.surf editing), rendering technique (.nfx), and shader code (.hlsl). Artists primarily work with .surf files, while engineers write .hlsl implementations.
这个三层系统将材质创作(.surf 编辑)、渲染技法(.nfx)和着色器代码(.hlsl)解耦。 美术师主要使用 .surf 文件,而工程师编写 .hlsl 实现。
Shader System Design PhilosophyShader 系统设计哲学
NeoX's shader system is built on several key principles that differentiate it from UE5:
NeoX 的 Shader 系统基于几个关键原则,这些原则使其区别于 UE5:
- No Visual Shader Editor: All materials are written as HLSL code or configured via XML. No node-based Material Editor like UE's Blueprint system.
- 无可视化 Shader 编辑器:所有材质都通过 HLSL 代码编写或 XML 配置。没有像 UE 蓝图系统那样的节点编辑器。
- Cross-Platform by Design: Shaders are written in a custom HLSL dialect that compiles to both D3D11 and OpenGL ES/Metal. Pre-compiled
.ps/.vsfiles for GL/Metal platforms are checked into the repository. - 跨平台设计:着色器使用自定义 HLSL 方言编写,可编译到 D3D11 和 OpenGL ES/Metal。预编译的
.ps/.vs文件(GL/Metal 平台)直接提交到代码库。 - Declarative Pipeline Configuration: The entire rendering pipeline is configured via
forward_shading.renderXML file, which declares VertexFragmentModels, LightingModels, BlendStates, DepthStates, and ShaderCompositors in one place. - 声明式管线配置:整个渲染管线通过
forward_shading.renderXML 文件配置,在一处声明 VertexFragmentModels、LightingModels、BlendStates、DepthStates 和 ShaderCompositors。 - Macro-Based Shader Variants: Instead of UE's ShaderPermutationDomain, NeoX uses
macro_define.xmlto enumerate all valid macro combinations (INSTANCE_TYPE, TON_MAPPING_TYPE, LOD_LEVEL_TYPE, etc.). - 基于宏的 Shader 变体:NeoX 使用
macro_define.xml枚举所有有效宏组合(INSTANCE_TYPE、TON_MAPPING_TYPE、LOD_LEVEL_TYPE 等),而不是 UE 的 ShaderPermutationDomain。
Rendering Technologies渲染技术
NeoX implements a comprehensive set of rendering technologies, with some unique systems not found in UE5:
NeoX 实现了一套全面的渲染技术,其中一些独特系统在 UE5 中找不到:
| Technology技术 | NeoX ImplementationNeoX 实现 | UE5.6 EquivalentUE5.6 对应物 |
|---|---|---|
| BRDF | GGX (D_GGX + F_Schlick + SmithJoint)GGX(D_GGX + F_Schlick + SmithJoint) | Similar (GGX with slight variations)类似(GGX 略有差异) |
| Shading Models光照模型 | 16 models (Isotropy/Skin/Hair/ClearCoat/Toon/SSSS/Water/Cloth/Glint/Sheen/etc.)16 种模型(新增 Water/Cloth/Glint/Sheen 等) | 11 models (no built-in Toon)11 种模型(无内置 Toon) |
| Virtual Texture虚拟纹理 | ✓ Full streaming VT system (RVT + adaptive VT + tile memory path)✓ 完整流式 VT 系统(RVT + 自适应 VT + Tile 内存路径) | ✓ Virtual Shadow Maps (UE5.4+)✓ 虚拟阴影贴图(UE5.4+) |
| GPU ParticlesGPU 粒子 | ✓ NxParticle — compute-shader-driven GPU particle system✓ NxParticle——计算着色器驱动的 GPU 粒子系统 | ✓ Niagara GPU simulation✓ Niagara GPU 模拟 |
| Multi-Layered PBR多层 PBR | Built-in N-layer clearcoat system内置 N 层清漆系统 | Substrate (experimental, UE5.4+)Substrate(实验性,UE5.4+) |
| Planet Rendering星球渲染 | ✓ Complete planet shader system (672-line library)✓ 完整星球着色器系统(672 行库) | ✗ No built-in system✗ 无内置系统 |
| Post Processing后处理 | ~60+ hand-written effects~60+ 手写效果 | ~30+ built-in + PostProcessVolume~30+ 内置 + PostProcessVolume |
| Dynamic GI动态 GI | Light Probe SH (limited)Light Probe SH(有限) | Lumen (full dynamic GI)Lumen(全动态 GI) |
| Nanite | ✗ No equivalent✗ 无对应物 | ✓ Virtual geometry system✓ 虚拟几何系统 |
| Shadow Maps阴影贴图 | CSM | CSM + Virtual Shadow MapsCSM + 虚拟阴影贴图 |
NeoX vs UE5.6 — Key DifferencesNeoX vs UE5.6 — 关键差异
When NeoX excels: Projects requiring deep customization of rendering algorithms, mobile optimization with tight memory budgets, or specific visual styles (e.g., stylized toon shading, procedural space effects) benefit from NeoX's direct shader control.
NeoX 擅长的场景:需要深度定制渲染算法、移动端优化(严格内存预算)、或特定视觉风格(如风格化卡通着色、程序化太空效果)的项目 受益于 NeoX 的直接 Shader 控制。
When UE5 excels: Projects requiring film-quality visuals in real time, large open worlds, or rapid prototyping benefit from UE5's Nanite/Lumen/VSM and high-level authoring tools.
UE5 擅长的场景:需要实时电影级画质、大型开放世界、或快速原型开发的项目 受益于 UE5 的 Nanite/Lumen/VSM 和高层创作工具。
How to Read This Series如何阅读本系列
This series is structured to mirror the actual shader codebase organization at res_upgrade/shader/.
Each article examines a specific subsystem with references to actual file paths in the G86 project.
When a feature originates from the old engine (res/shader/), it is clearly marked.
本系列按照 res_upgrade/shader/ 中实际 Shader 代码库的组织结构编写。
每篇文章检查特定子系统,并引用 G86 项目中的实际文件路径。
当某功能源自旧引擎(res/shader/)时,会明确标注。
Series Map系列地图
01 Shader System01 Shader 系统
02 Rendering Pipeline02 渲染管线
03 Material System03 材质系统
04 Lighting Models04 光照模型
05 Post Processing05 后处理
06 Custom Features *(planned)*06 自定义功能 *(待写)*
- Planet Rendering System星球渲染系统
- PSE Particle SystemPSE 粒子系统