@woosh/meep-engine 3.59.0 → 3.60.1
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.
- package/package.json +1 -1
- package/src/shade/playground/probe_clipmap/index.html +12 -0
- package/src/shade/playground/probe_clipmap/main.d.ts.map +1 -1
- package/src/shade/playground/probe_clipmap/main.js +5 -0
- package/src/shade/renderer/Renderer.d.ts.map +1 -1
- package/src/shade/renderer/Renderer.js +4 -6
- package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.d.ts +63 -1
- package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.d.ts.map +1 -1
- package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.js +228 -16
- package/src/shade/renderer/geometry/sdf/cards/GPUMeshCardSets.d.ts +27 -4
- package/src/shade/renderer/geometry/sdf/cards/GPUMeshCardSets.d.ts.map +1 -1
- package/src/shade/renderer/geometry/sdf/cards/GPUMeshCardSets.js +526 -23
- package/src/shade/renderer/geometry/sdf/cards/MeshCardCaptureMode.d.ts +11 -0
- package/src/shade/renderer/geometry/sdf/cards/MeshCardCaptureMode.d.ts.map +1 -0
- package/src/shade/renderer/geometry/sdf/cards/MeshCardCaptureMode.js +21 -0
- package/src/shade/renderer/geometry/sdf/cards/mesh_cards_raster_pass_descriptor.d.ts +65 -0
- package/src/shade/renderer/geometry/sdf/cards/mesh_cards_raster_pass_descriptor.d.ts.map +1 -0
- package/src/shade/renderer/geometry/sdf/cards/mesh_cards_raster_pass_descriptor.js +376 -0
- package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_capture.d.ts +7 -3
- package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_capture.d.ts.map +1 -1
- package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_capture.js +70 -6
- package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_raster_args.d.ts +20 -0
- package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_raster_args.d.ts.map +1 -0
- package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_raster_args.js +80 -0
- package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_raster_scatter.d.ts +18 -0
- package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_raster_scatter.d.ts.map +1 -0
- package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_raster_scatter.js +113 -0
- package/src/shade/renderer/geometry/virtual/sdf/VGEO_SDF.d.ts +47 -0
- package/src/shade/renderer/geometry/virtual/sdf/VGEO_SDF.d.ts.map +1 -0
- package/src/shade/renderer/geometry/virtual/sdf/VGEO_SDF.js +80 -0
- package/src/shade/renderer/geometry/virtual/sdf/VGeoSDFProxies.d.ts +91 -0
- package/src/shade/renderer/geometry/virtual/sdf/VGeoSDFProxies.d.ts.map +1 -0
- package/src/shade/renderer/geometry/virtual/sdf/VGeoSDFProxies.js +902 -0
- package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_collect.d.ts +16 -0
- package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_collect.d.ts.map +1 -0
- package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_collect.js +67 -0
- package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_decode.d.ts +17 -0
- package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_decode.d.ts.map +1 -0
- package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_decode.js +145 -0
- package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_traverse.d.ts +12 -0
- package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_traverse.d.ts.map +1 -0
- package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_traverse.js +105 -0
- package/src/shade/renderer/global_illumination/probe/octahedral/shader_lpv_build_gbuffer.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe/octahedral/shader_lpv_build_gbuffer.js +2 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts +3 -9
- package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.js +13 -31
- package/src/shade/renderer/global_illumination/probe_clipmap/PROBE_CLIPMAP_PROPOSAL_2026_10_27.md +764 -48
- package/src/shade/renderer/global_illumination/probe_clipmap/PROBE_RAYS_VARIABLE_AND_SORTED_SCOPE_2026_10_30.md +410 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSceneHolds.d.ts +3 -2
- package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSceneHolds.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSceneHolds.js +4 -3
- package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.d.ts +41 -17
- package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.js +57 -33
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/BRICK_CLIPMAP.d.ts +11 -3
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/BRICK_CLIPMAP.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/BRICK_CLIPMAP.js +13 -4
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.d.ts +9 -18
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.js +8 -10
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap.d.ts +12 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap.js +28 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.d.ts +1 -29
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.js +1 -74
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MESH_BRICK.d.ts +161 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MESH_BRICK.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MESH_BRICK.js +219 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MESH_BRICK_INSTANCE_STRUCT.d.ts +1 -8
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MESH_BRICK_INSTANCE_STRUCT.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MESH_BRICK_INSTANCE_STRUCT.js +1 -9
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MeshSDFBrickProvider.d.ts +40 -12
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MeshSDFBrickProvider.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MeshSDFBrickProvider.js +373 -31
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_instance.d.ts +2 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_instance.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_instance.js +2 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_texel.d.ts +15 -8
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_texel.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_texel.js +28 -14
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_walk.d.ts +23 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_walk.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_walk.js +66 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_batch.d.ts +29 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_batch.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_batch.js +210 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_command.d.ts +29 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_command.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_command.js +86 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_gather.d.ts +41 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_gather.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_gather.js +439 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_resolve.d.ts +23 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_resolve.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_resolve.js +135 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_free.d.ts +3 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_free.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_free.js +12 -3
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.d.ts +21 -18
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.js +254 -73
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP.d.ts +149 -8
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP.js +181 -13
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap.d.ts +179 -7
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap.js +412 -31
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_pick.js +4 -4
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_sample_radiance.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_sample_radiance.js +4 -3
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_accumulate.d.ts +36 -10
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_accumulate.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_accumulate.js +218 -29
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_admit.d.ts +5 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_admit.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_admit.js +24 -14
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_due.d.ts +15 -6
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_due.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_due.js +21 -22
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_guide.d.ts +36 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_guide.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_guide.js +257 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.d.ts +18 -7
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.js +157 -51
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_order.d.ts +23 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_order.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_order.js +110 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_project.d.ts +24 -2
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_project.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_project.js +90 -10
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_ray_layout.d.ts +45 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_ray_layout.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_ray_layout.js +205 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_relocate.js +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_retire.d.ts +16 -3
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_retire.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_retire.js +55 -10
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_schedule.d.ts +19 -4
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_schedule.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_schedule.js +60 -6
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_shade.d.ts +10 -9
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_shade.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_shade.js +32 -39
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.d.ts +21 -14
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.js +100 -30
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace_command.d.ts +6 -2
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace_command.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace_command.js +26 -10
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_hits.d.ts +3 -2
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_hits.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_hits.js +12 -12
- package/src/shade/renderer/gpu_primitive/sort/SORT_DIGIT_SETTINGS_STRUCT.d.ts +10 -0
- package/src/shade/renderer/gpu_primitive/sort/SORT_DIGIT_SETTINGS_STRUCT.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/sort/SORT_DIGIT_SETTINGS_STRUCT.js +21 -0
- package/src/shade/renderer/gpu_primitive/sort/SORT_PASS_SETTINGS_STRUCT.d.ts +5 -2
- package/src/shade/renderer/gpu_primitive/sort/SORT_PASS_SETTINGS_STRUCT.d.ts.map +1 -1
- package/src/shade/renderer/gpu_primitive/sort/SORT_PASS_SETTINGS_STRUCT.js +31 -23
- package/src/shade/renderer/gpu_primitive/sort/SORT_SIZE_STRUCT.d.ts +10 -0
- package/src/shade/renderer/gpu_primitive/sort/SORT_SIZE_STRUCT.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/sort/SORT_SIZE_STRUCT.js +22 -0
- package/src/shade/renderer/gpu_primitive/sort/chunk_sort_constants.d.ts +9 -0
- package/src/shade/renderer/gpu_primitive/sort/chunk_sort_constants.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/sort/chunk_sort_constants.js +18 -0
- package/src/shade/renderer/gpu_primitive/sort/chunk_sort_digit.d.ts +8 -3
- package/src/shade/renderer/gpu_primitive/sort/chunk_sort_digit.d.ts.map +1 -1
- package/src/shade/renderer/gpu_primitive/sort/chunk_sort_digit.js +41 -32
- package/src/shade/renderer/gpu_primitive/sort/chunk_sort_histogram_tile.d.ts +31 -0
- package/src/shade/renderer/gpu_primitive/sort/chunk_sort_histogram_tile.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/sort/chunk_sort_histogram_tile.js +71 -0
- package/src/shade/renderer/gpu_primitive/sort/chunk_sort_scatter_tile.d.ts +47 -0
- package/src/shade/renderer/gpu_primitive/sort/chunk_sort_scatter_tile.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/sort/chunk_sort_scatter_tile.js +210 -0
- package/src/shade/renderer/gpu_primitive/sort/defs.d.ts +5 -4
- package/src/shade/renderer/gpu_primitive/sort/defs.d.ts.map +1 -1
- package/src/shade/renderer/gpu_primitive/sort/defs.js +5 -4
- package/src/shade/renderer/gpu_primitive/sort/graph_radix_sort.d.ts +56 -15
- package/src/shade/renderer/gpu_primitive/sort/graph_radix_sort.d.ts.map +1 -1
- package/src/shade/renderer/gpu_primitive/sort/graph_radix_sort.js +410 -61
- package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_histogram.d.ts +4 -1
- package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_histogram.d.ts.map +1 -1
- package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_histogram.js +16 -42
- package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_histogram_indirect.d.ts +15 -0
- package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_histogram_indirect.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_histogram_indirect.js +60 -0
- package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_prepare.d.ts +25 -0
- package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_prepare.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_prepare.js +89 -0
- package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_scatter.d.ts +3 -8
- package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_scatter.d.ts.map +1 -1
- package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_scatter.js +28 -160
- package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_scatter_indirect.d.ts +12 -0
- package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_scatter_indirect.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_scatter_indirect.js +74 -0
- package/src/shade/renderer/gpu_primitive/sort/verify_radix_sort.d.ts +3 -1
- package/src/shade/renderer/gpu_primitive/sort/verify_radix_sort.d.ts.map +1 -1
- package/src/shade/renderer/gpu_primitive/sort/verify_radix_sort.js +387 -188
- package/src/shade/renderer/lightmap/bake/shader_lightmap_viz_to_irradiance_flat.js +1 -1
- package/src/shade/renderer/lightmap/bake/shader_lightmap_viz_to_sh.js +1 -1
- package/src/shade/renderer/material/resident/GPUResidentMaterialContext.d.ts.map +1 -1
- package/src/shade/renderer/material/resident/GPUResidentMaterialContext.js +90 -72
- package/src/shade/renderer/material/resident/RESIDENT_MATERIAL_TEXTURE_LAYOUT.d.ts +5 -0
- package/src/shade/renderer/material/resident/RESIDENT_MATERIAL_TEXTURE_LAYOUT.d.ts.map +1 -1
- package/src/shade/renderer/material/resident/RESIDENT_MATERIAL_TEXTURE_LAYOUT.js +9 -0
- package/src/shade/renderer/path_tracer/shader/INDIRECT_TEXTURE_FILTER.d.ts +13 -0
- package/src/shade/renderer/path_tracer/shader/INDIRECT_TEXTURE_FILTER.d.ts.map +1 -0
- package/src/shade/renderer/path_tracer/shader/INDIRECT_TEXTURE_FILTER.js +14 -0
- package/src/shade/renderer/path_tracer/shader/IndirectTextureFilter.d.ts +10 -0
- package/src/shade/renderer/path_tracer/shader/IndirectTextureFilter.d.ts.map +1 -0
- package/src/shade/renderer/path_tracer/shader/IndirectTextureFilter.js +15 -0
- package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_tangent_normal.d.ts +4 -3
- package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_tangent_normal.d.ts.map +1 -1
- package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_tangent_normal.js +6 -5
- package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_texture.d.ts +17 -2
- package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_texture.d.ts.map +1 -1
- package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_texture.js +25 -57
- package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_texture_exact.d.ts +13 -0
- package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_texture_exact.d.ts.map +1 -0
- package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_texture_exact.js +70 -0
- package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_texture_stochastic.d.ts +10 -0
- package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_texture_stochastic.d.ts.map +1 -0
- package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_texture_stochastic.js +59 -0
- package/src/shade/renderer/path_tracer/shader/chunk_indirect_texture_load.d.ts +12 -0
- package/src/shade/renderer/path_tracer/shader/chunk_indirect_texture_load.d.ts.map +1 -0
- package/src/shade/renderer/path_tracer/shader/chunk_indirect_texture_load.js +49 -0
- package/src/shade/renderer/path_tracer/shader/chunk_ray_hit_to_opacity.d.ts.map +1 -1
- package/src/shade/renderer/path_tracer/shader/chunk_ray_hit_to_opacity.js +1 -0
- package/src/shade/renderer/path_tracer/shader/chunk_render_trace_path.d.ts.map +1 -1
- package/src/shade/renderer/path_tracer/shader/chunk_render_trace_path.js +1 -0
- package/src/shade/renderer/path_tracer/shader/chunk_sample_material.d.ts.map +1 -1
- package/src/shade/renderer/path_tracer/shader/chunk_sample_material.js +2 -1
- package/src/shade/renderer/path_tracer/shader/chunk_sample_material_data.d.ts +7 -0
- package/src/shade/renderer/path_tracer/shader/chunk_sample_material_data.d.ts.map +1 -1
- package/src/shade/renderer/path_tracer/shader/chunk_sample_material_data.js +15 -6
- package/src/shade/renderer/scene/GPUSceneContext.d.ts +7 -1
- package/src/shade/renderer/scene/GPUSceneContext.d.ts.map +1 -1
- package/src/shade/renderer/scene/GPUSceneContext.js +26 -1
- package/src/shade/renderer/shader/chunk/bvh/chunk_bvh_query_aabb_cooperative.d.ts +7 -7
- package/src/shade/renderer/shader/chunk/bvh/chunk_bvh_query_aabb_cooperative.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/bvh/chunk_bvh_query_aabb_cooperative.js +262 -294
- package/src/shade/renderer/shader/chunk/filter/MULTISCALE_MEAN_STRUCT.d.ts +9 -0
- package/src/shade/renderer/shader/chunk/filter/MULTISCALE_MEAN_STRUCT.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/filter/MULTISCALE_MEAN_STRUCT.js +21 -0
- package/src/shade/renderer/shader/chunk/filter/chunk_multiscale_mean.d.ts +43 -0
- package/src/shade/renderer/shader/chunk/filter/chunk_multiscale_mean.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/filter/chunk_multiscale_mean.js +87 -0
- package/src/shade/renderer/shader/chunk/noise/r/chunk_r2_canonical.d.ts +7 -1
- package/src/shade/renderer/shader/chunk/noise/r/chunk_r2_canonical.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/noise/r/chunk_r2_canonical.js +1 -1
- package/src/shade/renderer/shader/chunk/subgroup/chunk_subgroup_reserve_workgroup.d.ts +21 -0
- package/src/shade/renderer/shader/chunk/subgroup/chunk_subgroup_reserve_workgroup.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/subgroup/chunk_subgroup_reserve_workgroup.js +42 -0
- package/src/shade/renderer/wind/GPUSceneWind.d.ts +1 -1
- package/src/shade/wgsl/emulator/CPUBitmapData.d.ts +19 -0
- package/src/shade/wgsl/emulator/CPUBitmapData.d.ts.map +1 -1
- package/src/shade/wgsl/emulator/CPUBitmapData.js +27 -0
- package/src/shade/wgsl/emulator/WGSLLanguageCore.d.ts.map +1 -1
- package/src/shade/wgsl/emulator/WGSLLanguageCore.js +65 -19
- package/src/view/elements/progress/segmented/GhostTrail.d.ts +116 -0
- package/src/view/elements/progress/segmented/GhostTrail.d.ts.map +1 -0
- package/src/view/elements/progress/segmented/GhostTrail.js +280 -0
- package/src/view/elements/progress/segmented/RESOURCE_BAR_SEGMENTS.d.ts +3 -1
- package/src/view/elements/progress/segmented/RESOURCE_BAR_SEGMENTS.d.ts.map +1 -1
- package/src/view/elements/progress/segmented/RESOURCE_BAR_SEGMENTS.js +3 -1
- package/src/view/elements/progress/segmented/SEGMENT_TIERS_DEFAULT.d.ts +11 -0
- package/src/view/elements/progress/segmented/SEGMENT_TIERS_DEFAULT.d.ts.map +1 -0
- package/src/view/elements/progress/segmented/SEGMENT_TIERS_DEFAULT.js +15 -0
- package/src/view/elements/progress/segmented/SegmentDefinition.d.ts +3 -0
- package/src/view/elements/progress/segmented/SegmentDefinition.d.ts.map +1 -1
- package/src/view/elements/progress/segmented/SegmentDefinition.js +3 -0
- package/src/view/elements/progress/segmented/SegmentTier.d.ts +38 -0
- package/src/view/elements/progress/segmented/SegmentTier.d.ts.map +1 -0
- package/src/view/elements/progress/segmented/SegmentTier.js +50 -0
- package/src/view/elements/progress/segmented/SegmentedResourceBarView.d.ts +163 -10
- package/src/view/elements/progress/segmented/SegmentedResourceBarView.d.ts.map +1 -1
- package/src/view/elements/progress/segmented/SegmentedResourceBarView.js +442 -101
- package/src/view/elements/progress/segmented/playground/index.html +78 -0
- package/src/view/elements/progress/segmented/playground/main.d.ts +2 -0
- package/src/view/elements/progress/segmented/playground/main.d.ts.map +1 -0
- package/src/view/elements/progress/segmented/playground/main.js +173 -0
- package/src/view/elements/progress/segmented/segment_cell_layout.d.ts +48 -0
- package/src/view/elements/progress/segmented/segment_cell_layout.d.ts.map +1 -0
- package/src/view/elements/progress/segmented/segment_cell_layout.js +75 -0
- package/src/view/elements/progress/segmented/segment_notch_place.d.ts +18 -0
- package/src/view/elements/progress/segmented/segment_notch_place.d.ts.map +1 -0
- package/src/view/elements/progress/segmented/segment_notch_place.js +28 -0
- package/src/view/elements/progress/segmented/segment_tick_positions.d.ts +32 -0
- package/src/view/elements/progress/segmented/segment_tick_positions.d.ts.map +1 -0
- package/src/view/elements/progress/segmented/segment_tick_positions.js +103 -0
- package/src/view/elements/progress/segmented/segmented-resource-bar.css +142 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_provider.d.ts +0 -35
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_provider.d.ts.map +0 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_provider.js +0 -238
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/VGEO_BRICK.d.ts +0 -99
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/VGEO_BRICK.d.ts.map +0 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/VGEO_BRICK.js +0 -139
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/VGeoBrickProvider.d.ts +0 -65
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/VGeoBrickProvider.d.ts.map +0 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/VGeoBrickProvider.js +0 -393
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/chunk_vgeo_brick_box.d.ts +0 -17
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/chunk_vgeo_brick_box.d.ts.map +0 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/chunk_vgeo_brick_box.js +0 -36
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/chunk_vgeo_brick_pair.d.ts +0 -29
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/chunk_vgeo_brick_pair.d.ts.map +0 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/chunk_vgeo_brick_pair.js +0 -108
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/chunk_vgeo_brick_texel.d.ts +0 -31
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/chunk_vgeo_brick_texel.d.ts.map +0 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/chunk_vgeo_brick_texel.js +0 -113
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/chunk_vgeo_brick_triangle.d.ts +0 -36
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/chunk_vgeo_brick_triangle.d.ts.map +0 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/chunk_vgeo_brick_triangle.js +0 -85
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/shader_vgeo_brick_distance.d.ts +0 -23
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/shader_vgeo_brick_distance.d.ts.map +0 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/shader_vgeo_brick_distance.js +0 -273
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/shader_vgeo_brick_gather.d.ts +0 -13
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/shader_vgeo_brick_gather.d.ts.map +0 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/shader_vgeo_brick_gather.js +0 -151
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/shader_vgeo_brick_traverse.d.ts +0 -13
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/shader_vgeo_brick_traverse.d.ts.map +0 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/shader_vgeo_brick_traverse.js +0 -133
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/shader_vgeo_brick_wait.d.ts +0 -22
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/shader_vgeo_brick_wait.d.ts.map +0 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/shader_vgeo_brick_wait.js +0 -135
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How a card set's pages are captured (PROBE_CLIPMAP_PROPOSAL_2026_10_27.md §6.5). Both write the
|
|
3
|
+
* same atlas texels in the same encoding; they differ in how a texel finds its surface and samples
|
|
4
|
+
* its material. {@link Raster } is the default: see `ProbeClipmapSettings#card_capture_mode`.
|
|
5
|
+
*/
|
|
6
|
+
export type MeshCardCaptureMode = number;
|
|
7
|
+
export namespace MeshCardCaptureMode {
|
|
8
|
+
let Trace: number;
|
|
9
|
+
let Raster: number;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=MeshCardCaptureMode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MeshCardCaptureMode.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/geometry/sdf/cards/MeshCardCaptureMode.js"],"names":[],"mappings":";;;;;kCAMU,MAAM"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How a card set's pages are captured (PROBE_CLIPMAP_PROPOSAL_2026_10_27.md §6.5). Both write the
|
|
3
|
+
* same atlas texels in the same encoding; they differ in how a texel finds its surface and samples
|
|
4
|
+
* its material. {@link Raster} is the default: see `ProbeClipmapSettings#card_capture_mode`.
|
|
5
|
+
*
|
|
6
|
+
* @readonly
|
|
7
|
+
* @enum {number}
|
|
8
|
+
*/
|
|
9
|
+
export const MeshCardCaptureMode = {
|
|
10
|
+
/**
|
|
11
|
+
* A ray a texel through its card's slab against the geometry's BLAS, the material sampled at the
|
|
12
|
+
* hit as the path tracer samples it: the resident 64² copies, level 0, one stochastic tap.
|
|
13
|
+
*/
|
|
14
|
+
Trace: 0,
|
|
15
|
+
/**
|
|
16
|
+
* Each card drawn orthographically along its direction, the slab its depth range, through the
|
|
17
|
+
* material's own template and bind group: its textures with their mips and hardware filtering.
|
|
18
|
+
* A template that cannot be drawn this way (no surface function) is traced.
|
|
19
|
+
*/
|
|
20
|
+
Raster: 1,
|
|
21
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import("../../../../descriptor/binding/BindGroupLayoutDescriptor.js").BindGroupLayoutDescriptor} BindGroupLayoutDescriptor
|
|
3
|
+
* @typedef {import("../../../material/template/ShadeMaterialTemplate.js").ShadeMaterialTemplate} ShadeMaterialTemplate
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Cells across a raster run's region: the region is MESH_CARD_MAX cells, this many a row.
|
|
7
|
+
* @type {number}
|
|
8
|
+
*/
|
|
9
|
+
export const MESH_CARD_RASTER_CELLS_X: number;
|
|
10
|
+
/**
|
|
11
|
+
* Rows of cells in a raster run's region.
|
|
12
|
+
* @type {number}
|
|
13
|
+
*/
|
|
14
|
+
export const MESH_CARD_RASTER_CELLS_Y: number;
|
|
15
|
+
/**
|
|
16
|
+
* The scratch the cards are drawn into, before the scatter moves their pages into the atlas.
|
|
17
|
+
* @type {GPUTextureFormat[]}
|
|
18
|
+
*/
|
|
19
|
+
export const MESH_CARD_RASTER_TARGET_FORMATS: GPUTextureFormat[];
|
|
20
|
+
/**
|
|
21
|
+
* @type {GPUTextureFormat}
|
|
22
|
+
*/
|
|
23
|
+
export const MESH_CARD_RASTER_DEPTH_FORMAT: GPUTextureFormat;
|
|
24
|
+
/**
|
|
25
|
+
* @type {WebGPUStruct}
|
|
26
|
+
*/
|
|
27
|
+
export const MESH_CARDS_RASTER_SETTINGS: WebGPUStruct;
|
|
28
|
+
/**
|
|
29
|
+
* Group 1: where the vertex stage pulls the geometry and its cards from. Vertex-only.
|
|
30
|
+
*
|
|
31
|
+
* `mesh_card_raster_runs` is a `vec4<u32>` a run: (first scatter thread, card set, the region's
|
|
32
|
+
* corner in the scratch as x | y << 16, the side of its cells in texels).
|
|
33
|
+
*
|
|
34
|
+
* @type {ShaderResourceGroupDescriptor}
|
|
35
|
+
*/
|
|
36
|
+
export const MESH_CARDS_RASTER_GROUP: ShaderResourceGroupDescriptor;
|
|
37
|
+
/**
|
|
38
|
+
* @type {BindGroupLayoutDescriptor}
|
|
39
|
+
*/
|
|
40
|
+
export const MESH_CARDS_RASTER_LAYOUT: BindGroupLayoutDescriptor;
|
|
41
|
+
/**
|
|
42
|
+
* Card capture by raster ({@link MeshCardCaptureMode.Raster}): one pipeline per material template,
|
|
43
|
+
* the template's group 0 — the material's one bind group, which the G-buffer pass binds — then
|
|
44
|
+
* {@link MESH_CARDS_RASTER_GROUP}, and {@link MESH_CARDS_RASTER_SETTINGS} as immediate data.
|
|
45
|
+
*
|
|
46
|
+
* A run's draw covers every card of its card set, each into its cell of the run's region of the
|
|
47
|
+
* scratch: `rgba8unorm` √(diffuse albedo) and depth, `rgba8unorm` emissive / s_e, and a
|
|
48
|
+
* `depth32float` depth through the slab. Draw it with culling off: a card sees either side.
|
|
49
|
+
*
|
|
50
|
+
* Only a template with a surface function can be drawn.
|
|
51
|
+
*
|
|
52
|
+
* @type {TemplatePassDescriptor}
|
|
53
|
+
*/
|
|
54
|
+
export const mesh_cards_raster_pass_descriptor: TemplatePassDescriptor;
|
|
55
|
+
/**
|
|
56
|
+
* Bytes of {@link MESH_CARDS_RASTER_SETTINGS} the draws hand `setImmediates`.
|
|
57
|
+
* @type {number}
|
|
58
|
+
*/
|
|
59
|
+
export const MESH_CARDS_RASTER_IMMEDIATE_SIZE: number;
|
|
60
|
+
export type BindGroupLayoutDescriptor = import("../../../../descriptor/binding/BindGroupLayoutDescriptor.js").BindGroupLayoutDescriptor;
|
|
61
|
+
export type ShadeMaterialTemplate = import("../../../material/template/ShadeMaterialTemplate.js").ShadeMaterialTemplate;
|
|
62
|
+
import { WebGPUStruct } from "../../../shader/type/WebGPUStruct.js";
|
|
63
|
+
import { ShaderResourceGroupDescriptor } from "../../../shader/resource/ShaderResourceGroupDescriptor.js";
|
|
64
|
+
import { TemplatePassDescriptor } from "../../../rasterize/TemplatePassDescriptor.js";
|
|
65
|
+
//# sourceMappingURL=mesh_cards_raster_pass_descriptor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mesh_cards_raster_pass_descriptor.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/geometry/sdf/cards/mesh_cards_raster_pass_descriptor.js"],"names":[],"mappings":"AAkCA;;;GAGG;AAEH;;;GAGG;AACH,uCAFU,MAAM,CAE0B;AAE1C;;;GAGG;AACH,uCAFU,MAAM,CAE4E;AAE5F;;;GAGG;AACH,8CAFU,kBAAkB,CAEgD;AAE5E;;GAEG;AACH,6DAA4D;AAE5D;;GAEG;AACH,yCAFU,YAAY,CASQ;AAE9B;;;;;;;GAOG;AACH,sCAFU,6BAA6B,CAEoC;AAe3E;;GAEG;AACH,uCAFU,yBAAyB,CAEiE;AAiOpG;;;;;;;;;;;;GAYG;AACH,gDAFU,sBAAsB,CAiC7B;AAEH;;;GAGG;AACH,+CAFU,MAAM,CAE+D;wCApVlE,OAAO,6DAA6D,EAAE,yBAAyB;oCAC/F,OAAO,qDAAqD,EAAE,qBAAqB;6BAVnE,sCAAsC;8CALrB,2DAA2D;uCARlE,8CAA8C"}
|
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
import { GPUShaderStage } from "../../../../descriptor/GPUShaderStage.js";
|
|
2
|
+
import { PipelineLayoutDescriptor } from "../../../../descriptor/pipeline/PipelineLayoutDescriptor.js";
|
|
3
|
+
import { DepthStencilState } from "../../../../descriptor/pipeline/render/DepthStencilState.js";
|
|
4
|
+
import { RenderPipelineDescriptor } from "../../../../descriptor/pipeline/render/RenderPipelineDescriptor.js";
|
|
5
|
+
import { GEOMETRY_ATTRIBUTE_DATA_RESOURCE } from "../../GEOMETRY_ATTRIBUTE_DATA_RESOURCE.js";
|
|
6
|
+
import { GEOMETRY_METADATA_STRUCT } from "../../GEOMETRY_METADATA_STRUCT.js";
|
|
7
|
+
import { MESHLET_METADATA_RESOURCE } from "../../meshlet/MESHLET_METADATA_RESOURCE.js";
|
|
8
|
+
import {
|
|
9
|
+
chunk_material_opacity_contract,
|
|
10
|
+
chunk_material_opacity_opaque,
|
|
11
|
+
chunk_material_surface_contract
|
|
12
|
+
} from "../../../material/template/chunk_material_surface.js";
|
|
13
|
+
import { rasterization_primitive_state } from "../../../rasterize/native/rasterization_primitive_state.js";
|
|
14
|
+
import { TemplatePassDescriptor } from "../../../rasterize/TemplatePassDescriptor.js";
|
|
15
|
+
import {
|
|
16
|
+
chunk_read_meshlet_vertex_by_draw_index
|
|
17
|
+
} from "../../../shader/chunk/geometry/meshlet/chunk_read_meshlet_vertex_by_draw_index.js";
|
|
18
|
+
import { chunk_random } from "../../../shader/chunk/random/chunk_random.js";
|
|
19
|
+
import { chunk_random_initialize } from "../../../shader/chunk/random/chunk_random_initialize.js";
|
|
20
|
+
import { GRADIENT_SAMPLING_INFO_STRUCT } from "../../../shader/chunk/texture/GRADIENT_SAMPLING_INFO_STRUCT.js";
|
|
21
|
+
import { CodeChunk } from "../../../shader/compiler/CodeChunk.js";
|
|
22
|
+
import { ShaderResourceGroupDescriptor } from "../../../shader/resource/ShaderResourceGroupDescriptor.js";
|
|
23
|
+
import { ShaderResourceSetDescriptor } from "../../../shader/resource/ShaderResourceSetDescriptor.js";
|
|
24
|
+
import { ShaderDescriptor } from "../../../shader/ShaderDescriptor.js";
|
|
25
|
+
import { f32, u32, vec4u } from "../../../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
|
|
26
|
+
import { WebGPUArray } from "../../../shader/type/WebGPUArray.js";
|
|
27
|
+
import { WebGPUStruct } from "../../../shader/type/WebGPUStruct.js";
|
|
28
|
+
import { MESH_SDF_HEADERS_RESOURCE, MESH_SDF_INDIRECTION_RESOURCE } from "../MESH_SDF_RESOURCES.js";
|
|
29
|
+
import { MESH_SDF_STRUCT } from "../MESH_SDF_STRUCT.js";
|
|
30
|
+
import { chunk_mesh_cards } from "./chunk_mesh_cards.js";
|
|
31
|
+
import { MESH_CARD_SETS_RESOURCE } from "./MESH_CARD_RESOURCES.js";
|
|
32
|
+
import { MESH_CARD_SET_STRUCT } from "./MESH_CARD_SET_STRUCT.js";
|
|
33
|
+
import { MESH_CARD_MAX } from "./MESH_CARDS.js";
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @typedef {import("../../../../descriptor/binding/BindGroupLayoutDescriptor.js").BindGroupLayoutDescriptor} BindGroupLayoutDescriptor
|
|
37
|
+
* @typedef {import("../../../material/template/ShadeMaterialTemplate.js").ShadeMaterialTemplate} ShadeMaterialTemplate
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Cells across a raster run's region: the region is MESH_CARD_MAX cells, this many a row.
|
|
42
|
+
* @type {number}
|
|
43
|
+
*/
|
|
44
|
+
export const MESH_CARD_RASTER_CELLS_X = 8;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Rows of cells in a raster run's region.
|
|
48
|
+
* @type {number}
|
|
49
|
+
*/
|
|
50
|
+
export const MESH_CARD_RASTER_CELLS_Y = Math.ceil(MESH_CARD_MAX / MESH_CARD_RASTER_CELLS_X);
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The scratch the cards are drawn into, before the scatter moves their pages into the atlas.
|
|
54
|
+
* @type {GPUTextureFormat[]}
|
|
55
|
+
*/
|
|
56
|
+
export const MESH_CARD_RASTER_TARGET_FORMATS = ["rgba8unorm", "rgba8unorm"];
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @type {GPUTextureFormat}
|
|
60
|
+
*/
|
|
61
|
+
export const MESH_CARD_RASTER_DEPTH_FORMAT = "depth32float";
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* @type {WebGPUStruct}
|
|
65
|
+
*/
|
|
66
|
+
export const MESH_CARDS_RASTER_SETTINGS = WebGPUStruct.from({
|
|
67
|
+
/** the run drawn, its entry in `mesh_card_raster_runs` */
|
|
68
|
+
run: u32,
|
|
69
|
+
/** the scratch's texels across */
|
|
70
|
+
width: f32,
|
|
71
|
+
/** the scratch's texels down */
|
|
72
|
+
height: f32,
|
|
73
|
+
}, "MeshCardsRasterSettings");
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Group 1: where the vertex stage pulls the geometry and its cards from. Vertex-only.
|
|
77
|
+
*
|
|
78
|
+
* `mesh_card_raster_runs` is a `vec4<u32>` a run: (first scatter thread, card set, the region's
|
|
79
|
+
* corner in the scratch as x | y << 16, the side of its cells in texels).
|
|
80
|
+
*
|
|
81
|
+
* @type {ShaderResourceGroupDescriptor}
|
|
82
|
+
*/
|
|
83
|
+
export const MESH_CARDS_RASTER_GROUP = new ShaderResourceGroupDescriptor();
|
|
84
|
+
|
|
85
|
+
MESH_CARDS_RASTER_GROUP.label = "mesh cards raster";
|
|
86
|
+
|
|
87
|
+
MESH_CARDS_RASTER_GROUP
|
|
88
|
+
.add(MESH_SDF_HEADERS_RESOURCE)
|
|
89
|
+
.add(MESH_SDF_INDIRECTION_RESOURCE)
|
|
90
|
+
.add(MESH_CARD_SETS_RESOURCE)
|
|
91
|
+
.addStorageBuffer("mesh_card_raster_runs", WebGPUArray.from(vec4u))
|
|
92
|
+
.addStorageBuffer("geometries", WebGPUArray.from(GEOMETRY_METADATA_STRUCT))
|
|
93
|
+
.add(MESHLET_METADATA_RESOURCE)
|
|
94
|
+
.add(GEOMETRY_ATTRIBUTE_DATA_RESOURCE);
|
|
95
|
+
|
|
96
|
+
MESH_CARDS_RASTER_GROUP.addVisibility(GPUShaderStage.VERTEX);
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* @type {BindGroupLayoutDescriptor}
|
|
100
|
+
*/
|
|
101
|
+
export const MESH_CARDS_RASTER_LAYOUT = MESH_CARDS_RASTER_GROUP.generateBindGroupLayoutDescriptor();
|
|
102
|
+
|
|
103
|
+
const vertex_resources = new ShaderResourceSetDescriptor();
|
|
104
|
+
|
|
105
|
+
vertex_resources.setImmediate("settings", MESH_CARDS_RASTER_SETTINGS);
|
|
106
|
+
vertex_resources.createGroup({ index: 0, label: "material (fragment only)" });
|
|
107
|
+
vertex_resources.addGroup(MESH_CARDS_RASTER_GROUP);
|
|
108
|
+
|
|
109
|
+
const VARYINGS = `
|
|
110
|
+
struct MeshCardRasterVertex {
|
|
111
|
+
@builtin(position) position: vec4<f32>,
|
|
112
|
+
@location(0) uv: vec2<f32>,
|
|
113
|
+
@location(1) uv1: vec2<f32>,
|
|
114
|
+
@location(2) position_os: vec3<f32>,
|
|
115
|
+
@location(3) normal: vec3<f32>,
|
|
116
|
+
@location(4) color: vec3<f32>,
|
|
117
|
+
@location(5) @interpolate(flat) card_set: u32,
|
|
118
|
+
@location(6) @interpolate(flat) card: u32,
|
|
119
|
+
@location(7) @interpolate(flat) emissive_scale: f32,
|
|
120
|
+
@location(8) @interpolate(flat) along: vec3<f32>,
|
|
121
|
+
}
|
|
122
|
+
`;
|
|
123
|
+
|
|
124
|
+
/*
|
|
125
|
+
Instance i of run r's draw is card i / m's meshlet i mod m, m the geometry's meshlets; vertex v is
|
|
126
|
+
its triangle v / 3's corner, as the alpha-tested raster reads a meshlet. A card maps the geometry's
|
|
127
|
+
local space onto its cell: lattice (u, v) across the card to texel (u, v) of the cell, its centre on
|
|
128
|
+
the lattice point, which is where the trace starts its ray; depth from the near face over the slab's
|
|
129
|
+
depth to [0, 1], so the hardware clips to the slab as the trace's t ≤ depth does. The geometry lies
|
|
130
|
+
inside its grid, so nothing it draws falls outside the card's face, and the cells need no clip.
|
|
131
|
+
*/
|
|
132
|
+
const vertex_body = CodeChunk.from(
|
|
133
|
+
//language=WGSL
|
|
134
|
+
`
|
|
135
|
+
${VARYINGS}
|
|
136
|
+
|
|
137
|
+
@vertex
|
|
138
|
+
fn main(
|
|
139
|
+
@builtin(vertex_index) vertex_draw_index: u32,
|
|
140
|
+
@builtin(instance_index) instance: u32,
|
|
141
|
+
) -> MeshCardRasterVertex {
|
|
142
|
+
var out: MeshCardRasterVertex;
|
|
143
|
+
|
|
144
|
+
let run = mesh_card_raster_runs[settings.run];
|
|
145
|
+
let card_set = mesh_card_sets[run.y];
|
|
146
|
+
let geometry = geometries[card_set.geometry];
|
|
147
|
+
let header = mesh_sdf_headers[card_set.geometry];
|
|
148
|
+
|
|
149
|
+
// the args draw no instance of a geometry without meshlets
|
|
150
|
+
let meshlets = max(geometry.meshlets_count, 1u);
|
|
151
|
+
let card = instance / meshlets;
|
|
152
|
+
let meshlet_header = meshlet_metadata[geometry.meshlets_address + instance % meshlets];
|
|
153
|
+
|
|
154
|
+
if (vertex_draw_index >= meshlet_header.primitive_count * 3u) {
|
|
155
|
+
// past the meshlet's triangles: a degenerate one, which draws nothing
|
|
156
|
+
return out;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
let attributes = read_meshlet_vertex_by_draw_index(meshlet_header, vertex_draw_index);
|
|
160
|
+
|
|
161
|
+
let record = header.cards + MESH_CARD_LAYOUT_RECORDS + card * MESH_CARD_RECORD_WORDS;
|
|
162
|
+
let direction = mesh_sdf_indirection[record + MESH_CARD_RECORD_DIRECTION];
|
|
163
|
+
let near = mesh_sdf_indirection[record + MESH_CARD_RECORD_NEAR];
|
|
164
|
+
let far = mesh_sdf_indirection[record + MESH_CARD_RECORD_FAR];
|
|
165
|
+
|
|
166
|
+
let axes = mesh_card_axes(direction);
|
|
167
|
+
let toward_plus = (direction & 1u) == 0u;
|
|
168
|
+
|
|
169
|
+
// voxels from the grid's corner
|
|
170
|
+
let p = (attributes.position - header.origin) / header.voxel;
|
|
171
|
+
|
|
172
|
+
let face = f32(select(header.bricks[axes.x] - near, near, toward_plus) * MESH_SDF_BRICK_VOXELS);
|
|
173
|
+
let depth = select(face - p[axes.x], p[axes.x] - face, toward_plus);
|
|
174
|
+
let slab = f32((far - near) * MESH_SDF_BRICK_VOXELS);
|
|
175
|
+
|
|
176
|
+
let corner = vec2<f32>(f32(run.z & 0xffffu), f32(run.z >> 16u))
|
|
177
|
+
+ vec2<f32>(f32(card % ${MESH_CARD_RASTER_CELLS_X}u), f32(card / ${MESH_CARD_RASTER_CELLS_X}u)) * f32(run.w);
|
|
178
|
+
let texel = corner + vec2<f32>(p[axes.y], p[axes.z]) + 0.5;
|
|
179
|
+
|
|
180
|
+
out.position = vec4<f32>(
|
|
181
|
+
texel.x / settings.width * 2.0 - 1.0,
|
|
182
|
+
1.0 - texel.y / settings.height * 2.0,
|
|
183
|
+
depth / slab,
|
|
184
|
+
1.0
|
|
185
|
+
);
|
|
186
|
+
|
|
187
|
+
var along = vec3<f32>(0.0);
|
|
188
|
+
|
|
189
|
+
along[axes.x] = select(-1.0, 1.0, toward_plus);
|
|
190
|
+
|
|
191
|
+
out.uv = attributes.uv;
|
|
192
|
+
out.uv1 = attributes.uv1;
|
|
193
|
+
out.position_os = attributes.position;
|
|
194
|
+
out.normal = attributes.normal;
|
|
195
|
+
out.color = attributes.color;
|
|
196
|
+
out.card_set = run.y;
|
|
197
|
+
out.card = card;
|
|
198
|
+
out.emissive_scale = card_set.emissive_scale;
|
|
199
|
+
out.along = along;
|
|
200
|
+
|
|
201
|
+
return out;
|
|
202
|
+
}
|
|
203
|
+
`, [
|
|
204
|
+
MESH_SDF_STRUCT.declaration_chunk,
|
|
205
|
+
MESH_CARD_SET_STRUCT.declaration_chunk,
|
|
206
|
+
GEOMETRY_METADATA_STRUCT.declaration_chunk,
|
|
207
|
+
chunk_mesh_cards,
|
|
208
|
+
chunk_read_meshlet_vertex_by_draw_index,
|
|
209
|
+
]);
|
|
210
|
+
|
|
211
|
+
const vertex_code = ShaderDescriptor.from({
|
|
212
|
+
label: "Mesh Cards Raster / vertex",
|
|
213
|
+
resources: vertex_resources,
|
|
214
|
+
body: vertex_body,
|
|
215
|
+
}).source;
|
|
216
|
+
|
|
217
|
+
/*
|
|
218
|
+
The template is handed what the G-buffer pass hands it, in the geometry's local space, the card
|
|
219
|
+
being there: real derivatives, as this is a raster with neighbours of its own triangle, unbiased, as
|
|
220
|
+
UE's card capture leaves its material mip bias at 0. Both functions run first, in uniform control
|
|
221
|
+
flow, so a template may sample with implicit derivatives.
|
|
222
|
+
|
|
223
|
+
Coverage is drawn as the trace draws it, a texel's surface opaque with probability its opacity, from
|
|
224
|
+
a seed fixed by the card set, the card and the texel; the depth test keeps the nearest opaque draw.
|
|
225
|
+
The planes are the trace's: √(albedo × (1 − metalness)) and depth through the slab on [1/255, 1];
|
|
226
|
+
emissive over s_e.
|
|
227
|
+
*/
|
|
228
|
+
const fragment_body = CodeChunk.from(
|
|
229
|
+
//language=WGSL
|
|
230
|
+
`
|
|
231
|
+
${VARYINGS}
|
|
232
|
+
|
|
233
|
+
struct MeshCardRasterTargets {
|
|
234
|
+
@location(0) albedo: vec4<f32>,
|
|
235
|
+
@location(1) emissive: vec4<f32>,
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
@fragment
|
|
239
|
+
fn main(in: MeshCardRasterVertex) -> MeshCardRasterTargets {
|
|
240
|
+
let uv = ${GRADIENT_SAMPLING_INFO_STRUCT.wgsl_ref}(in.uv, dpdx(in.uv), dpdy(in.uv));
|
|
241
|
+
let uv1 = ${GRADIENT_SAMPLING_INFO_STRUCT.wgsl_ref}(in.uv1, dpdx(in.uv1), dpdy(in.uv1));
|
|
242
|
+
let position_ddx = dpdx(in.position_os);
|
|
243
|
+
let position_ddy = dpdy(in.position_os);
|
|
244
|
+
|
|
245
|
+
var opacity_input: MaterialOpacityInput;
|
|
246
|
+
|
|
247
|
+
opacity_input.uv = uv;
|
|
248
|
+
opacity_input.mip_bias = 0.0;
|
|
249
|
+
opacity_input.position_ws = in.position_os;
|
|
250
|
+
|
|
251
|
+
let opacity = material_opacity(opacity_input);
|
|
252
|
+
|
|
253
|
+
var surface_input: MaterialSurfaceInput;
|
|
254
|
+
|
|
255
|
+
surface_input.uv = uv;
|
|
256
|
+
surface_input.uv1 = uv1;
|
|
257
|
+
surface_input.gradient_bias = vec2<f32>(1.0);
|
|
258
|
+
surface_input.position_os = in.position_os;
|
|
259
|
+
surface_input.position_os_ddx = position_ddx;
|
|
260
|
+
surface_input.position_os_ddy = position_ddy;
|
|
261
|
+
surface_input.position_ws = in.position_os;
|
|
262
|
+
surface_input.normal_ws = normalize(in.normal);
|
|
263
|
+
surface_input.face_normal_ws = normalize(cross(position_ddx, position_ddy));
|
|
264
|
+
surface_input.view_direction_ws = -in.along;
|
|
265
|
+
surface_input.vertex_color = in.color;
|
|
266
|
+
surface_input.pixel = in.position.xy;
|
|
267
|
+
|
|
268
|
+
let surface = material_surface(surface_input);
|
|
269
|
+
|
|
270
|
+
random_initialize(vec3<u32>(vec2<u32>(in.position.xy), in.card), vec3<u32>(in.card_set, 0u, 0u));
|
|
271
|
+
|
|
272
|
+
if (random() >= opacity) {
|
|
273
|
+
discard;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
let diffuse = surface.albedo * (1.0 - surface.metalness);
|
|
277
|
+
|
|
278
|
+
var out: MeshCardRasterTargets;
|
|
279
|
+
|
|
280
|
+
out.albedo = vec4<f32>(sqrt(max(diffuse, vec3<f32>(0.0))), (1.0 + 254.0 * saturate(in.position.z)) / 255.0);
|
|
281
|
+
|
|
282
|
+
if (in.emissive_scale > 0.0) {
|
|
283
|
+
out.emissive = vec4<f32>(surface.emissive / in.emissive_scale, 0.0);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
return out;
|
|
287
|
+
}
|
|
288
|
+
`, [
|
|
289
|
+
GRADIENT_SAMPLING_INFO_STRUCT.declaration_chunk,
|
|
290
|
+
chunk_material_surface_contract,
|
|
291
|
+
chunk_material_opacity_contract,
|
|
292
|
+
chunk_random,
|
|
293
|
+
chunk_random_initialize,
|
|
294
|
+
]);
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* @type {WeakMap<ShadeMaterialTemplate, ShaderResourceSetDescriptor>}
|
|
298
|
+
*/
|
|
299
|
+
const fragment_resources = new WeakMap();
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* @param {ShadeMaterialTemplate} template
|
|
303
|
+
* @returns {ShaderResourceSetDescriptor}
|
|
304
|
+
*/
|
|
305
|
+
function fragment_resources_of(template) {
|
|
306
|
+
let resources = fragment_resources.get(template);
|
|
307
|
+
|
|
308
|
+
if (resources === undefined) {
|
|
309
|
+
resources = new ShaderResourceSetDescriptor();
|
|
310
|
+
|
|
311
|
+
resources.addGroup(template.resources);
|
|
312
|
+
|
|
313
|
+
fragment_resources.set(template, resources);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
return resources;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
const depth_state = DepthStencilState.from({
|
|
320
|
+
depthWriteEnabled: true,
|
|
321
|
+
// depth through the slab from its near face: the nearest is the least
|
|
322
|
+
depthCompare: 'less',
|
|
323
|
+
format: MESH_CARD_RASTER_DEPTH_FORMAT,
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Card capture by raster ({@link MeshCardCaptureMode.Raster}): one pipeline per material template,
|
|
328
|
+
* the template's group 0 — the material's one bind group, which the G-buffer pass binds — then
|
|
329
|
+
* {@link MESH_CARDS_RASTER_GROUP}, and {@link MESH_CARDS_RASTER_SETTINGS} as immediate data.
|
|
330
|
+
*
|
|
331
|
+
* A run's draw covers every card of its card set, each into its cell of the run's region of the
|
|
332
|
+
* scratch: `rgba8unorm` √(diffuse albedo) and depth, `rgba8unorm` emissive / s_e, and a
|
|
333
|
+
* `depth32float` depth through the slab. Draw it with culling off: a card sees either side.
|
|
334
|
+
*
|
|
335
|
+
* Only a template with a surface function can be drawn.
|
|
336
|
+
*
|
|
337
|
+
* @type {TemplatePassDescriptor}
|
|
338
|
+
*/
|
|
339
|
+
export const mesh_cards_raster_pass_descriptor = new TemplatePassDescriptor("Mesh Card Capture / Raster", template => {
|
|
340
|
+
const fragment_code = ShaderDescriptor.from({
|
|
341
|
+
label: `Mesh Cards Raster / ${template.name}`,
|
|
342
|
+
resources: fragment_resources_of(template),
|
|
343
|
+
body: CodeChunk.from('', [
|
|
344
|
+
template.surface,
|
|
345
|
+
template.opacity ?? chunk_material_opacity_opaque,
|
|
346
|
+
fragment_body,
|
|
347
|
+
]),
|
|
348
|
+
}).source;
|
|
349
|
+
|
|
350
|
+
return RenderPipelineDescriptor.from({
|
|
351
|
+
label: `Mesh Card Capture / Raster / ${template.name}`,
|
|
352
|
+
layout: PipelineLayoutDescriptor.from([
|
|
353
|
+
template.resources.generateBindGroupLayoutDescriptor(),
|
|
354
|
+
MESH_CARDS_RASTER_LAYOUT,
|
|
355
|
+
], vertex_resources.immediateSize),
|
|
356
|
+
vertex: {
|
|
357
|
+
module: {
|
|
358
|
+
code: vertex_code
|
|
359
|
+
}
|
|
360
|
+
},
|
|
361
|
+
fragment: {
|
|
362
|
+
module: {
|
|
363
|
+
code: fragment_code
|
|
364
|
+
},
|
|
365
|
+
targets: MESH_CARD_RASTER_TARGET_FORMATS.map(format => ({ format })),
|
|
366
|
+
},
|
|
367
|
+
depthStencil: depth_state,
|
|
368
|
+
primitive: rasterization_primitive_state,
|
|
369
|
+
});
|
|
370
|
+
});
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Bytes of {@link MESH_CARDS_RASTER_SETTINGS} the draws hand `setImmediates`.
|
|
374
|
+
* @type {number}
|
|
375
|
+
*/
|
|
376
|
+
export const MESH_CARDS_RASTER_IMMEDIATE_SIZE = vertex_resources.immediateSize;
|
|
@@ -20,9 +20,13 @@ export const MESH_CARDS_CAPTURE_SETTINGS: WebGPUStruct;
|
|
|
20
20
|
* 3. At the opaque hit, `sample_material_data` with the material's resident row and an identity
|
|
21
21
|
* transform, the card being in local space.
|
|
22
22
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
23
|
+
* Both read the material's textures at the texel's footprint (`mesh_card_texture_level`), filtered
|
|
24
|
+
* exactly ({@link IndirectTextureFilter.Exact}): nothing averages a card texel after it is stored, so a
|
|
25
|
+
* single tap would be kept as the texel, and a tap landing on a thin feature of the texture would put
|
|
26
|
+
* it in one row of texels and not the next.
|
|
27
|
+
*
|
|
28
|
+
* The random state is seeded from the card set and the texel, which fixes every draw: the alpha's and
|
|
29
|
+
* the material's dither. A recapture of an unchanged material therefore writes the same bytes.
|
|
26
30
|
*
|
|
27
31
|
* The albedo plane holds √(albedo × (1 − metalness)), Lumen's diffuse colour as UE stores it, and
|
|
28
32
|
* the hit's depth through the slab mapped onto [1/255, 1]. The emissive plane holds emissive / s_e.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shader_mesh_cards_capture.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_capture.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shader_mesh_cards_capture.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_capture.js"],"names":[],"mappings":"AA8BA;;;GAGG;AACH,4CAFU,MAAM,CAE+B;AAE/C;;GAEG;AACH,0CAFU,YAAY,CASS;AAqB/B;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wCAFU,aAAa,CAgNsE;6BArRhE,sCAAsC;8BAJrC,kCAAkC"}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { INDIRECT_MATERIAL_ARRAY_TYPE } from "../../../material/resident/INDIRECT_MATERIAL_ARRAY_TYPE.js";
|
|
2
|
+
import {
|
|
3
|
+
RESIDENT_MATERIAL_TEXTURE_LEVEL_COUNT,
|
|
4
|
+
RESIDENT_MATERIAL_TEXTURE_RESOLUTION
|
|
5
|
+
} from "../../../material/resident/RESIDENT_MATERIAL_TEXTURE_LAYOUT.js";
|
|
2
6
|
import { chunk_sample_material_alpha, chunk_sample_material_data } from "../../../path_tracer/shader/chunk_sample_material_data.js";
|
|
7
|
+
import { INDIRECT_TEXTURE_FILTER } from "../../../path_tracer/shader/INDIRECT_TEXTURE_FILTER.js";
|
|
8
|
+
import { IndirectTextureFilter } from "../../../path_tracer/shader/IndirectTextureFilter.js";
|
|
3
9
|
import { BVH_TRAVERSAL_STACK_SIZE } from "../../../shader/chunk/bvh/BVH_TRAVERSAL_STACK_SIZE.js";
|
|
4
10
|
import { chunk_geometry_read_triangle_vertices } from "../../../shader/chunk/geometry/format/chunk_geometry_read_triangle_vertices.js";
|
|
5
11
|
import { MAT4_IDENTITY_DEFINITION } from "../../../shader/chunk/geometry/mat4/MAT4_IDENTITY_DEFINITION.js";
|
|
@@ -8,7 +14,9 @@ import { RAY_STRUCT } from "../../../shader/chunk/geometry/ray/RAY_STRUCT.js";
|
|
|
8
14
|
import { chunk_index_to_grid2d } from "../../../shader/chunk/grid/chunk_index_to_grid2d.js";
|
|
9
15
|
import { chunk_random } from "../../../shader/chunk/random/chunk_random.js";
|
|
10
16
|
import { chunk_random_initialize } from "../../../shader/chunk/random/chunk_random_initialize.js";
|
|
17
|
+
import { TRIANGLE_VERTICES_STRUCT } from "../../../shader/chunk/geometry/triangle/TRIANGLE_VERTICES_STRUCT.js";
|
|
11
18
|
import { CodeChunk } from "../../../shader/compiler/CodeChunk.js";
|
|
19
|
+
import { ShaderSwitchSet } from "../../../shader/compiler/ShaderSwitchSet.js";
|
|
12
20
|
import { ComputeShader } from "../../../shader/ComputeShader.js";
|
|
13
21
|
import { ShaderResourceSetDescriptor } from "../../../shader/resource/ShaderResourceSetDescriptor.js";
|
|
14
22
|
import { u32, vec4u } from "../../../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
|
|
@@ -70,9 +78,13 @@ mesh_sdf_add_blas_resources(resources.createGroup());
|
|
|
70
78
|
* 3. At the opaque hit, `sample_material_data` with the material's resident row and an identity
|
|
71
79
|
* transform, the card being in local space.
|
|
72
80
|
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
81
|
+
* Both read the material's textures at the texel's footprint (`mesh_card_texture_level`), filtered
|
|
82
|
+
* exactly ({@link IndirectTextureFilter.Exact}): nothing averages a card texel after it is stored, so a
|
|
83
|
+
* single tap would be kept as the texel, and a tap landing on a thin feature of the texture would put
|
|
84
|
+
* it in one row of texels and not the next.
|
|
85
|
+
*
|
|
86
|
+
* The random state is seeded from the card set and the texel, which fixes every draw: the alpha's and
|
|
87
|
+
* the material's dither. A recapture of an unchanged material therefore writes the same bytes.
|
|
76
88
|
*
|
|
77
89
|
* The albedo plane holds √(albedo × (1 − metalness)), Lumen's diffuse colour as UE stores it, and
|
|
78
90
|
* the hit's depth through the slab mapped onto [1/255, 1]. The emissive plane holds emissive / s_e.
|
|
@@ -86,6 +98,47 @@ export const shader_mesh_cards_capture = ComputeShader.from({
|
|
|
86
98
|
body: CodeChunk.from(
|
|
87
99
|
//language=WGSL
|
|
88
100
|
`
|
|
101
|
+
// The texture level a card texel reads a triangle's material at: its footprint, the card's texel steps
|
|
102
|
+
// carried along the card's direction onto the triangle's plane and through the triangle's uv per
|
|
103
|
+
// position, in texels of a slot's level 0. For a step s, direction d and normal n that is
|
|
104
|
+
// s - d (n·s)/(n·d) on the plane, taken here times n·d, so a triangle turning edge-on, whose footprint
|
|
105
|
+
// grows without bound, reaches the last level with nothing divided by 0, as a raster's would.
|
|
106
|
+
fn mesh_card_texture_level(
|
|
107
|
+
triangle: ${TRIANGLE_VERTICES_STRUCT.wgsl_ref},
|
|
108
|
+
along: vec3<f32>,
|
|
109
|
+
step_u: vec3<f32>,
|
|
110
|
+
step_v: vec3<f32>,
|
|
111
|
+
) -> f32 {
|
|
112
|
+
let edge_1 = triangle.b.position - triangle.a.position;
|
|
113
|
+
let edge_2 = triangle.c.position - triangle.a.position;
|
|
114
|
+
let normal = cross(edge_1, edge_2);
|
|
115
|
+
|
|
116
|
+
// an offset in the plane is a·edge_1 + b·edge_2, a and b its dots with these
|
|
117
|
+
let dual_1 = cross(edge_2, normal) / dot(normal, normal);
|
|
118
|
+
let dual_2 = cross(normal, edge_1) / dot(normal, normal);
|
|
119
|
+
|
|
120
|
+
let uv_1 = triangle.b.uv - triangle.a.uv;
|
|
121
|
+
let uv_2 = triangle.c.uv - triangle.a.uv;
|
|
122
|
+
|
|
123
|
+
let facing = dot(normal, along);
|
|
124
|
+
|
|
125
|
+
let on_plane_u = facing * step_u - along * dot(normal, step_u);
|
|
126
|
+
let on_plane_v = facing * step_v - along * dot(normal, step_v);
|
|
127
|
+
|
|
128
|
+
let uv_step_u = dot(on_plane_u, dual_1) * uv_1 + dot(on_plane_u, dual_2) * uv_2;
|
|
129
|
+
let uv_step_v = dot(on_plane_v, dual_1) * uv_1 + dot(on_plane_v, dual_2) * uv_2;
|
|
130
|
+
|
|
131
|
+
let span = ${RESIDENT_MATERIAL_TEXTURE_RESOLUTION}.0 * max(length(uv_step_u), length(uv_step_v));
|
|
132
|
+
let reach = abs(facing);
|
|
133
|
+
|
|
134
|
+
// a footprint of a slot or more, edge-on included, is the last level
|
|
135
|
+
return select(
|
|
136
|
+
${RESIDENT_MATERIAL_TEXTURE_LEVEL_COUNT - 1}.0,
|
|
137
|
+
log2(max(span, reach) / reach),
|
|
138
|
+
span < ${RESIDENT_MATERIAL_TEXTURE_RESOLUTION}.0 * reach
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
|
|
89
142
|
@compute @workgroup_size(${MESH_SDF_BAKE_WORKGROUP_SIZE})
|
|
90
143
|
fn main(
|
|
91
144
|
@builtin(workgroup_id) workgroup_id: vec3<u32>,
|
|
@@ -148,6 +201,13 @@ fn main(
|
|
|
148
201
|
|
|
149
202
|
along[axes.x] = select(-1.0, 1.0, toward_plus);
|
|
150
203
|
|
|
204
|
+
// the card's texel steps, a voxel each
|
|
205
|
+
var step_u = vec3<f32>(0.0);
|
|
206
|
+
var step_v = vec3<f32>(0.0);
|
|
207
|
+
|
|
208
|
+
step_u[axes.y] = header.voxel;
|
|
209
|
+
step_v[axes.z] = header.voxel;
|
|
210
|
+
|
|
151
211
|
let depth = f32(far - near) * brick_span;
|
|
152
212
|
|
|
153
213
|
random_initialize(vec3<u32>(page, texel), vec3<u32>(run.y, geometry, 0u));
|
|
@@ -167,6 +227,7 @@ fn main(
|
|
|
167
227
|
var hit_t = 0.0;
|
|
168
228
|
var lambda = vec3<f32>(0.0);
|
|
169
229
|
var triangle_index = 0u;
|
|
230
|
+
var texture_level = 0.0;
|
|
170
231
|
|
|
171
232
|
for (var step = 0u; step <= ${MESH_CARD_ALPHA_CONTINUATIONS}u; step++) {
|
|
172
233
|
let hit = ray_query_blas_nearest(ray, geometry, &stack, 0u);
|
|
@@ -177,13 +238,15 @@ fn main(
|
|
|
177
238
|
|
|
178
239
|
let triangle = geometry_read_triangle_vertices(geometries[geometry], hit.triangle);
|
|
179
240
|
let at = vec3<f32>(1.0 - hit.barycentrics.x - hit.barycentrics.y, hit.barycentrics.x, hit.barycentrics.y);
|
|
180
|
-
let
|
|
241
|
+
let level = mesh_card_texture_level(triangle, along, step_u, step_v);
|
|
242
|
+
let surface = sample_material_alpha(material, triangle, at, MAT4_IDENTITY, ray.direction, level);
|
|
181
243
|
|
|
182
244
|
if (random() < surface.opacity) {
|
|
183
245
|
found = true;
|
|
184
246
|
hit_t = travelled + hit.t;
|
|
185
247
|
lambda = at;
|
|
186
248
|
triangle_index = hit.triangle;
|
|
249
|
+
texture_level = level;
|
|
187
250
|
break;
|
|
188
251
|
}
|
|
189
252
|
|
|
@@ -204,7 +267,7 @@ fn main(
|
|
|
204
267
|
|
|
205
268
|
if (found) {
|
|
206
269
|
let triangle = geometry_read_triangle_vertices(geometries[geometry], triangle_index);
|
|
207
|
-
let data = sample_material_data(ray, material, triangle, lambda, MAT4_IDENTITY);
|
|
270
|
+
let data = sample_material_data(ray, material, triangle, lambda, MAT4_IDENTITY, texture_level);
|
|
208
271
|
|
|
209
272
|
let diffuse = data.albedo * (1.0 - data.metalness);
|
|
210
273
|
|
|
@@ -224,6 +287,7 @@ fn main(
|
|
|
224
287
|
`, [
|
|
225
288
|
MAT4_IDENTITY_DEFINITION,
|
|
226
289
|
RAY_STRUCT.declaration_chunk,
|
|
290
|
+
TRIANGLE_VERTICES_STRUCT.declaration_chunk,
|
|
227
291
|
MESH_CARD_SET_STRUCT.declaration_chunk,
|
|
228
292
|
chunk_mesh_cards,
|
|
229
293
|
chunk_index_to_grid2d,
|
|
@@ -234,4 +298,4 @@ fn main(
|
|
|
234
298
|
chunk_sample_material_alpha,
|
|
235
299
|
chunk_sample_material_data,
|
|
236
300
|
]),
|
|
237
|
-
});
|
|
301
|
+
}).variant(ShaderSwitchSet.EMPTY.with(INDIRECT_TEXTURE_FILTER, IndirectTextureFilter.Exact));
|