It seems like there's agreement among Bevy's rendering devs that our current
crate structure is confusing, makes features harder to implement, and makes it
difficult for crate authors to integrate their code with the engine. This
document can serve as a place to propose a new crate hierarchy to improve on
these issues.
Things like lights, clustering, shadow mapping, should all be reusable for custom materials without having to pull in bevy's default materials (standard material, color material).
I think whether to use the 2D or 3D render graph should depend on the camera entity, and that the render phases should be functional for either. A phase is just a collection of drawable entities. The entities may have mesh data, and do have materials (sprites will be converted to color material using a shared and batchable quad mesh, or whatever mesh data performs best). 2D is then basically 3D in practice (the GPU thinks so) but perhaps you don't use 3D lighting infrastructure most of the time, but you could.
Things I don't know where to put yet:
- tilemaps,
- shadows/pcss
- decals
- POM
- OIT
- Skybox
bevy_render
:
Our lowest-level crate, providing wgpu
integration and basic resource abstractions
Ex:
- extraction and pipelining
- AsBindGroup
(or its successor)
- RenderPhase
/PhaseItem
+ batching
- specialization
- render graph abstraction
- rename CameraRenderGraph
to RenderGraphDriver
, CameraDriverNode
to RenderGraphDriverNode
- let RenderGraphDriver
act on its own, have Camera
require RenderGraphDriver
- lets us move camera abstraction to bevy_camera
while keeping sub graph drivers here
This crate would stay mostly as-is, providing a single RenderPlugin
and several other smaller utilities.
bevy_camera
:
- basic Camera
, detached from 2d/3d/pbr, and concept of a View
.
- manages ViewTarget
(or its successor)
- controls presentation to the final Surface
.
- ordering primitives for camera render graph (more on this later, basically just SystemSet
)
- tonemapping, upscaling, (hdr output when we have it)
- should deferred/visbuffer go here?
This crate would contain mostly low-level, but flexible camera features:
for example, DLSS and stylized low-res renderers should be able to control
creation of the ViewTarget
and choose their own upscaler without tearing
out CameraPlugin
. I chose to put all the tonemapping and presentation-related
passes here since they feel low-level and fairly essential
compared to more opinionated effects, but I don't mind too much where they go.
bevy_material
: provides bevy's unified Material
abstraction.
- needs design
bevy_mesh_render
: mesh rendering backend for 2d and 3d
bevy_lighting
:
- provides built-in light types: DirectionalLight
, SpotLight
, PointLight
- clustering?
bevy_pbr
: contains the base for bevy's PBR lights and materials
- PhysicalCameraSettings
- common shader libs
- pbr lighting functions, etc
bevy_volumetrics
:
- volumetric fog
- atmosphere
- will be the target of the unified volumetrics proposal
bevy_anti_aliasing
: TAA, SMAA, FXAA, (CAS?)
bevy_post_processing
: Purely screenspace post-processing effects.
- color grading
- chromatic aberration
- bloom?
bevy_vfx
: Effects that are more physical, or aren't "pure" post processing
- SSAO
- SSR?
- DoF
- Motion blur
- auto exposure?
bevy_idk
: Wraps all of bevy's rendering APIs into a common, friendly frontend.
- Equivalent to current PbrPlugin
in scope
- needs a name, maybe a fancy branding one?
- Anything that we can't abstract into one of the lower-level crates should go here.