37 if (tilemap_index >
light.tilemap_max_get()) {
41 tile_co >>= uint(lod);
56 level =
clamp(level,
light.sun.clipmap_lod_min,
light.sun.clipmap_lod_max);
73 LightSunData sun =
light.sun;
77 level =
clamp(level + lod_bias, sun.clipmap_lod_min, sun.clipmap_lod_max);
86 min_level =
clamp(min_level + lod_bias, sun.clipmap_lod_min, sun.clipmap_lod_max);
87 max_level =
clamp(max_level + lod_bias, sun.clipmap_lod_min, sun.clipmap_lod_max);
89 for (
int level = min_level; level <= max_level; level++) {
113 float dist_to_light =
max(
length(lP) - radius, 1e-5f);
114 if (dist_to_light >
light.local.local.influence_radius_max) {
117 if (is_spot_light(
light.type)) {
119 float angle_tan =
length(lP.xy / dist_to_light);
120 if (angle_tan >
light.spot.spot_tan) {
124 else if (is_area_light(
light.type)) {
126 if (lP.
z - radius > 0.0f) {
132 lP -=
light.local.local.shadow_position;
141 lod =
clamp(lod + lod_bias, 0, SHADOW_TILEMAP_LOD);
143 if (radius == 0.0f) {
151 for (
int x = -1;
x <= 1;
x += 2) {
152 for (
int y = -1;
y <= 1;
y += 2) {
153 for (
int z = -1;
z <= 1;
z += 2) {
160 for (
int face_id = 0; face_id < 6; face_id++) {
161 if ((faces & (1u << uint(face_id))) == 0u) {
165 int tilemap_index =
light.tilemap_index + face_id;
245[[
compute,
local_size(SHADOW_DEPTH_SCAN_GROUP_SIZE, SHADOW_DEPTH_SCAN_GROUP_SIZE)]]
253 int2 tex_size = srt.input_depth_extent;
298 uint
index = global_id.x;
299 if (
index >= capture.capture_info_buf.surfel_len) {
307 .directional_lvl = srt.directional_level,
340 float offset = sampling.rng_1D_get(SAMPLING_VOLUME_W);
344 uni.uniform_buf.volumes.inv_tex_size;
349 float depth =
texelFetch(
hiz.hiz_tx, froxel.xy, uni.uniform_buf.volumes.tile_size_lod).r;
350 if (depth < ss_P.
z) {
354 float2 pixel = ((
float2(froxel.xy) + 0.5f) * uni.uniform_buf.volumes.inv_tex_size.xy) *
355 uni.uniform_buf.volumes.main_view_extent;
357 int bias = uni.uniform_buf.volumes.tile_size_lod;
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
#define SURFEL_GROUP_SIZE
#define VOLUME_GROUP_SIZE
float3 light_world_to_local_point(LightData light, float3 point)
float3 light_world_to_local_direction(LightData light, float3 L)
ShadowCoordinates shadow_directional_coordinates_at_level(LightData light, float3 lP, int level)
int shadow_tile_offset(uint2 tile, int tiles_index, int lod)
ShadowCoordinates shadow_punctual_coordinates(LightData light, float3 lP, int face_id)
int shadow_punctual_face_index_get(float3 lL)
int shadow_punctual_level(LightData light, float3 lP, bool is_perspective, float distance_to_camera, float film_pixel_radius)
float3 shadow_punctual_local_position_to_face_local(int face_id, float3 lL)
int shadow_directional_level(LightData light, float3 lP)
float3 volume_resolve_to_screen(const eevee::Uniform &uni, const ViewMatrices view, float3 coord)
#define storage(slot, qualifiers)
#define global_invocation_id
VecBase< bool, D > greaterThanEqual(VecOp< T, D >, VecOp< T, D >) RET
bool any(VecOp< bool, D >) RET
constexpr T clamp(T, U, U) RET
float length(VecOp< float, D >) RET
int atomicOr(int &, int) RET
TEX_TEMPLATE DataVec texelFetch(T, IntCoord, int) RET
#define in_range_inclusive(val, min_v, max_v)
template void light::foreach< shadow::usage::TagSurfelCtx, shadow::usage::TagUsage >(const LightRenderData &, shadow::usage::TagSurfelCtx &, shadow::usage::TagUsage &)
void foreach(const LightRenderData &srt, CallbackT &cb, ResourceT &res)
void foreach_visible(const LightRenderData &srt, float2 pixel, float linear_view_z, CallbackT &cb, ResourceT &res)
template void light::foreach_visible< shadow::usage::TagPixelCtx, shadow::usage::TagUsage >(const LightRenderData &, float2, float, shadow::usage::TagPixelCtx &, shadow::usage::TagUsage &)
void tag_usage_surfel(TagUsageSurfel &srt, TagUsage &tag, SurfelCapture &capture, const uint3 global_id)
void tag_usage_opaque(TagUsageOpaque &srt, const HiZ &hiz, const draw::View &views, TagUsage &tag, const uint3 global_id)
void tag_usage_volume(UnifiedVolumeProperties &volume, TagUsage &tag, const Uniform &uni, const draw::View &views, const Sampling &sampling, const HiZ &hiz, const uint3 global_id)
PipelineCompute tag_usage_surfels(usage::tag_usage_surfel)
PipelineCompute tag_usage_volume(usage::tag_usage_volume)
PipelineCompute tag_usage_opaque(usage::tag_usage_opaque)
float interleaved_gradient(float2 pixel, float seed, float offset)
bool is_perspective() const
float z_distance(float3 P) const
float3 point_view_to_world(float3 vP) const
float3 world_incident_vector(float3 P) const
float3 point_screen_to_view(float3 ssP) const
ViewMatrices get(uint view_id) const
const LightData(& light_buf)[]
ShadowTileMapData(& tilemaps_buf)[]
CaptureInfoData & capture_info_buf
void eval_directional(TagUsage &srt, uint index, LightData)
void eval_local(TagUsage &srt, uint index, LightData)
void tag_usage_tilemap_punctual(uint l_idx, float3 P, float radius, int lod_bias)
void tag_usage_tilemap_directional_at_level(uint l_idx, float3 P, int level)
void tag_usage_tile(LightData light, uint2 tile_co, int lod, int tilemap_index)
void shadow_tag_usage_tilemap_directional(uint l_idx, float3 P, float3 V, float radius, int lod_bias)
LightRenderData light_data
CCL_NAMESPACE_BEGIN struct Window V