@woosh/meep-engine 3.11.1 → 3.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/package.json +1 -1
  2. package/src/engine/ecs/storage/populateEngineSerializationRegistry.d.ts.map +1 -1
  3. package/src/engine/ecs/storage/populateEngineSerializationRegistry.js +294 -290
  4. package/src/engine/graphics3/ParticipatingMedia.d.ts +111 -0
  5. package/src/engine/graphics3/ParticipatingMedia.d.ts.map +1 -0
  6. package/src/engine/graphics3/ParticipatingMedia.js +203 -0
  7. package/src/engine/graphics3/ParticipatingMediaSerializationAdapter.d.ts +34 -0
  8. package/src/engine/graphics3/ParticipatingMediaSerializationAdapter.d.ts.map +1 -0
  9. package/src/engine/graphics3/ParticipatingMediaSerializationAdapter.js +73 -0
  10. package/src/engine/graphics3/ParticipatingMediaSystem3.d.ts +87 -0
  11. package/src/engine/graphics3/ParticipatingMediaSystem3.d.ts.map +1 -0
  12. package/src/engine/graphics3/ParticipatingMediaSystem3.js +184 -0
  13. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  14. package/src/shade/playground/volumetrics_froxel/README.md +104 -1
  15. package/src/shade/playground/volumetrics_froxel/index.html +20 -1
  16. package/src/shade/playground/volumetrics_froxel/main.d.ts.map +1 -1
  17. package/src/shade/playground/volumetrics_froxel/main.js +298 -0
  18. package/src/shade/playground/volumetrics_froxel/measure.d.ts +119 -0
  19. package/src/shade/playground/volumetrics_froxel/measure.d.ts.map +1 -0
  20. package/src/shade/playground/volumetrics_froxel/measure.js +559 -0
  21. package/src/shade/renderer/Renderer.d.ts.map +1 -1
  22. package/src/shade/renderer/Renderer.js +22 -18
  23. package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
  24. package/src/shade/renderer/shadow/map/shader/chunk_shadowmap_sample_point2.d.ts +14 -13
  25. package/src/shade/renderer/shadow/map/shader/chunk_shadowmap_sample_point2.d.ts.map +1 -1
  26. package/src/shade/renderer/shadow/map/shader/chunk_shadowmap_sample_point2.js +133 -129
  27. package/src/shade/renderer/volumetrics/GPUViewVolumetrics.d.ts.map +1 -1
  28. package/src/shade/renderer/volumetrics/GPUViewVolumetrics.js +480 -315
  29. package/src/shade/renderer/volumetrics/NOTES.md +649 -8
  30. package/src/shade/renderer/volumetrics/ParticipatingMediaVolume.d.ts +5 -0
  31. package/src/shade/renderer/volumetrics/ParticipatingMediaVolume.d.ts.map +1 -1
  32. package/src/shade/renderer/volumetrics/ParticipatingMediaVolume.js +21 -2
  33. package/src/shade/renderer/volumetrics/SceneVolumetrics.d.ts +26 -0
  34. package/src/shade/renderer/volumetrics/SceneVolumetrics.d.ts.map +1 -1
  35. package/src/shade/renderer/volumetrics/SceneVolumetrics.js +64 -21
  36. package/src/shade/renderer/volumetrics/VOLUMETRICS_METADATA_STRUCT.d.ts.map +1 -1
  37. package/src/shade/renderer/volumetrics/VOLUMETRICS_METADATA_STRUCT.js +84 -28
  38. package/src/shade/renderer/volumetrics/VOLUMETRICS_SUN_SHADOW_RESOLUTION.d.ts +98 -0
  39. package/src/shade/renderer/volumetrics/VOLUMETRICS_SUN_SHADOW_RESOLUTION.d.ts.map +1 -0
  40. package/src/shade/renderer/volumetrics/VOLUMETRICS_SUN_SHADOW_RESOLUTION.js +111 -0
  41. package/src/shade/renderer/volumetrics/build_volumetrics_sun_shadow_transform.d.ts +84 -0
  42. package/src/shade/renderer/volumetrics/build_volumetrics_sun_shadow_transform.d.ts.map +1 -0
  43. package/src/shade/renderer/volumetrics/build_volumetrics_sun_shadow_transform.js +252 -0
  44. package/src/shade/renderer/volumetrics/chunk_integrate_optical_depth.js +75 -75
  45. package/src/shade/renderer/volumetrics/chunk_volumetrics_local_light_shadow.d.ts +43 -0
  46. package/src/shade/renderer/volumetrics/chunk_volumetrics_local_light_shadow.d.ts.map +1 -0
  47. package/src/shade/renderer/volumetrics/chunk_volumetrics_local_light_shadow.js +145 -0
  48. package/src/shade/renderer/volumetrics/chunk_volumetrics_sample_froxel_extinction.d.ts +20 -0
  49. package/src/shade/renderer/volumetrics/chunk_volumetrics_sample_froxel_extinction.d.ts.map +1 -0
  50. package/src/shade/renderer/volumetrics/chunk_volumetrics_sample_froxel_extinction.js +48 -0
  51. package/src/shade/renderer/volumetrics/chunk_volumetrics_sun_optical_depth.d.ts +38 -0
  52. package/src/shade/renderer/volumetrics/chunk_volumetrics_sun_optical_depth.d.ts.map +1 -0
  53. package/src/shade/renderer/volumetrics/chunk_volumetrics_sun_optical_depth.js +107 -0
  54. package/src/shade/renderer/volumetrics/graph_build_volumetrics.d.ts +4 -1
  55. package/src/shade/renderer/volumetrics/graph_build_volumetrics.d.ts.map +1 -1
  56. package/src/shade/renderer/volumetrics/graph_build_volumetrics.js +577 -471
  57. package/src/shade/renderer/volumetrics/shader_volumetrics_build_lighting.d.ts.map +1 -1
  58. package/src/shade/renderer/volumetrics/shader_volumetrics_build_lighting.js +64 -13
  59. package/src/shade/renderer/volumetrics/shader_volumetrics_build_sun_shadow_volume.d.ts +8 -0
  60. package/src/shade/renderer/volumetrics/shader_volumetrics_build_sun_shadow_volume.d.ts.map +1 -0
  61. package/src/shade/renderer/volumetrics/shader_volumetrics_build_sun_shadow_volume.js +174 -0
  62. package/src/shade/wgsl/emulator/CPUBitmapData.d.ts +25 -0
  63. package/src/shade/wgsl/emulator/CPUBitmapData.d.ts.map +1 -1
  64. package/src/shade/wgsl/emulator/CPUBitmapData.js +33 -0
  65. package/src/shade/wgsl/emulator/WGSLJavaScriptCompiler.js +2221 -2215
  66. package/src/shade/wgsl/emulator/WGSLLanguageCore.d.ts.map +1 -1
  67. package/src/shade/wgsl/emulator/WGSLLanguageCore.js +1297 -1117
  68. package/src/shade/wgsl/emulator/cpu_texture_gather.d.ts +69 -0
  69. package/src/shade/wgsl/emulator/cpu_texture_gather.d.ts.map +1 -0
  70. package/src/shade/wgsl/emulator/cpu_texture_gather.js +148 -0
  71. package/src/shade/wgsl/emulator/cpu_texture_sample.d.ts +16 -0
  72. package/src/shade/wgsl/emulator/cpu_texture_sample.d.ts.map +1 -1
  73. package/src/shade/wgsl/emulator/cpu_texture_sample.js +176 -172
