Blender V5.3
eevee_lightprobe_sphere_culling.bsl.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
10
12
13struct Cull {
14 [[storage(0, read_write)]] SphereProbeData (&lightprobe_sphere_buf)[SPHERE_PROBE_MAX];
15
17};
18
23[[compute, local_size(SPHERE_PROBE_SELECT_GROUP_SIZE)]]
24void cull([[resource_table]] Cull &srt,
25 [[resource_table]] const Uniform &uni,
27 [[global_invocation_id]] const uint3 global_id)
28{
29 int idx = int(global_id.x);
30 if (idx >= srt.lightprobe_sphere_count) {
31 return;
32 }
33
35 if (idx == srt.lightprobe_sphere_count - 1) {
36 sh = volumes.world();
37 }
38 else {
39 float3 probe_center = srt.lightprobe_sphere_buf[idx].location;
40 sh = volumes.sample_probe_no_dithered_no_biases(probe_center);
41 }
42
43 float clamp_indirect_sh = uni.uniform_buf.clamp.surface_indirect;
44 sh = spherical_harmonics::clamp_energy(sh, clamp_indirect_sh);
45
46 srt.lightprobe_sphere_buf[idx].low_freq_light = lightprobe::sphere::extract_low_freq_lighting(
47 sh);
48}
49
50} // namespace eevee::lightprobe::sphere
51
PipelineCompute eevee_lightprobe_sphere_select(eevee::lightprobe::sphere::cull)
#define storage(slot, qualifiers)
#define push_constant
#define resource_table
#define global_invocation_id
#define compute
#define local_size(...)
ReflectionProbeLowFreqLight extract_low_freq_lighting(SphericalHarmonicL1< float4 > sh)
void cull(Cull &srt, const Uniform &uni, const LightprobeVolumeRenderData &volumes, const uint3 global_id)
SphericalHarmonicL1< float4 > clamp_energy(SphericalHarmonicL1< float4 > sh, float clamp_value)
SphereProbeData(& lightprobe_sphere_buf)[SPHERE_PROBE_MAX]