@woosh/meep-engine 3.42.0 → 3.44.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.
Files changed (345) hide show
  1. package/editor/prototypeEditorShell.d.ts.map +1 -1
  2. package/editor/prototypeEditorShell.js +4 -2
  3. package/package.json +91 -96
  4. package/src/engine/Clock.d.ts +15 -0
  5. package/src/engine/Clock.d.ts.map +1 -1
  6. package/src/engine/Clock.js +29 -5
  7. package/src/engine/Engine.d.ts.map +1 -1
  8. package/src/engine/Engine.js +11 -19
  9. package/src/engine/graphics/ecs/mesh-v2/MeshSkin.d.ts +57 -0
  10. package/src/engine/graphics/ecs/mesh-v2/MeshSkin.d.ts.map +1 -0
  11. package/src/engine/graphics/ecs/mesh-v2/MeshSkin.js +84 -0
  12. package/src/engine/graphics3/AnimationGraphSystem.d.ts +23 -13
  13. package/src/engine/graphics3/AnimationGraphSystem.d.ts.map +1 -1
  14. package/src/engine/graphics3/AnimationGraphSystem.js +61 -64
  15. package/src/engine/graphics3/AnimationSystem.d.ts +24 -15
  16. package/src/engine/graphics3/AnimationSystem.d.ts.map +1 -1
  17. package/src/engine/graphics3/AnimationSystem.js +67 -61
  18. package/src/engine/graphics3/MeshSkinSystem.d.ts +56 -0
  19. package/src/engine/graphics3/MeshSkinSystem.d.ts.map +1 -0
  20. package/src/engine/graphics3/MeshSkinSystem.js +317 -0
  21. package/src/engine/graphics3/MeshSystem.d.ts +15 -35
  22. package/src/engine/graphics3/MeshSystem.d.ts.map +1 -1
  23. package/src/engine/graphics3/MeshSystem.js +21 -298
  24. package/src/engine/graphics3/RowChains.d.ts +76 -0
  25. package/src/engine/graphics3/RowChains.d.ts.map +1 -0
  26. package/src/engine/graphics3/RowChains.js +347 -0
  27. package/src/engine/graphics3/ShadedGeometrySystem.d.ts +6 -0
  28. package/src/engine/graphics3/ShadedGeometrySystem.d.ts.map +1 -1
  29. package/src/engine/graphics3/ShadedGeometrySystem.js +329 -309
  30. package/src/engine/graphics3/animation/AnimationClips.d.ts +56 -0
  31. package/src/engine/graphics3/animation/AnimationClips.d.ts.map +1 -0
  32. package/src/engine/graphics3/animation/AnimationClips.js +79 -0
  33. package/src/engine/graphics3/animation/ClipListPlayer.d.ts +13 -14
  34. package/src/engine/graphics3/animation/ClipListPlayer.d.ts.map +1 -1
  35. package/src/engine/graphics3/animation/ClipListPlayer.js +262 -263
  36. package/src/engine/graphics3/animation/write_clip_playback.d.ts +3 -3
  37. package/src/engine/graphics3/animation/write_clip_playback.js +4 -4
  38. package/src/engine/graphics3/pose/query_entity_node_world_pose.d.ts +5 -0
  39. package/src/engine/graphics3/pose/query_entity_node_world_pose.d.ts.map +1 -1
  40. package/src/engine/graphics3/pose/query_entity_node_world_pose.js +80 -75
  41. package/src/engine/graphics3/prefab/PrefabInstance.d.ts +4 -24
  42. package/src/engine/graphics3/prefab/PrefabInstance.d.ts.map +1 -1
  43. package/src/engine/graphics3/prefab/PrefabInstance.js +60 -80
  44. package/src/engine/graphics3/prefab/prefab_instantiate.d.ts +16 -3
  45. package/src/engine/graphics3/prefab/prefab_instantiate.d.ts.map +1 -1
  46. package/src/engine/graphics3/prefab/prefab_instantiate.js +49 -12
  47. package/src/engine/graphics3/prefab/prefab_place.d.ts +31 -17
  48. package/src/engine/graphics3/prefab/prefab_place.d.ts.map +1 -1
  49. package/src/engine/graphics3/prefab/prefab_place.js +175 -130
  50. package/src/engine/graphics3/register_clips.d.ts +64 -0
  51. package/src/engine/graphics3/register_clips.d.ts.map +1 -0
  52. package/src/engine/graphics3/register_clips.js +114 -0
  53. package/src/engine/physics/cloth/MEASUREMENTS.md +795 -0
  54. package/src/engine/physics/cloth/PLAN.md +339 -9
  55. package/src/engine/physics/cloth/build/ClothProxy.d.ts +113 -61
  56. package/src/engine/physics/cloth/build/ClothProxy.d.ts.map +1 -1
  57. package/src/engine/physics/cloth/build/ClothProxy.js +142 -77
  58. package/src/engine/physics/cloth/build/cloth_bind_in_frame.d.ts +22 -0
  59. package/src/engine/physics/cloth/build/cloth_bind_in_frame.d.ts.map +1 -0
  60. package/src/engine/physics/cloth/build/cloth_bind_in_frame.js +75 -0
  61. package/src/engine/physics/cloth/build/cloth_proxy_from_joints.d.ts +43 -30
  62. package/src/engine/physics/cloth/build/cloth_proxy_from_joints.d.ts.map +1 -1
  63. package/src/engine/physics/cloth/build/cloth_proxy_from_joints.js +357 -284
  64. package/src/engine/physics/cloth/build/cloth_proxy_from_mesh.d.ts +62 -0
  65. package/src/engine/physics/cloth/build/cloth_proxy_from_mesh.d.ts.map +1 -0
  66. package/src/engine/physics/cloth/build/cloth_proxy_from_mesh.js +280 -0
  67. package/src/engine/physics/cloth/collider/cloth_collider_sdf.d.ts +1 -1
  68. package/src/engine/physics/cloth/collider/cloth_collider_sdf.js +1 -1
  69. package/src/engine/physics/cloth/ecs/Cloth.d.ts +17 -9
  70. package/src/engine/physics/cloth/ecs/Cloth.d.ts.map +1 -1
  71. package/src/engine/physics/cloth/ecs/Cloth.js +220 -212
  72. package/src/engine/physics/cloth/ecs/ClothDynamicsFlags.js +6 -0
  73. package/src/engine/physics/cloth/ecs/ClothHold.d.ts +91 -0
  74. package/src/engine/physics/cloth/ecs/ClothHold.d.ts.map +1 -0
  75. package/src/engine/physics/cloth/ecs/ClothHold.js +103 -0
  76. package/src/engine/physics/cloth/ecs/ClothInstance.d.ts +254 -48
  77. package/src/engine/physics/cloth/ecs/ClothInstance.d.ts.map +1 -1
  78. package/src/engine/physics/cloth/ecs/ClothInstance.js +277 -47
  79. package/src/engine/physics/cloth/ecs/ClothPin.d.ts +73 -0
  80. package/src/engine/physics/cloth/ecs/ClothPin.d.ts.map +1 -0
  81. package/src/engine/physics/cloth/ecs/ClothPin.js +92 -0
  82. package/src/engine/physics/cloth/ecs/ClothPinSerializationAdapter.d.ts +36 -0
  83. package/src/engine/physics/cloth/ecs/ClothPinSerializationAdapter.d.ts.map +1 -0
  84. package/src/engine/physics/cloth/ecs/ClothPinSerializationAdapter.js +61 -0
  85. package/src/engine/physics/cloth/ecs/ClothRig.d.ts +23 -17
  86. package/src/engine/physics/cloth/ecs/ClothRig.d.ts.map +1 -1
  87. package/src/engine/physics/cloth/ecs/ClothRig.js +29 -27
  88. package/src/engine/physics/cloth/ecs/ClothSystem.d.ts +12 -14
  89. package/src/engine/physics/cloth/ecs/ClothSystem.d.ts.map +1 -1
  90. package/src/engine/physics/cloth/ecs/ClothSystem.js +20 -15
  91. package/src/engine/physics/cloth/ecs/ClothWorld.d.ts +57 -36
  92. package/src/engine/physics/cloth/ecs/ClothWorld.d.ts.map +1 -1
  93. package/src/engine/physics/cloth/ecs/ClothWorld.js +816 -179
  94. package/src/engine/physics/cloth/ecs/WorkerClothSystem.d.ts +12 -13
  95. package/src/engine/physics/cloth/ecs/WorkerClothSystem.d.ts.map +1 -1
  96. package/src/engine/physics/cloth/ecs/WorkerClothSystem.js +20 -14
  97. package/src/engine/physics/cloth/ecs/cloth_build_rows.d.ts +63 -11
  98. package/src/engine/physics/cloth/ecs/cloth_build_rows.d.ts.map +1 -1
  99. package/src/engine/physics/cloth/ecs/cloth_build_rows.js +321 -84
  100. package/src/engine/physics/cloth/ecs/cloth_dynamics_map.d.ts +9 -7
  101. package/src/engine/physics/cloth/ecs/cloth_dynamics_map.d.ts.map +1 -1
  102. package/src/engine/physics/cloth/ecs/cloth_dynamics_map.js +9 -7
  103. package/src/engine/physics/cloth/ecs/cloth_gather_colliders.d.ts +3 -3
  104. package/src/engine/physics/cloth/ecs/cloth_gather_colliders.js +30 -30
  105. package/src/engine/physics/cloth/ecs/cloth_geodesic.d.ts +37 -0
  106. package/src/engine/physics/cloth/ecs/cloth_geodesic.d.ts.map +1 -0
  107. package/src/engine/physics/cloth/ecs/cloth_geodesic.js +142 -0
  108. package/src/engine/physics/cloth/ecs/cloth_holds.d.ts +97 -0
  109. package/src/engine/physics/cloth/ecs/cloth_holds.d.ts.map +1 -0
  110. package/src/engine/physics/cloth/ecs/cloth_holds.js +608 -0
  111. package/src/engine/physics/cloth/ecs/cloth_reconstruct_pose.d.ts +2 -2
  112. package/src/engine/physics/cloth/ecs/cloth_reconstruct_pose.d.ts.map +1 -1
  113. package/src/engine/physics/cloth/ecs/cloth_reconstruct_pose.js +160 -9
  114. package/src/engine/physics/cloth/ecs/cloth_seed_rig.d.ts +17 -22
  115. package/src/engine/physics/cloth/ecs/cloth_seed_rig.d.ts.map +1 -1
  116. package/src/engine/physics/cloth/ecs/cloth_seed_rig.js +55 -117
  117. package/src/engine/physics/cloth/ecs/cloth_seed_subtree.d.ts +21 -6
  118. package/src/engine/physics/cloth/ecs/cloth_seed_subtree.d.ts.map +1 -1
  119. package/src/engine/physics/cloth/ecs/cloth_seed_subtree.js +44 -15
  120. package/src/engine/physics/cloth/ecs/cloth_write_back.d.ts +5 -0
  121. package/src/engine/physics/cloth/ecs/cloth_write_back.d.ts.map +1 -1
  122. package/src/engine/physics/cloth/ecs/cloth_write_back.js +60 -16
  123. package/src/engine/physics/cloth/ecs/cloth_write_back_rig.d.ts.map +1 -1
  124. package/src/engine/physics/cloth/ecs/cloth_write_back_rig.js +65 -58
  125. package/src/engine/physics/cloth/playground/collide_main.js +1 -1
  126. package/src/engine/physics/cloth/playground/garment_build.d.ts.map +1 -1
  127. package/src/engine/physics/cloth/playground/garment_build.js +17 -5
  128. package/src/engine/physics/cloth/playground/garment_main.js +1 -1
  129. package/src/engine/physics/cloth/playground/rig_build.d.ts.map +1 -1
  130. package/src/engine/physics/cloth/playground/rig_build.js +302 -296
  131. package/src/engine/physics/cloth/solver/ClothState.d.ts +45 -7
  132. package/src/engine/physics/cloth/solver/ClothState.d.ts.map +1 -1
  133. package/src/engine/physics/cloth/solver/ClothState.js +63 -7
  134. package/src/engine/physics/cloth/solver/cloth_contact_find.d.ts +6 -1
  135. package/src/engine/physics/cloth/solver/cloth_contact_find.d.ts.map +1 -1
  136. package/src/engine/physics/cloth/solver/cloth_contact_find.js +7 -2
  137. package/src/engine/physics/cloth/solver/cloth_hold_line.d.ts +114 -0
  138. package/src/engine/physics/cloth/solver/cloth_hold_line.d.ts.map +1 -0
  139. package/src/engine/physics/cloth/solver/cloth_hold_line.js +362 -0
  140. package/src/engine/physics/cloth/solver/cloth_self_find.d.ts +6 -2
  141. package/src/engine/physics/cloth/solver/cloth_self_find.d.ts.map +1 -1
  142. package/src/engine/physics/cloth/solver/cloth_self_find.js +13 -13
  143. package/src/engine/physics/cloth/solver/cloth_solver_constants.d.ts +24 -12
  144. package/src/engine/physics/cloth/solver/cloth_solver_constants.d.ts.map +1 -1
  145. package/src/engine/physics/cloth/solver/cloth_solver_constants.js +24 -12
  146. package/src/engine/physics/cloth/solver/cloth_step.d.ts +16 -0
  147. package/src/engine/physics/cloth/solver/cloth_step.d.ts.map +1 -1
  148. package/src/engine/physics/cloth/solver/cloth_step.js +183 -20
  149. package/src/engine/physics/cloth/solver/cloth_step_instance.d.ts +1 -0
  150. package/src/engine/physics/cloth/solver/cloth_step_instance.d.ts.map +1 -1
  151. package/src/engine/physics/cloth/solver/cloth_step_instance.js +10 -3
  152. package/src/engine/physics/cloth/solver/constraint/cloth_leash_row.d.ts +1 -1
  153. package/src/engine/physics/cloth/solver/constraint/cloth_leash_row.d.ts.map +1 -1
  154. package/src/engine/physics/cloth/solver/constraint/cloth_leash_row.js +353 -346
  155. package/src/engine/physics/cloth/solver/constraint/cloth_self_row.d.ts +7 -5
  156. package/src/engine/physics/cloth/solver/constraint/cloth_self_row.d.ts.map +1 -1
  157. package/src/engine/physics/cloth/solver/constraint/cloth_self_row.js +7 -5
  158. package/src/engine/physics/cloth/wind/cloth_sample_air.d.ts +9 -9
  159. package/src/engine/physics/cloth/wind/cloth_sample_air.d.ts.map +1 -1
  160. package/src/engine/physics/cloth/wind/cloth_sample_air.js +26 -26
  161. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  162. package/src/engine/simulation/Ticker.d.ts +13 -0
  163. package/src/engine/simulation/Ticker.d.ts.map +1 -1
  164. package/src/engine/simulation/Ticker.js +43 -8
  165. package/src/shade/RENDERER_CONTRACT.md +8 -2
  166. package/src/shade/playground/mesh_row_ceiling/main.js +2 -1
  167. package/src/shade/playground/skinned_blas_refit/main.d.ts.map +1 -1
  168. package/src/shade/playground/skinned_blas_refit/main.js +11 -19
  169. package/src/shade/playground/skinned_blas_refit/place_character.d.ts +6 -3
  170. package/src/shade/playground/skinned_blas_refit/place_character.d.ts.map +1 -1
  171. package/src/shade/playground/skinned_blas_refit/place_character.js +90 -90
  172. package/src/shade/playground/skinned_mesh_soup/main.d.ts.map +1 -1
  173. package/src/shade/playground/skinned_mesh_soup/main.js +502 -509
  174. package/src/shade/playground/texture_encode/README.md +129 -109
  175. package/src/shade/playground/texture_encode/main.js +1430 -1430
  176. package/src/shade/playground/vgeo_runtime/README.md +5 -4
  177. package/src/shade/renderer/Renderer.d.ts.map +1 -1
  178. package/src/shade/renderer/Renderer.js +6 -5
  179. package/src/shade/renderer/animation/GPUAnimationManager.d.ts +45 -14
  180. package/src/shade/renderer/animation/GPUAnimationManager.d.ts.map +1 -1
  181. package/src/shade/renderer/animation/GPUAnimationManager.js +316 -64
  182. package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.d.ts +5 -0
  183. package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.d.ts.map +1 -1
  184. package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.js +11 -1
  185. package/src/shade/renderer/atmosphere/GPUSky.d.ts +12 -0
  186. package/src/shade/renderer/atmosphere/GPUSky.d.ts.map +1 -1
  187. package/src/shade/renderer/atmosphere/GPUSky.js +162 -147
  188. package/src/shade/renderer/geometry/BoxGeometry.d.ts +1 -11
  189. package/src/shade/renderer/geometry/BoxGeometry.d.ts.map +1 -1
  190. package/src/shade/renderer/geometry/BoxGeometry.js +6 -13
  191. package/src/shade/renderer/geometry/CapsuleGeometry.d.ts +19 -0
  192. package/src/shade/renderer/geometry/CapsuleGeometry.d.ts.map +1 -0
  193. package/src/shade/renderer/geometry/CapsuleGeometry.js +24 -0
  194. package/src/shade/renderer/geometry/ConeGeometry.d.ts +20 -0
  195. package/src/shade/renderer/geometry/ConeGeometry.d.ts.map +1 -0
  196. package/src/shade/renderer/geometry/ConeGeometry.js +33 -0
  197. package/src/shade/renderer/geometry/CylinderGeometry.d.ts +21 -0
  198. package/src/shade/renderer/geometry/CylinderGeometry.d.ts.map +1 -0
  199. package/src/shade/renderer/geometry/CylinderGeometry.js +35 -0
  200. package/src/shade/renderer/geometry/PlaneGeometry.d.ts +17 -0
  201. package/src/shade/renderer/geometry/PlaneGeometry.d.ts.map +1 -0
  202. package/src/shade/renderer/geometry/PlaneGeometry.js +22 -0
  203. package/src/shade/renderer/geometry/TorusGeometry.d.ts +18 -0
  204. package/src/shade/renderer/geometry/TorusGeometry.d.ts.map +1 -0
  205. package/src/shade/renderer/geometry/TorusGeometry.js +23 -0
  206. package/src/shade/renderer/geometry/UVSphereGeometry.d.ts +21 -0
  207. package/src/shade/renderer/geometry/UVSphereGeometry.d.ts.map +1 -0
  208. package/src/shade/renderer/geometry/UVSphereGeometry.js +34 -0
  209. package/src/shade/renderer/geometry/primitives/make_capsule_geometry.d.ts +19 -0
  210. package/src/shade/renderer/geometry/primitives/make_capsule_geometry.d.ts.map +1 -0
  211. package/src/shade/renderer/geometry/primitives/make_capsule_geometry.js +205 -0
  212. package/src/shade/renderer/geometry/primitives/make_cone_geometry.d.ts +21 -0
  213. package/src/shade/renderer/geometry/primitives/make_cone_geometry.d.ts.map +1 -0
  214. package/src/shade/renderer/geometry/primitives/make_cone_geometry.js +36 -0
  215. package/src/shade/renderer/geometry/primitives/make_cylinder_geometry.d.ts +1 -1
  216. package/src/shade/renderer/geometry/primitives/make_cylinder_geometry.d.ts.map +1 -1
  217. package/src/shade/renderer/geometry/primitives/make_cylinder_geometry.js +44 -9
  218. package/src/shade/renderer/geometry/primitives/make_uv_sphere_geometry.d.ts +20 -0
  219. package/src/shade/renderer/geometry/primitives/make_uv_sphere_geometry.d.ts.map +1 -0
  220. package/src/shade/renderer/geometry/primitives/make_uv_sphere_geometry.js +190 -0
  221. package/src/shade/renderer/geometry/virtual/runtime/graph_vgeo_expand_instances_to_meshlets.d.ts.map +1 -1
  222. package/src/shade/renderer/geometry/virtual/runtime/graph_vgeo_expand_instances_to_meshlets.js +7 -2
  223. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/graph_prefix_scan_csdldf.d.ts +26 -8
  224. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/graph_prefix_scan_csdldf.d.ts.map +1 -1
  225. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/graph_prefix_scan_csdldf.js +56 -39
  226. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/shader_prefix_scan_csdldf.d.ts +7 -0
  227. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/shader_prefix_scan_csdldf.d.ts.map +1 -1
  228. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/shader_prefix_scan_csdldf.js +46 -4
  229. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/test_prefix_sum.d.ts.map +1 -1
  230. package/src/shade/renderer/gpu_primitive/prefix_sum/v1/test_prefix_sum.js +4 -2
  231. package/src/shade/renderer/gpu_primitive/sort/defs.d.ts +2 -2
  232. package/src/shade/renderer/gpu_primitive/sort/defs.js +79 -79
  233. package/src/shade/renderer/gpu_primitive/sort/graph_radix_sort.d.ts +1 -1
  234. package/src/shade/renderer/gpu_primitive/sort/graph_radix_sort.d.ts.map +1 -1
  235. package/src/shade/renderer/gpu_primitive/sort/graph_radix_sort.js +7 -3
  236. package/src/shade/renderer/lightmap/bake/shader_lightmap_denoise_sh.d.ts.map +1 -1
  237. package/src/shade/renderer/lightmap/bake/shader_lightmap_denoise_sh.js +10 -3
  238. package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
  239. package/src/shade/renderer/particles/DESIGN.md +13 -9
  240. package/src/shade/renderer/particles/GPUParticleSystem.js +1 -1
  241. package/src/shade/renderer/particles/coherence/graph_particle_bucket.d.ts +4 -3
  242. package/src/shade/renderer/particles/coherence/graph_particle_bucket.d.ts.map +1 -1
  243. package/src/shade/renderer/particles/coherence/graph_particle_bucket.js +200 -194
  244. package/src/shade/renderer/particles/graph_particles.d.ts.map +1 -1
  245. package/src/shade/renderer/particles/graph_particles.js +6 -2
  246. package/src/shade/renderer/particles/shaders/chunk_particle_lighting.d.ts +1 -1
  247. package/src/shade/renderer/particles/shaders/chunk_particle_lighting.js +1 -1
  248. package/src/shade/renderer/particles/warmup/graph_particle_warmup.d.ts.map +1 -1
  249. package/src/shade/renderer/particles/warmup/graph_particle_warmup.js +334 -329
  250. package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
  251. package/src/shade/renderer/rasterize/bucket/prepare_meshlet_draw_commands_by_material.d.ts.map +1 -1
  252. package/src/shade/renderer/rasterize/bucket/prepare_meshlet_draw_commands_by_material.js +7 -2
  253. package/src/shade/renderer/rasterize/expand/mesh/graph_expand_meshes_to_meshlets.d.ts.map +1 -1
  254. package/src/shade/renderer/rasterize/expand/mesh/graph_expand_meshes_to_meshlets.js +16 -4
  255. package/src/shade/renderer/rasterize/native/avboit/AVBOITSideChannel.d.ts +3 -2
  256. package/src/shade/renderer/rasterize/native/avboit/AVBOITSideChannel.d.ts.map +1 -1
  257. package/src/shade/renderer/rasterize/native/avboit/AVBOITSideChannel.js +3 -2
  258. package/src/shade/renderer/scene/GPUSceneContext.d.ts +9 -1
  259. package/src/shade/renderer/scene/GPUSceneContext.d.ts.map +1 -1
  260. package/src/shade/renderer/scene/GPUSceneContext.js +23 -1
  261. package/src/shade/renderer/texture/COMPRESSED_TEXTURE_PLAN_2026_09_01.md +2444 -2345
  262. package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgb.d.ts.map +1 -1
  263. package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgb.js +312 -310
  264. package/src/shade/renderer/texture/encode/chunk_bc1_encode_block.d.ts +3 -3
  265. package/src/shade/renderer/texture/encode/chunk_bc1_encode_block.d.ts.map +1 -1
  266. package/src/shade/renderer/texture/encode/chunk_bc1_encode_block.js +383 -375
  267. package/src/shade/renderer/texture/encode/chunk_bc6h_encode_block_mode11.d.ts.map +1 -1
  268. package/src/shade/renderer/texture/encode/chunk_bc6h_encode_block_mode11.js +349 -346
  269. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block.d.ts +58 -0
  270. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block.d.ts.map +1 -0
  271. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block.js +536 -0
  272. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.d.ts +21 -7
  273. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.d.ts.map +1 -1
  274. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.js +291 -327
  275. package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode1.d.ts +25 -0
  276. package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode1.d.ts.map +1 -0
  277. package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode1.js +99 -0
  278. package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode6.d.ts +5 -3
  279. package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode6.d.ts.map +1 -1
  280. package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode6.js +47 -71
  281. package/src/shade/renderer/texture/encode/chunk_bc7_partition_2.d.ts +10 -0
  282. package/src/shade/renderer/texture/encode/chunk_bc7_partition_2.d.ts.map +1 -0
  283. package/src/shade/renderer/texture/encode/chunk_bc7_partition_2.js +50 -0
  284. package/src/shade/renderer/texture/encode/shader_texture_encode_bc7.d.ts +4 -5
  285. package/src/shade/renderer/texture/encode/shader_texture_encode_bc7.d.ts.map +1 -1
  286. package/src/shade/renderer/texture/encode/shader_texture_encode_bc7.js +7 -8
  287. package/src/shade/renderer/volumetrics/GPUViewVolumetrics.d.ts +4 -1
  288. package/src/shade/renderer/volumetrics/GPUViewVolumetrics.d.ts.map +1 -1
  289. package/src/shade/renderer/volumetrics/GPUViewVolumetrics.js +74 -3
  290. package/src/shade/renderer/volumetrics/NOTES.md +1023 -957
  291. package/src/shade/renderer/volumetrics/chunk_volumetrics_irradiance_sh.d.ts +5 -4
  292. package/src/shade/renderer/volumetrics/chunk_volumetrics_irradiance_sh.d.ts.map +1 -1
  293. package/src/shade/renderer/volumetrics/chunk_volumetrics_irradiance_sh.js +5 -4
  294. package/src/shade/renderer/volumetrics/gi/chunk_volumetrics_gi.d.ts +1 -1
  295. package/src/shade/renderer/volumetrics/gi/chunk_volumetrics_gi.js +1 -1
  296. package/src/shade/renderer/volumetrics/gi/graph_build_froxel_gi.d.ts +1 -1
  297. package/src/shade/renderer/volumetrics/gi/graph_build_froxel_gi.js +1 -1
  298. package/src/shade/renderer/volumetrics/graph_build_froxel_irradiance.d.ts +41 -0
  299. package/src/shade/renderer/volumetrics/graph_build_froxel_irradiance.d.ts.map +1 -0
  300. package/src/shade/renderer/volumetrics/graph_build_froxel_irradiance.js +112 -0
  301. package/src/shade/renderer/volumetrics/graph_build_volumetrics.d.ts +9 -23
  302. package/src/shade/renderer/volumetrics/graph_build_volumetrics.d.ts.map +1 -1
  303. package/src/shade/renderer/volumetrics/graph_build_volumetrics.js +18 -126
  304. package/src/shade/renderer/volumetrics/shader_volumetrics_build_irradiance.d.ts +22 -0
  305. package/src/shade/renderer/volumetrics/shader_volumetrics_build_irradiance.d.ts.map +1 -0
  306. package/src/shade/renderer/volumetrics/shader_volumetrics_build_irradiance.js +228 -0
  307. package/src/shade/renderer/volumetrics/shader_volumetrics_build_lighting.d.ts.map +1 -1
  308. package/src/shade/renderer/volumetrics/shader_volumetrics_build_lighting.js +0 -53
  309. package/src/shade/renderer/water/chunk_water_transport.d.ts.map +1 -1
  310. package/src/shade/renderer/water/chunk_water_transport.js +7 -5
  311. package/src/shade/renderer/water/medium/GPUWaterBodies.d.ts.map +1 -1
  312. package/src/shade/renderer/water/medium/GPUWaterBodies.js +8 -2
  313. package/src/shade/renderer/water/optics/chunk_water_receiver_downwelling.d.ts +3 -2
  314. package/src/shade/renderer/water/optics/chunk_water_receiver_downwelling.d.ts.map +1 -1
  315. package/src/shade/renderer/water/optics/chunk_water_receiver_downwelling.js +3 -2
  316. package/src/shade/renderer/water/shader_water.d.ts.map +1 -1
  317. package/src/shade/renderer/water/shader_water.js +3 -1
  318. package/src/shade/renderer/water/surface/GPUWaterSurface.d.ts.map +1 -1
  319. package/src/shade/renderer/water/surface/GPUWaterSurface.js +3 -1
  320. package/src/shade/renderer/water/surface/chunk_water_surface_sample.d.ts +4 -3
  321. package/src/shade/renderer/water/surface/chunk_water_surface_sample.d.ts.map +1 -1
  322. package/src/shade/renderer/water/surface/chunk_water_surface_sample.js +17 -7
  323. package/src/shade/renderer/water/surface/graph_water_tessellation.d.ts.map +1 -1
  324. package/src/shade/renderer/water/surface/graph_water_tessellation.js +11 -4
  325. package/src/shade/renderer/water/surface/particles/GPUWaterParticles.d.ts.map +1 -1
  326. package/src/shade/renderer/water/surface/particles/GPUWaterParticles.js +93 -30
  327. package/src/shade/renderer/water/surface/particles/WATER_PARTICLE_STRUCT.d.ts.map +1 -1
  328. package/src/shade/renderer/water/surface/particles/WATER_PARTICLE_STRUCT.js +13 -5
  329. package/src/shade/renderer/water/surface/particles/chunk_water_particle.d.ts +29 -8
  330. package/src/shade/renderer/water/surface/particles/chunk_water_particle.d.ts.map +1 -1
  331. package/src/shade/renderer/water/surface/particles/chunk_water_particle.js +155 -30
  332. package/src/shade/renderer/water/surface/particles/chunk_water_particle_step.d.ts +6 -1
  333. package/src/shade/renderer/water/surface/particles/chunk_water_particle_step.d.ts.map +1 -1
  334. package/src/shade/renderer/water/surface/particles/chunk_water_particle_step.js +157 -39
  335. package/src/shade/renderer/water/surface/particles/shader_water_particles.d.ts +91 -21
  336. package/src/shade/renderer/water/surface/particles/shader_water_particles.d.ts.map +1 -1
  337. package/src/shade/renderer/water/surface/particles/shader_water_particles.js +442 -70
  338. package/src/shade/wgsl/emulator/WGSLJavaScriptCompiler.js +11 -3
  339. package/src/shade/wgsl/emulator/WGSLLanguageCore.d.ts.map +1 -1
  340. package/src/shade/wgsl/emulator/WGSLLanguageCore.js +3 -0
  341. package/src/shade/wgsl/validate_wgsl_source.d.ts.map +1 -1
  342. package/src/shade/wgsl/validate_wgsl_source.js +74 -3
  343. package/src/engine/graphics3/register_instance_animation.d.ts +0 -114
  344. package/src/engine/graphics3/register_instance_animation.d.ts.map +0 -1
  345. package/src/engine/graphics3/register_instance_animation.js +0 -201
