bevyengine/bevy
bevy_solari
Experimental ray-traced lighting. Adds dynamic global illumination using GPU ray tracing (DXR / RTX / Vulkan ray query) on top of Bevy's PBR pipeline.
Purpose
bevy_solari is the engine's first foray into hardware ray tracing. It augments — not replaces — the existing PBR pipeline with:
- A bottom-level acceleration structure (BLAS) per mesh.
- A top-level acceleration structure (TLAS) per frame.
- Ray-traced direct lighting.
- Real-time GI via reservoir sampling (ReSTIR-like).
- Denoising for the noisy ray-traced output.
The crate is gated behind the bevy_solari cargo feature and behind a runtime check that the GPU adapter supports ray tracing. Without that, falling back to the standard PBR path is the default.
Directory layout
crates/bevy_solari/src/
├── lib.rs # SolariPlugin
├── scene/ # BLAS/TLAS construction
├── realtime/ # Reservoir sampling, temporal accumulation
├── pathtracer/ # Reference path tracer (validation, not real-time)
├── direct_light_sampling/
├── shaders/ # WGSL ray-tracing shaders
└── …Key abstractions
| Type | File | Description |
|---|---|---|
SolariPlugin |
crates/bevy_solari/src/lib.rs |
Adds the ray-tracing infrastructure. |
SolariLighting |
crates/bevy_solari/src/realtime/ |
Per-camera component opting into RT lighting. |
Pathtracer |
crates/bevy_solari/src/pathtracer/ |
Reference path tracer for validation. |
How it works
graph LR
Meshes -->|build| BLAS
BLAS -->|aggregate| TLAS
TLAS -->|trace| Rays[Ray-traced lighting]
Rays -->|accumulate| Reservoir[ReSTIR reservoirs]
Reservoir -->|denoise| Output
Output -->|combine| PBR[PBR shader]Each frame, BLASes for newly-meshed entities are constructed (or cached) and a TLAS is built from the active scene. Ray-traced direct lighting samples each light source via reservoir resampling. GI is approximated through the same machinery extended with secondary bounces.
A "reference" path tracer in pathtracer/ runs at much lower frame rate but produces an unbiased ground truth for comparing the real-time output.
Integration points
- Depends on:
bevy_render,bevy_pbr,bevy_camera,bevy_light,bevy_mesh,bevy_image,wgpu(with ray-tracing extensions). - Depended on by: Opt-in only.
Entry points for modification
- Sampling improvements:
realtime/. Reservoir code. - Denoiser: the relevant subdirectory; the denoiser has changed significantly across releases.
- New light contribution:
direct_light_sampling/. - The crate is experimental — APIs and shader code change rapidly.
See also
bevy_pbr— the underlying PBR pipeline.bevy_light— light data sources.- The
examples/3d/solari.rsexample.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.