Blender V5.3
eevee::lightprobe::volume Namespace Reference

Namespaces

namespace  display

Classes

struct  AtlasStore
struct  LoadGrid
struct  LoadWorld
struct  RayCapture
struct  SceneBound
struct  VolumeOffset

Functions

float3 grid_sample_position (float4x4 grid_local_to_world_mat, int3 grid_res, int3 cell_coord)
bool grid_local_coord (VolumeProbeData grid_data, float3 P, float3 &r_lP)
int grid_brick_index_get (VolumeProbeData grid_data, int3 brick_coord)
int3 grid_cell_corner (int cell_corner_id)
int3 grid_brick_coord (float3 lP)
float3 grid_brick_local_coord (float3 lP, int3 brick_coord)
float3 grid_bias_sample_coord (sampler3D atlas_tx, VolumeProbeData grid_data, uint2 brick_atlas_coord, float3 brick_lP, float3 lNg)
void scene_bounds (SceneBound &srt, const uint3 global_id)
void volume_offset (VolumeOffset &srt, const uint3 global_id)
void ray_capture (RayCapture &srt, const draw::View &views, const uint3 global_id)
void load_grid (const LoadGrid &srt, const LightprobeVolumeRenderData &lvd, AtlasStore &atlas, const uint3 group_id, const uint3 local_id)
void load_world (const LoadWorld &srt, const LightprobeVolumeRenderData &lvd, AtlasStore &atlas, const uint3 local_id)

Detailed Description

Shaders related to lightprobe volume baking. Note that this file only contains part of the implementation. Shaders that are dispatched per surfel are in eevee_surfel_* files.

Function Documentation

◆ grid_bias_sample_coord()

float3 eevee::lightprobe::volume::grid_bias_sample_coord ( sampler3D atlas_tx,
VolumeProbeData grid_data,
uint2 brick_atlas_coord,
float3 brick_lP,
float3 lNg )

Return the biased local brick local coordinated.

References:

"Probe-based lighting, strand-based hair system, and physical hair shading in Unity's Enemies" by Francesco Cifariello Ciardi, Lasse Jon Fuglsang Pedersen and John Parsaie.

"Multi-Scale Global Illumination in Quantum Break" by Ari Silvennoinen and Ville Timonen.

"Dynamic Diffuse Global Illumination with Ray-Traced Irradiance Fields" by Morgan McGuire.

Definition at line 87 of file eevee_lightprobe_volume.bsl.hh.

References cos_theta(), dot(), float, floor, greaterThan, grid_bias_sample_coord(), grid_cell_corner(), IRRADIANCE_GRID_BRICK_SIZE, len(), normalize_and_get_length(), safe_rcp(), saturate, select, square(), texelFetch(), float3::x, float3::y, float3::z, and int3::z.

Referenced by grid_bias_sample_coord().

◆ grid_brick_coord()

int3 eevee::lightprobe::volume::grid_brick_coord ( float3 lP)

Return the brick coordinate inside the grid.

Definition at line 65 of file eevee_lightprobe_volume.bsl.hh.

References grid_brick_coord(), IRRADIANCE_GRID_BRICK_SIZE, and max.

Referenced by grid_brick_coord().

◆ grid_brick_index_get()

int eevee::lightprobe::volume::grid_brick_index_get ( VolumeProbeData grid_data,
int3 brick_coord )

◆ grid_brick_local_coord()

float3 eevee::lightprobe::volume::grid_brick_local_coord ( float3 lP,
int3 brick_coord )

Return the local coordinated of the shading point inside the brick in unnormalized coordinate.

Definition at line 75 of file eevee_lightprobe_volume.bsl.hh.

References float, grid_brick_local_coord(), IRRADIANCE_GRID_BRICK_SIZE, and max.

Referenced by grid_brick_local_coord().

◆ grid_cell_corner()

int3 eevee::lightprobe::volume::grid_cell_corner ( int cell_corner_id)

◆ grid_local_coord()

bool eevee::lightprobe::volume::grid_local_coord ( VolumeProbeData grid_data,
float3 P,
float3 & r_lP )

Return true if sample position is valid. r_lP is the local position in grid units [0..grid_size).

Definition at line 35 of file eevee_lightprobe_volume.bsl.hh.

References all(), clamp(), equal, grid_local_coord(), and P.