@@ -0,0 +1,25 @@
1
+ /**
2
+ * One BC7 mode 1 block from its partition, four endpoints and sixteen indices, as four
3
+ * little-endian words.
4
+ *
5
+ * The layout `bc7_write_block` states for mode 1: two mode bits — a zero and a one — then six bits
6
+ * of partition, then the colour endpoints by channel, red for both ends of the first subset and then
7
+ * both ends of the second, then green, then blue, six bits each; one parity bit per *subset*, shared
8
+ * by its two ends; then the indices, three bits each except the two anchors', texel 0 and the
9
+ * partition's second anchor, whose top bit is implied zero. Honouring that is the encoder's, by
10
+ * swapping a subset's ends; this drops the top bit, as the JavaScript writer drops it. Mode 1 has no
11
+ * alpha: it decodes opaque.
12
+ *
13
+ * Endpoints are given as the eight-bit values they decode to — six stored bits, the subset's parity
14
+ * bit below them, the top bit replicated below that — so the stored bits are read off them. The
15
+ * parity is read off each subset's first end; the encoder gives both ends the same one.
16
+ *
17
+ * Each word is composed by shifts at the fields' fixed positions, except the indices: the second
18
+ * anchor moves with the partition, so the three-bit fields are laid out as if none were short and
19
+ * the anchor's top bit is then cut out of the run.
20
+ *
21
+ * @type {CodeChunk}
22
+ */
23
+ export const chunk_bc7_pack_mode1: CodeChunk;
24
+ import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
25
+ //# sourceMappingURL=chunk_bc7_pack_mode1.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk_bc7_pack_mode1.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/texture/encode/chunk_bc7_pack_mode1.js"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,mCAFU,SAAS,CA2EZ;0BAlGmB,oCAAoC"}
@@ -0,0 +1,99 @@
1
+ import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
2
+ import { chunk_bc7_partition_2 } from "./chunk_bc7_partition_2.js";
3
+
4
+ /**
5
+ * One BC7 mode 1 block from its partition, four endpoints and sixteen indices, as four
6
+ * little-endian words.
7
+ *
8
+ * The layout `bc7_write_block` states for mode 1: two mode bits — a zero and a one — then six bits
9
+ * of partition, then the colour endpoints by channel, red for both ends of the first subset and then
10
+ * both ends of the second, then green, then blue, six bits each; one parity bit per *subset*, shared
11
+ * by its two ends; then the indices, three bits each except the two anchors', texel 0 and the
12
+ * partition's second anchor, whose top bit is implied zero. Honouring that is the encoder's, by
13
+ * swapping a subset's ends; this drops the top bit, as the JavaScript writer drops it. Mode 1 has no
14
+ * alpha: it decodes opaque.
15
+ *
16
+ * Endpoints are given as the eight-bit values they decode to — six stored bits, the subset's parity
17
+ * bit below them, the top bit replicated below that — so the stored bits are read off them. The
18
+ * parity is read off each subset's first end; the encoder gives both ends the same one.
19
+ *
20
+ * Each word is composed by shifts at the fields' fixed positions, except the indices: the second
21
+ * anchor moves with the partition, so the three-bit fields are laid out as if none were short and
22
+ * the anchor's top bit is then cut out of the run.
23
+ *
24
+ * @type {CodeChunk}
25
+ */
26
+ export const chunk_bc7_pack_mode1 = CodeChunk.from(
27
+ //language=WGSL
28
+ `
29
+ fn bc7_pack_mode1(
30
+ pattern: u32,
31
+ a0: vec3<u32>, a1: vec3<u32>,
32
+ b0: vec3<u32>, b1: vec3<u32>,
33
+ indices: array<u32, 16>
34
+ ) -> vec4<u32> {
35
+ // the six stored bits of each end's channels, and each subset's parity
36
+ let sa0 = a0 >> vec3<u32>(2u);
37
+ let sa1 = a1 >> vec3<u32>(2u);
38
+ let sb0 = b0 >> vec3<u32>(2u);
39
+ let sb1 = b1 >> vec3<u32>(2u);
40
+
41
+ let parity_a = (a0.x >> 1u) & 1u;
42
+ let parity_b = (b0.x >> 1u) & 1u;
43
+
44
+ // texels 1 to 15 at three bits each, as if no anchor were short: forty-five bits over two words
45
+ var low = 0u;
46
+ var high = 0u;
47
+
48
+ for (var i = 1u; i < 16u; i++) {
49
+ let shift = 3u * (i - 1u);
50
+ let index = indices[i] & 7u;
51
+
52
+ if (shift < 32u) {
53
+ low |= index << shift;
54
+ }
55
+
56
+ // texel 11's field straddles the two words, bits 30 to 32
57
+ if (shift == 30u) {
58
+ high |= index >> 2u;
59
+ }
60
+
61
+ if (shift > 32u) {
62
+ high |= index << (shift - 32u);
63
+ }
64
+ }
65
+
66
+ // cut the second anchor's top bit out of the run: the bits below it stay, the bits above it
67
+ // move down by one
68
+ let cut = 3u * (bc7_partition_2_anchor(pattern) - 1u) + 2u;
69
+
70
+ let keep_low = select(0xFFFFFFFFu, (1u << cut) - 1u, cut < 32u);
71
+ let keep_high = select((1u << (cut - 32u)) - 1u, 0u, cut < 32u);
72
+
73
+ let shifted_low = (low >> 1u) | (high << 31u);
74
+ let shifted_high = high >> 1u;
75
+
76
+ let run_low = (low & keep_low) | (shifted_low & ~keep_low);
77
+ let run_high = (high & keep_high) | (shifted_high & ~keep_high);
78
+
79
+ // the forty-six index bits: texel 0's two, then the run
80
+ let stream_low = (indices[0] & 3u) | (run_low << 2u);
81
+ let stream_high = (run_low >> 30u) | (run_high << 2u);
82
+
83
+ // mode 1 is signalled by a zero bit and then a one, bits 0 and 1; the partition from bit 2,
84
+ // red from bit 8
85
+ let w0 = 2u | (pattern << 2u) | (sa0.x << 8u) | (sa1.x << 14u) | (sb0.x << 20u) | (sb1.x << 26u);
86
+
87
+ // the first subset's second blue straddles bits 62 to 67
88
+ let w1 = sa0.y | (sa1.y << 6u) | (sb0.y << 12u) | (sb1.y << 18u) | (sa0.z << 24u) | (sa1.z << 30u);
89
+
90
+ // the parity bits at 80 and 81, the indices from 82
91
+ let w2 = (sa1.z >> 2u) | (sb0.z << 4u) | (sb1.z << 10u) | (parity_a << 16u) | (parity_b << 17u) | (stream_low << 18u);
92
+
93
+ let w3 = (stream_low >> 14u) | (stream_high << 18u);
94
+
95
+ return vec4<u32>(w0, w1, w2, w3);
96
+ }
97
+ `, [
98
+ chunk_bc7_partition_2,
99
+ ]);
@@ -6,14 +6,16 @@
6
6
  * then blue, seven bits each; alpha likewise; one parity bit per endpoint; then the indices, four
