pub struct LightClusterGrid3D { /* private fields */ }Expand description
UE5-style 3D Froxel Clustered Deferred Lighting grid binning up to 256 dynamic point and spot lights with zero per-frame heap allocations.
Implementations§
Source§impl LightClusterGrid3D
3D frustum froxel binning and Cook-Torrance GGX local light evaluation for LightClusterGrid3D.
impl LightClusterGrid3D
3D frustum froxel binning and Cook-Torrance GGX local light evaluation for LightClusterGrid3D.
Sourcepub fn has_active_lights(&self) -> bool
pub fn has_active_lights(&self) -> bool
Returns whether any local point or spot lights are active in the current frame.
§Returns
bool-truewhen at least one local light is binned.
Sourcepub fn build_clusters(
&mut self,
camera: &Camera3D,
aspect: f32,
point_lights: &[PointLight3D],
spot_lights: &[SpotLight3D],
)
pub fn build_clusters( &mut self, camera: &Camera3D, aspect: f32, point_lights: &[PointLight3D], spot_lights: &[SpotLight3D], )
Bins all point_lights and spot_lights into the 16x9x16 logarithmic-Z camera frustum grid without heap allocations.
§Arguments
&Camera3D- Active 3D perspective camera.f32- Viewport width-to-height aspect ratio.&[PointLight3D]- Active world-space point lights.&[SpotLight3D]- Active world-space spotlights.
Sourcepub fn evaluate_pixel(
&self,
world_pos: Vec3,
normal: Vec3,
view_dir: Vec3,
material_terms: (Vec3, Vec3, f32, f32),
screen_depth: (f32, f32, f32),
) -> Vec3
pub fn evaluate_pixel( &self, world_pos: Vec3, normal: Vec3, view_dir: Vec3, material_terms: (Vec3, Vec3, f32, f32), screen_depth: (f32, f32, f32), ) -> Vec3
Evaluates all local point and spot lights assigned to the pixel’s 3D froxel using UE5 windowed inverse-square PBR attenuation and Cook-Torrance GGX specular.
§Arguments
Vec3- Pixel world-space surface position.Vec3- Unit outward surface normal.Vec3- Unit view direction pointing from surface toward camera.(Vec3, Vec3, f32, f32)-(base_albedo, f0_specular, alpha2_ggx, diffuse_scale).(f32, f32, f32)-(uv_x, uv_y, linear_depth)normalized screen UV in[0, 1]and camera depth.
§Returns
Vec3- Summed linear HDR direct radiance contributed by local clustered lights.
Sourcepub fn evaluate_irradiance_fast(
&self,
world_pos: Vec3,
normal: Vec3,
screen_depth: (f32, f32, f32),
) -> Vec3
pub fn evaluate_irradiance_fast( &self, world_pos: Vec3, normal: Vec3, screen_depth: (f32, f32, f32), ) -> Vec3
Evaluates fast Lambertian linear-HDR local irradiance from the 3D froxel grid without ln() or GGX specular overhead (tuned for coarse deferred probe injection).
§Arguments
Vec3- World-space surface position.Vec3- Unit outward surface normal.(f32, f32, f32)-(uv_x, uv_y, linear_depth)normalized screen UV in[0, 1]and camera depth.
§Returns
Vec3- Summed linear HDR local diffuse irradiance RGB.
Source§impl LightClusterGrid3D
Implements impl #impl_generics #name #ty_generics #where_clause.
impl LightClusterGrid3D
Implements impl #impl_generics #name #ty_generics #where_clause.