@woosh/meep-engine 3.69.0 → 3.70.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 +30 -1
- package/build/bundle-worker-terrain.js +1 -1
- package/package.json +1 -1
- package/src/core/bvh8/build/BVH8Converter.d.ts +16 -0
- package/src/core/bvh8/build/BVH8Converter.d.ts.map +1 -1
- package/src/core/bvh8/build/BVH8Converter.js +64 -37
- package/src/core/bvh8/build/bvh8_assign_slots_greedy.d.ts +25 -0
- package/src/core/bvh8/build/bvh8_assign_slots_greedy.d.ts.map +1 -0
- package/src/core/bvh8/build/bvh8_assign_slots_greedy.js +68 -0
- package/src/core/bvh8/build/bvh8_from_proxy.d.ts.map +1 -1
- package/src/core/bvh8/build/bvh8_from_proxy.js +2 -33
- package/src/core/bvh8/build/bvh8_node_fit_slots.d.ts +22 -0
- package/src/core/bvh8/build/bvh8_node_fit_slots.d.ts.map +1 -0
- package/src/core/bvh8/build/bvh8_node_fit_slots.js +115 -0
- package/src/core/bvh8/bvh8_depth.d.ts +8 -0
- package/src/core/bvh8/bvh8_depth.d.ts.map +1 -0
- package/src/core/bvh8/bvh8_depth.js +39 -0
- package/src/core/math/complex/complex_fft_radix2.d.ts +19 -0
- package/src/core/math/complex/complex_fft_radix2.d.ts.map +1 -0
- package/src/core/math/complex/complex_fft_radix2.js +71 -0
- package/src/engine/graphics3/GPUFluidSystem.d.ts +17 -4
- package/src/engine/graphics3/GPUFluidSystem.d.ts.map +1 -1
- package/src/engine/graphics3/GPUFluidSystem.js +113 -16
- package/src/engine/physics/cloth/playground/wind_main.js +7 -6
- package/src/engine/physics/cloth/wind/AbstractClothWind.d.ts +2 -2
- package/src/engine/physics/cloth/wind/AbstractClothWind.js +2 -2
- package/src/engine/physics/cloth/wind/ClothFluidWind.d.ts +3 -3
- package/src/engine/physics/cloth/wind/ClothFluidWind.d.ts.map +1 -1
- package/src/engine/physics/cloth/wind/ClothFluidWind.js +7 -9
- package/src/engine/physics/cloth/wind/ClothGPUFluidWind.d.ts +10 -10
- package/src/engine/physics/cloth/wind/ClothGPUFluidWind.d.ts.map +1 -1
- package/src/engine/physics/cloth/wind/ClothGPUFluidWind.js +14 -22
- package/src/engine/physics/fluid/FluidAtmosphere.d.ts +16 -2
- package/src/engine/physics/fluid/FluidAtmosphere.d.ts.map +1 -1
- package/src/engine/physics/fluid/FluidAtmosphere.js +17 -3
- package/src/engine/physics/fluid/ecs/FluidEffectorsComponentSerializationAdapter.d.ts +1 -2
- package/src/engine/physics/fluid/ecs/FluidEffectorsComponentSerializationAdapter.d.ts.map +1 -1
- package/src/engine/physics/fluid/ecs/FluidEffectorsComponentSerializationAdapter.js +1 -2
- package/src/engine/physics/fluid/ecs/FluidEffectorsSystem.d.ts +8 -5
- package/src/engine/physics/fluid/ecs/FluidEffectorsSystem.d.ts.map +1 -1
- package/src/engine/physics/fluid/ecs/FluidEffectorsSystem.js +60 -17
- package/src/engine/physics/fluid/effector/AbstractFluidEffector.d.ts +1 -1
- package/src/engine/physics/fluid/effector/AbstractFluidEffector.js +1 -1
- package/src/engine/physics/fluid/effector/GlobalFluidEffector.d.ts +33 -47
- package/src/engine/physics/fluid/effector/GlobalFluidEffector.d.ts.map +1 -1
- package/src/engine/physics/fluid/effector/GlobalFluidEffector.js +38 -176
- package/src/engine/physics/fluid/effector/GlobalFluidEffectorSerializationAdapter.d.ts +8 -11
- package/src/engine/physics/fluid/effector/GlobalFluidEffectorSerializationAdapter.d.ts.map +1 -1
- package/src/engine/physics/fluid/effector/GlobalFluidEffectorSerializationAdapter.js +13 -24
- package/src/engine/physics/fluid/effector/GlobalFluidEffectorSerializationUpgrader_0_1.d.ts +16 -0
- package/src/engine/physics/fluid/effector/GlobalFluidEffectorSerializationUpgrader_0_1.d.ts.map +1 -0
- package/src/engine/physics/fluid/effector/GlobalFluidEffectorSerializationUpgrader_0_1.js +35 -0
- package/src/engine/physics/fluid/fluid_apply_atmosphere.d.ts +1 -1
- package/src/engine/physics/fluid/fluid_apply_atmosphere.js +1 -1
- package/src/engine/physics/fluid/turbulence/FLUID_TURBULENCE_TILE.d.ts +28 -0
- package/src/engine/physics/fluid/turbulence/FLUID_TURBULENCE_TILE.d.ts.map +1 -0
- package/src/engine/physics/fluid/turbulence/FLUID_TURBULENCE_TILE.js +29 -0
- package/src/engine/physics/fluid/turbulence/fluid_atmosphere_velocity_at.d.ts +16 -0
- package/src/engine/physics/fluid/turbulence/fluid_atmosphere_velocity_at.d.ts.map +1 -0
- package/src/engine/physics/fluid/turbulence/fluid_atmosphere_velocity_at.js +49 -0
- package/src/engine/physics/fluid/turbulence/fluid_turbulence_inverse_tile_size.d.ts +11 -0
- package/src/engine/physics/fluid/turbulence/fluid_turbulence_inverse_tile_size.d.ts.map +1 -0
- package/src/engine/physics/fluid/turbulence/fluid_turbulence_inverse_tile_size.js +18 -0
- package/src/engine/physics/fluid/turbulence/fluid_turbulence_tile_data.d.ts +25 -0
- package/src/engine/physics/fluid/turbulence/fluid_turbulence_tile_data.d.ts.map +1 -0
- package/src/engine/physics/fluid/turbulence/fluid_turbulence_tile_data.js +65 -0
- package/src/engine/physics/fluid/turbulence/fluid_turbulence_tile_generate.d.ts +56 -0
- package/src/engine/physics/fluid/turbulence/fluid_turbulence_tile_generate.d.ts.map +1 -0
- package/src/engine/physics/fluid/turbulence/fluid_turbulence_tile_generate.js +313 -0
- package/src/engine/physics/fluid/turbulence/fluid_turbulence_tile_sample.d.ts +16 -0
- package/src/engine/physics/fluid/turbulence/fluid_turbulence_tile_sample.d.ts.map +1 -0
- package/src/engine/physics/fluid/turbulence/fluid_turbulence_tile_sample.js +69 -0
- package/src/generation/foliage/mesh/branch_ring_triangulate.d.ts +1 -1
- package/src/generation/foliage/mesh/branch_ring_triangulate.js +1 -1
- package/src/shade/playground/bvh_repro/README.md +8 -6
- package/src/shade/playground/bvh_repro/index.html +125 -124
- package/src/shade/playground/bvh_repro/main.js +259 -254
- package/src/shade/playground/foliage_wind/foliage_world.d.ts.map +1 -1
- package/src/shade/playground/foliage_wind/foliage_world.js +7 -4
- package/src/shade/playground/grass_surfaces/main.js +3 -2
- package/src/shade/playground/particle_ecs/bonfire_wind.d.ts +23 -13
- package/src/shade/playground/particle_ecs/bonfire_wind.d.ts.map +1 -1
- package/src/shade/playground/particle_ecs/bonfire_wind.js +30 -33
- package/src/shade/playground/skinned_blas_refit/README.md +26 -14
- package/src/shade/playground/skinned_blas_refit/shader_blas_audit_leaf_triangles.d.ts +14 -9
- package/src/shade/playground/skinned_blas_refit/shader_blas_audit_leaf_triangles.d.ts.map +1 -1
- package/src/shade/playground/skinned_blas_refit/shader_blas_audit_leaf_triangles.js +126 -127
- package/src/shade/playground/skinned_blas_refit/shader_blas_audit_points.js +95 -95
- package/src/shade/playground/skinned_blas_refit/shader_blas_audit_visibility.d.ts +9 -1
- package/src/shade/playground/skinned_blas_refit/shader_blas_audit_visibility.d.ts.map +1 -1
- package/src/shade/playground/skinned_blas_refit/shader_blas_audit_visibility.js +146 -135
- package/src/shade/playground/skinned_blas_refit/verify_clone_leaves.d.ts +6 -6
- package/src/shade/playground/skinned_blas_refit/verify_clone_leaves.d.ts.map +1 -1
- package/src/shade/playground/skinned_blas_refit/verify_clone_leaves.js +148 -134
- package/src/shade/playground/skinned_blas_refit/verify_leaf_triangles.d.ts +11 -8
- package/src/shade/playground/skinned_blas_refit/verify_leaf_triangles.d.ts.map +1 -1
- package/src/shade/playground/skinned_blas_refit/verify_leaf_triangles.js +342 -202
- package/src/shade/playground/skinned_blas_refit/verify_skinned_blas_refit.d.ts +12 -13
- package/src/shade/playground/skinned_blas_refit/verify_skinned_blas_refit.d.ts.map +1 -1
- package/src/shade/playground/skinned_blas_refit/verify_skinned_blas_refit.js +136 -116
- package/src/shade/playground/skinned_blas_refit/verify_traversal_reachability.d.ts +4 -4
- package/src/shade/playground/skinned_blas_refit/verify_traversal_reachability.d.ts.map +1 -1
- package/src/shade/playground/skinned_blas_refit/verify_traversal_reachability.js +255 -249
- package/src/shade/playground/water_surface/main.js +6 -3
- package/src/shade/renderer/animation/GPUAnimationManager.js +2 -2
- package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.d.ts.map +1 -1
- package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.js +7 -8
- package/src/shade/renderer/fluid/FLUID_FAR_FIELD_STRUCT.d.ts +111 -0
- package/src/shade/renderer/fluid/FLUID_FAR_FIELD_STRUCT.d.ts.map +1 -0
- package/src/shade/renderer/fluid/FLUID_FAR_FIELD_STRUCT.js +162 -0
- package/src/shade/renderer/fluid/GPUFluidCascade.d.ts +37 -8
- package/src/shade/renderer/fluid/GPUFluidCascade.d.ts.map +1 -1
- package/src/shade/renderer/fluid/GPUFluidCascade.js +149 -47
- package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts +10 -3
- package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts.map +1 -1
- package/src/shade/renderer/fluid/GPUFluidCascadeStack.js +69 -10
- package/src/shade/renderer/fluid/chunk_fluid_far_field.d.ts +19 -0
- package/src/shade/renderer/fluid/chunk_fluid_far_field.d.ts.map +1 -0
- package/src/shade/renderer/fluid/chunk_fluid_far_field.js +43 -0
- package/src/shade/renderer/fluid/coupling/FLUID_CASCADE_PARENT_STRUCT.d.ts +10 -9
- package/src/shade/renderer/fluid/coupling/FLUID_CASCADE_PARENT_STRUCT.d.ts.map +1 -1
- package/src/shade/renderer/fluid/coupling/FLUID_CASCADE_PARENT_STRUCT.js +14 -12
- package/src/shade/renderer/fluid/coupling/FLUID_CASCADE_RESTRICT_STRUCT.d.ts +3 -2
- package/src/shade/renderer/fluid/coupling/FLUID_CASCADE_RESTRICT_STRUCT.d.ts.map +1 -1
- package/src/shade/renderer/fluid/coupling/FLUID_CASCADE_RESTRICT_STRUCT.js +7 -5
- package/src/shade/renderer/fluid/coupling/chunk_fluid_cascade_epilogue.d.ts +17 -9
- package/src/shade/renderer/fluid/coupling/chunk_fluid_cascade_epilogue.d.ts.map +1 -1
- package/src/shade/renderer/fluid/coupling/chunk_fluid_cascade_epilogue.js +58 -18
- package/src/shade/renderer/fluid/coupling/chunk_fluid_cascade_parent.d.ts +23 -11
- package/src/shade/renderer/fluid/coupling/chunk_fluid_cascade_parent.d.ts.map +1 -1
- package/src/shade/renderer/fluid/coupling/chunk_fluid_cascade_parent.js +371 -335
- package/src/shade/renderer/fluid/coupling/shader_fluid_cascade_fill.d.ts.map +1 -1
- package/src/shade/renderer/fluid/coupling/shader_fluid_cascade_fill.js +2 -1
- package/src/shade/renderer/fluid/coupling/shader_fluid_cascade_ghosts.d.ts.map +1 -1
- package/src/shade/renderer/fluid/coupling/shader_fluid_cascade_ghosts.js +109 -108
- package/src/shade/renderer/fluid/coupling/shader_fluid_cascade_restrict.d.ts +5 -3
- package/src/shade/renderer/fluid/coupling/shader_fluid_cascade_restrict.d.ts.map +1 -1
- package/src/shade/renderer/fluid/coupling/shader_fluid_cascade_restrict.js +24 -12
- package/src/shade/renderer/fluid/mac/FLUID_MAC_STEP_STRUCT.d.ts +6 -2
- package/src/shade/renderer/fluid/mac/FLUID_MAC_STEP_STRUCT.d.ts.map +1 -1
- package/src/shade/renderer/fluid/mac/FLUID_MAC_STEP_STRUCT.js +10 -5
- package/src/shade/renderer/fluid/mac/FluidMacPasses.d.ts +20 -21
- package/src/shade/renderer/fluid/mac/FluidMacPasses.d.ts.map +1 -1
- package/src/shade/renderer/fluid/mac/FluidMacPasses.js +453 -427
- package/src/shade/renderer/fluid/mac/shader_fluid_mac_advect_correct.d.ts.map +1 -1
- package/src/shade/renderer/fluid/mac/shader_fluid_mac_advect_correct.js +2 -1
- package/src/shade/renderer/fluid/publish/FluidWindPublish.d.ts +13 -5
- package/src/shade/renderer/fluid/publish/FluidWindPublish.d.ts.map +1 -1
- package/src/shade/renderer/fluid/publish/FluidWindPublish.js +20 -10
- package/src/shade/renderer/fluid/publish/chunk_fluid_wind_publish_cell.d.ts +2 -2
- package/src/shade/renderer/fluid/publish/chunk_fluid_wind_publish_cell.js +2 -2
- package/src/shade/renderer/fluid/publish/shader_fluid_wind_publish.d.ts +5 -3
- package/src/shade/renderer/fluid/publish/shader_fluid_wind_publish.d.ts.map +1 -1
- package/src/shade/renderer/fluid/publish/shader_fluid_wind_publish.js +147 -142
- package/src/shade/renderer/fluid/query/GPUFluidQueries.js +2 -2
- package/src/shade/renderer/geometry/GPUGeometryManager.d.ts.map +1 -1
- package/src/shade/renderer/geometry/GPUGeometryManager.js +5 -7
- package/src/shade/renderer/geometry/MeshletGeometry.d.ts +4 -1
- package/src/shade/renderer/geometry/MeshletGeometry.d.ts.map +1 -1
- package/src/shade/renderer/geometry/MeshletGeometry.js +4 -1
- package/src/shade/renderer/geometry/MeshletGeometrySerializationAdapter.d.ts +20 -0
- package/src/shade/renderer/geometry/MeshletGeometrySerializationAdapter.d.ts.map +1 -1
- package/src/shade/renderer/geometry/MeshletGeometrySerializationAdapter.js +35 -3
- package/src/shade/renderer/geometry/blas_from_meshlets.d.ts +9 -3
- package/src/shade/renderer/geometry/blas_from_meshlets.d.ts.map +1 -1
- package/src/shade/renderer/geometry/blas_from_meshlets.js +16 -30
- package/src/shade/renderer/geometry/bvh/BLAS8_REFIT_TARGET_STRUCT.d.ts +14 -0
- package/src/shade/renderer/geometry/bvh/BLAS8_REFIT_TARGET_STRUCT.d.ts.map +1 -0
- package/src/shade/renderer/geometry/bvh/BLAS8_REFIT_TARGET_STRUCT.js +33 -0
- package/src/shade/renderer/geometry/bvh/GPUBLASRefitBatch.d.ts +18 -21
- package/src/shade/renderer/geometry/bvh/GPUBLASRefitBatch.d.ts.map +1 -1
- package/src/shade/renderer/geometry/bvh/GPUBLASRefitBatch.js +78 -158
- package/src/shade/renderer/geometry/bvh/GPUGeometryBVHManager.d.ts +18 -39
- package/src/shade/renderer/geometry/bvh/GPUGeometryBVHManager.d.ts.map +1 -1
- package/src/shade/renderer/geometry/bvh/GPUGeometryBVHManager.js +39 -398
- package/src/shade/renderer/geometry/bvh/GPUGeometryMeshletsBVH.d.ts +6 -7
- package/src/shade/renderer/geometry/bvh/GPUGeometryMeshletsBVH.d.ts.map +1 -1
- package/src/shade/renderer/geometry/bvh/GPUGeometryMeshletsBVH.js +5 -7
- package/src/shade/renderer/geometry/bvh/bvh8_build_for_meshlets.d.ts +36 -0
- package/src/shade/renderer/geometry/bvh/bvh8_build_for_meshlets.d.ts.map +1 -0
- package/src/shade/renderer/geometry/bvh/bvh8_build_for_meshlets.js +179 -0
- package/src/shade/renderer/geometry/bvh/meshlet_batch_to_clustered_bvh.d.ts +30 -0
- package/src/shade/renderer/geometry/bvh/meshlet_batch_to_clustered_bvh.d.ts.map +1 -0
- package/src/shade/renderer/geometry/bvh/meshlet_batch_to_clustered_bvh.js +207 -0
- package/src/shade/renderer/geometry/bvh/shader_blas8_refit_batch.d.ts +52 -0
- package/src/shade/renderer/geometry/bvh/shader_blas8_refit_batch.d.ts.map +1 -0
- package/src/shade/renderer/geometry/bvh/shader_blas8_refit_batch.js +464 -0
- package/src/shade/renderer/geometry/meshlet/MeshletBatch.d.ts +12 -0
- package/src/shade/renderer/geometry/meshlet/MeshletBatch.d.ts.map +1 -1
- package/src/shade/renderer/geometry/meshlet/MeshletBatch.js +37 -0
- package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_classify.d.ts.map +1 -1
- package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_classify.js +4 -4
- package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_evaluate.d.ts.map +1 -1
- package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_evaluate.js +2 -2
- package/src/shade/renderer/geometry/sdf/chunk_blas_query_band_sdf.d.ts.map +1 -1
- package/src/shade/renderer/geometry/sdf/chunk_blas_query_band_sdf.js +2 -2
- package/src/shade/renderer/geometry/sdf/shader_sdf_visualize.d.ts.map +1 -1
- package/src/shade/renderer/geometry/sdf/shader_sdf_visualize.js +4 -4
- package/src/shade/renderer/geometry/sdf/surface/shader_mesh_surface_trace.d.ts.map +1 -1
- package/src/shade/renderer/geometry/sdf/surface/shader_mesh_surface_trace.js +2 -2
- package/src/shade/renderer/geometry/sr_create_group_RTX.d.ts.map +1 -1
- package/src/shade/renderer/geometry/sr_create_group_RTX.js +4 -4
- package/src/shade/renderer/global_illumination/brick4/gpu/bake/brick4_bake_basic.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/brick4/gpu/bake/brick4_bake_basic.js +1 -0
- package/src/shade/renderer/global_illumination/lpv/bake/GPULightProbeVolumeRenderer.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/lpv/bake/GPULightProbeVolumeRenderer.js +1 -0
- package/src/shade/renderer/global_illumination/lpv/placement/graph_generate_probe_locations.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/lpv/placement/graph_generate_probe_locations.js +372 -376
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MESH_BRICK.d.ts +9 -10
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MESH_BRICK.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MESH_BRICK.js +10 -11
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_walk.d.ts +2 -2
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_walk.js +2 -2
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_gather.d.ts +12 -8
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_gather.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_gather.js +109 -60
- package/src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_mesh_sdf.js +2 -2
- package/src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_mesh_surfaces.js +2 -2
- package/src/shade/renderer/gpu_primitive/bvh/BVH_BUFFER_LAYOUT.d.ts +2 -2
- package/src/shade/renderer/gpu_primitive/bvh/BVH_BUFFER_LAYOUT.js +70 -70
- package/src/shade/renderer/gpu_primitive/bvh/BVH_BUILD_SETTINGS_STRUCT.d.ts +6 -7
- package/src/shade/renderer/gpu_primitive/bvh/BVH_BUILD_SETTINGS_STRUCT.d.ts.map +1 -1
- package/src/shade/renderer/gpu_primitive/bvh/BVH_BUILD_SETTINGS_STRUCT.js +6 -7
- package/src/shade/renderer/gpu_primitive/bvh/graph_bvh_build_lbvh.d.ts +3 -3
- package/src/shade/renderer/gpu_primitive/bvh/graph_bvh_build_lbvh.js +3 -3
- package/src/shade/renderer/gpu_primitive/bvh/shader_bvh_build_single_workgroup.js +1 -1
- package/src/shade/renderer/gpu_primitive/bvh/shader_bvh_emit_hierarchy.d.ts +2 -2
- package/src/shade/renderer/gpu_primitive/bvh/shader_bvh_emit_hierarchy.js +3 -3
- package/src/shade/renderer/gpu_primitive/bvh8/BVH8_TREE_BUFFER_LAYOUT.d.ts +69 -0
- package/src/shade/renderer/gpu_primitive/bvh8/BVH8_TREE_BUFFER_LAYOUT.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/bvh8/BVH8_TREE_BUFFER_LAYOUT.js +89 -0
- package/src/shade/renderer/gpu_primitive/bvh8/bvh8_encode_from_bvh2.d.ts +41 -0
- package/src/shade/renderer/gpu_primitive/bvh8/bvh8_encode_from_bvh2.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/bvh8/bvh8_encode_from_bvh2.js +348 -0
- package/src/shade/renderer/gpu_primitive/bvh8/check_bvh8_tree.d.ts +34 -0
- package/src/shade/renderer/gpu_primitive/bvh8/check_bvh8_tree.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/bvh8/check_bvh8_tree.js +291 -0
- package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_assign.d.ts +31 -0
- package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_assign.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_assign.js +175 -0
- package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_depth.d.ts +27 -0
- package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_depth.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_depth.js +48 -0
- package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_gather.d.ts +26 -0
- package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_gather.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_gather.js +118 -0
- package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_node.d.ts +22 -0
- package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_node.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_node.js +143 -0
- package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_sums.d.ts +36 -0
- package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_sums.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/bvh8/chunk_bvh8_encode_sums.js +97 -0
- package/src/shade/renderer/gpu_primitive/bvh8/graph_bvh8_encode_from_bvh2.d.ts +49 -0
- package/src/shade/renderer/gpu_primitive/bvh8/graph_bvh8_encode_from_bvh2.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/bvh8/graph_bvh8_encode_from_bvh2.js +265 -0
- package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_assign.d.ts +37 -0
- package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_assign.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_assign.js +109 -0
- package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_count.d.ts +15 -0
- package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_count.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_count.js +85 -0
- package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_count_single_workgroup.d.ts +26 -0
- package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_count_single_workgroup.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_count_single_workgroup.js +200 -0
- package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_parents.d.ts +19 -0
- package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_parents.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_parents.js +81 -0
- package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_write.d.ts +14 -0
- package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_write.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/bvh8/shader_bvh8_encode_write.js +101 -0
- package/src/shade/renderer/gpu_primitive/bvh8/verify_gpu_bvh8_encode.d.ts +19 -0
- package/src/shade/renderer/gpu_primitive/bvh8/verify_gpu_bvh8_encode.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/bvh8/verify_gpu_bvh8_encode.js +361 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_bake.d.ts.map +1 -1
- package/src/shade/renderer/grass/surface/shader_grass_surface_bake.js +5 -6
- package/src/shade/renderer/lightmap/GPULightMap.d.ts.map +1 -1
- package/src/shade/renderer/lightmap/GPULightMap.js +1 -0
- package/src/shade/renderer/path_tracer/accumulating/AccumulatingPathTracer.d.ts.map +1 -1
- package/src/shade/renderer/path_tracer/accumulating/AccumulatingPathTracer.js +1 -0
- package/src/shade/renderer/path_tracer/graph_path_trace_scene.d.ts.map +1 -1
- package/src/shade/renderer/path_tracer/graph_path_trace_scene.js +1 -0
- package/src/shade/renderer/scene/GPUInstancesAccelerationStructure.d.ts +8 -4
- package/src/shade/renderer/scene/GPUInstancesAccelerationStructure.d.ts.map +1 -1
- package/src/shade/renderer/scene/GPUInstancesAccelerationStructure.js +60 -33
- package/src/shade/renderer/scene/verify_gpu_tlas_build.d.ts +6 -6
- package/src/shade/renderer/scene/verify_gpu_tlas_build.d.ts.map +1 -1
- package/src/shade/renderer/scene/verify_gpu_tlas_build.js +23 -53
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/BVH8_INODE_STRUCT.d.ts +3 -1
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/BVH8_INODE_STRUCT.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/BVH8_INODE_STRUCT.js +5 -3
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/BVH8_MAX_DEPTH.d.ts +28 -0
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/BVH8_MAX_DEPTH.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/BVH8_MAX_DEPTH.js +29 -0
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_node_grid.d.ts +25 -0
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_node_grid.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_node_grid.js +97 -0
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_node_intersect.d.ts +8 -0
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_node_intersect.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_node_intersect.js +23 -14
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_node_slot_distances.d.ts +36 -0
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_node_slot_distances.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_node_slot_distances.js +222 -0
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_ray_direction_rcp.d.ts +20 -0
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_ray_direction_rcp.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_ray_direction_rcp.js +30 -0
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_tree_read.d.ts +30 -0
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_tree_read.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_tree_read.js +91 -0
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_waiting_slots.d.ts +23 -0
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_waiting_slots.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_waiting_slots.js +40 -0
- package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_blas_nearest.d.ts +22 -0
- package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_blas_nearest.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_blas_nearest.js +121 -70
- package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_blas_occluded.d.ts +13 -1
- package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_blas_occluded.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_blas_occluded.js +117 -61
- package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_nearest.d.ts +21 -0
- package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_nearest.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_nearest.js +111 -72
- package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_nearest_among.d.ts +1 -2
- package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_nearest_among.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_nearest_among.js +83 -54
- package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_occluded.d.ts +14 -0
- package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_occluded.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_occluded.js +92 -60
- package/src/shade/renderer/shader/chunk/sdf/chunk_point_query_blas_nearest.d.ts +22 -0
- package/src/shade/renderer/shader/chunk/sdf/chunk_point_query_blas_nearest.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/sdf/chunk_point_query_blas_nearest.js +153 -106
- package/src/shade/renderer/shader/chunk/sdf/chunk_scene_point_query_nearest.d.ts +21 -0
- package/src/shade/renderer/shader/chunk/sdf/chunk_scene_point_query_nearest.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/sdf/chunk_scene_point_query_nearest.js +115 -74
- package/src/shade/renderer/shader/chunk/sdf/chunk_scene_sdf_raymarch.d.ts +5 -2
- package/src/shade/renderer/shader/chunk/sdf/chunk_scene_sdf_raymarch.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/sdf/chunk_scene_sdf_raymarch.js +89 -63
- package/src/shade/renderer/shader/chunk/sdf/chunk_sdf_query_distance.d.ts +15 -0
- package/src/shade/renderer/shader/chunk/sdf/chunk_sdf_query_distance.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/sdf/chunk_sdf_query_distance.js +108 -63
- package/src/shade/renderer/shadow/sdf/chunk_ray_query_sdf_raycast.d.ts +14 -0
- package/src/shade/renderer/shadow/sdf/chunk_ray_query_sdf_raycast.d.ts.map +1 -1
- package/src/shade/renderer/shadow/sdf/chunk_ray_query_sdf_raycast.js +94 -60
- package/src/shade/renderer/shadow/sdf/graph_draw_sdf_shadows.d.ts.map +1 -1
- package/src/shade/renderer/shadow/sdf/graph_draw_sdf_shadows.js +4 -4
- package/src/shade/renderer/volumetrics/graph_build_volumetrics.js +2 -2
- package/src/shade/renderer/water/query/shader_water_surface_query.d.ts.map +1 -1
- package/src/shade/renderer/water/query/shader_water_surface_query.js +227 -227
- package/src/shade/renderer/water/surface/particles/chunk_water_particle_step.d.ts.map +1 -1
- package/src/shade/renderer/water/surface/particles/chunk_water_particle_step.js +7 -4
- package/src/shade/renderer/water/surface/particles/shader_water_particles.js +2 -2
- package/src/shade/renderer/wind/GPUSceneWind.d.ts +36 -4
- package/src/shade/renderer/wind/GPUSceneWind.d.ts.map +1 -1
- package/src/shade/renderer/wind/GPUSceneWind.js +150 -4
- package/src/shade/renderer/wind/WIND_FIELD_STRUCT.d.ts +9 -3
- package/src/shade/renderer/wind/WIND_FIELD_STRUCT.d.ts.map +1 -1
- package/src/shade/renderer/wind/WIND_FIELD_STRUCT.js +13 -3
- package/src/shade/renderer/wind/WIND_FIELD_UNIFORM.d.ts +6 -6
- package/src/shade/renderer/wind/WIND_FIELD_UNIFORM.js +6 -6
- package/src/shade/renderer/wind/chunk_fluid_turbulence.d.ts +39 -0
- package/src/shade/renderer/wind/chunk_fluid_turbulence.d.ts.map +1 -0
- package/src/shade/renderer/wind/chunk_fluid_turbulence.js +63 -0
- package/src/shade/renderer/wind/chunk_wind_field_sample_cascades.d.ts +10 -7
- package/src/shade/renderer/wind/chunk_wind_field_sample_cascades.d.ts.map +1 -1
- package/src/shade/renderer/wind/chunk_wind_field_sample_cascades.js +34 -11
- package/src/shade/renderer/wind/chunk_wind_field_sample_uniform.d.ts +2 -2
- package/src/shade/renderer/wind/chunk_wind_field_sample_uniform.js +2 -2
- package/src/shade/renderer/wind/wind_field_add_resources.d.ts +6 -4
- package/src/shade/renderer/wind/wind_field_add_resources.d.ts.map +1 -1
- package/src/shade/renderer/wind/wind_field_add_resources.js +9 -6
- package/src/shade/renderer/geometry/bvh/BLAS_REFIT_TARGET_STRUCT.d.ts +0 -18
- package/src/shade/renderer/geometry/bvh/BLAS_REFIT_TARGET_STRUCT.d.ts.map +0 -1
- package/src/shade/renderer/geometry/bvh/BLAS_REFIT_TARGET_STRUCT.js +0 -50
- package/src/shade/renderer/geometry/bvh/bvh2_derive_topology.d.ts +0 -23
- package/src/shade/renderer/geometry/bvh/bvh2_derive_topology.d.ts.map +0 -1
- package/src/shade/renderer/geometry/bvh/bvh2_derive_topology.js +0 -87
- package/src/shade/renderer/geometry/bvh/shader_blas_refit_batch.d.ts +0 -42
- package/src/shade/renderer/geometry/bvh/shader_blas_refit_batch.d.ts.map +0 -1
- package/src/shade/renderer/geometry/bvh/shader_blas_refit_batch.js +0 -141
- package/src/shade/renderer/geometry/bvh/shader_blas_refit_batch_seed.d.ts +0 -21
- package/src/shade/renderer/geometry/bvh/shader_blas_refit_batch_seed.d.ts.map +0 -1
- package/src/shade/renderer/geometry/bvh/shader_blas_refit_batch_seed.js +0 -75
- package/src/shade/renderer/geometry/meshlet_batch_to_bvh.d.ts +0 -17
- package/src/shade/renderer/geometry/meshlet_batch_to_bvh.d.ts.map +0 -1
- package/src/shade/renderer/geometry/meshlet_batch_to_bvh.js +0 -247
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_ray_query_blas_occlusion.d.ts +0 -7
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_ray_query_blas_occlusion.d.ts.map +0 -1
- package/src/shade/renderer/shader/chunk/bvh/bvh8/webgpu/chunk_bvh8_ray_query_blas_occlusion.js +0 -226
- package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_mask_visibility_via_rays.d.ts +0 -8
- package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_mask_visibility_via_rays.d.ts.map +0 -1
- package/src/shade/renderer/shader/chunk/light/lpv/chunk_lpv_mask_visibility_via_rays.js +0 -45
- package/src/shade/renderer/shader/chunk/light/sample/chunk_ray_sample_light.d.ts +0 -3
- package/src/shade/renderer/shader/chunk/light/sample/chunk_ray_sample_light.d.ts.map +0 -1
- package/src/shade/renderer/shader/chunk/light/sample/chunk_ray_sample_light.js +0 -105
- package/src/shade/renderer/shadow/sdf/chunk_ray_query_sdf_distance.d.ts +0 -6
- package/src/shade/renderer/shadow/sdf/chunk_ray_query_sdf_distance.d.ts.map +0 -1
- package/src/shade/renderer/shadow/sdf/chunk_ray_query_sdf_distance.js +0 -86
- package/src/shade/renderer/shadow/sdf/chunk_ray_query_sdf_raycast_traversal_count.d.ts +0 -2
- package/src/shade/renderer/shadow/sdf/chunk_ray_query_sdf_raycast_traversal_count.d.ts.map +0 -1
- package/src/shade/renderer/shadow/sdf/chunk_ray_query_sdf_raycast_traversal_count.js +0 -136
|
@@ -13,7 +13,11 @@
|
|
|
13
13
|
* {@link slot}, from the device; nothing here writes texels;
|
|
14
14
|
* - {@link uniform}: the table a reader takes, {@link WIND_FIELD_STRUCT}: every cascade's window and
|
|
15
15
|
* read record, finest first, and `v_far(t)`;
|
|
16
|
-
* - {@link previous_uniform}: the table as the frame before read it, over the same atlas
|
|
16
|
+
* - {@link previous_uniform}: the table as the frame before read it, over the same atlas;
|
|
17
|
+
* - {@link turbulence}: the far field's turbulence tile, `rgba16float`, which every reader of the field
|
|
18
|
+
* samples where the far field has turbulence. One texel of zeros until the far field first has any,
|
|
19
|
+
* then the engine's tile and its band-limited levels as mips (`fluid_turbulence_tile_levels`), uploaded
|
|
20
|
+
* once and kept.
|
|
17
21
|
*
|
|
18
22
|
* **The producer's frame**, before any consumer encodes (at `FrameStart`, ahead of the scene's own
|
|
19
23
|
* update):
|
|
@@ -21,7 +25,8 @@
|
|
|
21
25
|
* set_cascades(count, resolution) the stack's shape; allocates tiles
|
|
22
26
|
* set_cascade_window(c, corner, cell_size) where each cascade's window is
|
|
23
27
|
* set_cascade_decay(c, decay) k_c, each cascade's read record
|
|
24
|
-
* set_far_velocity(velocity)
|
|
28
|
+
* set_far_velocity(velocity) u(t), the far field's mean
|
|
29
|
+
* set_turbulence(sigma, offset, length) its turbulence
|
|
25
30
|
*
|
|
26
31
|
* and the scene's update ({@link update}) uploads the table once, if anything changed. Nothing here
|
|
27
32
|
* allocates once the count is fixed: the setters write a retained copy of the table in place.
|
|
@@ -84,6 +89,18 @@ export class GPUSceneWind {
|
|
|
84
89
|
* @returns {number}
|
|
85
90
|
*/
|
|
86
91
|
get cascade_count(): number;
|
|
92
|
+
/**
|
|
93
|
+
* Whether the field is the far field's mean at every point, this frame and the frame before: no
|
|
94
|
+
* cascades and no turbulence in either. What `WIND_FIELD_UNIFORM` is set from.
|
|
95
|
+
* @returns {boolean}
|
|
96
|
+
*/
|
|
97
|
+
get is_uniform(): boolean;
|
|
98
|
+
/**
|
|
99
|
+
* A view of the far field's turbulence tile, as the readers bind it, `fluid_turbulence`: replaced
|
|
100
|
+
* once, the first time the far field has turbulence, so a consumer takes it per frame ({@link bind}).
|
|
101
|
+
* @returns {GPUTextureView}
|
|
102
|
+
*/
|
|
103
|
+
get turbulence(): GPUTextureView;
|
|
87
104
|
/**
|
|
88
105
|
* The atlas slot of a cascade's tile: the one this frame's readers take.
|
|
89
106
|
*
|
|
@@ -138,11 +155,26 @@ export class GPUSceneWind {
|
|
|
138
155
|
*/
|
|
139
156
|
set_cascade_decay(index: number, decay: number): void;
|
|
140
157
|
/**
|
|
141
|
-
* `
|
|
158
|
+
* `u(t)`: the far field's mean now, which is the wind wherever no cascade holds when the far field has
|
|
159
|
+
* no turbulence.
|
|
142
160
|
*
|
|
143
161
|
* @param {ArrayLike<number>} velocity m/s, x, y, z
|
|
144
162
|
*/
|
|
145
163
|
set_far_velocity(velocity: ArrayLike<number>): void;
|
|
164
|
+
/**
|
|
165
|
+
* The far field's turbulence now: `σ`, its rms on each axis, m/s, 0 for none; `offset`, how far the
|
|
166
|
+
* mean has carried it, m; `length`, its length scale `L`, m. The far field at a world point `p` is then
|
|
167
|
+
* `u + σ·T((p − offset) ⊙ S⁻¹)`, `S` the tile's size for `L`. The first `σ` that is not 0 uploads the
|
|
168
|
+
* engine's tile, once.
|
|
169
|
+
*
|
|
170
|
+
* The offset is folded into one tile here, in f64, so the table holds a coordinate in `[0, 1)` however
|
|
171
|
+
* far the air has carried the turbulence.
|
|
172
|
+
*
|
|
173
|
+
* @param {number} sigma
|
|
174
|
+
* @param {ArrayLike<number>} offset
|
|
175
|
+
* @param {number} length > 0 when `sigma` is not 0
|
|
176
|
+
*/
|
|
177
|
+
set_turbulence(sigma: number, offset: ArrayLike<number>, length: number): void;
|
|
146
178
|
/**
|
|
147
179
|
* Upload the tables that changed since their last upload; once a frame, after the producer
|
|
148
180
|
* and before any consumer encodes. The tiles' texel origins and the atlas's size are taken here,
|
|
@@ -151,7 +183,7 @@ export class GPUSceneWind {
|
|
|
151
183
|
update(): void;
|
|
152
184
|
/**
|
|
153
185
|
* Put the field into a dispatch's bindings, under the names `wind_field_add_resources` declares:
|
|
154
|
-
* `wind_field` and `
|
|
186
|
+
* `wind_field`, `wind_field_atlas` and `fluid_turbulence`; the samplers are the declaration's defaults.
|
|
155
187
|
*
|
|
156
188
|
* @param {Object} bindings
|
|
157
189
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GPUSceneWind.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/wind/GPUSceneWind.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GPUSceneWind.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/wind/GPUSceneWind.js"],"names":[],"mappings":"AAmCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH;IAsHI;;;;;OAKG;IACH,wDAJW,UAAU,MAAM,CAAC,YACjB,MAAM,GACJ,cAAc,CAoB1B;IAzDD;;OAEG;IACH,+BA4BC;IA4BD;;;;OAIG;IACH,4BAEC;IAED;;;OAGG;IACH,yBAEC;IAED;;;;OAIG;IACH,kCAEC;IAED;;;OAGG;IACH,qCAEC;IAED;;OAEG;IACH,4BAEC;IAED;;;;OAIG;IACH,0BAKC;IAED;;;;OAIG;IACH,iCAEC;IAED;;;;;OAKG;IACH,YAHW,MAAM,GACJ,MAAM,CAOlB;IAED;;;;;;;;;OASG;IACH,oBAHW,MAAM,GACJ,MAAM,CAkBlB;IAED;;;OAGG;IACH,sBAgBC;IAED;;;;;;;;;OASG;IACH,oBAHW,MAAM,cACN,UAAU,MAAM,CAAC,QAmE3B;IAED;;;;;;;;OAQG;IACH,0BAJW,MAAM,UACN,UAAU,MAAM,CAAC,aACjB,MAAM,QAmBhB;IAED;;;;;;;OAOG;IACH,yBAHW,MAAM,SACN,MAAM,QAYhB;IAED;;;;;OAKG;IACH,2BAFW,UAAU,MAAM,CAAC,QAY3B;IAED;;;;;;;;;;;;OAYG;IACH,sBAJW,MAAM,UACN,UAAU,MAAM,CAAC,UACjB,MAAM,QA+BhB;IAwCD;;;;OAIG;IACH,eAmBC;IAiED;;;;;OAKG;IACH,0BAIC;IAED;;;;;;OAMG;IACH,kCAIC;IAED;;OAEG;IACH,gBAWC;;CACJ;+BAjsB8B,oCAAoC"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { assert } from "../../../core/assert.js";
|
|
2
|
+
import { FLUID_TURBULENCE_TEXELS_PER_LENGTH, FLUID_TURBULENCE_TILE_RESOLUTION } from "../../../engine/physics/fluid/turbulence/FLUID_TURBULENCE_TILE.js";
|
|
3
|
+
import { fluid_turbulence_tile_level_size } from "../../../engine/physics/fluid/turbulence/fluid_turbulence_tile_generate.js";
|
|
4
|
+
import { fluid_turbulence_inverse_tile_size } from "../../../engine/physics/fluid/turbulence/fluid_turbulence_inverse_tile_size.js";
|
|
5
|
+
import { fluid_turbulence_tile_data_rgba16 } from "../../../engine/physics/fluid/turbulence/fluid_turbulence_tile_data.js";
|
|
2
6
|
import { CLIPMAP_LEVEL_STRUCT } from "../shader/chunk/clipmap/CLIPMAP_LEVEL_STRUCT.js";
|
|
3
7
|
import { GPUTileAtlas3D } from "../texture/atlas/GPUTileAtlas3D.js";
|
|
4
8
|
import { WIND_FIELD_CASCADE_LIMIT, WIND_FIELD_TILE_BORDER, WIND_FIELD_TILE_FORMAT } from "./WIND_FIELD.js";
|
|
@@ -17,6 +21,10 @@ const CASCADE_DECAY = WIND_CASCADE_STRUCT.get('decay').offset >>> 2;
|
|
|
17
21
|
const FAR_VELOCITY = WIND_FIELD_STRUCT.get('far_velocity').offset >>> 2;
|
|
18
22
|
const CASCADE_COUNT = WIND_FIELD_STRUCT.get('cascade_count').offset >>> 2;
|
|
19
23
|
const INVERSE_ATLAS_SIZE = WIND_FIELD_STRUCT.get('inverse_atlas_size').offset >>> 2;
|
|
24
|
+
const TURBULENCE_SIGMA = WIND_FIELD_STRUCT.get('turbulence_sigma').offset >>> 2;
|
|
25
|
+
const TURBULENCE_SCALE = WIND_FIELD_STRUCT.get('turbulence_scale').offset >>> 2;
|
|
26
|
+
const TURBULENCE_ORIGIN = WIND_FIELD_STRUCT.get('turbulence_origin').offset >>> 2;
|
|
27
|
+
const TURBULENCE_INVERSE_TEXEL = WIND_FIELD_STRUCT.get('turbulence_inverse_texel').offset >>> 2;
|
|
20
28
|
|
|
21
29
|
/**
|
|
22
30
|
* Content of the atlas before any cascade has a resolution: one texel and its skirt, so there is a
|
|
@@ -40,7 +48,11 @@ const PLACEHOLDER_CONTENT = [1, 1, 1];
|
|
|
40
48
|
* {@link slot}, from the device; nothing here writes texels;
|
|
41
49
|
* - {@link uniform}: the table a reader takes, {@link WIND_FIELD_STRUCT}: every cascade's window and
|
|
42
50
|
* read record, finest first, and `v_far(t)`;
|
|
43
|
-
* - {@link previous_uniform}: the table as the frame before read it, over the same atlas
|
|
51
|
+
* - {@link previous_uniform}: the table as the frame before read it, over the same atlas;
|
|
52
|
+
* - {@link turbulence}: the far field's turbulence tile, `rgba16float`, which every reader of the field
|
|
53
|
+
* samples where the far field has turbulence. One texel of zeros until the far field first has any,
|
|
54
|
+
* then the engine's tile and its band-limited levels as mips (`fluid_turbulence_tile_levels`), uploaded
|
|
55
|
+
* once and kept.
|
|
44
56
|
*
|
|
45
57
|
* **The producer's frame**, before any consumer encodes (at `FrameStart`, ahead of the scene's own
|
|
46
58
|
* update):
|
|
@@ -48,7 +60,8 @@ const PLACEHOLDER_CONTENT = [1, 1, 1];
|
|
|
48
60
|
* set_cascades(count, resolution) the stack's shape; allocates tiles
|
|
49
61
|
* set_cascade_window(c, corner, cell_size) where each cascade's window is
|
|
50
62
|
* set_cascade_decay(c, decay) k_c, each cascade's read record
|
|
51
|
-
* set_far_velocity(velocity)
|
|
63
|
+
* set_far_velocity(velocity) u(t), the far field's mean
|
|
64
|
+
* set_turbulence(sigma, offset, length) its turbulence
|
|
52
65
|
*
|
|
53
66
|
* and the scene's update ({@link update}) uploads the table once, if anything changed. Nothing here
|
|
54
67
|
* allocates once the count is fixed: the setters write a retained copy of the table in place.
|
|
@@ -86,6 +99,21 @@ export class GPUSceneWind {
|
|
|
86
99
|
/** @type {GPUBuffer} */
|
|
87
100
|
#previous_uniform;
|
|
88
101
|
|
|
102
|
+
/**
|
|
103
|
+
* The turbulence tile: one texel until {@link set_turbulence} first has a σ, the engine's tile after.
|
|
104
|
+
* @type {GPUTexture}
|
|
105
|
+
*/
|
|
106
|
+
#turbulence;
|
|
107
|
+
|
|
108
|
+
/** {@link #turbulence}'s view, as readers bind it. @type {GPUTextureView} */
|
|
109
|
+
#turbulence_view;
|
|
110
|
+
|
|
111
|
+
/** Whether {@link #turbulence} is the engine's tile yet. */
|
|
112
|
+
#turbulence_tiled = false;
|
|
113
|
+
|
|
114
|
+
/** Scratch for the tile's inverse size. */
|
|
115
|
+
#inverse_tile_size = new Float64Array(3);
|
|
116
|
+
|
|
89
117
|
/**
|
|
90
118
|
* The table as the shader reads it, written in place by the setters.
|
|
91
119
|
* @type {ArrayBuffer}
|
|
@@ -101,6 +129,7 @@ export class GPUSceneWind {
|
|
|
101
129
|
*/
|
|
102
130
|
#previous_bytes = new ArrayBuffer(WIND_FIELD_STRUCT.size);
|
|
103
131
|
#previous_u32 = new Uint32Array(this.#previous_bytes);
|
|
132
|
+
#previous_f32 = new Float32Array(this.#previous_bytes);
|
|
104
133
|
|
|
105
134
|
#count = 0;
|
|
106
135
|
|
|
@@ -162,6 +191,17 @@ export class GPUSceneWind {
|
|
|
162
191
|
size: WIND_FIELD_STRUCT.size,
|
|
163
192
|
usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST,
|
|
164
193
|
});
|
|
194
|
+
|
|
195
|
+
// a new texture is 0: no turbulence, and never read while σ is 0
|
|
196
|
+
this.#turbulence = device.createTexture({
|
|
197
|
+
label: 'GPUSceneWind/turbulence placeholder',
|
|
198
|
+
size: [1, 1, 1],
|
|
199
|
+
dimension: '3d',
|
|
200
|
+
format: 'rgba16float',
|
|
201
|
+
usage: GPUTextureUsage.TEXTURE_BINDING,
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
this.#turbulence_view = this.#turbulence.createView();
|
|
165
205
|
}
|
|
166
206
|
|
|
167
207
|
/**
|
|
@@ -231,6 +271,27 @@ export class GPUSceneWind {
|
|
|
231
271
|
return this.#count;
|
|
232
272
|
}
|
|
233
273
|
|
|
274
|
+
/**
|
|
275
|
+
* Whether the field is the far field's mean at every point, this frame and the frame before: no
|
|
276
|
+
* cascades and no turbulence in either. What `WIND_FIELD_UNIFORM` is set from.
|
|
277
|
+
* @returns {boolean}
|
|
278
|
+
*/
|
|
279
|
+
get is_uniform() {
|
|
280
|
+
return this.#count === 0
|
|
281
|
+
&& this.#previous_u32[CASCADE_COUNT] === 0
|
|
282
|
+
&& this.#f32[TURBULENCE_SIGMA] === 0
|
|
283
|
+
&& this.#previous_f32[TURBULENCE_SIGMA] === 0;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* A view of the far field's turbulence tile, as the readers bind it, `fluid_turbulence`: replaced
|
|
288
|
+
* once, the first time the far field has turbulence, so a consumer takes it per frame ({@link bind}).
|
|
289
|
+
* @returns {GPUTextureView}
|
|
290
|
+
*/
|
|
291
|
+
get turbulence() {
|
|
292
|
+
return this.#turbulence_view;
|
|
293
|
+
}
|
|
294
|
+
|
|
234
295
|
/**
|
|
235
296
|
* The atlas slot of a cascade's tile: the one this frame's readers take.
|
|
236
297
|
*
|
|
@@ -420,7 +481,8 @@ export class GPUSceneWind {
|
|
|
420
481
|
}
|
|
421
482
|
|
|
422
483
|
/**
|
|
423
|
-
* `
|
|
484
|
+
* `u(t)`: the far field's mean now, which is the wind wherever no cascade holds when the far field has
|
|
485
|
+
* no turbulence.
|
|
424
486
|
*
|
|
425
487
|
* @param {ArrayLike<number>} velocity m/s, x, y, z
|
|
426
488
|
*/
|
|
@@ -436,6 +498,88 @@ export class GPUSceneWind {
|
|
|
436
498
|
this.#dirty = true;
|
|
437
499
|
}
|
|
438
500
|
|
|
501
|
+
/**
|
|
502
|
+
* The far field's turbulence now: `σ`, its rms on each axis, m/s, 0 for none; `offset`, how far the
|
|
503
|
+
* mean has carried it, m; `length`, its length scale `L`, m. The far field at a world point `p` is then
|
|
504
|
+
* `u + σ·T((p − offset) ⊙ S⁻¹)`, `S` the tile's size for `L`. The first `σ` that is not 0 uploads the
|
|
505
|
+
* engine's tile, once.
|
|
506
|
+
*
|
|
507
|
+
* The offset is folded into one tile here, in f64, so the table holds a coordinate in `[0, 1)` however
|
|
508
|
+
* far the air has carried the turbulence.
|
|
509
|
+
*
|
|
510
|
+
* @param {number} sigma
|
|
511
|
+
* @param {ArrayLike<number>} offset
|
|
512
|
+
* @param {number} length > 0 when `sigma` is not 0
|
|
513
|
+
*/
|
|
514
|
+
set_turbulence(sigma, offset, length) {
|
|
515
|
+
assert.isFinite(sigma, 'sigma');
|
|
516
|
+
assert.greaterThanOrEqual(sigma, 0, 'sigma');
|
|
517
|
+
|
|
518
|
+
const f32 = this.#f32;
|
|
519
|
+
|
|
520
|
+
f32[TURBULENCE_SIGMA] = sigma;
|
|
521
|
+
|
|
522
|
+
if (sigma !== 0) {
|
|
523
|
+
assert.isFinite(length, 'length');
|
|
524
|
+
assert.greaterThan(length, 0, 'length');
|
|
525
|
+
|
|
526
|
+
this.#ensure_turbulence_tile();
|
|
527
|
+
|
|
528
|
+
const inverse = fluid_turbulence_inverse_tile_size(this.#inverse_tile_size, length);
|
|
529
|
+
|
|
530
|
+
f32[TURBULENCE_INVERSE_TEXEL] = FLUID_TURBULENCE_TEXELS_PER_LENGTH / length;
|
|
531
|
+
|
|
532
|
+
for (let axis = 0; axis < 3; axis++) {
|
|
533
|
+
assert.isFinite(offset[axis], 'offset');
|
|
534
|
+
|
|
535
|
+
const origin = -offset[axis] * inverse[axis];
|
|
536
|
+
|
|
537
|
+
f32[TURBULENCE_SCALE + axis] = inverse[axis];
|
|
538
|
+
f32[TURBULENCE_ORIGIN + axis] = origin - Math.floor(origin);
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
this.#dirty = true;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
/**
|
|
546
|
+
* Replace the placeholder with the engine's tile, once.
|
|
547
|
+
*/
|
|
548
|
+
#ensure_turbulence_tile() {
|
|
549
|
+
if (this.#turbulence_tiled) {
|
|
550
|
+
return;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
const levels = fluid_turbulence_tile_data_rgba16();
|
|
554
|
+
|
|
555
|
+
const texture = this.#device.createTexture({
|
|
556
|
+
label: 'GPUSceneWind/turbulence',
|
|
557
|
+
size: Array.from(FLUID_TURBULENCE_TILE_RESOLUTION),
|
|
558
|
+
dimension: '3d',
|
|
559
|
+
format: 'rgba16float',
|
|
560
|
+
mipLevelCount: levels.length,
|
|
561
|
+
usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST,
|
|
562
|
+
});
|
|
563
|
+
|
|
564
|
+
const size = [0, 0, 0];
|
|
565
|
+
|
|
566
|
+
for (let level = 0; level < levels.length; level++) {
|
|
567
|
+
fluid_turbulence_tile_level_size(size, FLUID_TURBULENCE_TILE_RESOLUTION, level);
|
|
568
|
+
|
|
569
|
+
this.#device.queue.writeTexture(
|
|
570
|
+
{ texture, mipLevel: level },
|
|
571
|
+
levels[level],
|
|
572
|
+
{ bytesPerRow: 8 * size[0], rowsPerImage: size[1] },
|
|
573
|
+
size
|
|
574
|
+
);
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
this.#turbulence.destroy();
|
|
578
|
+
this.#turbulence = texture;
|
|
579
|
+
this.#turbulence_view = texture.createView();
|
|
580
|
+
this.#turbulence_tiled = true;
|
|
581
|
+
}
|
|
582
|
+
|
|
439
583
|
/**
|
|
440
584
|
* Upload the tables that changed since their last upload; once a frame, after the producer
|
|
441
585
|
* and before any consumer encodes. The tiles' texel origins and the atlas's size are taken here,
|
|
@@ -527,13 +671,14 @@ export class GPUSceneWind {
|
|
|
527
671
|
|
|
528
672
|
/**
|
|
529
673
|
* Put the field into a dispatch's bindings, under the names `wind_field_add_resources` declares:
|
|
530
|
-
* `wind_field` and `
|
|
674
|
+
* `wind_field`, `wind_field_atlas` and `fluid_turbulence`; the samplers are the declaration's defaults.
|
|
531
675
|
*
|
|
532
676
|
* @param {Object} bindings
|
|
533
677
|
*/
|
|
534
678
|
bind(bindings) {
|
|
535
679
|
bindings.wind_field = this.#uniform;
|
|
536
680
|
bindings.wind_field_atlas = this.#atlas.texture;
|
|
681
|
+
bindings.fluid_turbulence = this.#turbulence_view;
|
|
537
682
|
}
|
|
538
683
|
|
|
539
684
|
/**
|
|
@@ -562,5 +707,6 @@ export class GPUSceneWind {
|
|
|
562
707
|
this.#atlas.destroy();
|
|
563
708
|
this.#uniform.destroy();
|
|
564
709
|
this.#previous_uniform.destroy();
|
|
710
|
+
this.#turbulence.destroy();
|
|
565
711
|
}
|
|
566
712
|
}
|
|
@@ -18,7 +18,7 @@ export const WIND_LEVEL_ARRAY: WebGPUArray;
|
|
|
18
18
|
export const WIND_CASCADE_ARRAY: WebGPUArray;
|
|
19
19
|
/**
|
|
20
20
|
* The published wind field as a shader reads it: the uniform `wind_field`
|
|
21
|
-
* (GPU_FLUID_CASCADES_PROPOSAL_2026_10_16.md §11).
|
|
21
|
+
* (GPU_FLUID_CASCADES_PROPOSAL_2026_10_16.md §11). 832 bytes.
|
|
22
22
|
*
|
|
23
23
|
* Cascade `c` (finest first, below `cascade_count`) is two rows at index `c`:
|
|
24
24
|
* - `levels[c]`: its window as a clipmap level (`CLIPMAP_LEVEL_STRUCT`) — the world cell at
|
|
@@ -29,10 +29,16 @@ export const WIND_CASCADE_ARRAY: WebGPUArray;
|
|
|
29
29
|
*
|
|
30
30
|
* Rows at and past `cascade_count` are never read.
|
|
31
31
|
*
|
|
32
|
-
* - `far_velocity`: `
|
|
33
|
-
* what every cascade's deviation decays toward.
|
|
32
|
+
* - `far_velocity`: `u(t)`, m/s, the far field's mean now.
|
|
34
33
|
* - `inverse_atlas_size`: one over the atlas texture's texels along x, y and z, so a texel coordinate
|
|
35
34
|
* times it is the normalised one a sample takes.
|
|
35
|
+
* - `turbulence_sigma`, `turbulence_scale`, `turbulence_origin`: the far field's turbulence now, so
|
|
36
|
+
* the far field at a world point `p` is `v_far(t, p) = far_velocity + σ·T(p ⊙ scale + origin)`
|
|
37
|
+
* (`chunk_fluid_turbulence`): `σ` in m/s, 0 for none; `scale` one over the tile's size in the
|
|
38
|
+
* world; `origin` the tile coordinate of the world's origin, the turbulence's offset folded into one
|
|
39
|
+
* tile; `inverse_texel` one over the tile's texel in the world, `8 / L`, from which a read inside a
|
|
40
|
+
* cascade takes the tile's level for the cascade's cell (`fluid_turbulence_lod`). `v_far(t, p)` is the wind everywhere no cascade holds, and what every cascade's deviation
|
|
41
|
+
* decays toward.
|
|
36
42
|
*
|
|
37
43
|
* @type {WebGPUStruct}
|
|
38
44
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WIND_FIELD_STRUCT.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/wind/WIND_FIELD_STRUCT.js"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,kCAFU,YAAY,CAgBJ;AAElB;;;;GAIG;AACH,+BAFU,WAAW,CAE4E;AAEjG;;;GAGG;AACH,iCAFU,WAAW,CAE6E;AAElG
|
|
1
|
+
{"version":3,"file":"WIND_FIELD_STRUCT.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/wind/WIND_FIELD_STRUCT.js"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,kCAFU,YAAY,CAgBJ;AAElB;;;;GAIG;AACH,+BAFU,WAAW,CAE4E;AAEjG;;;GAGG;AACH,iCAFU,WAAW,CAE6E;AAElG;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,gCAFU,YAAY,CAYN;6BA1Ea,gCAAgC;4BADjC,+BAA+B"}
|
|
@@ -41,7 +41,7 @@ export const WIND_CASCADE_ARRAY = WebGPUArray.from(WIND_CASCADE_STRUCT, WIND_FIE
|
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
43
|
* The published wind field as a shader reads it: the uniform `wind_field`
|
|
44
|
-
* (GPU_FLUID_CASCADES_PROPOSAL_2026_10_16.md §11).
|
|
44
|
+
* (GPU_FLUID_CASCADES_PROPOSAL_2026_10_16.md §11). 832 bytes.
|
|
45
45
|
*
|
|
46
46
|
* Cascade `c` (finest first, below `cascade_count`) is two rows at index `c`:
|
|
47
47
|
* - `levels[c]`: its window as a clipmap level (`CLIPMAP_LEVEL_STRUCT`) — the world cell at
|
|
@@ -52,10 +52,16 @@ export const WIND_CASCADE_ARRAY = WebGPUArray.from(WIND_CASCADE_STRUCT, WIND_FIE
|
|
|
52
52
|
*
|
|
53
53
|
* Rows at and past `cascade_count` are never read.
|
|
54
54
|
*
|
|
55
|
-
* - `far_velocity`: `
|
|
56
|
-
* what every cascade's deviation decays toward.
|
|
55
|
+
* - `far_velocity`: `u(t)`, m/s, the far field's mean now.
|
|
57
56
|
* - `inverse_atlas_size`: one over the atlas texture's texels along x, y and z, so a texel coordinate
|
|
58
57
|
* times it is the normalised one a sample takes.
|
|
58
|
+
* - `turbulence_sigma`, `turbulence_scale`, `turbulence_origin`: the far field's turbulence now, so
|
|
59
|
+
* the far field at a world point `p` is `v_far(t, p) = far_velocity + σ·T(p ⊙ scale + origin)`
|
|
60
|
+
* (`chunk_fluid_turbulence`): `σ` in m/s, 0 for none; `scale` one over the tile's size in the
|
|
61
|
+
* world; `origin` the tile coordinate of the world's origin, the turbulence's offset folded into one
|
|
62
|
+
* tile; `inverse_texel` one over the tile's texel in the world, `8 / L`, from which a read inside a
|
|
63
|
+
* cascade takes the tile's level for the cascade's cell (`fluid_turbulence_lod`). `v_far(t, p)` is the wind everywhere no cascade holds, and what every cascade's deviation
|
|
64
|
+
* decays toward.
|
|
59
65
|
*
|
|
60
66
|
* @type {WebGPUStruct}
|
|
61
67
|
*/
|
|
@@ -65,4 +71,8 @@ export const WIND_FIELD_STRUCT = WebGPUStruct.from({
|
|
|
65
71
|
far_velocity: vec3f,
|
|
66
72
|
cascade_count: u32,
|
|
67
73
|
inverse_atlas_size: vec3f,
|
|
74
|
+
turbulence_sigma: f32,
|
|
75
|
+
turbulence_scale: vec3f,
|
|
76
|
+
turbulence_inverse_texel: f32,
|
|
77
|
+
turbulence_origin: vec3f,
|
|
68
78
|
}, "WindField");
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Whether the published wind field is uniform: it holds no cascades
|
|
3
|
-
* `wind_field.far_velocity` at every point — `GPUSceneWind.
|
|
4
|
-
* no producer fills (one without a GPU fluid). Decided by `chunk_wind_field_sample`, whose uniform
|
|
2
|
+
* Whether the published wind field is uniform: it holds no cascades and its far field no turbulence,
|
|
3
|
+
* so the wind is `wind_field.far_velocity` at every point — `GPUSceneWind.is_uniform`, which is every
|
|
4
|
+
* scene no producer fills (one without a GPU fluid). Decided by `chunk_wind_field_sample`, whose uniform
|
|
5
5
|
* alternative is the far field and nothing else, and by `chunk_participating_media_noise`, whose
|
|
6
6
|
* uniform alternative is the scroll alone: with no departure from the far field anywhere, the flow
|
|
7
7
|
* map has nothing to carry.
|
|
8
8
|
*
|
|
9
|
-
* A pass sets it from the field it binds, `scene.wind.
|
|
10
|
-
*
|
|
11
|
-
* `
|
|
9
|
+
* A pass sets it from the field it binds, `scene.wind.is_uniform`, the frame it binds it; that holds
|
|
10
|
+
* only when the field as the frame before read it was uniform too, so a pass that also reads the
|
|
11
|
+
* history (`chunk_wind_field_sample_previous`) takes the same rule.
|
|
12
12
|
* `false`, the default, is the field read as it is, cascades or none, so a pass that never sets it
|
|
13
13
|
* reads the wind exactly as it always did.
|
|
14
14
|
*
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { ShaderSwitch } from "../shader/compiler/ShaderSwitch.js";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Whether the published wind field is uniform: it holds no cascades
|
|
5
|
-
* `wind_field.far_velocity` at every point — `GPUSceneWind.
|
|
6
|
-
* no producer fills (one without a GPU fluid). Decided by `chunk_wind_field_sample`, whose uniform
|
|
4
|
+
* Whether the published wind field is uniform: it holds no cascades and its far field no turbulence,
|
|
5
|
+
* so the wind is `wind_field.far_velocity` at every point — `GPUSceneWind.is_uniform`, which is every
|
|
6
|
+
* scene no producer fills (one without a GPU fluid). Decided by `chunk_wind_field_sample`, whose uniform
|
|
7
7
|
* alternative is the far field and nothing else, and by `chunk_participating_media_noise`, whose
|
|
8
8
|
* uniform alternative is the scroll alone: with no departure from the far field anywhere, the flow
|
|
9
9
|
* map has nothing to carry.
|
|
10
10
|
*
|
|
11
|
-
* A pass sets it from the field it binds, `scene.wind.
|
|
12
|
-
*
|
|
13
|
-
* `
|
|
11
|
+
* A pass sets it from the field it binds, `scene.wind.is_uniform`, the frame it binds it; that holds
|
|
12
|
+
* only when the field as the frame before read it was uniform too, so a pass that also reads the
|
|
13
|
+
* history (`chunk_wind_field_sample_previous`) takes the same rule.
|
|
14
14
|
* `false`, the default, is the field read as it is, cascades or none, so a pass that never sets it
|
|
15
15
|
* reads the wind exactly as it always did.
|
|
16
16
|
*
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Declare the turbulence tile's bindings in a resource group, under the names
|
|
3
|
+
* {@link chunk_fluid_turbulence} reads:
|
|
4
|
+
* - `fluid_turbulence`: the tile, `texture_3d<f32>`, filterable, `rgba16float`, the engine's tile
|
|
5
|
+
* (`fluid_turbulence_tile_data`) as `GPUSceneWind#turbulence` holds it;
|
|
6
|
+
* - `fluid_turbulence_sampler`: {@link FLUID_TURBULENCE_SAMPLER_DESCRIPTOR}, the declaration's default,
|
|
7
|
+
* so a host binds only the texture.
|
|
8
|
+
*
|
|
9
|
+
* @param {import("../shader/resource/ShaderResourceGroupDescriptor.js").ShaderResourceGroupDescriptor} group
|
|
10
|
+
* @returns {import("../shader/resource/ShaderResourceGroupDescriptor.js").ShaderResourceGroupDescriptor} group
|
|
11
|
+
*/
|
|
12
|
+
export function fluid_turbulence_add_resources(group: import("../shader/resource/ShaderResourceGroupDescriptor.js").ShaderResourceGroupDescriptor): import("../shader/resource/ShaderResourceGroupDescriptor.js").ShaderResourceGroupDescriptor;
|
|
13
|
+
/**
|
|
14
|
+
* The sampler the far field's turbulence tile is read with: trilinear and repeating on every axis,
|
|
15
|
+
* the tile being one period of an infinite field, and linear between its levels.
|
|
16
|
+
*
|
|
17
|
+
* @type {SamplerDescriptor}
|
|
18
|
+
*/
|
|
19
|
+
export const FLUID_TURBULENCE_SAMPLER_DESCRIPTOR: SamplerDescriptor;
|
|
20
|
+
/**
|
|
21
|
+
* `fluid_turbulence_at(q, lod)`: the far field's unit-rms turbulence at tile coordinate `q` (one tile
|
|
22
|
+
* is 1 on each axis, repeating), band-limited to level `lod`: one trilinear tap of `fluid_turbulence`
|
|
23
|
+
* between two of its levels. A caller scales it by `σ` and places `q` from a world point by the far
|
|
24
|
+
* field's offset and length scale.
|
|
25
|
+
*
|
|
26
|
+
* `fluid_turbulence_lod(cell, inverse_texel)`: the level a lattice of cell `cell` reads, the tile's
|
|
27
|
+
* texel being `1 / inverse_texel`: `log2(cell / texel)`, and 0 for a cell no larger than a texel. Level
|
|
28
|
+
* `ℓ` holds the wavelengths of two of its texels and longer (`fluid_turbulence_tile_generate_levels`), so
|
|
29
|
+
* a lattice reads what its cells can hold: nothing aliased into it, and a footprint of about a texel a
|
|
30
|
+
* cell, which is what a tap's cache wants.
|
|
31
|
+
*
|
|
32
|
+
* Bindings as {@link fluid_turbulence_add_resources} declares them.
|
|
33
|
+
*
|
|
34
|
+
* @type {CodeChunk}
|
|
35
|
+
*/
|
|
36
|
+
export const chunk_fluid_turbulence: CodeChunk;
|
|
37
|
+
import { SamplerDescriptor } from "../../descriptor/texture/SamplerDescriptor.js";
|
|
38
|
+
import { CodeChunk } from "../shader/compiler/CodeChunk.js";
|
|
39
|
+
//# sourceMappingURL=chunk_fluid_turbulence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk_fluid_turbulence.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/wind/chunk_fluid_turbulence.js"],"names":[],"mappings":"AAkBA;;;;;;;;;;GAUG;AACH,sDAHW,OAAO,qDAAqD,EAAE,6BAA6B,GACzF,OAAO,qDAAqD,EAAE,6BAA6B,CAMvG;AA9BD;;;;;GAKG;AACH,kDAFU,iBAAiB,CASvB;AAmBJ;;;;;;;;;;;;;;;GAeG;AACH,qCAFU,SAAS,CAajB;kCA9DgC,+CAA+C;0BACvD,iCAAiC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { SamplerDescriptor } from "../../descriptor/texture/SamplerDescriptor.js";
|
|
2
|
+
import { CodeChunk } from "../shader/compiler/CodeChunk.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The sampler the far field's turbulence tile is read with: trilinear and repeating on every axis,
|
|
6
|
+
* the tile being one period of an infinite field, and linear between its levels.
|
|
7
|
+
*
|
|
8
|
+
* @type {SamplerDescriptor}
|
|
9
|
+
*/
|
|
10
|
+
export const FLUID_TURBULENCE_SAMPLER_DESCRIPTOR = Object.freeze(SamplerDescriptor.from({
|
|
11
|
+
magFilter: "linear",
|
|
12
|
+
minFilter: "linear",
|
|
13
|
+
mipmapFilter: "linear",
|
|
14
|
+
addressModeU: "repeat",
|
|
15
|
+
addressModeV: "repeat",
|
|
16
|
+
addressModeW: "repeat",
|
|
17
|
+
}));
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Declare the turbulence tile's bindings in a resource group, under the names
|
|
21
|
+
* {@link chunk_fluid_turbulence} reads:
|
|
22
|
+
* - `fluid_turbulence`: the tile, `texture_3d<f32>`, filterable, `rgba16float`, the engine's tile
|
|
23
|
+
* (`fluid_turbulence_tile_data`) as `GPUSceneWind#turbulence` holds it;
|
|
24
|
+
* - `fluid_turbulence_sampler`: {@link FLUID_TURBULENCE_SAMPLER_DESCRIPTOR}, the declaration's default,
|
|
25
|
+
* so a host binds only the texture.
|
|
26
|
+
*
|
|
27
|
+
* @param {import("../shader/resource/ShaderResourceGroupDescriptor.js").ShaderResourceGroupDescriptor} group
|
|
28
|
+
* @returns {import("../shader/resource/ShaderResourceGroupDescriptor.js").ShaderResourceGroupDescriptor} group
|
|
29
|
+
*/
|
|
30
|
+
export function fluid_turbulence_add_resources(group) {
|
|
31
|
+
return group
|
|
32
|
+
.addTexture("fluid_turbulence", "float", "3d")
|
|
33
|
+
.addSampler("fluid_turbulence_sampler", "filtering", FLUID_TURBULENCE_SAMPLER_DESCRIPTOR);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* `fluid_turbulence_at(q, lod)`: the far field's unit-rms turbulence at tile coordinate `q` (one tile
|
|
38
|
+
* is 1 on each axis, repeating), band-limited to level `lod`: one trilinear tap of `fluid_turbulence`
|
|
39
|
+
* between two of its levels. A caller scales it by `σ` and places `q` from a world point by the far
|
|
40
|
+
* field's offset and length scale.
|
|
41
|
+
*
|
|
42
|
+
* `fluid_turbulence_lod(cell, inverse_texel)`: the level a lattice of cell `cell` reads, the tile's
|
|
43
|
+
* texel being `1 / inverse_texel`: `log2(cell / texel)`, and 0 for a cell no larger than a texel. Level
|
|
44
|
+
* `ℓ` holds the wavelengths of two of its texels and longer (`fluid_turbulence_tile_generate_levels`), so
|
|
45
|
+
* a lattice reads what its cells can hold: nothing aliased into it, and a footprint of about a texel a
|
|
46
|
+
* cell, which is what a tap's cache wants.
|
|
47
|
+
*
|
|
48
|
+
* Bindings as {@link fluid_turbulence_add_resources} declares them.
|
|
49
|
+
*
|
|
50
|
+
* @type {CodeChunk}
|
|
51
|
+
*/
|
|
52
|
+
export const chunk_fluid_turbulence = CodeChunk.from(
|
|
53
|
+
//language=WGSL
|
|
54
|
+
`
|
|
55
|
+
fn fluid_turbulence_at(q: vec3<f32>, lod: f32) -> vec3<f32> {
|
|
56
|
+
return textureSampleLevel(fluid_turbulence, fluid_turbulence_sampler, q, lod).xyz;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
fn fluid_turbulence_lod(cell: f32, inverse_texel: f32) -> f32 {
|
|
60
|
+
return max(0.0, log2(cell * inverse_texel));
|
|
61
|
+
}
|
|
62
|
+
`
|
|
63
|
+
);
|
|
@@ -3,21 +3,24 @@
|
|
|
3
3
|
* `chunk_wind_field_sample` links for a field as it is ({@link WIND_FIELD_UNIFORM} `false`), any
|
|
4
4
|
* number of cascades, none included.
|
|
5
5
|
*
|
|
6
|
-
* Reads `wind_field` ({@link WIND_FIELD_STRUCT}), `wind_field_atlas` and
|
|
7
|
-
* {@link wind_field_add_resources} declares them. `wind_field_sample_in(field, position_ws)` is the
|
|
6
|
+
* Reads `wind_field` ({@link WIND_FIELD_STRUCT}), `wind_field_atlas`, `wind_field_sampler` and the
|
|
7
|
+
* turbulence tile, as {@link wind_field_add_resources} declares them. `wind_field_sample_in(field, position_ws)` is the
|
|
8
8
|
* same read through any table over that atlas, the previous frame's for one.
|
|
9
9
|
*
|
|
10
10
|
* **The read:**
|
|
11
11
|
* - the cascades' windows are walked finest first, each by `clipmap_level_select`, and the first holding
|
|
12
12
|
* the point answers, with how far into its edge band of {@link WIND_FIELD_BAND_WIDTH} cells the point is;
|
|
13
|
-
* -
|
|
14
|
-
*
|
|
13
|
+
* - the far field at the point, `v_far(t, p)`: its mean, plus its turbulence's one tap when it has any
|
|
14
|
+
* (`wind_field_far`), band-limited inside a cascade to the cascade's cell, as the cascade's own far
|
|
15
|
+
* field is, and whole beyond every cascade;
|
|
16
|
+
* - a cascade's read is the atmosphere identity, `v_far(t, p) + tap · k_c`: one trilinear tap of its
|
|
17
|
+
* tile, which holds `v − v_far(t_s,c)` at cell centres, times its decay;
|
|
15
18
|
* - in the band, a second read blends in linearly, all of it on the window's face: the parent's
|
|
16
|
-
* identity read, or `v_far(t)` for the coarsest; deeper than the band, one read;
|
|
17
|
-
* - outside every cascade, `v_far(t)`.
|
|
19
|
+
* identity read, or `v_far(t, p)` for the coarsest; deeper than the band, one read;
|
|
20
|
+
* - outside every cascade, `v_far(t, p)`.
|
|
18
21
|
*
|
|
19
22
|
* The blend and the decay are taken now, at the sample, so a cascade that last stepped ticks ago reads
|
|
20
|
-
* the far field's current
|
|
23
|
+
* the far field's current mean, turbulence and drag. Air at the far field publishes a deviation of 0 and reads
|
|
21
24
|
* back `v_far(t)` exactly, on every cascade, in every band, at every instant: the blend is written as
|
|
22
25
|
* `inner + (outer − inner)·w`, which leaves equal reads as they are.
|
|
23
26
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chunk_wind_field_sample_cascades.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/wind/chunk_wind_field_sample_cascades.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chunk_wind_field_sample_cascades.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/wind/chunk_wind_field_sample_cascades.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,+CAFU,SAAS,CAmFjB;0BA/HwB,iCAAiC"}
|