7
7
  * bits each except texel 0's three, because its top bit is implied zero. That last rule is the
8
8
  * encoder's to honour, by swapping the ends when texel 0 lands in the upper half, and this does not
9
- * check it.
9
+ * check it: the top bit is dropped, as the JavaScript writer drops it.
10
10
  *
11
11
  * Endpoints are given as the eight-bit values they decode to — seven stored bits over the parity
12
12
  * bit — so the parity is read off them rather than passed beside them, and a caller cannot hand in
13
13
  * a pair that disagrees with itself.
14
14
  *
15
- * Bit by bit, as the JavaScript writer is, because the fields straddle word boundaries and a
16
- * hundred and twenty-eight iterations are nothing.
15
+ * Each word is composed by shifts at the fields' fixed positions, the two that straddle a word
16
+ * boundary — the second end's green, bits 28 to 34, and the second parity bit, bit 64 — split
17
+ * across them. The JavaScript writer goes bit by bit; here a hundred and twenty-eight iterations
18
+ * over two function-local arrays were 13% of a 4096² encode on a 4090.
17
19
  *
18
20
  * @type {CodeChunk}
19
21
  */
@@ -1 +1 @@
1
- {"version":3,"file":"chunk_bc7_pack_mode6.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/texture/encode/chunk_bc7_pack_mode6.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;GAkBG;AACH,mCAFU,SAAS,CAmDhB;0BAtEuB,oCAAoC"}
1
+ {"version":3,"file":"chunk_bc7_pack_mode6.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/texture/encode/chunk_bc7_pack_mode6.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,mCAFU,SAAS,CAyBhB;0BA9CuB,oCAAoC"}
@@ -1,71 +1,47 @@
1
- import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
2
-
3
- /**
4
- * One BC7 mode 6 block from its two endpoints and sixteen indices, as four little-endian words.
5
- *
6
- * The layout `bc7_write_block` states for mode 6, in the same order for every field: seven mode
7
- * bits — six zeros and a one — then the colour endpoints by channel, red for both ends, then green,
8
- * then blue, seven bits each; alpha likewise; one parity bit per endpoint; then the indices, four
9
- * bits each except texel 0's three, because its top bit is implied zero. That last rule is the
10
- * encoder's to honour, by swapping the ends when texel 0 lands in the upper half, and this does not
11
- * check it.
12
- *
13
- * Endpoints are given as the eight-bit values they decode to — seven stored bits over the parity
14
- * bit — so the parity is read off them rather than passed beside them, and a caller cannot hand in
15
- * a pair that disagrees with itself.
16
- *
17
- * Bit by bit, as the JavaScript writer is, because the fields straddle word boundaries and a
18
- * hundred and twenty-eight iterations are nothing.
19
- *
20
- * @type {CodeChunk}
21
- */
22
- export const chunk_bc7_pack_mode6 = CodeChunk.from(
23
- //language=WGSL
24
- `
25
- fn bc7_pack_mode6(e0: vec4<u32>, e1: vec4<u32>, indices: array<u32, 16>) -> vec4<u32> {
26
- var values: array<u32, 27>;
27
- var counts: array<u32, 27>;
28
-
29
- // mode 6 is signalled by six zero bits and then a one
30
- values[0] = 64u;
31
- counts[0] = 7u;
32
-
33
- for (var channel = 0u; channel < 4u; channel++) {
34
- values[1u + channel * 2u] = e0[channel] >> 1u;
35
- values[2u + channel * 2u] = e1[channel] >> 1u;
36
- counts[1u + channel * 2u] = 7u;
37
- counts[2u + channel * 2u] = 7u;
38
- }
39
-
40
- values[9] = e0.x & 1u;
41
- values[10] = e1.x & 1u;
42
- counts[9] = 1u;
43
- counts[10] = 1u;
44
-
45
- for (var texel = 0u; texel < 16u; texel++) {
46
- values[11u + texel] = indices[texel];
47
- counts[11u + texel] = select(4u, 3u, texel == 0u);
48
- }
49
-
50
- var words = array<u32, 4>(0u, 0u, 0u, 0u);
51
-
52
- var bit = 0u;
53
-
54
- for (var field = 0u; field < 27u; field++) {
55
- let value = values[field];
56
- let count = counts[field];
57
-
58
- for (var k = 0u; k < count; k++) {
59
- if (((value >> k) & 1u) != 0u) {
60
- let at = bit + k;
61
-
62
- words[at >> 5u] |= 1u << (at & 31u);
63
- }
64
- }
65
-
66
- bit += count;
67
- }
68
-
69
- return vec4<u32>(words[0], words[1], words[2], words[3]);
70
- }
71
- `);
1
+ import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
2
+
3
+ /**
4
+ * One BC7 mode 6 block from its two endpoints and sixteen indices, as four little-endian words.
5
+ *
6
+ * The layout `bc7_write_block` states for mode 6, in the same order for every field: seven mode
7
+ * bits — six zeros and a one — then the colour endpoints by channel, red for both ends, then green,
8
+ * then blue, seven bits each; alpha likewise; one parity bit per endpoint; then the indices, four
9
+ * bits each except texel 0's three, because its top bit is implied zero. That last rule is the
10
+ * encoder's to honour, by swapping the ends when texel 0 lands in the upper half, and this does not
11
+ * check it: the top bit is dropped, as the JavaScript writer drops it.
12
+ *
13
+ * Endpoints are given as the eight-bit values they decode to — seven stored bits over the parity
14
+ * bit — so the parity is read off them rather than passed beside them, and a caller cannot hand in
15
+ * a pair that disagrees with itself.
16
+ *
17
+ * Each word is composed by shifts at the fields' fixed positions, the two that straddle a word
18
+ * boundary — the second end's green, bits 28 to 34, and the second parity bit, bit 64 — split
19
+ * across them. The JavaScript writer goes bit by bit; here a hundred and twenty-eight iterations
20
+ * over two function-local arrays were 13% of a 4096² encode on a 4090.
21
+ *
22
+ * @type {CodeChunk}
23
+ */
24
+ export const chunk_bc7_pack_mode6 = CodeChunk.from(
25
+ //language=WGSL
26
+ `
27
+ fn bc7_pack_mode6(e0: vec4<u32>, e1: vec4<u32>, indices: array<u32, 16>) -> vec4<u32> {
28
+ // the seven stored bits of each end's channels
29
+ let s0 = e0 >> vec4<u32>(1u);
30
+ let s1 = e1 >> vec4<u32>(1u);
31
+
32
+ // mode 6 is signalled by six zero bits and then a one, bits 0 to 6; red from bit 7
33
+ let w0 = 64u | (s0.x << 7u) | (s1.x << 14u) | (s0.y << 21u) | (s1.y << 28u);
34
+
35
+ // the parity bits are the ends' low bits, the first at bit 63 and the second at bit 64
36
+ let w1 = (s1.y >> 4u) | (s0.z << 3u) | (s1.z << 10u) | (s0.w << 17u) | (s1.w << 24u) | ((e0.x & 1u) << 31u);
37
+
38
+ let w2 = (e1.x & 1u) | ((indices[0] & 7u) << 1u)
39
+ | (indices[1] << 4u) | (indices[2] << 8u) | (indices[3] << 12u) | (indices[4] << 16u)
40
+ | (indices[5] << 20u) | (indices[6] << 24u) | (indices[7] << 28u);
41
+
42
+ let w3 = indices[8] | (indices[9] << 4u) | (indices[10] << 8u) | (indices[11] << 12u)
43
+ | (indices[12] << 16u) | (indices[13] << 20u) | (indices[14] << 24u) | (indices[15] << 28u);
44
+
45
+ return vec4<u32>(w0, w1, w2, w3);
46
+ }
47
+ `);
@@ -0,0 +1,10 @@
1
+ /**
2
+ * BC7's two-subset partitions as a shader reads them: which texels a pattern puts in the second
3
+ * subset, and that subset's anchor — the texel whose index is stored a bit short. The first
4
+ * subset's anchor is always texel 0, which every pattern puts in the first subset.
5
+ *
6
+ * @type {CodeChunk}
7
+ */
8
+ export const chunk_bc7_partition_2: CodeChunk;
9
+ import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
10
+ //# sourceMappingURL=chunk_bc7_partition_2.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk_bc7_partition_2.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/texture/encode/chunk_bc7_partition_2.js"],"names":[],"mappings":"AA4BA;;;;;;GAMG;AACH,oCAFU,SAAS,CAgBhB;0BAhDuB,oCAAoC"}
@@ -0,0 +1,50 @@
1
+ import { BC7_ANCHOR_2, BC7_PARTITIONS_2 } from "../../../../format/texture/basis/uastc/bc7_tables.js";
2
+ import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
3
+
4
+ /**
5
+ * BC7's sixty-four two-subset partitions, one word each: bit `i` set where texel `i` is in the
6
+ * second subset, and the second subset's anchor texel from bit 16.
7
+ *
8
+ * Built from the tables the UASTC transcoder uses rather than transcribed again, so the encoder and
9
+ * the transcoders cannot disagree about a shape.
10
+ *
11
+ * @returns {string} sixty-four WGSL `u32` literals
12
+ */
13
+ function partition_words() {
14
+ const words = [];
15
+
16
+ for (let partition = 0; partition < 64; partition++) {
17
+ let mask = 0;
18
+
19
+ for (let texel = 0; texel < 16; texel++) {
20
+ mask |= BC7_PARTITIONS_2[partition * 16 + texel] << texel;
21
+ }
22
+
23
+ words.push(`${(mask | (BC7_ANCHOR_2[partition] << 16)) >>> 0}u`);
24
+ }
25
+
26
+ return words.join(', ');
27
+ }
28
+
29
+ /**
30
+ * BC7's two-subset partitions as a shader reads them: which texels a pattern puts in the second
31
+ * subset, and that subset's anchor — the texel whose index is stored a bit short. The first
32
+ * subset's anchor is always texel 0, which every pattern puts in the first subset.
33
+ *
34
+ * @type {CodeChunk}
35
+ */
36
+ export const chunk_bc7_partition_2 = CodeChunk.from(
37
+ //language=WGSL
38
+ `
39
+ const BC7_PARTITION_2 = array<u32, 64>(${partition_words()});
40
+
41
+ // the texels a two-subset partition puts in its second subset, bit i for texel i
42
+ fn bc7_partition_2_mask(pattern: u32) -> u32 {
43
+ return BC7_PARTITION_2[pattern] & 0xFFFFu;
44
+ }
45
+
46
+ // the second subset's anchor texel
47
+ fn bc7_partition_2_anchor(pattern: u32) -> u32 {
48
+ return BC7_PARTITION_2[pattern] >> 16u;
49
+ }
50
+ `);
@@ -1,11 +1,10 @@
1
1
  /**
2
2
  * Every level of a texture to `bc7-rgba-unorm` or its sRGB twin, one invocation per block.
3
3
  *
4
- * **Mode 6 only**, today: the single-subset mode with the finest indices, fitted by
5
- * {@link chunk_bc7_encode_block_mode6} over all four channels. A mode search across the
6
- * partitioned modes is a later quality step, and a separate chunk — this shader would call it
7
- * instead, and nothing about the format or the bytes it produces changes. The dispatch shape is
8
- * {@link shader_texture_encode_bc4}'s; a block is four words.
4
+ * Each block in mode 6 or mode 1, whichever {@link chunk_bc7_encode_block} estimates loses less:
5
+ * one line through all four channels with sixteen levels, or two lines through the colour over one
6
+ * of the sixty-four partitions. The dispatch shape is {@link shader_texture_encode_bc4}'s; a block is
7
+ * four words.
9
8
  *
10
9
  * @type {ComputeShader}
11
10
  */