Referenced by grid_local_coord().

◆ grid_sample_position()

float3 eevee::lightprobe::volume::grid_sample_position ( float4x4 grid_local_to_world_mat,
int3 grid_res,
int3 cell_coord )

Returns world position of a volume lightprobe sample (center of cell). Returned position take into account the half voxel padding on each sides. grid_local_to_world_mat is the unmodified object matrix. grid_res is the un-padded grid resolution. cell_coord is the coordinate of the sample in [0..grid_res) range.

Definition at line 23 of file eevee_lightprobe_volume.bsl.hh.

References grid_sample_position().

Referenced by grid_sample_position(), load_grid(), ray_capture(), eevee::debug::irradiance_grid::vert_main(), eevee::lightprobe::volume::display::vert_main(), and volume_offset().

◆ load_grid()

void eevee::lightprobe::volume::load_grid ( const LoadGrid & srt,
const LightprobeVolumeRenderData & lvd,
AtlasStore & atlas,
const uint3 group_id,
const uint3 local_id )

Load an input light-grid cache texture into the atlas. Takes care of dilating valid lighting into invalid samples and composite light-probes.

Each thread group will load a brick worth of data and add the needed padding texels.

Definition at line 73 of file eevee_lightprobe_volume_load.bsl.hh.

References spherical_harmonics::add(), all(), clamp(), spherical_harmonics::dering(), equal, grid_brick_index_get(), grid_cell_corner(), grid_sample_position(), IRRADIANCE_GRID_BRICK_SIZE, SphericalHarmonicL1< T >::L0, SphericalHarmonicL1< T >::L1, length_squared(), load_grid(), local_invocation_id, spherical_harmonics::madd(), spherical_harmonics::mul(), normalize, P, resource_table, spherical_harmonics::rotate(), safe_rcp(), square(), texelFetch(), textureSize(), spherical_harmonics::triple_product(), unroll, work_group_id, x, y, and z().

Referenced by load_grid().

◆ load_world()

void eevee::lightprobe::volume::load_world ( const LoadWorld & srt,
const LightprobeVolumeRenderData & lvd,
AtlasStore & atlas,
const uint3 local_id )

Load the extracted spherical harmonics from the world into the probe volume atlas.

The whole thread group will load the same data and write a brick worth of data.

Definition at line 213 of file eevee_lightprobe_volume_load.bsl.hh.

References spherical_harmonics::dering(), SphericalHarmonicL1< T >::L0, SphericalHarmonicL1< T >::L1, load_world(), local_invocation_id, and resource_table.

Referenced by load_world().

◆ ray_capture()

void eevee::lightprobe::volume::ray_capture ( RayCapture & srt,
const draw::View & views,
const uint3 global_id )

For every irradiance probe sample, compute the incoming radiance from both side. This is the same as the surfel ray but we do not actually transport the light, we only capture the irradiance as spherical harmonic coefficients.

Dispatched as 1 thread per irradiance probe sample.

Definition at line 371 of file eevee_lightprobe_volume_bake.bsl.hh.

References any(), assert, SurfelData::capture_info_buf, drw_debug_line(), global_invocation_id, greaterThanEqual, grid_sample_position(), imageLoadFast, imageStoreFast, SphericalHarmonicL1< T >::L0, SphericalHarmonicL1< T >::L1, eevee::surfel::list_index_get(), P, ray_capture(), resource_table, SurfelData::surfel_buf, and ViewMatrices::world_incident_vector().

Referenced by ray_capture().

◆ scene_bounds()

void eevee::lightprobe::volume::scene_bounds ( SceneBound & srt,
const uint3 global_id )

◆ volume_offset()

void eevee::lightprobe::volume::volume_offset ( VolumeOffset & srt,
const uint3 global_id )

For every irradiance probe sample, check if close to a surrounding surfel and try to offset the irradiance sample position. This is similar to the surfel ray but we do not actually transport the light.

Dispatched as 1 thread per irradiance probe sample.

Definition at line 237 of file eevee_lightprobe_volume_bake.bsl.hh.

References any(), SurfelData::capture_info_buf, dot(), global_invocation_id, greaterThanEqual, grid_sample_position(), imageStoreFast, P, resource_table, SurfelData::surfel_buf, and volume_offset().

Referenced by volume_offset().