Skip to main content

ProbeGrid

Struct ProbeGrid 

Source
pub struct ProbeGrid {
    pub volume: ProbeVolume,
    pub update: ProbeUpdate,
    pub probes: Vec<GpuProbe>,
}
Expand description

Topic 50’s irradiance volume (docs/notes/rendering.md): where the probes are, and what each of them holds.

The diffuse half of global illumination. mesh.slang interpolates the grid trilinearly and adds the result to the flat ambient term, so a description with no probes draws the frame it always did — see crcbl_shaders::probe, which is where the spherical harmonics live and where they are checked against the literature.

§The irradiance is authored, not baked

GpuProbe::accumulate is how an application turns an environment into a row, and it is the only correct way to fill one. There is no bake tool, on a hard prerequisite rather than on taste: a gather bake casts rays at scene triangles, and this engine has no ray-triangle intersector and no BVH — crcbl_phys’s query module has ray-vs-sphere, ray-vs-AABB and ray-vs-capsule and nothing else.

§Default is the volume that changes no pixel

No probes and a grid of no extent, which is what every existing caller gets: the shader’s fetch clamps onto the table’s cleared first row and adds exactly zero. There is no branch anywhere selecting it, and no RenderEffects bit — the off-switch is the scene.

Fields§

§volume: ProbeVolume

Where the grid is, how far apart its probes are, and how many there are on each axis.

§update: ProbeUpdate

What fills probes once the scene is running.

ProbeUpdate::Authored by default, which is the frame every scene drew before the updater landed.

§probes: Vec<GpuProbe>

One row per probe, the clipmap’s levels one after another finest first and x-fastest within each, each level’s cells wrapped by its own scroll offset: ProbeVolume::row is the index, and it is level_row(level) + (z · counts.y + y) · counts.x + x for the volume as authored, before anything has scrolled.

Its length must be volume’s total — one level’s worth per level — which ForwardRenderer::with_scene checks before it creates anything, through this type’s own check.

Trait Implementations§

Source§

impl Clone for ProbeGrid

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ProbeGrid

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ProbeGrid

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for ProbeGrid

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ProbeGrid

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> HalThreadSafe for T
where T: Send + Sync,

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.