@@ -1 +1 @@
1
- {"version":3,"file":"shader_texture_encode_bc7.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/texture/encode/shader_texture_encode_bc7.js"],"names":[],"mappings":"AAQA;;;;;;;;;;GAUG;AACH,wCAFU,aAAa,CA2CpB;8BA1D2B,+BAA+B"}
1
+ {"version":3,"file":"shader_texture_encode_bc7.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/texture/encode/shader_texture_encode_bc7.js"],"names":[],"mappings":"AAQA;;;;;;;;;GASG;AACH,wCAFU,aAAa,CA2CpB;8BAzD2B,+BAA+B"}
@@ -1,7 +1,7 @@
1
1
  import { chunk_grid3d_to_index } from "../../shader/chunk/grid/chunk_grid3d_to_index.js";
2
2
  import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
3
3
  import { ComputeShader } from "../../shader/ComputeShader.js";
4
- import { chunk_bc7_encode_block_mode6 } from "./chunk_bc7_encode_block_mode6.js";
4
+ import { chunk_bc7_encode_block } from "./chunk_bc7_encode_block.js";
5
5
  import { chunk_texture_encode_load_block } from "./chunk_texture_encode_load_block.js";
6
6
  import { TEXTURE_ENCODE_WORKGROUP_SIZE } from "./shader_texture_encode_bc4.js";