@@ -1,19 +1,20 @@
1
1
  /**
2
- * Cone-sampled point shadow PCF. Samples random directions inside a cone around the receiver-
3
- * to-light vector and re-encodes each one to the octahedral atlas. The cone aperture comes
4
- * from the GDC bulb-radius scaling in {@link chunk_max_penumbra_percentage}; the factor of 2
5
- * carries over the texels tangent-plane conversion an earlier disk-based variant used (1
6
- * atlas texel 2/face_dim of Δn.xy near the +Z pole), so the angular footprint stays
7
- * comparable.
2
+ * Cone-sampled point shadow PCF: 8 random directions inside a cone around the receiver-to-light
3
+ * vector, each re-encoded to the light's octahedral map, one `textureLoad` per tap, ending in
4
+ * {@link chunk_contact_harden_pcf_kernel}. Tap directions come from {@link chunk_random}, which the
5
+ * calling shader (deferred lighting / volumetrics) initialises per invocation, so neighbouring
6
+ * pixels decorrelate without a rotation table or a blue-noise disk.
8
7
  *
9
- * No blue-noise disk, no rotation table, no atlas-border clamp. Random tap directions come
10
- * from {@link chunk_random}, which the calling shader (deferred lighting / volumetrics)
11
- * initialises per invocation, so neighbours decorrelate naturally. Each tap is one
12
- * \`textureLoad\` and the loop ends in {@link chunk_contact_harden_pcf_kernel} unchanged.
8
+ * The aperture is the GDC bulb-radius scaling in {@link chunk_max_penumbra_percentage}; the factor
9
+ * of 2 carries over the texels tangent-plane conversion an earlier disk-based variant used (1
10
+ * atlas texel ≈ 2/face_dim of Δn.xy near the +Z pole), so the angular footprint stays comparable.
13
11
  *
14
- * No clamp on the aperture: the receiver direction is sampled in 3D and re-encoded per tap, so
15
- * the octahedral encode always lands in [0, 1]² — even a full-sphere aperture stays inside
16
- * this light's slot.
12
+ * Addressing: `atlas_aabb` is the INNER octahedral surface, and the cube octahedral remap
13
+ * surrounds it with a `SHADOWMAP_ATLAS_BORDER`-texel skirt holding
14
+ * `inner[texture_octahedral_wrap_texel_coordinates(local)]`. Under the bilinear convention
15
+ * `uv * size - 0.5` a uv on the edge of the square rounds to -1 or `size` — one texel into that
16
+ * skirt, which is this light's own wrapped data. The encode always lands in [0, 1]² and the round
17
+ * can overshoot by at most one texel, so the aperture needs no clamp.
17
18
  *
18
19
  * @see chunk_cone_sample_direction
19
20
  * @type {CodeChunk}
@@ -1 +1 @@
1
- {"version":3,"file":"chunk_shadowmap_sample_point2.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/shadow/map/shader/chunk_shadowmap_sample_point2.js"],"names":[],"mappings":"AAgBA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,4CAFU,SAAS,CA8FjB;0BAvHwB,uCAAuC"}
1
+ {"version":3,"file":"chunk_shadowmap_sample_point2.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/shadow/map/shader/chunk_shadowmap_sample_point2.js"],"names":[],"mappings":"AAgBA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,4CAFU,SAAS,CAiGjB;0BA3HwB,uCAAuC"}
@@ -1,129 +1,133 @@
1
- import { LIGHT_DATABASE_SPEC } from "../../../light/LIGHT_DATABASE_SPEC.js";
2
- import { chunk_cone_sample_direction } from "../../../shader/chunk/geometry/cone/chunk_cone_sample_direction.js";
3
- import {
4
- chunk_uv_octahedral_unit_encode
5
- } from "../../../shader/chunk/geometry/octahedron/chunk_uv_octahedral_unit_encode.js";
6
- import { chunk_random } from "../../../shader/chunk/random/chunk_random.js";
7
- import { chunk_random_round_vec2 } from "../../../shader/chunk/random/chunk_random_round_vec2.js";
8
- import { chunk_random_vec2 } from "../../../shader/chunk/random/chunk_random_vec2.js";
9
- import { chunk_uv_to_texel_coordinate } from "../../../shader/chunk/texture/chunk_uv_to_texel_coordinate.js";
10
- import { CodeChunk } from "../../../shader/compiler/CodeChunk.js";
11
- import { chunk_get_shadow_offsets } from "./chunk_get_shadow_offsets.js";
12
- import { chunk_contact_harden_pcf_kernel } from "./dpcf/chunk_contact_harden_pcf_kernel.js";
13
- import { chunk_max_penumbra_percentage } from "./dpcf/chunk_max_penumbra_percentage.js";
14
-
15
- const SHADOW_POINT_DESCRIPTOR = LIGHT_DATABASE_SPEC.get('shadow_point');
16
-
17
- /**
18
- * Cone-sampled point shadow PCF. Samples random directions inside a cone around the receiver-
19
- * to-light vector and re-encodes each one to the octahedral atlas. The cone aperture comes
20
- * from the GDC bulb-radius scaling in {@link chunk_max_penumbra_percentage}; the factor of 2
21
- * carries over the texels tangent-plane conversion an earlier disk-based variant used (1
22
- * atlas texel 2/face_dim of Δn.xy near the +Z pole), so the angular footprint stays
23
- * comparable.
24
- *
25
- * No blue-noise disk, no rotation table, no atlas-border clamp. Random tap directions come
26
- * from {@link chunk_random}, which the calling shader (deferred lighting / volumetrics)
27
- * initialises per invocation, so neighbours decorrelate naturally. Each tap is one
28
- * \`textureLoad\` and the loop ends in {@link chunk_contact_harden_pcf_kernel} unchanged.
29
- *
30
- * No clamp on the aperture: the receiver direction is sampled in 3D and re-encoded per tap, so
31
- * the octahedral encode always lands in [0, 1 even a full-sphere aperture stays inside
32
- * this light's slot.
33
- *
34
- * @see chunk_cone_sample_direction
35
- * @type {CodeChunk}
36
- */
37
- export const chunk_shadowmap_sample_point2 = CodeChunk.from(
38
- //language=WGSL
39
- `
40
- fn shadowmap_sample_point(
41
- database: ptr<storage, array<u32>>,
42
- shadow_id: u32,
43
- position_ws: vec3f,
44
- surface_normal_ws: vec3f,
45
- light_position_ws: vec3f,
46
- light_max_distance: f32,
47
- light_radius: f32,
48
- ) -> f32 {
49
- const NORMAL_BIAS_SCALE = 2.0;
50
- const DEPTH_OFFSET_BIAS = 0.0001;
51
-
52
- let atlas_aabb = ${SHADOW_POINT_DESCRIPTOR.marshalling_method_read}(database, shadow_id);
53
-
54
- // unbiased distance and light direction, used to compute the bias amounts
55
- let to_light_unbiased = light_position_ws - position_ws;
56
- let dist_to_light_unbiased = length(to_light_unbiased);
57
- let light_direction = to_light_unbiased / max(dist_to_light_unbiased, 1e-6);
58
-
59
- let world_pixel_size = 2.0 * dist_to_light_unbiased / max(atlas_aabb.z, 1.0);
60
- let shadowmap_bias = get_shadow_offsets(surface_normal_ws, light_direction);
61
- let normal_offset = world_pixel_size * shadowmap_bias.x * surface_normal_ws * NORMAL_BIAS_SCALE;
62
-
63
- // re-evaluate direction and distance from the normal-biased position
64
- let to_surface = (position_ws + normal_offset) - light_position_ws;
65
- let distance_to_center = length(to_surface);
66
-
67
- // Direction the cube faces captured: FROM LIGHT TO SURFACE
68
- let dir_light_to_surface = to_surface / max(distance_to_center, 1e-6);
69
-
70
- let face_size = vec2u(atlas_aabb.zw);
71
-
72
- // reverse-Z convention: close to light -> 1, at or beyond light_max_distance -> 0.
73
- let radial = distance_to_center / max(light_max_distance, 1e-6);
74
- let depth_bias = DEPTH_OFFSET_BIAS * shadowmap_bias.y;
75
- let reference_depth = (1.0 - saturate(radial)) + depth_bias;
76
-
77
- // Cone aperture (~ tan of the half-angle). max_penumbra_percentage is the GDC formula
78
- // mapping bulb radius to a fraction of the atlas face; the 2× factor is the texels
79
- // tangent-plane conversion. Unclamped: any aperture is valid because the octahedral
80
- // re-encode in the loop always stays inside this light's slot.
81
- let cone_aperture = 2.0 * max_penumbra_percentage(light_radius, light_radius);
82
-
83
- var occluders: f32 = 0.0;
84
- var occluder_dist_sum: f32 = 0.0;
85
-
86
- for (var tap: u32 = 0u; tap < 8u; tap++) {
87
-
88
- let xi = random_vec2();
89
-
90
- let perturbed_dir = cone_sample_direction(dir_light_to_surface, cone_aperture, xi);
91
-
92
- let octahedral_uv = uv_octahedral_unit_encode(perturbed_dir);
93
- let local_texel = uv_to_texel_coordinate(octahedral_uv, face_size);
94
-
95
- // instead of doing bilinear, we use stochastic sampling instead
96
- let rounded_local_texel = random_round_vec2(local_texel);
97
-
98
- let sample_texel = vec2<u32>(rounded_local_texel) + vec2<u32>(atlas_aabb.xy);
99
-
100
- let stored = textureLoad(shadowmapAtlas, sample_texel, 0);
101
- let dist = stored - reference_depth;
102
-
103
- // Per-tap binary compare; reverse-Z + step(0, stored - ref) ⇒ 1 = occluded.
104
- let occluded = step(0.0, dist);
105
-
106
- occluders += occluded;
107
- occluder_dist_sum += dist * occluded;
108
- }
109
-
110
- return contact_harden_pcf_kernel(
111
- occluders,
112
- occluder_dist_sum,
113
- reference_depth,
114
-
115
- );
116
- }
117
- `, [
118
- SHADOW_POINT_DESCRIPTOR.chunk_read,
119
- chunk_cone_sample_direction,
120
- chunk_contact_harden_pcf_kernel,
121
- chunk_get_shadow_offsets,
122
- chunk_max_penumbra_percentage,
123
- chunk_random,
124
- chunk_uv_octahedral_unit_encode,
125
- chunk_uv_to_texel_coordinate,
126
- chunk_random_round_vec2,
127
- chunk_random_vec2,
128
- ]
129
- );
1
+ import { LIGHT_DATABASE_SPEC } from "../../../light/LIGHT_DATABASE_SPEC.js";
2
+ import { chunk_cone_sample_direction } from "../../../shader/chunk/geometry/cone/chunk_cone_sample_direction.js";
3
+ import {
4
+ chunk_uv_octahedral_unit_encode
5
+ } from "../../../shader/chunk/geometry/octahedron/chunk_uv_octahedral_unit_encode.js";
6
+ import { chunk_random } from "../../../shader/chunk/random/chunk_random.js";
7
+ import { chunk_random_round_vec2 } from "../../../shader/chunk/random/chunk_random_round_vec2.js";
8
+ import { chunk_random_vec2 } from "../../../shader/chunk/random/chunk_random_vec2.js";
9
+ import { chunk_uv_to_texel_coordinate } from "../../../shader/chunk/texture/chunk_uv_to_texel_coordinate.js";
10
+ import { CodeChunk } from "../../../shader/compiler/CodeChunk.js";
11
+ import { chunk_get_shadow_offsets } from "./chunk_get_shadow_offsets.js";
12
+ import { chunk_contact_harden_pcf_kernel } from "./dpcf/chunk_contact_harden_pcf_kernel.js";
13
+ import { chunk_max_penumbra_percentage } from "./dpcf/chunk_max_penumbra_percentage.js";
14
+
15
+ const SHADOW_POINT_DESCRIPTOR = LIGHT_DATABASE_SPEC.get('shadow_point');
16
+
17
+ /**
18
+ * Cone-sampled point shadow PCF: 8 random directions inside a cone around the receiver-to-light
19
+ * vector, each re-encoded to the light's octahedral map, one `textureLoad` per tap, ending in
20
+ * {@link chunk_contact_harden_pcf_kernel}. Tap directions come from {@link chunk_random}, which the
21
+ * calling shader (deferred lighting / volumetrics) initialises per invocation, so neighbouring
22
+ * pixels decorrelate without a rotation table or a blue-noise disk.
23
+ *
24
+ * The aperture is the GDC bulb-radius scaling in {@link chunk_max_penumbra_percentage}; the factor
25
+ * of 2 carries over the texels tangent-plane conversion an earlier disk-based variant used (1
26
+ * atlas texel 2/face_dim of Δn.xy near the +Z pole), so the angular footprint stays comparable.
27
+ *
28
+ * Addressing: `atlas_aabb` is the INNER octahedral surface, and the cube → octahedral remap
29
+ * surrounds it with a `SHADOWMAP_ATLAS_BORDER`-texel skirt holding
30
+ * `inner[texture_octahedral_wrap_texel_coordinates(local)]`. Under the bilinear convention
31
+ * `uv * size - 0.5` a uv on the edge of the square rounds to -1 or `size` one texel into that
32
+ * skirt, which is this light's own wrapped data. The encode always lands in [0, 1]² and the round
33
+ * can overshoot by at most one texel, so the aperture needs no clamp.
34
+ *
35
+ * @see chunk_cone_sample_direction
36
+ * @type {CodeChunk}
37
+ */
38
+ export const chunk_shadowmap_sample_point2 = CodeChunk.from(
39
+ //language=WGSL
40
+ `
41
+ fn shadowmap_sample_point(
42
+ database: ptr<storage, array<u32>>,
43
+ shadow_id: u32,
44
+ position_ws: vec3f,
45
+ surface_normal_ws: vec3f,
46
+ light_position_ws: vec3f,
47
+ light_max_distance: f32,
48
+ light_radius: f32,
49
+ ) -> f32 {
50
+ const NORMAL_BIAS_SCALE = 2.0;
51
+ const DEPTH_OFFSET_BIAS = 0.0001;
52
+
53
+ let atlas_aabb = ${SHADOW_POINT_DESCRIPTOR.marshalling_method_read}(database, shadow_id);
54
+
55
+ // unbiased distance and light direction, used to compute the bias amounts
56
+ let to_light_unbiased = light_position_ws - position_ws;
57
+ let dist_to_light_unbiased = length(to_light_unbiased);
58
+ let light_direction = to_light_unbiased / max(dist_to_light_unbiased, 1e-6);
59
+
60
+ let world_pixel_size = 2.0 * dist_to_light_unbiased / max(atlas_aabb.z, 1.0);
61
+ let shadowmap_bias = get_shadow_offsets(surface_normal_ws, light_direction);
62
+ let normal_offset = world_pixel_size * shadowmap_bias.x * surface_normal_ws * NORMAL_BIAS_SCALE;
63
+
64
+ // re-evaluate direction and distance from the normal-biased position
65
+ let to_surface = (position_ws + normal_offset) - light_position_ws;
66
+ let distance_to_center = length(to_surface);
67
+
68
+ // Direction the cube faces captured: FROM LIGHT TO SURFACE
69
+ let dir_light_to_surface = to_surface / max(distance_to_center, 1e-6);
70
+
71
+ let face_size = vec2u(atlas_aabb.zw);
72
+
73
+ // reverse-Z convention: close to light -> 1, at or beyond light_max_distance -> 0.
74
+ let radial = distance_to_center / max(light_max_distance, 1e-6);
75
+ let depth_bias = DEPTH_OFFSET_BIAS * shadowmap_bias.y;
76
+ let reference_depth = (1.0 - saturate(radial)) + depth_bias;
77
+
78
+ // Cone aperture (~ tan of the half-angle). max_penumbra_percentage is the GDC formula mapping
79
+ // bulb radius to a fraction of the atlas face; the 2× factor is the texels → tangent-plane
80
+ // conversion. Unclamped — see the header on why any aperture stays addressable.
81
+ let cone_aperture = 2.0 * max_penumbra_percentage(light_radius, light_radius);
82
+
83
+ var occluders: f32 = 0.0;
84
+ var occluder_dist_sum: f32 = 0.0;
85
+
86
+ for (var tap: u32 = 0u; tap < 8u; tap++) {
87
+
88
+ let xi = random_vec2();
89
+
90
+ let perturbed_dir = cone_sample_direction(dir_light_to_surface, cone_aperture, xi);
91
+
92
+ let octahedral_uv = uv_octahedral_unit_encode(perturbed_dir);
93
+ let local_texel = uv_to_texel_coordinate(octahedral_uv, face_size);
94
+
95
+ // one of the two neighbours at random rather than a blend of them: stochastic bilinear
96
+ let rounded_local_texel = random_round_vec2(local_texel);
97
+
98
+ // Signed: the round reaches -1 at a uv of 0, and the skirt is where that tap belongs. Via
99
+ // u32 the -1 would be an indeterminate conversion — 0xFFFFFFFF reaches the skirt through
100
+ // the wrapping add, 0 silently reads the opposite edge of the inner surface. i32 is exact
101
+ // here, and the inner origin is at least SHADOWMAP_ATLAS_BORDER, so the sum is positive.
102
+ let sample_texel = vec2<u32>(vec2<i32>(rounded_local_texel) + vec2<i32>(atlas_aabb.xy));
103
+
104
+ let stored = textureLoad(shadowmapAtlas, sample_texel, 0);
105
+ let dist = stored - reference_depth;
106
+
107
+ // Per-tap binary compare; reverse-Z + step(0, stored - ref) ⇒ 1 = occluded.
108
+ let occluded = step(0.0, dist);
109
+
110
+ occluders += occluded;
111
+ occluder_dist_sum += dist * occluded;
112
+ }
113
+
114
+ return contact_harden_pcf_kernel(
115
+ occluders,
116
+ occluder_dist_sum,
117
+ reference_depth,
118
+
119
+ );
120
+ }
121
+ `, [
122
+ SHADOW_POINT_DESCRIPTOR.chunk_read,
123
+ chunk_cone_sample_direction,
124
+ chunk_contact_harden_pcf_kernel,
125
+ chunk_get_shadow_offsets,
126
+ chunk_max_penumbra_percentage,
127
+ chunk_random,
128
+ chunk_uv_octahedral_unit_encode,
129
+ chunk_uv_to_texel_coordinate,
130
+ chunk_random_round_vec2,
131
+ chunk_random_vec2,
132
+ ]
133
+ );
@@ -1 +1 @@
1
- {"version":3,"file":"GPUViewVolumetrics.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/volumetrics/GPUViewVolumetrics.js"],"names":[],"mappings":"AAkBA;IAgFI;;;;OAIG;IACH,qDAqBC;IAtED;;OAEG;IACH,8BAOC;IAjBD;;OAEG;IACH,2BAEC;IA6BD;;OAEG;IACH,4BAEC;IAZD;;OAEG;IACH,yBAEC;IA+CD,gBAWC;IAgGD;;;;;;;OAOG;IACH;;;MAwEC;;CAEJ"}
1
+ {"version":3,"file":"GPUViewVolumetrics.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/volumetrics/GPUViewVolumetrics.js"],"names":[],"mappings":"AA4BA;IAyHI;;;;OAIG;IACH,qDAqBC;IA/GD;;OAEG;IACH,8BAOC;IAjBD;;OAEG;IACH,2BAEC;IA6BD;;OAEG;IACH,4BAEC;IAZD;;OAEG;IACH,yBAEC;IAwFD,gBAWC;IAiND;;;;;;;OAOG;IACH;;;MAyEC;;CAEJ"}