BabylonJS / BabylonJS/Babylon-Lite
Integration of the Render Graph as 1st-Class Citizen
- Dominant language
- TypeScript
- Stars
- 149
- Forks
- 29
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 106
Description
Subproject for integrating the Render Graph as a first-class citizen in Babylon Lite.
## Milestones
- [x] **Frame Graph with Render Pass Tasks** - Implement the minimal frame graph core. The central abstraction is a FrameGraphRenderPass that encapsulates WebGPU render pass creation (color/depth attachments, load/store ops, MSAA resolve, viewport) and takes an execute callback for drawing. Build and execute are simple ordered loops. No texture lifetime analysis yet.
- [x] **Auto-Created Frame Graph (PoC)** - The frame graph is automatically created under the hood when startEngine() is called. It replicates what renderFrame() does today: shadow passes + main pass (opaque bundle + transmissive + transparent). User scene code is completely unchanged. All parity tests must pass. renderFrame() is replaced by executeFrameGraph().
- [x] **Scene-Wide Light UBOs** - Refactor light UBO ownership/update so it is handled once at the scene level instead of inside each `buildXXXRenderables` path. All render tasks should consume the same scene light buffer rather than each material builder owning its own copy.
- [x] **Pass Layer in Frame Graph** - Introduce a `Pass` / `RenderPass` abstraction (mirroring Babylon.js' `IFrameGraphPass` / `FrameGraphRenderPass`) so a `Task` records one or more passes during `record()` and `execute()` iterates them. `FrameGraph.build()` becomes two-phase (record then initialize) so a pass can safely reference RTs allocated by other tasks. Today only `RenderPass` exists and `RenderTask` records exactly one - but the surface is shaped to support multi-pass tasks (e.g. shadow cascades) without re-flowing the `Task` contract.
- [x] **Material Views** - Introduce lightweight material views so frame graph render tasks can render meshes with pass-specific material feature bits (for example shadow/depth variants) without mutating or duplicating source materials.
- [x] **Shadow Passes as Frame Graph Tasks** - Extract shadow rendering from the inline loop into proper frame graph render pass tasks (one per shadow generator). Shadows are now self-contained tasks ordered before the main render task in the graph.
- [x] **Transmissive Materials** - Implement transmissive material support before moving shadows into frame graph tasks, so the main render task has the required opaque/transmissive/transparent sequencing and render-target inputs.
- [x] **Reverse Z** - Implement the reverse Z depth buffer (see also https://godotengine.org/article/introducing-reverse-z/)
- [x] **Post-Processing** - Implement post-processing task support, using frame graph task dependencies and texture inputs/outputs.
- [x] **Geometry renderer** - Implement the geometry renderer task, so that we can generate arbitrary geometry textures. Will be needed for some advanced post-processes.
- [ ] **Fluid simulation** - Implement fluid simulation and rendering.
- [ ] **Advanced Post-Processing** - Implement advanced post-processes (SSAO2, SSR, etc.).
- [ ] **Utility Tasks (clear, copy, compute)** - Implement building-block tasks for future post-processing and compute pipelines.
- [ ] **Object List Abstraction** - Add an object-list resource/abstraction that represents named sets of scene objects/renderables flowing between frame graph tasks, so tasks do not have to directly own ad-hoc mesh arrays.
- [ ] **Culling Task** - Add a frame graph task that consumes an input object list plus camera/frustum state and produces a culled object list for downstream render and shadow tasks.
- [ ] **Texture Handle System** - Introduce engine-level TextureManager where textures are accessed via integer TextureHandle values instead of raw GPUTexture. Migrate texture producers and consumers. The frame graph uses handles for render target declarations, enabling future aliasing.
- [ ] **Texture Lifetime Analysis & Aliasing** - Compute texture lifespans across tasks. Group by description hash, alias non-overlapping lifespans to reduce GPU memory usage. Verify savings.
Contributor guide
Assessment
This issue has not been assessed yet.