7
7
  import { texture_encode_resources } from "./texture_encode_resources.js";
@@ -9,11 +9,10 @@ import { texture_encode_resources } from "./texture_encode_resources.js";
9
9
  /**
10
10
  * Every level of a texture to `bc7-rgba-unorm` or its sRGB twin, one invocation per block.
11
11
  *
12
- * **Mode 6 only**, today: the single-subset mode with the finest indices, fitted by
13
- * {@link chunk_bc7_encode_block_mode6} over all four channels. A mode search across the
14
- * partitioned modes is a later quality step, and a separate chunk — this shader would call it
15
- * instead, and nothing about the format or the bytes it produces changes. The dispatch shape is
16
- * {@link shader_texture_encode_bc4}'s; a block is four words.
12
+ * Each block in mode 6 or mode 1, whichever {@link chunk_bc7_encode_block} estimates loses less:
13
+ * one line through all four channels with sixteen levels, or two lines through the colour over one
14
+ * of the sixty-four partitions. The dispatch shape is {@link shader_texture_encode_bc4}'s; a block is
15
+ * four words.
17
16
  *
18
17
  * @type {ComputeShader}
19
18
  */
@@ -44,7 +43,7 @@ fn main(
44
43
 
45
44
  let texels = texture_encode_load_block(level, block_x, block_y);
46
45
 
47
- let packed = bc7_encode_block_mode6(texels);
46
+ let packed = bc7_encode_block(texels);
48
47
 
49
48
  let word = level.word_offset + block_y * level.row_stride_words + block_x * 4u;
50
49
 
@@ -56,6 +55,6 @@ fn main(
56
55
  `, [
57
56
  chunk_grid3d_to_index,
58
57
  chunk_texture_encode_load_block,
59
- chunk_bc7_encode_block_mode6,
58
+ chunk_bc7_encode_block,
60
59
  ]),
61
60
  });
@@ -34,7 +34,10 @@ export class GPUViewVolumetrics {
34
34
  * module that starts the froxel irradiance volume
35
35
  * @returns {{resolved: number, metadata: number, irradiance: {Y: number, CoCg: number}}} the
36
36
  * integrated aerial LUT, the metadata buffer, and the froxel irradiance volume
37
- * (chunk_volumetrics_irradiance_sh) for the transparent surfaces the lighting pass cannot see
37
+ * (chunk_volumetrics_irradiance_sh) that lit particles are lit by. The two do not depend on
38
+ * each other, and a pass building only one of them is culled when nothing reads it. A scene
39
+ * with no participating-media volume records no fog at all, and `resolved` is then a constant:
40
+ * no in-scatter, full transmittance.
38
41
  */
39
42
  graph_update({ graph, light_cluster_data, light_cluster_lookup, light_cluster_parameters, shadowmap_atlas, indirect_lighting_mode, }: {
40
43
  graph: FrameGraph;
@@ -1 +1 @@
1
- {"version":3,"file":"GPUViewVolumetrics.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/volumetrics/GPUViewVolumetrics.js"],"names":[],"mappings":"AAiCA;IAkII;;;;OAIG;IACH,kBAHW,cAAc,qBAwBxB;IAxHD;;OAEG;IACH,4BAOC;IAjBD;;OAEG;IACH,2BAEC;IAsCD;;OAEG;IACH,0BAEC;IAZD;;OAEG;IACH,yBAEC;IAwFD,gBAWC;IA6ND;;;;;;;;;;;;;OAaG;IACH;QAX+B,KAAK,EAAzB,UAAU;QACM,kBAAkB,EAAlC,MAAM;QACU,oBAAoB,EAApC,MAAM;QACU,wBAAwB,EAAxC,MAAM;QACU,eAAe,EAA/B,MAAM;QACuE,sBAAsB,EAAnG,OAAO,iCAAiC,EAAE,yBAAyB;QAEjE;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE;YAAC,CAAC,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAC,CAAA;KAAC,CAyFvF;;CAEJ;yBApfY,OAAO,2DAA2D,EAAE,UAAU;6BAC9E,OAAO,2BAA2B,EAAE,cAAc"}
1
+ {"version":3,"file":"GPUViewVolumetrics.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/volumetrics/GPUViewVolumetrics.js"],"names":[],"mappings":"AAkCA;IA2II;;;;OAIG;IACH,kBAHW,cAAc,qBAyCxB;IAlJD;;OAEG;IACH,4BAOC;IAjBD;;OAEG;IACH,2BAEC;IAsCD;;OAEG;IACH,0BAEC;IAZD;;OAEG;IACH,yBAEC;IAkHD,gBAaC;IA6ND;;;;;;;;;;;;;;;;OAgBG;IACH;QAd+B,KAAK,EAAzB,UAAU;QACM,kBAAkB,EAAlC,MAAM;QACU,oBAAoB,EAApC,MAAM;QACU,wBAAwB,EAAxC,MAAM;QACU,eAAe,EAA/B,MAAM;QACuE,sBAAsB,EAAnG,OAAO,iCAAiC,EAAE,yBAAyB;QAEjE;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE;YAAC,CAAC,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAC,CAAA;KAAC,CAmIvF;;CAEJ;yBA1jBY,OAAO,2DAA2D,EAAE,UAAU;6BAC9E,OAAO,2BAA2B,EAAE,cAAc"}
@@ -10,6 +10,7 @@ import {
10
10
  build_volumetrics_sun_shadow_transform,
11
11
  volumetrics_sun_shadow_cascade_far
12
12
  } from "./build_volumetrics_sun_shadow_transform.js";
13
+ import { graph_build_froxel_irradiance } from "./graph_build_froxel_irradiance.js";
13
14
  import { graph_build_volumetrics } from "./graph_build_volumetrics.js";
14
15
  import {
15
16
  VOLUMETRICS_SUN_SHADOW_CASCADE_COUNT,
@@ -151,6 +152,15 @@ export class GPUViewVolumetrics {
151
152
  */
152
153
  #sun_shadow_cascade_far = new Float32Array(4);
153
154
 
155
+ /**
156
+ * What the fog integrates to through no medium: nothing in-scattered (.rgb 0), everything
157
+ * transmitted (.a 1). Handed out in place of the aerial LUT on a frame whose scene has no
158
+ * participating-media volume, so every surface that samples the fog keeps doing so and reads
159
+ * it as none, for one texel and no pass. Written once, at construction.
160
+ * @type {GPUTextureContext}
161
+ */
162
+ #no_medium;
163
+
154
164
  /**
155
165
  * @type {GPUTypedBuffer}
156
166
  */
@@ -181,6 +191,23 @@ export class GPUViewVolumetrics {
181
191
  this.#volumetrics_textures[i] = texture;
182
192
  }
183
193
 
194
+ const no_medium = new GPUTextureContext(device);
195
+ no_medium.descriptor.label = "volumetrics/no medium";
196
+ no_medium.descriptor.format = "rgba16float";
197
+ no_medium.descriptor.dimension = "3d";
198
+ no_medium.descriptor.size = [1, 1, 1];
199
+ no_medium.descriptor.usage = GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST;
200
+
201
+ device.queue.writeTexture(
202
+ { texture: no_medium.gpu_texture },
203
+ new Float16Array([0, 0, 0, 1]),
204
+ { bytesPerRow: 8, rowsPerImage: 1 },
205
+ [1, 1, 1]
206
+ );
207
+ no_medium.incrementVersion();
208
+
209
+ this.#no_medium = no_medium;
210
+
184
211
  this.#metadata = GPUTypedBuffer.create({
185
212
  type: VOLUMETRICS_METADATA_STRUCT,
186
213
  device,
@@ -200,6 +227,8 @@ export class GPUViewVolumetrics {
200
227
  textures[i] = null;
201
228
  }
202
229
 
230
+ this.#no_medium.destroy();
231
+
203
232
  }
204
233
 
205
234
  #update_resolution() {
@@ -433,7 +462,10 @@ export class GPUViewVolumetrics {
433
462
  * module that starts the froxel irradiance volume
434
463
  * @returns {{resolved: number, metadata: number, irradiance: {Y: number, CoCg: number}}} the
435
464
  * integrated aerial LUT, the metadata buffer, and the froxel irradiance volume
436
- * (chunk_volumetrics_irradiance_sh) for the transparent surfaces the lighting pass cannot see
465
+ * (chunk_volumetrics_irradiance_sh) that lit particles are lit by. The two do not depend on
466
+ * each other, and a pass building only one of them is culled when nothing reads it. A scene
467
+ * with no participating-media volume records no fog at all, and `resolved` is then a constant:
468
+ * no in-scatter, full transmittance.
437
469
  */
438
470
  graph_update({
439
471
  graph,
@@ -479,6 +511,35 @@ export class GPUViewVolumetrics {
479
511
 
480
512
  const resolution = this.#volumetrics_textures[0].size;
481
513
 
514
+ // Particle lighting first, and on its own: it reads no medium. The frame graph culls it when
515
+ // nothing reads it.
516
+ const irradiance = graph_build_froxel_irradiance({
517
+ graph,
518
+ camera,
519
+ view,
520
+ lights,
521
+ light_cluster_data,
522
+ light_cluster_lookup,
523
+ light_cluster_parameters,
524
+ shadowmap_atlas,
525
+ volumetrics_metadata: gr_metadata,
526
+ resolution,
527
+ indirect_lighting_mode,
528
+ });
529
+
530
+ if (view.scene.volumetrics.source.volumes.length === 0) {
531
+ // No medium: nothing scatters and nothing absorbs, so the fog is the identity everywhere
532
+ // and the passes that would integrate it to that are not recorded. Nothing accumulates
533
+ // either, which leaves the history stale for whenever a volume arrives.
534
+ this.#reset_history = true;
535
+
536
+ return {
537
+ resolved: graph_import_texture(graph, this.#no_medium, "volumetrics no medium"),
538
+ metadata: gr_metadata,
539
+ irradiance,
540
+ };
541
+ }
542
+
482
543
  // Ping-pong the two persistent froxel textures: this frame writes [parity] and reads the
483
544
  // previous frame's accumulation from [parity ^ 1]. On the first frame / after a resize the
484
545
  // history is invalid, which #update_metadata signals via history_reset (the TAA then emits
@@ -493,16 +554,26 @@ export class GPUViewVolumetrics {
493
554
  taa_output = graph_import_texture(graph, this.#volumetrics_textures[parity], "volumetrics taa output");
494
555
  }
495
556
 
496
- const { lut_aerial, irradiance } = graph_build_volumetrics({
557
+ /*
558
+ The sun's transmittance and the multiple scattering are the scene sky's, built once and
559
+ read from here on. Brought current now rather than in a pass: the sky submits commands of
560
+ its own, which land ahead of this frame's -- recorded into the frame graph they would be
561
+ paid every frame, which is what they used to be. A no-op after the first call.
562
+ */
563
+ const sky = view.scene.sky;
564
+
565
+ sky.update();
566
+
567
+ const { lut_aerial } = graph_build_volumetrics({
497
568
  graph,
498
569
  camera,
499
570
  lights,
500
571
  view,
572
+ sky,
501
573
  light_cluster_data,
502
574
  light_cluster_lookup,
503
575
  light_cluster_parameters,
504
576
  shadowmap_atlas,
505
- indirect_lighting_mode,
506
577
 
507
578
  volumetrics_metadata: gr_metadata,
508
579
  volumetric_resolution: resolution,