wde_pbr/lib.rs
1//! Physically based rendering (PBR) integration for WaterDropEngine.
2//!
3//! This crate wires the PBR rendering stack into the engine and exposes the core
4//! building blocks to configure deferred PBR rendering.
5//!
6//! The PBR rendering stack is built on top of the deferred rendering pipeline, and consists of the following passes:
7//! - [`RenderPassDeferredGBuffer`](crate::passes::RenderPassDeferredGBuffer): Renders the scene geometry into the G-buffer (only opaque objects). It writes to the [`DepthTexture`](crate::textures::DepthTexture) and the G-buffer [`DeferredTextures`](crate::textures::DeferredTextures) (albedo, normal, depth) in MSAA format.
8//! - [`RenderPassDeferredLighting`](crate::passes::RenderPassDeferredLighting): Performs the lighting pass, reading from the resolved G-buffer textures [`DeferredTexturesResolved`](crate::textures::DeferredTexturesResolved) and writing to a [`RenderTexture`](crate::textures::RenderTexture) in MSAA format.
9//! - [`RenderPassTransparent`](crate::passes::RenderPassTransparent): Renders transparent objects, using the [`DepthTexture`](crate::textures::DepthTexture) for depth testing, and writing to the same [`RenderTexture`](crate::textures::RenderTexture) as the lighting pass (in MSAA format).
10//! - `RenderPassResolve`: At the end of the frame, resolves the MSAA [`RenderTexture`](crate::textures::RenderTexture) to the swapchain image for presentation. This pass is automatically added by the engine and cannot be configured.
11//!
12//! To find out more about the deferred rendering pipeline and how to add custom render subpasses, see the documentation of the [`deferred`](crate::deferred) module.
13use crate::prelude::*;
14use bevy::prelude::*;
15
16#[doc(hidden)]
17pub mod prelude {
18 pub use crate::deferred::*;
19 pub use crate::passes::*;
20 pub use crate::textures::*;
21}
22
23pub mod deferred;
24mod passes;
25mod textures;
26
27pub struct PbrPlugin;
28impl Plugin for PbrPlugin {
29 fn build(&self, app: &mut App) {
30 app.add_plugins(CorePlugin)
31 .add_plugins(PassesPlugin)
32 .add_plugins(DeferredPlugin);
33 }
34}