@woosh/meep-engine 3.74.0 → 3.76.0
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/CHANGELOG.md +20 -19
- package/package.json +1 -1
- package/src/core/geom/2d/hilbert/v2_hilbert_encode.d.ts +11 -0
- package/src/core/geom/2d/hilbert/v2_hilbert_encode.d.ts.map +1 -0
- package/src/core/geom/2d/hilbert/v2_hilbert_encode.js +46 -0
- package/src/engine/asset/GameAssetType.d.ts +1 -0
- package/src/engine/asset/GameAssetType.js +5 -1
- package/src/engine/asset/loaders/GroomAssetLoader.d.ts +33 -0
- package/src/engine/asset/loaders/GroomAssetLoader.d.ts.map +1 -0
- package/src/engine/asset/loaders/GroomAssetLoader.js +99 -0
- package/src/engine/graphics/ecs/hair/Hair.d.ts +47 -0
- package/src/engine/graphics/ecs/hair/Hair.d.ts.map +1 -0
- package/src/engine/graphics/ecs/hair/Hair.js +61 -0
- package/src/engine/graphics/hair/Groom.d.ts +130 -0
- package/src/engine/graphics/hair/Groom.d.ts.map +1 -0
- package/src/engine/graphics/hair/Groom.js +193 -0
- package/src/engine/graphics/hair/GroomSerializationAdapter.d.ts +24 -0
- package/src/engine/graphics/hair/GroomSerializationAdapter.d.ts.map +1 -0
- package/src/engine/graphics/hair/GroomSerializationAdapter.js +77 -0
- package/src/engine/graphics/hair/groom_build_group.d.ts +85 -0
- package/src/engine/graphics/hair/groom_build_group.d.ts.map +1 -0
- package/src/engine/graphics/hair/groom_build_group.js +487 -0
- package/src/engine/graphics/hair/groom_generate_scalp.d.ts +29 -0
- package/src/engine/graphics/hair/groom_generate_scalp.d.ts.map +1 -0
- package/src/engine/graphics/hair/groom_generate_scalp.js +184 -0
- package/src/engine/graphics/hair/groom_rank_order.d.ts +15 -0
- package/src/engine/graphics/hair/groom_rank_order.d.ts.map +1 -0
- package/src/engine/graphics/hair/groom_rank_order.js +53 -0
- package/src/engine/graphics/hair/groom_root_spacing.d.ts +12 -0
- package/src/engine/graphics/hair/groom_root_spacing.d.ts.map +1 -0
- package/src/engine/graphics/hair/groom_root_spacing.js +120 -0
- package/src/engine/graphics/render/frame_graph/FrameGraph.d.ts +6 -0
- package/src/engine/graphics/render/frame_graph/FrameGraph.d.ts.map +1 -1
- package/src/engine/graphics/render/frame_graph/FrameGraph.js +9 -0
- package/src/engine/graphics3/GPUAcousticSystem.d.ts +29 -32
- package/src/engine/graphics3/GPUAcousticSystem.d.ts.map +1 -1
- package/src/engine/graphics3/GPUAcousticSystem.js +87 -162
- package/src/engine/graphics3/HairSystem.d.ts +102 -0
- package/src/engine/graphics3/HairSystem.d.ts.map +1 -0
- package/src/engine/graphics3/HairSystem.js +456 -0
- package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
- package/src/engine/sound/ecs/audio/AudioEmitterSystem.d.ts.map +1 -1
- package/src/engine/sound/ecs/audio/AudioEmitterSystem.js +35 -17
- package/src/engine/sound/ecs/audio/LiveEmitterSet.d.ts.map +1 -1
- package/src/engine/sound/ecs/audio/LiveEmitterSet.js +2 -3
- package/src/engine/sound/simulation/AcousticSimulator.d.ts +7 -0
- package/src/engine/sound/simulation/AcousticSimulator.d.ts.map +1 -1
- package/src/engine/sound/simulation/AcousticSimulator.js +27 -0
- package/src/engine/sound/simulation/README.md +121 -107
- package/src/engine/sound/sopra/README.md +8 -3
- package/src/engine/sound/sopra/definition/effect/AcousticReverbEffect.d.ts +2 -2
- package/src/engine/sound/sopra/definition/effect/AcousticReverbEffect.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/effect/AcousticReverbEffect.js +4 -3
- package/src/engine/sound/sopra/runtime/AcousticReverbConvolution.d.ts +118 -0
- package/src/engine/sound/sopra/runtime/AcousticReverbConvolution.d.ts.map +1 -0
- package/src/engine/sound/sopra/runtime/AcousticReverbConvolution.js +472 -0
- package/src/engine/sound/sopra/runtime/AcousticReverbLines.d.ts +166 -0
- package/src/engine/sound/sopra/runtime/AcousticReverbLines.d.ts.map +1 -0
- package/src/engine/sound/sopra/runtime/AcousticReverbLines.js +447 -0
- package/src/engine/sound/sopra/runtime/AcousticReverbNetwork.d.ts +69 -113
- package/src/engine/sound/sopra/runtime/AcousticReverbNetwork.d.ts.map +1 -1
- package/src/engine/sound/sopra/runtime/AcousticReverbNetwork.js +143 -491
- package/src/engine/sound/sopra/runtime/AcousticSpeakers.d.ts +102 -0
- package/src/engine/sound/sopra/runtime/AcousticSpeakers.d.ts.map +1 -0
- package/src/engine/sound/sopra/runtime/AcousticSpeakers.js +232 -0
- package/src/engine/sound/sopra/runtime/BusGraph.d.ts +17 -3
- package/src/engine/sound/sopra/runtime/BusGraph.d.ts.map +1 -1
- package/src/engine/sound/sopra/runtime/BusGraph.js +55 -5
- package/src/engine/sound/sopra/runtime/EventInstance.d.ts +8 -6
- package/src/engine/sound/sopra/runtime/EventInstance.d.ts.map +1 -1
- package/src/engine/sound/sopra/runtime/EventInstance.js +113 -105
- package/src/engine/sound/sopra/runtime/acoustic_reverb_decay.d.ts +13 -0
- package/src/engine/sound/sopra/runtime/acoustic_reverb_decay.d.ts.map +1 -0
- package/src/engine/sound/sopra/runtime/acoustic_reverb_decay.js +15 -0
- package/src/generation/grid/generation/discrete/GridTaskConnectRooms.d.ts.map +1 -1
- package/src/generation/grid/generation/discrete/GridTaskConnectRooms.js +4 -6
- package/src/shade/assets/textures/hair_scattering.bin +0 -0
- package/src/shade/device/pipeline/PipelineEnquiry.d.ts +11 -0
- package/src/shade/device/pipeline/PipelineEnquiry.d.ts.map +1 -1
- package/src/shade/device/pipeline/PipelineEnquiry.js +13 -0
- package/src/shade/playground/hair/index.html +50 -0
- package/src/shade/playground/hair/main.d.ts +2 -0
- package/src/shade/playground/hair/main.d.ts.map +1 -0
- package/src/shade/playground/hair/main.js +274 -0
- package/src/shade/playground/screen_probes/README.md +54 -0
- package/src/shade/playground/screen_probes/index.html +271 -0
- package/src/shade/playground/screen_probes/main.d.ts +8 -0
- package/src/shade/playground/screen_probes/main.d.ts.map +1 -0
- package/src/shade/playground/screen_probes/main.js +527 -0
- package/src/shade/playground/skinned_blas_refit/diff_traced_against_rasterized.d.ts.map +1 -1
- package/src/shade/playground/skinned_blas_refit/diff_traced_against_rasterized.js +4 -5
- package/src/shade/playground/skinned_blas_refit/main.d.ts.map +1 -1
- package/src/shade/playground/skinned_blas_refit/main.js +6 -12
- package/src/shade/playground/skinned_mesh_soup/main.d.ts.map +1 -1
- package/src/shade/playground/skinned_mesh_soup/main.js +1 -2
- package/src/shade/playground/vgeo_scene/README.md +12 -2
- package/src/shade/playground/vgeo_scene/main.js +1 -1
- package/src/shade/playground/volumetrics_froxel/README.md +191 -191
- package/src/shade/playground/volumetrics_froxel/measure.d.ts +3 -3
- package/src/shade/playground/volumetrics_froxel/measure.d.ts.map +1 -1
- package/src/shade/playground/volumetrics_froxel/measure.js +11 -13
- package/src/shade/playground/vsm/main.d.ts.map +1 -1
- package/src/shade/playground/vsm/main.js +5 -6
- package/src/shade/renderer/Renderer.d.ts.map +1 -1
- package/src/shade/renderer/Renderer.js +85 -16
- package/src/shade/renderer/STATIC_GRAPHICS_ENGINE_ASSETS.d.ts +6 -0
- package/src/shade/renderer/STATIC_GRAPHICS_ENGINE_ASSETS.d.ts.map +1 -1
- package/src/shade/renderer/STATIC_GRAPHICS_ENGINE_ASSETS.js +10 -0
- package/src/shade/renderer/acoustics/ACOUSTIC_LISTENER_RESOURCES.d.ts +28 -0
- package/src/shade/renderer/acoustics/ACOUSTIC_LISTENER_RESOURCES.d.ts.map +1 -0
- package/src/shade/renderer/acoustics/ACOUSTIC_LISTENER_RESOURCES.js +42 -0
- package/src/shade/renderer/acoustics/ACOUSTIC_PROBE_DATABASE_SPEC.d.ts +58 -0
- package/src/shade/renderer/acoustics/ACOUSTIC_PROBE_DATABASE_SPEC.d.ts.map +1 -0
- package/src/shade/renderer/acoustics/ACOUSTIC_PROBE_DATABASE_SPEC.js +108 -0
- package/src/shade/renderer/acoustics/GPUAcousticLattice.d.ts +1 -1
- package/src/shade/renderer/acoustics/GPUAcousticProbes.d.ts +161 -0
- package/src/shade/renderer/acoustics/GPUAcousticProbes.d.ts.map +1 -0
- package/src/shade/renderer/acoustics/GPUAcousticProbes.js +760 -0
- package/src/shade/renderer/acoustics/GPUAcoustics.d.ts +1 -1
- package/src/shade/renderer/acoustics/acoustic_listener_order.d.ts +12 -0
- package/src/shade/renderer/acoustics/acoustic_listener_order.d.ts.map +1 -0
- package/src/shade/renderer/acoustics/acoustic_listener_order.js +56 -0
- package/src/shade/renderer/acoustics/chunk_acoustic_direct.d.ts.map +1 -1
- package/src/shade/renderer/acoustics/chunk_acoustic_direct.js +5 -0
- package/src/shade/renderer/acoustics/chunk_acoustic_direct_cone.d.ts +57 -0
- package/src/shade/renderer/acoustics/chunk_acoustic_direct_cone.d.ts.map +1 -0
- package/src/shade/renderer/acoustics/chunk_acoustic_direct_cone.js +314 -0
- package/src/shade/renderer/acoustics/chunk_acoustic_finite.d.ts +15 -0
- package/src/shade/renderer/acoustics/chunk_acoustic_finite.d.ts.map +1 -0
- package/src/shade/renderer/acoustics/chunk_acoustic_finite.js +21 -0
- package/src/shade/renderer/acoustics/chunk_acoustic_gather.js +1 -1
- package/src/shade/renderer/acoustics/chunk_acoustic_lean.d.ts +27 -0
- package/src/shade/renderer/acoustics/chunk_acoustic_lean.d.ts.map +1 -0
- package/src/shade/renderer/acoustics/chunk_acoustic_lean.js +42 -0
- package/src/shade/renderer/acoustics/chunk_acoustic_listener.d.ts +80 -0
- package/src/shade/renderer/acoustics/chunk_acoustic_listener.d.ts.map +1 -0
- package/src/shade/renderer/acoustics/chunk_acoustic_listener.js +274 -0
- package/src/shade/renderer/acoustics/chunk_acoustic_partials.d.ts +2 -2
- package/src/shade/renderer/acoustics/chunk_acoustic_partials.js +2 -2
- package/src/shade/renderer/acoustics/chunk_acoustic_phonon.d.ts +7 -0
- package/src/shade/renderer/acoustics/chunk_acoustic_phonon.d.ts.map +1 -1
- package/src/shade/renderer/acoustics/chunk_acoustic_phonon.js +24 -1
- package/src/shade/renderer/acoustics/chunk_acoustic_resample.js +1 -1
- package/src/shade/renderer/acoustics/chunk_acoustic_reservoir.js +1 -1
- package/src/shade/renderer/acoustics/chunk_acoustic_through.d.ts +43 -0
- package/src/shade/renderer/acoustics/chunk_acoustic_through.d.ts.map +1 -0
- package/src/shade/renderer/acoustics/chunk_acoustic_through.js +153 -0
- package/src/shade/renderer/acoustics/chunk_acoustic_trace.d.ts +3 -1
- package/src/shade/renderer/acoustics/chunk_acoustic_trace.d.ts.map +1 -1
- package/src/shade/renderer/acoustics/chunk_acoustic_trace.js +10 -1
- package/src/shade/renderer/acoustics/shader_acoustic_combine.d.ts +7 -3
- package/src/shade/renderer/acoustics/shader_acoustic_combine.d.ts.map +1 -1
- package/src/shade/renderer/acoustics/shader_acoustic_combine.js +22 -6
- package/src/shade/renderer/acoustics/shader_acoustic_coupling.d.ts +14 -0
- package/src/shade/renderer/acoustics/shader_acoustic_coupling.d.ts.map +1 -0
- package/src/shade/renderer/acoustics/shader_acoustic_coupling.js +102 -0
- package/src/shade/renderer/acoustics/shader_acoustic_listener.d.ts +12 -0
- package/src/shade/renderer/acoustics/shader_acoustic_listener.d.ts.map +1 -0
- package/src/shade/renderer/acoustics/shader_acoustic_listener.js +80 -0
- package/src/shade/renderer/acoustics/shader_acoustic_receive.d.ts.map +1 -1
- package/src/shade/renderer/acoustics/shader_acoustic_receive.js +27 -6
- package/src/shade/renderer/acoustics/shader_acoustic_room.d.ts +11 -0
- package/src/shade/renderer/acoustics/shader_acoustic_room.d.ts.map +1 -0
- package/src/shade/renderer/acoustics/shader_acoustic_room.js +111 -0
- package/src/shade/renderer/acoustics/shader_acoustic_source.d.ts +18 -0
- package/src/shade/renderer/acoustics/shader_acoustic_source.d.ts.map +1 -0
- package/src/shade/renderer/acoustics/shader_acoustic_source.js +130 -0
- package/src/shade/renderer/deferred/chunk_read_gBuffer_material.d.ts.map +1 -1
- package/src/shade/renderer/deferred/chunk_read_gBuffer_material.js +3 -1
- package/src/shade/renderer/deferred/chunk_shade_direct_lights.d.ts +23 -0
- package/src/shade/renderer/deferred/chunk_shade_direct_lights.d.ts.map +1 -0
- package/src/shade/renderer/deferred/chunk_shade_direct_lights.js +111 -0
- package/src/shade/renderer/deferred/chunk_shade_directional_lights.d.ts +17 -6
- package/src/shade/renderer/deferred/chunk_shade_directional_lights.d.ts.map +1 -1
- package/src/shade/renderer/deferred/chunk_shade_directional_lights.js +26 -21
- package/src/shade/renderer/deferred/chunk_shade_standard_material_direct.d.ts +12 -22
- package/src/shade/renderer/deferred/chunk_shade_standard_material_direct.d.ts.map +1 -1
- package/src/shade/renderer/deferred/chunk_shade_standard_material_direct.js +20 -100
- package/src/shade/renderer/deferred/chunk_shade_standard_material_direct_restir.d.ts.map +1 -1
- package/src/shade/renderer/deferred/chunk_shade_standard_material_direct_restir.js +6 -4
- package/src/shade/renderer/deferred/chunk_standard_material_direct_light_lobe.d.ts +15 -0
- package/src/shade/renderer/deferred/chunk_standard_material_direct_light_lobe.d.ts.map +1 -0
- package/src/shade/renderer/deferred/chunk_standard_material_direct_light_lobe.js +47 -0
- package/src/shade/renderer/extension/ViewLighting.d.ts +101 -0
- package/src/shade/renderer/extension/ViewLighting.d.ts.map +1 -0
- package/src/shade/renderer/extension/ViewLighting.js +168 -0
- package/src/shade/renderer/fluid/GPUFluidCascade.d.ts +3 -3
- package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts +1 -1
- package/src/shade/renderer/fluid/forcing/GPUFluidForcing.d.ts +7 -7
- package/src/shade/renderer/fluid/pressure/GPUFluidPressureSolve.d.ts +1 -1
- package/src/shade/renderer/fluid/query/GPUFluidQueries.d.ts +1 -1
- package/src/shade/renderer/geometry/virtual/build/level/VGeoFrontier.d.ts +2 -2
- package/src/shade/renderer/geometry/virtual/build/level/VGeoFrontier.js +2 -2
- package/src/shade/renderer/geometry/virtual/build/level/VGeoLevelOptions.d.ts +5 -2
- package/src/shade/renderer/geometry/virtual/build/level/VGeoLevelOptions.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/build/level/VGeoLevelOptions.js +5 -2
- package/src/shade/renderer/geometry/virtual/build/level/vgeo_build_group_step.d.ts +9 -2
- package/src/shade/renderer/geometry/virtual/build/level/vgeo_build_group_step.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/build/level/vgeo_build_group_step.js +48 -12
- package/src/shade/renderer/geometry/virtual/format/read/VGeoContainerReader.d.ts +0 -22
- package/src/shade/renderer/geometry/virtual/format/read/VGeoContainerReader.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/format/read/VGeoContainerReader.js +0 -42
- package/src/shade/renderer/geometry/virtual/format/read/VGeoReadOptions.d.ts +2 -18
- package/src/shade/renderer/geometry/virtual/format/read/VGeoReadOptions.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/format/read/VGeoReadOptions.js +2 -19
- package/src/shade/renderer/geometry/virtual/format/read/vgeo_page_worker_serve.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/format/read/vgeo_page_worker_serve.js +0 -1
- package/src/shade/renderer/geometry/virtual/runtime/GPUVirtualGeometryRuntime.d.ts +5 -4
- package/src/shade/renderer/geometry/virtual/runtime/GPUVirtualGeometryRuntime.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/runtime/GPUVirtualGeometryRuntime.js +3 -1
- package/src/shade/renderer/geometry/virtual/runtime/VGeoFeedbackLoop.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/runtime/VGeoFeedbackLoop.js +3 -1
- package/src/shade/renderer/geometry/virtual/runtime/VGeoPageFetcher.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/runtime/VGeoPageFetcher.js +0 -1
- package/src/shade/renderer/geometry/virtual/runtime/VGeoViewCut.d.ts +60 -14
- package/src/shade/renderer/geometry/virtual/runtime/VGeoViewCut.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/runtime/VGeoViewCut.js +75 -39
- package/src/shade/renderer/global_illumination/brick4/gpu/draw/shader_brick4_indirect_lighting.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/brick4/gpu/draw/shader_brick4_indirect_lighting.js +3 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUSceneBrickClipmap.d.ts +0 -9
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUSceneBrickClipmap.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUSceneBrickClipmap.js +45 -17
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.d.ts +7 -3
- 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 +43 -7
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_indirect_lighting.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_indirect_lighting.js +3 -1
- package/src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.d.ts +15 -7
- package/src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.js +40 -9
- package/src/shade/renderer/global_illumination/screen_probe/SCREEN_PROBE.d.ts +23 -0
- package/src/shade/renderer/global_illumination/screen_probe/SCREEN_PROBE.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/screen_probe/SCREEN_PROBE.js +26 -0
- package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeDebugView.d.ts +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeDebugView.js +6 -0
- package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.d.ts +13 -1
- package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.js +23 -1
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe.js +2 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_rough_specular.d.ts +29 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_rough_specular.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_rough_specular.js +102 -0
- package/src/shade/renderer/global_illumination/screen_probe/graph_screen_probe_debug_view.d.ts +8 -1
- package/src/shade/renderer/global_illumination/screen_probe/graph_screen_probe_debug_view.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/screen_probe/graph_screen_probe_debug_view.js +27 -1
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_gather.d.ts +4 -1
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_gather.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_gather.js +4 -1
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_indirect_lighting.d.ts +11 -5
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_indirect_lighting.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_indirect_lighting.js +28 -10
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_resolve.d.ts +36 -2
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_resolve.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_resolve.js +149 -4
- package/src/shade/renderer/global_illumination/shader_resolve_indirect_lighting.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/shader_resolve_indirect_lighting.js +3 -1
- package/src/shade/renderer/hair/GPUHairSystem.d.ts +159 -0
- package/src/shade/renderer/hair/GPUHairSystem.d.ts.map +1 -0
- package/src/shade/renderer/hair/GPUHairSystem.js +1132 -0
- package/src/shade/renderer/hair/HAIR.d.ts +102 -0
- package/src/shade/renderer/hair/HAIR.d.ts.map +1 -0
- package/src/shade/renderer/hair/HAIR.js +115 -0
- package/src/shade/renderer/hair/HAIR_DATABASE_SPEC.d.ts +17 -0
- package/src/shade/renderer/hair/HAIR_DATABASE_SPEC.d.ts.map +1 -0
- package/src/shade/renderer/hair/HAIR_DATABASE_SPEC.js +71 -0
- package/src/shade/renderer/hair/HAIR_FRAME_STRUCTS.d.ts +11 -0
- package/src/shade/renderer/hair/HAIR_FRAME_STRUCTS.d.ts.map +1 -0
- package/src/shade/renderer/hair/HAIR_FRAME_STRUCTS.js +48 -0
- package/src/shade/renderer/hair/HairFrame.d.ts +41 -0
- package/src/shade/renderer/hair/HairFrame.d.ts.map +1 -0
- package/src/shade/renderer/hair/HairFrame.js +76 -0
- package/src/shade/renderer/hair/chunk_hair_bsdf.d.ts +42 -0
- package/src/shade/renderer/hair/chunk_hair_bsdf.d.ts.map +1 -0
- package/src/shade/renderer/hair/chunk_hair_bsdf.js +170 -0
- package/src/shade/renderer/hair/chunk_hair_dual_scattering.d.ts +30 -0
- package/src/shade/renderer/hair/chunk_hair_dual_scattering.d.ts.map +1 -0
- package/src/shade/renderer/hair/chunk_hair_dual_scattering.js +131 -0
- package/src/shade/renderer/hair/chunk_hair_pixel.d.ts +32 -0
- package/src/shade/renderer/hair/chunk_hair_pixel.d.ts.map +1 -0
- package/src/shade/renderer/hair/chunk_hair_pixel.js +116 -0
- package/src/shade/renderer/hair/chunk_hair_strand.d.ts +40 -0
- package/src/shade/renderer/hair/chunk_hair_strand.d.ts.map +1 -0
- package/src/shade/renderer/hair/chunk_hair_strand.js +85 -0
- package/src/shade/renderer/hair/chunk_hair_volume.d.ts +31 -0
- package/src/shade/renderer/hair/chunk_hair_volume.d.ts.map +1 -0
- package/src/shade/renderer/hair/chunk_hair_volume.js +106 -0
- package/src/shade/renderer/hair/hair_id_draw.d.ts +24 -0
- package/src/shade/renderer/hair/hair_id_draw.d.ts.map +1 -0
- package/src/shade/renderer/hair/hair_id_draw.js +135 -0
- package/src/shade/renderer/hair/hair_lighting.d.ts +53 -0
- package/src/shade/renderer/hair/hair_lighting.d.ts.map +1 -0
- package/src/shade/renderer/hair/hair_lighting.js +270 -0
- package/src/shade/renderer/hair/hair_scattering_lut.d.ts +75 -0
- package/src/shade/renderer/hair/hair_scattering_lut.d.ts.map +1 -0
- package/src/shade/renderer/hair/hair_scattering_lut.js +271 -0
- package/src/shade/renderer/hair/hair_stamp.d.ts +33 -0
- package/src/shade/renderer/hair/hair_stamp.d.ts.map +1 -0
- package/src/shade/renderer/hair/hair_stamp.js +175 -0
- package/src/shade/renderer/hair/shader_hair_classes.d.ts +21 -0
- package/src/shade/renderer/hair/shader_hair_classes.d.ts.map +1 -0
- package/src/shade/renderer/hair/shader_hair_classes.js +86 -0
- package/src/shade/renderer/hair/shader_hair_cull.d.ts +31 -0
- package/src/shade/renderer/hair/shader_hair_cull.d.ts.map +1 -0
- package/src/shade/renderer/hair/shader_hair_cull.js +194 -0
- package/src/shade/renderer/hair/shader_hair_lod.d.ts +33 -0
- package/src/shade/renderer/hair/shader_hair_lod.d.ts.map +1 -0
- package/src/shade/renderer/hair/shader_hair_lod.js +268 -0
- package/src/shade/renderer/hair/shader_hair_volume.d.ts +28 -0
- package/src/shade/renderer/hair/shader_hair_volume.d.ts.map +1 -0
- package/src/shade/renderer/hair/shader_hair_volume.js +167 -0
- package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
- package/src/shade/renderer/loader/usd/usd_build_scene.d.ts +31 -0
- package/src/shade/renderer/loader/usd/usd_build_scene.d.ts.map +1 -1
- package/src/shade/renderer/loader/usd/usd_build_scene.js +36 -21
- package/src/shade/renderer/loader/usd/usd_groom_extension.d.ts +60 -0
- package/src/shade/renderer/loader/usd/usd_groom_extension.d.ts.map +1 -0
- package/src/shade/renderer/loader/usd/usd_groom_extension.js +417 -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 +4 -1
- package/src/shade/renderer/path_tracer/shader/chunk_shading_closure_from_material_data.d.ts.map +1 -1
- package/src/shade/renderer/path_tracer/shader/chunk_shading_closure_from_material_data.js +3 -1
- package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
- package/src/shade/renderer/postprocess/ssr/SSR.d.ts +4 -1
- package/src/shade/renderer/postprocess/ssr/SSR.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/ssr/SSR.js +9 -0
- package/src/shade/renderer/postprocess/ssr/resolve/chunk_ssr_sample_radiance.d.ts +16 -1
- package/src/shade/renderer/postprocess/ssr/resolve/chunk_ssr_sample_radiance.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/ssr/resolve/chunk_ssr_sample_radiance.js +47 -3
- package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader.js +5 -3
- package/src/shade/renderer/postprocess/ssr/ssr_combine_shader.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/ssr/ssr_combine_shader.js +6 -5
- package/src/shade/renderer/rasterize/forward/chunk_forward_shade_standard_fragment.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/forward/chunk_forward_shade_standard_fragment.js +5 -2
- package/src/shade/renderer/rasterize/native/avboit/avboit_draw_fragment_body.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/native/avboit/avboit_draw_fragment_body.js +5 -0
- package/src/shade/renderer/rasterize/native/avboit/shader_avboit_splat.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/native/avboit/shader_avboit_splat.js +4 -1
- package/src/shade/renderer/rasterize/native/oit/oit_resolve_fragment_body.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/native/oit/oit_resolve_fragment_body.js +5 -1
- package/src/shade/renderer/rasterize/native/oit/shader_oit_generate_moments.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/native/oit/shader_oit_generate_moments.js +7 -4
- package/src/shade/renderer/shader/chunk/brdf/chunk_shadowed_F90.d.ts +13 -8
- package/src/shade/renderer/shader/chunk/brdf/chunk_shadowed_F90.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/brdf/chunk_shadowed_F90.js +18 -14
- package/src/shade/renderer/shader/chunk/light/chunk_compute_multiscattering_specular.d.ts +3 -2
- package/src/shade/renderer/shader/chunk/light/chunk_compute_multiscattering_specular.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/light/chunk_compute_multiscattering_specular.js +12 -4
- package/src/shade/renderer/shader/chunk/material/MATERIAL_SHADING_INFO_STRUCT.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/material/MATERIAL_SHADING_INFO_STRUCT.js +1 -0
- package/src/shade/renderer/shader/chunk/material/chunk_compute_indirect_specular.js +1 -1
- package/src/shade/renderer/shader/chunk/material/chunk_metalness_to_specular_F90.d.ts +16 -0
- package/src/shade/renderer/shader/chunk/material/chunk_metalness_to_specular_F90.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/material/chunk_metalness_to_specular_F90.js +25 -0
- package/src/shade/renderer/shader/chunk/material/chunk_re_direct_multiscatter.js +2 -2
- package/src/shade/renderer/shader/compiler/ShaderSwitch.d.ts +1 -1
- package/src/shade/renderer/shader/compiler/ShaderSwitchSet.d.ts +1 -1
- package/src/shade/renderer/shader/resource/ShaderResourceDescriptor.d.ts +1 -1
- package/src/shade/renderer/shadow/map/shader/chunk_shadowmap_sample_point2.d.ts +2 -2
- package/src/shade/renderer/shadow/map/shader/chunk_shadowmap_sample_point2.js +2 -2
- package/src/shade/renderer/water/query/GPUWaterQueries.d.ts +1 -1
|
@@ -39,7 +39,7 @@ export class GPUAcoustics {
|
|
|
39
39
|
* @param {*} resources
|
|
40
40
|
* @param {{encoder: import("../../device/ShadeGPUCommandContext.js").ShadeGPUCommandContext}} context
|
|
41
41
|
*/
|
|
42
|
-
static "__#
|
|
42
|
+
static "__#604@#execute"(pass: object, resources: any, context: {
|
|
43
43
|
encoder: import("../../device/ShadeGPUCommandContext.js").ShadeGPUCommandContext;
|
|
44
44
|
}): void;
|
|
45
45
|
/**
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The order the listener's rays are traced in: lane `k` traces Fibonacci point `order[k]` of `n`
|
|
3
|
+
* (`sphere_fibonacci_point`). Consecutive Fibonacci points stand a golden angle apart, so a subgroup of consecutive
|
|
4
|
+
* indices would send its rays all round the sphere; sorted along a 2-D Hilbert curve over their octahedral map, each run
|
|
5
|
+
* of consecutive lanes looks into one patch of it, and its rays, their hits and the hits' traces to a source keep
|
|
6
|
+
* together. Every point once.
|
|
7
|
+
*
|
|
8
|
+
* @param {number} n points of the Fibonacci sphere
|
|
9
|
+
* @returns {Uint32Array} a permutation of `0 … n − 1`
|
|
10
|
+
*/
|
|
11
|
+
export function acoustic_listener_order(n: number): Uint32Array;
|
|
12
|
+
//# sourceMappingURL=acoustic_listener_order.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acoustic_listener_order.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/acoustics/acoustic_listener_order.js"],"names":[],"mappings":"AAaA;;;;;;;;;GASG;AACH,2CAHW,MAAM,GACJ,WAAW,CAkCvB"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { assert } from "../../../core/assert.js";
|
|
2
|
+
import { v2_hilbert_encode } from "../../../core/geom/2d/hilbert/v2_hilbert_encode.js";
|
|
3
|
+
import { octahedral_direction_to_uv } from "../../../core/geom/3d/octahedra/octahedral_direction_to_uv.js";
|
|
4
|
+
|
|
5
|
+
const PHI = Math.sqrt(5) * 0.5 + 0.5;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Bits per axis of the octahedral grid the directions are sorted on: a grid of 4,096 cells over the square, finer than
|
|
9
|
+
* the rays, so ties are rare. Chosen.
|
|
10
|
+
* @type {number}
|
|
11
|
+
*/
|
|
12
|
+
const ORDER_BITS = 6;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The order the listener's rays are traced in: lane `k` traces Fibonacci point `order[k]` of `n`
|
|
16
|
+
* (`sphere_fibonacci_point`). Consecutive Fibonacci points stand a golden angle apart, so a subgroup of consecutive
|
|
17
|
+
* indices would send its rays all round the sphere; sorted along a 2-D Hilbert curve over their octahedral map, each run
|
|
18
|
+
* of consecutive lanes looks into one patch of it, and its rays, their hits and the hits' traces to a source keep
|
|
19
|
+
* together. Every point once.
|
|
20
|
+
*
|
|
21
|
+
* @param {number} n points of the Fibonacci sphere
|
|
22
|
+
* @returns {Uint32Array} a permutation of `0 … n − 1`
|
|
23
|
+
*/
|
|
24
|
+
export function acoustic_listener_order(n) {
|
|
25
|
+
assert.isNonNegativeInteger(n, 'n');
|
|
26
|
+
|
|
27
|
+
const keys = new Float64Array(n);
|
|
28
|
+
const order = new Uint32Array(n);
|
|
29
|
+
const direction = [0, 0, 0];
|
|
30
|
+
const uv = [0, 0];
|
|
31
|
+
const cells = 1 << ORDER_BITS;
|
|
32
|
+
|
|
33
|
+
for (let i = 0; i < n; i++) {
|
|
34
|
+
const phi = 2 * Math.PI * ((i * (PHI - 1)) % 1);
|
|
35
|
+
const z = 1 - (2 * i + 1) / n;
|
|
36
|
+
const s = Math.sqrt(Math.max(0, 1 - z * z));
|
|
37
|
+
|
|
38
|
+
direction[0] = Math.cos(phi) * s;
|
|
39
|
+
direction[1] = Math.sin(phi) * s;
|
|
40
|
+
direction[2] = z;
|
|
41
|
+
|
|
42
|
+
octahedral_direction_to_uv(uv, 0, direction, 0);
|
|
43
|
+
|
|
44
|
+
keys[i] = v2_hilbert_encode(
|
|
45
|
+
Math.min(cells - 1, Math.floor(uv[0] * cells)),
|
|
46
|
+
Math.min(cells - 1, Math.floor(uv[1] * cells)),
|
|
47
|
+
ORDER_BITS
|
|
48
|
+
);
|
|
49
|
+
order[i] = i;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// ties keep the Fibonacci order
|
|
53
|
+
order.sort((a, b) => keys[a] - keys[b] || a - b);
|
|
54
|
+
|
|
55
|
+
return order;
|
|
56
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chunk_acoustic_direct.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/acoustics/chunk_acoustic_direct.js"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;GAeG;AACH,2CAFU,SAAS,CAoBhB;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AACH,oCAFU,SAAS,
|
|
1
|
+
{"version":3,"file":"chunk_acoustic_direct.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/acoustics/chunk_acoustic_direct.js"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;GAeG;AACH,2CAFU,SAAS,CAoBhB;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AACH,oCAFU,SAAS,CAqEZ;0BA9HmB,iCAAiC"}
|
|
@@ -106,6 +106,11 @@ fn acoustic_direct_ray(origin: vec3<f32>, aim: vec3<f32>, fallback: vec4<u32>, c
|
|
|
106
106
|
|
|
107
107
|
steps -= exit.steps;
|
|
108
108
|
|
|
109
|
+
if (exit.kind == BRICK_TRACE_MISS && exit.unknown) {
|
|
110
|
+
// out of the wall into space not built yet: not known
|
|
111
|
+
return vec4<f32>(0.0);
|
|
112
|
+
}
|
|
113
|
+
|
|
109
114
|
if (exit.kind == BRICK_TRACE_MISS) {
|
|
110
115
|
// still inside the wall where the source is
|
|
111
116
|
return vec4<f32>(energy, 1.0);
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cells the cone over a source's disk is kept in, each the rays of the cone through a cell of the disk, a lane each:
|
|
3
|
+
* enough that the cells alone read a straight edge across the disk within 0.025 of the exact share, and that the edge
|
|
4
|
+
* moving by a hundredth of the radius moves the share by under 0.01. Chosen.
|
|
5
|
+
* @type {number}
|
|
6
|
+
*/
|
|
7
|
+
export const ACOUSTIC_CONE_CELLS: number;
|
|
8
|
+
/**
|
|
9
|
+
* The direct path as a cone from the listener over the source's disk, one cell of it: the share of the cell each
|
|
10
|
+
* occluder leaves open, and what the walls let through of the rest. The cells' mean is the source's direct energy.
|
|
11
|
+
*
|
|
12
|
+
* ```wgsl
|
|
13
|
+
* fn acoustic_cone_visible(x: f32) -> f32
|
|
14
|
+
* fn acoustic_direct_cone_cell(listener: vec3<f32>, source: vec3<f32>, radius: f32, cell: u32, fallback: vec4<u32>, cascade_count: u32, atlas_shift: u32) -> vec4<f32>
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* The disk of `radius` about `source`, square to the line, as the listener sees it, is kept as
|
|
18
|
+
* {@link ACOUSTIC_CONE_CELLS} cells even by area (a Vogel spiral, in the frame the direct target uses), each a disk of
|
|
19
|
+
* radius `radius/√N`. Cell `cell` is the cone from the listener over its own disk: a ray to its centre, `t` along which
|
|
20
|
+
* it is `w = (radius/√N)·t/D` across.
|
|
21
|
+
*
|
|
22
|
+
* Where the field reads `d` along the ray, with its normal at `θ` to the ray, the surface's plane cuts the cell's
|
|
23
|
+
* cross-section `d / sin θ` off its centre, and leaves open the share on its near side, `1 − (acos x − x√(1 − x²))/π`
|
|
24
|
+
* at `x = d / (w sin θ)` held to [−1, 1] (`acoustic_cone_visible`): the share moves smoothly as an edge crosses the
|
|
25
|
+
* disk, and a face square to the ray hides the whole cell once the ray is in it. The field's own distance decides,
|
|
26
|
+
* not the tracer's half-voxel hit, so an edge stands where the field has it. An occluder is a stretch of the ray where
|
|
27
|
+
* its cell meets something: the least share it leaves open, `v`, and the transmission of the brick where the ray stood
|
|
28
|
+
* deepest in it, `T` (a cell deep inside a solid holds no record, so the deepest brick; the default only for a solid
|
|
29
|
+
* the ray meets nothing else of), let `v + (1 − v)·T` through.
|
|
30
|
+
*
|
|
31
|
+
* A cell is read from both ends, so its cost does not grow with the walls between (`acoustic_cone_leg`): a leg from the
|
|
32
|
+
* listener passes every occluder it can see past, and stops where its cell stands wholly inside a wall; a leg from the
|
|
33
|
+
* disk back toward it does the same from the other side, starting where the ray leaves the coarsest window if the disk
|
|
34
|
+
* lies past it (`acoustic_window_reach`; beyond, nothing is known to stand). Between the two walls the interval is read at fixed points
|
|
35
|
+
* (`acoustic_through_interval`, jittered by the cell): where nothing between is open they are one wall, taking its
|
|
36
|
+
* transmission, and each solid run past an open one is another; every occluder multiplies, however many there are.
|
|
37
|
+
*
|
|
38
|
+
* A leg marches the finest cascade whose voxel is at least its cell's width there: an empty cell of the clipmap,
|
|
39
|
+
* passed whole, holds no flat surface within about a voxel, and a brick's band is four, so nothing the cell reaches is
|
|
40
|
+
* passed unread. Where that is a coarser cascade than the finest holding the point, the finest field is read too, the
|
|
41
|
+
* deeper of the two standing (an empty cell there says only that a surface is at least its band away): a coarse cascade
|
|
42
|
+
* cannot hold the depth of a wall a couple of its voxels thick. A step is the field's distance, and never shorter than
|
|
43
|
+
* the lesser of half a voxel and the whole cone's width there; a step that only goes on in the next cascade reads
|
|
44
|
+
* nothing and closes nothing.
|
|
45
|
+
*
|
|
46
|
+
* A wall thinner than a voxel of its cascade stands in the field as a dip that never reads below zero, which the field
|
|
47
|
+
* cannot tell from a surface passed that near: the cone goes by the distance, and passes part of the sound through it,
|
|
48
|
+
* where the tracer's half-voxel hit (the reflections' paths) blocks it.
|
|
49
|
+
*
|
|
50
|
+
* The two legs share one budget of `BRICK_TRACE_STEPS` steps. A leg that spends it, or leaves through space not built
|
|
51
|
+
* yet, has no answer: `w` 0. An answer is `(energy per band, 1)`.
|
|
52
|
+
*
|
|
53
|
+
* @type {CodeChunk}
|
|
54
|
+
*/
|
|
55
|
+
export const chunk_acoustic_direct_cone: CodeChunk;
|
|
56
|
+
import { CodeChunk } from "../shader/compiler/CodeChunk.js";
|
|
57
|
+
//# sourceMappingURL=chunk_acoustic_direct_cone.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk_acoustic_direct_cone.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/acoustics/chunk_acoustic_direct_cone.js"],"names":[],"mappings":"AAcA;;;;;GAKG;AACH,kCAFU,MAAM,CAEsB;AAEtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,yCAFU,SAAS,CAsPZ;0BA/SmB,iCAAiC"}
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
import { MESH_SDF_BRICK_VOXELS } from "../geometry/sdf/MESH_SDF.js";
|
|
2
|
+
import {
|
|
3
|
+
BRICK_TRACE_HIT_VOXELS,
|
|
4
|
+
BRICK_TRACE_NUDGE,
|
|
5
|
+
BRICK_TRACE_STEPS,
|
|
6
|
+
chunk_brick_clipmap_distance,
|
|
7
|
+
chunk_brick_clipmap_trace
|
|
8
|
+
} from "../global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.js";
|
|
9
|
+
import { chunk_aabb3_distance_to_ray_v2 } from "../shader/chunk/geometry/aabb3/chunk_aabb3_distance_to_ray_v2.js";
|
|
10
|
+
import { PI_DECLARATION } from "../shader/chunk/math/PI_DECLARATION.js";
|
|
11
|
+
import { CodeChunk } from "../shader/compiler/CodeChunk.js";
|
|
12
|
+
import { chunk_acoustic_through } from "./chunk_acoustic_through.js";
|
|
13
|
+
import { chunk_brick_acoustics } from "./chunk_brick_acoustics.js";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Cells the cone over a source's disk is kept in, each the rays of the cone through a cell of the disk, a lane each:
|
|
17
|
+
* enough that the cells alone read a straight edge across the disk within 0.025 of the exact share, and that the edge
|
|
18
|
+
* moving by a hundredth of the radius moves the share by under 0.01. Chosen.
|
|
19
|
+
* @type {number}
|
|
20
|
+
*/
|
|
21
|
+
export const ACOUSTIC_CONE_CELLS = 32;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The direct path as a cone from the listener over the source's disk, one cell of it: the share of the cell each
|
|
25
|
+
* occluder leaves open, and what the walls let through of the rest. The cells' mean is the source's direct energy.
|
|
26
|
+
*
|
|
27
|
+
* ```wgsl
|
|
28
|
+
* fn acoustic_cone_visible(x: f32) -> f32
|
|
29
|
+
* fn acoustic_direct_cone_cell(listener: vec3<f32>, source: vec3<f32>, radius: f32, cell: u32, fallback: vec4<u32>, cascade_count: u32, atlas_shift: u32) -> vec4<f32>
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* The disk of `radius` about `source`, square to the line, as the listener sees it, is kept as
|
|
33
|
+
* {@link ACOUSTIC_CONE_CELLS} cells even by area (a Vogel spiral, in the frame the direct target uses), each a disk of
|
|
34
|
+
* radius `radius/√N`. Cell `cell` is the cone from the listener over its own disk: a ray to its centre, `t` along which
|
|
35
|
+
* it is `w = (radius/√N)·t/D` across.
|
|
36
|
+
*
|
|
37
|
+
* Where the field reads `d` along the ray, with its normal at `θ` to the ray, the surface's plane cuts the cell's
|
|
38
|
+
* cross-section `d / sin θ` off its centre, and leaves open the share on its near side, `1 − (acos x − x√(1 − x²))/π`
|
|
39
|
+
* at `x = d / (w sin θ)` held to [−1, 1] (`acoustic_cone_visible`): the share moves smoothly as an edge crosses the
|
|
40
|
+
* disk, and a face square to the ray hides the whole cell once the ray is in it. The field's own distance decides,
|
|
41
|
+
* not the tracer's half-voxel hit, so an edge stands where the field has it. An occluder is a stretch of the ray where
|
|
42
|
+
* its cell meets something: the least share it leaves open, `v`, and the transmission of the brick where the ray stood
|
|
43
|
+
* deepest in it, `T` (a cell deep inside a solid holds no record, so the deepest brick; the default only for a solid
|
|
44
|
+
* the ray meets nothing else of), let `v + (1 − v)·T` through.
|
|
45
|
+
*
|
|
46
|
+
* A cell is read from both ends, so its cost does not grow with the walls between (`acoustic_cone_leg`): a leg from the
|
|
47
|
+
* listener passes every occluder it can see past, and stops where its cell stands wholly inside a wall; a leg from the
|
|
48
|
+
* disk back toward it does the same from the other side, starting where the ray leaves the coarsest window if the disk
|
|
49
|
+
* lies past it (`acoustic_window_reach`; beyond, nothing is known to stand). Between the two walls the interval is read at fixed points
|
|
50
|
+
* (`acoustic_through_interval`, jittered by the cell): where nothing between is open they are one wall, taking its
|
|
51
|
+
* transmission, and each solid run past an open one is another; every occluder multiplies, however many there are.
|
|
52
|
+
*
|
|
53
|
+
* A leg marches the finest cascade whose voxel is at least its cell's width there: an empty cell of the clipmap,
|
|
54
|
+
* passed whole, holds no flat surface within about a voxel, and a brick's band is four, so nothing the cell reaches is
|
|
55
|
+
* passed unread. Where that is a coarser cascade than the finest holding the point, the finest field is read too, the
|
|
56
|
+
* deeper of the two standing (an empty cell there says only that a surface is at least its band away): a coarse cascade
|
|
57
|
+
* cannot hold the depth of a wall a couple of its voxels thick. A step is the field's distance, and never shorter than
|
|
58
|
+
* the lesser of half a voxel and the whole cone's width there; a step that only goes on in the next cascade reads
|
|
59
|
+
* nothing and closes nothing.
|
|
60
|
+
*
|
|
61
|
+
* A wall thinner than a voxel of its cascade stands in the field as a dip that never reads below zero, which the field
|
|
62
|
+
* cannot tell from a surface passed that near: the cone goes by the distance, and passes part of the sound through it,
|
|
63
|
+
* where the tracer's half-voxel hit (the reflections' paths) blocks it.
|
|
64
|
+
*
|
|
65
|
+
* The two legs share one budget of `BRICK_TRACE_STEPS` steps. A leg that spends it, or leaves through space not built
|
|
66
|
+
* yet, has no answer: `w` 0. An answer is `(energy per band, 1)`.
|
|
67
|
+
*
|
|
68
|
+
* @type {CodeChunk}
|
|
69
|
+
*/
|
|
70
|
+
export const chunk_acoustic_direct_cone = CodeChunk.from(
|
|
71
|
+
//language=WGSL
|
|
72
|
+
`
|
|
73
|
+
const ACOUSTIC_CONE_CELLS = ${ACOUSTIC_CONE_CELLS}u;
|
|
74
|
+
const ACOUSTIC_CONE_CELL_RADIUS = ${1 / Math.sqrt(ACOUSTIC_CONE_CELLS)};
|
|
75
|
+
const ACOUSTIC_CONE_GOLDEN_ANGLE = ${Math.PI * (3 - Math.sqrt(5))};
|
|
76
|
+
|
|
77
|
+
/** the leg reached its end */
|
|
78
|
+
const ACOUSTIC_CONE_LEG_CLEAR = 0u;
|
|
79
|
+
/** the leg stands where its cell is wholly inside a wall */
|
|
80
|
+
const ACOUSTIC_CONE_LEG_WALL = 1u;
|
|
81
|
+
/** the leg spent its steps, or left through space not built yet */
|
|
82
|
+
const ACOUSTIC_CONE_LEG_UNRESOLVED = 2u;
|
|
83
|
+
|
|
84
|
+
struct AcousticConeLeg {
|
|
85
|
+
kind: u32,
|
|
86
|
+
/** what the occluders the leg passed let through */
|
|
87
|
+
energy: vec3<f32>,
|
|
88
|
+
/** where it stands in a wall, along its own direction */
|
|
89
|
+
t: f32,
|
|
90
|
+
/** that wall's transmission, and whether a brick of it said so */
|
|
91
|
+
passing: vec3<f32>,
|
|
92
|
+
walled: bool,
|
|
93
|
+
steps: u32,
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
fn acoustic_cone_visible(x: f32) -> f32 {
|
|
97
|
+
let c = clamp(x, -1.0, 1.0);
|
|
98
|
+
|
|
99
|
+
return 1.0 - (acos(c) - c * sqrt(1.0 - c * c)) / PI;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** a leg of a cell from \`start\` along \`direction\` to \`t_max\`, its cell \`width + slope·t\` across; \`cone\` the whole cone's width over the distance from the listener, \`near\` that distance at the start, \`away\` its sign along the leg */
|
|
103
|
+
fn acoustic_cone_leg(start: vec3<f32>, direction: vec3<f32>, t_max: f32, width: f32, slope: f32, near: f32, away: f32, cone: f32, budget: u32, fallback: vec4<u32>, cascade_count: u32, atlas_shift: u32) -> AcousticConeLeg {
|
|
104
|
+
var leg: AcousticConeLeg;
|
|
105
|
+
|
|
106
|
+
leg.kind = ACOUSTIC_CONE_LEG_UNRESOLVED;
|
|
107
|
+
leg.energy = vec3<f32>(1.0);
|
|
108
|
+
leg.passing = vec3<f32>(1.0);
|
|
109
|
+
|
|
110
|
+
// the occluder the cell is meeting: whether there is one, its least open share, and where it stood deepest
|
|
111
|
+
var open = false;
|
|
112
|
+
var least = 1.0;
|
|
113
|
+
var deepest = 0.0;
|
|
114
|
+
|
|
115
|
+
var march: BrickClipmapMarch;
|
|
116
|
+
|
|
117
|
+
march.t = 0.0;
|
|
118
|
+
march.cascade = brick_clipmap_start(start, cascade_count);
|
|
119
|
+
|
|
120
|
+
if (march.cascade >= cascade_count) {
|
|
121
|
+
leg.kind = ACOUSTIC_CONE_LEG_CLEAR;
|
|
122
|
+
|
|
123
|
+
return leg;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
for (var step = 0u; step < budget; step++) {
|
|
127
|
+
leg.steps = step + 1u;
|
|
128
|
+
|
|
129
|
+
var stood = BRICK_MARCH_LEFT;
|
|
130
|
+
let here = max(width + slope * march.t, 0.0);
|
|
131
|
+
let before = march.t;
|
|
132
|
+
|
|
133
|
+
if (march.t <= t_max) {
|
|
134
|
+
// the finest cascade whose voxel holds the cell's width
|
|
135
|
+
while (march.cascade + 1u < cascade_count && brick_levels[march.cascade].cell_size < ${MESH_SDF_BRICK_VOXELS}.0 * here) {
|
|
136
|
+
march.cascade++;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
stood = brick_clipmap_march(start, direction, cascade_count, &march);
|
|
140
|
+
|
|
141
|
+
if (stood == BRICK_MARCH_LEFT && march.unknown) {
|
|
142
|
+
return leg;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// a step that only went on in the next cascade stands nowhere new: nothing read, nothing closed
|
|
146
|
+
if (stood == BRICK_MARCH_MOVED && !(march.t > before)) {
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
var visible = 1.0;
|
|
152
|
+
|
|
153
|
+
if (stood == BRICK_MARCH_CELL) {
|
|
154
|
+
var d = -BRICK_CLIPMAP_BAND_VOXELS * march.voxel;
|
|
155
|
+
var normal = vec3<f32>(0.0);
|
|
156
|
+
let half_voxel = ${BRICK_TRACE_HIT_VOXELS} * march.voxel;
|
|
157
|
+
|
|
158
|
+
if (march.entry != BRICK_CLIPMAP_EMPTY_INSIDE) {
|
|
159
|
+
let local = (march.position - march.cell_min) / march.voxel;
|
|
160
|
+
|
|
161
|
+
d = brick_clipmap_sample(march.entry, local, march.voxel, atlas_shift);
|
|
162
|
+
|
|
163
|
+
if (d < here + half_voxel) {
|
|
164
|
+
normal = brick_clipmap_normal(march.entry, local, atlas_shift);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
var depth = d;
|
|
169
|
+
|
|
170
|
+
// read in a coarser cascade than the finest holding the point: the finest field holds the depth of a wall
|
|
171
|
+
// the coarse one is too coarse for; an empty cell there only says the surface is at least its band away
|
|
172
|
+
if (march.cascade > brick_clipmap_start(march.position, cascade_count)) {
|
|
173
|
+
let fine = brick_clipmap_point(march.position, cascade_count, atlas_shift);
|
|
174
|
+
|
|
175
|
+
if (fine.entry != BRICK_CLIPMAP_EMPTY) {
|
|
176
|
+
depth = min(depth, fine.distance);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// the surface's plane cuts the cell's cross-section depth / sin θ off its centre, θ its normal's angle to the
|
|
181
|
+
// ray: a face square to the ray hides the whole cell once the ray is in it, however narrow the wall
|
|
182
|
+
let facing = dot(normal, direction);
|
|
183
|
+
let sine = select(1.0, sqrt(max(1.0 - facing * facing, 0.0)), dot(normal, normal) > 0.0);
|
|
184
|
+
let across = depth / max(sine, 1e-4);
|
|
185
|
+
|
|
186
|
+
visible = select(select(1.0, 0.0, across < 0.0), acoustic_cone_visible(across / here), here > 0.0);
|
|
187
|
+
|
|
188
|
+
// a cell deep inside a solid holds no record: the wall's is a brick's
|
|
189
|
+
let slot = march.entry != BRICK_CLIPMAP_EMPTY_INSIDE;
|
|
190
|
+
|
|
191
|
+
if (visible < 1.0 && (!open || (slot && (!leg.walled || depth < deepest)))) {
|
|
192
|
+
deepest = depth;
|
|
193
|
+
leg.walled = slot;
|
|
194
|
+
leg.passing = brick_acoustics_read(march.entry, fallback).transmission;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
if (visible <= 0.0 && depth < 0.0) {
|
|
198
|
+
// wholly inside a wall: the other leg and the interval read on from here
|
|
199
|
+
leg.kind = ACOUSTIC_CONE_LEG_WALL;
|
|
200
|
+
leg.t = march.t;
|
|
201
|
+
|
|
202
|
+
return leg;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
let from_listener = near + away * march.t;
|
|
206
|
+
var next = march.t + max(abs(d), max(min(0.5 * march.voxel, cone * from_listener), ${BRICK_TRACE_NUDGE} * march.voxel));
|
|
207
|
+
|
|
208
|
+
if (march.entry == BRICK_CLIPMAP_EMPTY_INSIDE) {
|
|
209
|
+
let cell_size = ${MESH_SDF_BRICK_VOXELS}.0 * march.voxel;
|
|
210
|
+
|
|
211
|
+
next = aabb3_distance_to_ray(march.cell_min, march.cell_min + cell_size, start, direction).y + ${BRICK_TRACE_NUDGE} * march.voxel;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// the last sample stands on the leg's end
|
|
215
|
+
march.t = select(next, min(next, t_max), march.t < t_max);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
if (visible < 1.0) {
|
|
219
|
+
if (!open) {
|
|
220
|
+
open = true;
|
|
221
|
+
least = 1.0;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
least = min(least, visible);
|
|
225
|
+
} else if (open) {
|
|
226
|
+
open = false;
|
|
227
|
+
leg.energy *= least + (1.0 - least) * leg.passing;
|
|
228
|
+
leg.walled = false;
|
|
229
|
+
leg.passing = vec3<f32>(1.0);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
if (stood == BRICK_MARCH_LEFT && !open) {
|
|
233
|
+
leg.kind = ACOUSTIC_CONE_LEG_CLEAR;
|
|
234
|
+
|
|
235
|
+
return leg;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
return leg;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
fn acoustic_direct_cone_cell(listener: vec3<f32>, source: vec3<f32>, radius: f32, cell: u32, fallback: vec4<u32>, cascade_count: u32, atlas_shift: u32) -> vec4<f32> {
|
|
243
|
+
let line = source - listener;
|
|
244
|
+
let length_line = length(line);
|
|
245
|
+
|
|
246
|
+
if (!(length_line > radius)) {
|
|
247
|
+
return vec4<f32>(1.0);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// the cell's centre on the disk, in the direct target's frame
|
|
251
|
+
let axis = line / length_line;
|
|
252
|
+
let up = select(vec3<f32>(0.0, 1.0, 0.0), vec3<f32>(1.0, 0.0, 0.0), abs(axis.y) > 0.999);
|
|
253
|
+
let across = normalize(cross(up, axis));
|
|
254
|
+
let along = cross(axis, across);
|
|
255
|
+
let r = radius * sqrt((f32(cell) + 0.5) / f32(ACOUSTIC_CONE_CELLS));
|
|
256
|
+
let a = f32(cell) * ACOUSTIC_CONE_GOLDEN_ANGLE;
|
|
257
|
+
let aim = source + r * (cos(a) * across + sin(a) * along);
|
|
258
|
+
|
|
259
|
+
let span = aim - listener;
|
|
260
|
+
let distance = length(span);
|
|
261
|
+
let direction = span / distance;
|
|
262
|
+
|
|
263
|
+
// the cell's width, and the whole cone's, over the distance from the listener
|
|
264
|
+
let spread = radius * ACOUSTIC_CONE_CELL_RADIUS / length_line;
|
|
265
|
+
let cone = radius / length_line;
|
|
266
|
+
|
|
267
|
+
let forward = acoustic_cone_leg(listener, direction, distance, 0.0, spread, 0.0, 1.0, cone, ${BRICK_TRACE_STEPS}u, fallback, cascade_count, atlas_shift);
|
|
268
|
+
|
|
269
|
+
if (forward.kind == ACOUSTIC_CONE_LEG_UNRESOLVED) {
|
|
270
|
+
return vec4<f32>(0.0);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
if (forward.kind == ACOUSTIC_CONE_LEG_CLEAR) {
|
|
274
|
+
return vec4<f32>(forward.energy, 1.0);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
// from where the ray leaves the coarsest window, if the disk lies past it: beyond, nothing is known to stand
|
|
278
|
+
let reach = acoustic_window_reach(listener, direction, distance, cascade_count);
|
|
279
|
+
let back = acoustic_cone_leg(listener + reach * direction, -direction, max(reach - forward.t, 0.0), spread * reach, -spread, reach, -1.0, cone, ${BRICK_TRACE_STEPS}u - min(forward.steps, ${BRICK_TRACE_STEPS}u), fallback, cascade_count, atlas_shift);
|
|
280
|
+
|
|
281
|
+
if (back.kind == ACOUSTIC_CONE_LEG_UNRESOLVED) {
|
|
282
|
+
return vec4<f32>(0.0);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
var energy = forward.energy * back.energy;
|
|
286
|
+
|
|
287
|
+
// the wall the forward leg stands in, read by a brick of it where either leg found one
|
|
288
|
+
let wall = select(select(forward.passing, back.passing, back.kind == ACOUSTIC_CONE_LEG_WALL && back.walled), forward.passing, forward.walled);
|
|
289
|
+
|
|
290
|
+
if (back.kind == ACOUSTIC_CONE_LEG_CLEAR) {
|
|
291
|
+
// nothing between the disk and the forward leg's wall but what the back leg passed
|
|
292
|
+
energy *= wall;
|
|
293
|
+
} else {
|
|
294
|
+
// both legs stand inside their walls: no shell off a face to take for open space
|
|
295
|
+
let between = acoustic_through_interval(listener, direction, forward.t, reach - back.t, fract(0.5 + f32(cell) * ${(Math.sqrt(5) - 1) / 2}), 0.0, back.passing, fallback, cascade_count, atlas_shift);
|
|
296
|
+
|
|
297
|
+
if (between.w < 0.0) {
|
|
298
|
+
return vec4<f32>(0.0);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
// nothing open between: the two legs stand in one wall
|
|
302
|
+
energy *= select(forward.passing * between.xyz, wall, between.w == 0.0);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
return vec4<f32>(energy, 1.0);
|
|
306
|
+
}
|
|
307
|
+
`, [
|
|
308
|
+
PI_DECLARATION,
|
|
309
|
+
chunk_brick_clipmap_trace,
|
|
310
|
+
chunk_brick_clipmap_distance,
|
|
311
|
+
chunk_aabb3_distance_to_ray_v2,
|
|
312
|
+
chunk_brick_acoustics,
|
|
313
|
+
chunk_acoustic_through,
|
|
314
|
+
]);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether every component is a number a sum can hold: not infinite, not NaN.
|
|
3
|
+
*
|
|
4
|
+
* ```wgsl
|
|
5
|
+
* fn acoustic_finite3(v: vec3<f32>) -> bool
|
|
6
|
+
* ```
|
|
7
|
+
*
|
|
8
|
+
* Read from the bits, an exponent of all ones: WGSL lets a compiler assume a float is finite, and a comparison with
|
|
9
|
+
* one that is not need not answer.
|
|
10
|
+
*
|
|
11
|
+
* @type {CodeChunk}
|
|
12
|
+
*/
|
|
13
|
+
export const chunk_acoustic_finite: CodeChunk;
|
|
14
|
+
import { CodeChunk } from "../shader/compiler/CodeChunk.js";
|
|
15
|
+
//# sourceMappingURL=chunk_acoustic_finite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk_acoustic_finite.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/acoustics/chunk_acoustic_finite.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,oCAFU,SAAS,CAQhB;0BApBuB,iCAAiC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { CodeChunk } from "../shader/compiler/CodeChunk.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Whether every component is a number a sum can hold: not infinite, not NaN.
|
|
5
|
+
*
|
|
6
|
+
* ```wgsl
|
|
7
|
+
* fn acoustic_finite3(v: vec3<f32>) -> bool
|
|
8
|
+
* ```
|
|
9
|
+
*
|
|
10
|
+
* Read from the bits, an exponent of all ones: WGSL lets a compiler assume a float is finite, and a comparison with
|
|
11
|
+
* one that is not need not answer.
|
|
12
|
+
*
|
|
13
|
+
* @type {CodeChunk}
|
|
14
|
+
*/
|
|
15
|
+
export const chunk_acoustic_finite = CodeChunk.from(
|
|
16
|
+
//language=WGSL
|
|
17
|
+
`
|
|
18
|
+
fn acoustic_finite3(v: vec3<f32>) -> bool {
|
|
19
|
+
return all((bitcast<vec3<u32>>(v) & vec3<u32>(0x7F800000u)) != vec3<u32>(0x7F800000u));
|
|
20
|
+
}
|
|
21
|
+
`);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The lean of a set of arrivals with what their own sampling puts in it taken out.
|
|
3
|
+
*
|
|
4
|
+
* ```wgsl
|
|
5
|
+
* fn acoustic_unbiased_lean(sum: vec3<f32>, squares: f32, total: f32) -> vec3<f32>
|
|
6
|
+
* ```
|
|
7
|
+
*
|
|
8
|
+
* `sum` is `Σ xᵢ`, each answer's energy along its arrival direction; `squares` is `Σ |xᵢ|²`, each answer's energy
|
|
9
|
+
* squared; `total` is `Σ wᵢ`, the energies. The length of `sum / total` is the share of the energy that arrives from
|
|
10
|
+
* one direction, ψ, but read from a finite set of samples it is never zero: `|Σ xᵢ|²` holds every answer's own
|
|
11
|
+
* `|xᵢ|²` beside the products of different answers, and n answers from every side alike lean about `1/√n` toward
|
|
12
|
+
* wherever their draw fell. The self terms taken out of both the lean's square and the total's, what is left is the
|
|
13
|
+
* products of different answers, whose expectation is the square of the expected lean:
|
|
14
|
+
*
|
|
15
|
+
* ```
|
|
16
|
+
* ψ² = (|Σ xᵢ|² − Σ |xᵢ|²) / ((Σ wᵢ)² − Σ wᵢ²)
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* (with `|xᵢ| = wᵢ`, the unbiased squared mean resultant length of weighted directions). The result is `sum`'s
|
|
20
|
+
* direction at length `ψ · total`, so that over `total` it is the lean; nothing where the products of different
|
|
21
|
+
* answers lean no way, or there is one answer alone to read them from.
|
|
22
|
+
*
|
|
23
|
+
* @type {CodeChunk}
|
|
24
|
+
*/
|
|
25
|
+
export const chunk_acoustic_lean: CodeChunk;
|
|
26
|
+
import { CodeChunk } from "../shader/compiler/CodeChunk.js";
|
|
27
|
+
//# sourceMappingURL=chunk_acoustic_lean.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk_acoustic_lean.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/acoustics/chunk_acoustic_lean.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,kCAFU,SAAS,CAiBhB;0BAzCuB,iCAAiC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { CodeChunk } from "../shader/compiler/CodeChunk.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The lean of a set of arrivals with what their own sampling puts in it taken out.
|
|
5
|
+
*
|
|
6
|
+
* ```wgsl
|
|
7
|
+
* fn acoustic_unbiased_lean(sum: vec3<f32>, squares: f32, total: f32) -> vec3<f32>
|
|
8
|
+
* ```
|
|
9
|
+
*
|
|
10
|
+
* `sum` is `Σ xᵢ`, each answer's energy along its arrival direction; `squares` is `Σ |xᵢ|²`, each answer's energy
|
|
11
|
+
* squared; `total` is `Σ wᵢ`, the energies. The length of `sum / total` is the share of the energy that arrives from
|
|
12
|
+
* one direction, ψ, but read from a finite set of samples it is never zero: `|Σ xᵢ|²` holds every answer's own
|
|
13
|
+
* `|xᵢ|²` beside the products of different answers, and n answers from every side alike lean about `1/√n` toward
|
|
14
|
+
* wherever their draw fell. The self terms taken out of both the lean's square and the total's, what is left is the
|
|
15
|
+
* products of different answers, whose expectation is the square of the expected lean:
|
|
16
|
+
*
|
|
17
|
+
* ```
|
|
18
|
+
* ψ² = (|Σ xᵢ|² − Σ |xᵢ|²) / ((Σ wᵢ)² − Σ wᵢ²)
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* (with `|xᵢ| = wᵢ`, the unbiased squared mean resultant length of weighted directions). The result is `sum`'s
|
|
22
|
+
* direction at length `ψ · total`, so that over `total` it is the lean; nothing where the products of different
|
|
23
|
+
* answers lean no way, or there is one answer alone to read them from.
|
|
24
|
+
*
|
|
25
|
+
* @type {CodeChunk}
|
|
26
|
+
*/
|
|
27
|
+
export const chunk_acoustic_lean = CodeChunk.from(
|
|
28
|
+
//language=WGSL
|
|
29
|
+
`
|
|
30
|
+
fn acoustic_unbiased_lean(sum: vec3<f32>, squares: f32, total: f32) -> vec3<f32> {
|
|
31
|
+
let across = dot(sum, sum) - squares;
|
|
32
|
+
let pairs = total * total - squares;
|
|
33
|
+
|
|
34
|
+
if (!(across > 0.0) || !(pairs > 0.0)) {
|
|
35
|
+
return vec3<f32>(0.0);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
let share = min(1.0, sqrt(across / pairs));
|
|
39
|
+
|
|
40
|
+
return sum * (share * total * inverseSqrt(dot(sum, sum)));
|
|
41
|
+
}
|
|
42
|
+
`);
|