Repository navigation
en rendering overview
中文 | English | Docs | Repository
Nullus renders in three layers: the Game Thread produces commands, the Render Thread consumes them and builds the frame, and the RHI lane translates commands into native command buffers and submits them. Those boundaries are fixed, and rendering features must land in the right layer.
Game Thread
SceneRenderStore incremental updates + RenderFramePacket (camera, view, output targets, frame parameters)
|
v
Render Thread
FrameGraph decides pass order and resource transitions
visibility collection -> draw commands -> pipeline state -> command recording
|
v
RHI lane (Dispatch / Translate / Submit)
native command buffers -> queue submission -> semaphores -> Present
The Game Thread no longer copies the whole scene every frame. SceneRenderStore is persistent data owned by the Render Thread and updated incrementally through commands; only a lightweight payload crosses per frame. That removes the per-frame snapshot cost in large scenes.
The FrameGraph describes each pass's inputs and outputs together with resource states, and derives execution order and barriers. Rendering code declares dependencies while the framework handles:
- When a resource is created, used, and released
- Texture and buffer state transitions
- Aliasing and reuse of transient resources
- Dependency edges between passes
This model lets the forward and deferred paths share resource management, and keeps new passes from hand-writing barriers.
| Path | Content |
|---|---|
| Forward | Depth prepass, forward shading, transparent objects, skybox, editor overlays |
| Deferred | GBuffer, clustered lighting, decals, deferred lighting, transparency, editor output |
Both paths are built through the FrameGraph. The editor and the game share the same pass implementations and only differ in output targets.
- Clustered lighting buckets lights into frustum clusters instead of iterating every light per pixel.
- Decals project after the GBuffer stage in the deferred path.
- Skybox is its own pass, drawn before transparent objects.
- Transparent objects sort back to front and disable depth writes.
- Editor view output gives the Scene View and Game View their own targets, so focusing one never rebuilds the whole pipeline.
- Visibility collection driven by the spatial index instead of a per-object linear scan
- Draw command caching and instancing batching
- Static mesh LOD construction and runtime selection
- HLOD proxies and residency budgets
- HZB occlusion on DX12, conservatively gated by device capability
Details are in Graphics Backends and Large-Scene Features.
HLSL is the only maintained shader source. DXIL, SPIR-V, and reflection data are build artifacts, and maintaining one HLSL source alongside a hand-written GLSL copy is not allowed.
The engine ships a shader library plus a set of ShaderLab shaders: StandardPBR, Transparent, UnlitColor, UnlitTexture, AlphaTest, and ForwardDepthOnly, along with the deferred-path shaders DeferredGBuffer, DeferredLighting, DeferredDecal, Skybox, HZBBuild, and HZBOcclusion.
Binding spaces are fixed and do not vary by backend:
| Space | Content |
|---|---|
set0 |
Frame / Scene |
set1 |
Material |
set2 |
Object |
set3 |
Pass / Rare |
Material data belongs to the Material space. Pass constants and pass textures are renderer-controlled and do not live on material instances.
The project file's rhi_thread_mode accepts three values:
| Mode | Notes |
|---|---|
none |
No dedicated RHI thread; useful for comparison and debugging |
dedicated_thread |
RHI work runs on a fixed thread |
tasks |
The RHI lane is an execution context on TaskGraph workers |
DX12 and Vulkan default to tasks, while Metal stays on dedicated_thread until thread ownership and concurrent submission are validated. Backends declare support through a capability bit; forcing an unsupported combination fails startup with an explicit reason instead of silently falling back.
- A
FrameResourceRingslot only answers "is the GPU still using this batch"; reuse timing is decided by GPU fences. - CPU frame latency is governed together by
FrameLatencyControllerand the Render / Rhi / Swapchain sync depths ofRenderCommandFence. - Resource release goes through a deferred queue so nothing is reclaimed while the GPU may still reference it.
-
Distance Fields covers DX12 mesh/global fields, import settings, and diagnostics.
-
Cameras, Lights, and Output renders the scene.
-
Materials and ShaderLab authors shaders and materials.
-
Graphics Backends and Large-Scene Features covers the backend matrix and large-scene details.
Nullus Engine
中文
- 认识 Nullus
- 安装与快速入门
- 使用编辑器
- 场景与对象
- Prefab 工作流
- 资产与内容管线
- 渲染、材质与光照
- 大场景与资源管理
- 游戏逻辑与脚本
- 用户界面
- 动画与角色
- 物理与交互
- 音频、特效与媒体
- AI 与联网
- 平台、构建与发布
- 扩展与引擎架构
- 调试、性能与质量
- 参考手册
- 示例与发展路线
English
- Getting to Know Nullus
- Install and Quick Start
- Using the Editor
- Scenes and Objects
- Prefab Workflow
- Assets and Content Pipeline
- Rendering, Materials, and Lighting
- Large Scenes and Resource Management
- Gameplay and Scripting
- User Interface
- Animation and Characters
- Physics and Interaction
- Audio, Visual Effects, and Media
- AI and Networking
- Platforms, Builds, and Releases
- Extending the Engine
- Debugging, Performance, and Quality
- Reference
- Examples and Roadmap