@woosh/meep-engine 3.76.0 → 3.78.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 (265) hide show
  1. package/editor/particles/effect/ParticleReferenceSimulation.d.ts +11 -0
  2. package/editor/particles/effect/ParticleReferenceSimulation.d.ts.map +1 -1
  3. package/editor/particles/effect/ParticleReferenceSimulation.js +14 -0
  4. package/editor/view/particles/effect/ParticleGraphEditorView.js +1 -1
  5. package/package.json +3 -2
  6. package/src/engine/EngineHarness.d.ts +4 -6
  7. package/src/engine/EngineHarness.d.ts.map +1 -1
  8. package/src/engine/EngineHarness.js +11 -19
  9. package/src/engine/asset/loaders/GroomAssetLoader.d.ts +1 -1
  10. package/src/engine/asset/loaders/GroomAssetLoader.d.ts.map +1 -1
  11. package/src/engine/asset/loaders/GroomAssetLoader.js +16 -2
  12. package/src/engine/graphics/ecs/hair/Hair.d.ts +7 -0
  13. package/src/engine/graphics/ecs/hair/Hair.d.ts.map +1 -1
  14. package/src/engine/graphics/ecs/hair/Hair.js +9 -0
  15. package/src/engine/graphics/ecs/hair/HairDynamics.d.ts +63 -0
  16. package/src/engine/graphics/ecs/hair/HairDynamics.d.ts.map +1 -0
  17. package/src/engine/graphics/ecs/hair/HairDynamics.js +82 -0
  18. package/src/engine/graphics/hair/Groom.d.ts +45 -0
  19. package/src/engine/graphics/hair/Groom.d.ts.map +1 -1
  20. package/src/engine/graphics/hair/Groom.js +56 -0
  21. package/src/engine/graphics/hair/GroomSerializationAdapter.d.ts +27 -1
  22. package/src/engine/graphics/hair/GroomSerializationAdapter.d.ts.map +1 -1
  23. package/src/engine/graphics/hair/GroomSerializationAdapter.js +105 -32
  24. package/src/engine/graphics/hair/GroomSerializationUpgrader_0_1.d.ts +8 -0
  25. package/src/engine/graphics/hair/GroomSerializationUpgrader_0_1.d.ts.map +1 -0
  26. package/src/engine/graphics/hair/GroomSerializationUpgrader_0_1.js +31 -0
  27. package/src/engine/graphics/hair/groom_bind_to_mesh.d.ts +85 -0
  28. package/src/engine/graphics/hair/groom_bind_to_mesh.d.ts.map +1 -0
  29. package/src/engine/graphics/hair/groom_bind_to_mesh.js +216 -0
  30. package/src/engine/graphics/hair/groom_build_group.d.ts +7 -2
  31. package/src/engine/graphics/hair/groom_build_group.d.ts.map +1 -1
  32. package/src/engine/graphics/hair/groom_build_group.js +11 -2
  33. package/src/engine/graphics/hair/groom_build_guides.d.ts +43 -0
  34. package/src/engine/graphics/hair/groom_build_guides.d.ts.map +1 -0
  35. package/src/engine/graphics/hair/groom_build_guides.js +267 -0
  36. package/src/engine/graphics/hair/groom_root_spacing.d.ts +6 -4
  37. package/src/engine/graphics/hair/groom_root_spacing.d.ts.map +1 -1
  38. package/src/engine/graphics/hair/groom_root_spacing.js +199 -66
  39. package/src/engine/graphics3/HairColliderSystem.d.ts +59 -0
  40. package/src/engine/graphics3/HairColliderSystem.d.ts.map +1 -0
  41. package/src/engine/graphics3/HairColliderSystem.js +270 -0
  42. package/src/engine/graphics3/HairSystem.d.ts +21 -4
  43. package/src/engine/graphics3/HairSystem.d.ts.map +1 -1
  44. package/src/engine/graphics3/HairSystem.js +270 -4
  45. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  46. package/src/engine/sound/sopra/runtime/EventInstance.d.ts +0 -1
  47. package/src/engine/sound/sopra/runtime/EventInstance.d.ts.map +1 -1
  48. package/src/engine/sound/sopra/runtime/EventInstance.js +0 -1
  49. package/src/shade/assets/textures/hair_scattering.bin +0 -0
  50. package/src/shade/playground/hair/main.js +27 -4
  51. package/src/shade/playground/hair_skinned/index.html +192 -0
  52. package/src/shade/playground/hair_skinned/main.d.ts +7 -0
  53. package/src/shade/playground/hair_skinned/main.d.ts.map +1 -0
  54. package/src/shade/playground/hair_skinned/main.js +481 -0
  55. package/src/shade/playground/hair_skinned/skinned_hair.d.ts +49 -0
  56. package/src/shade/playground/hair_skinned/skinned_hair.d.ts.map +1 -0
  57. package/src/shade/playground/hair_skinned/skinned_hair.js +362 -0
  58. package/src/shade/playground/sparks/README.md +36 -0
  59. package/src/shade/playground/sparks/index.html +145 -0
  60. package/src/shade/playground/sparks/main.d.ts +7 -0
  61. package/src/shade/playground/sparks/main.d.ts.map +1 -0
  62. package/src/shade/playground/sparks/main.js +312 -0
  63. package/src/shade/playground/sparks/sparks_effect.d.ts +72 -0
  64. package/src/shade/playground/sparks/sparks_effect.d.ts.map +1 -0
  65. package/src/shade/playground/sparks/sparks_effect.js +180 -0
  66. package/src/shade/renderer/Renderer.d.ts.map +1 -1
  67. package/src/shade/renderer/Renderer.js +18 -3
  68. package/src/shade/renderer/acoustics/GPUAcousticLattice.d.ts +1 -1
  69. package/src/shade/renderer/acoustics/GPUAcousticProbes.d.ts +1 -1
  70. package/src/shade/renderer/acoustics/GPUAcoustics.d.ts +1 -1
  71. package/src/shade/renderer/animation/GPUAnimationManager.d.ts +3 -2
  72. package/src/shade/renderer/animation/GPUAnimationManager.d.ts.map +1 -1
  73. package/src/shade/renderer/animation/GPUAnimationManager.js +74 -3
  74. package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.d.ts +13 -3
  75. package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.d.ts.map +1 -1
  76. package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.js +16 -5
  77. package/src/shade/renderer/animation/skinning/shader_meshlet_apply_skinning.js +8 -8
  78. package/src/shade/renderer/deferred/chunk_shade_direct_lights.js +2 -2
  79. package/src/shade/renderer/deferred/chunk_shade_directional_lights.d.ts +4 -2
  80. package/src/shade/renderer/deferred/chunk_shade_directional_lights.d.ts.map +1 -1
  81. package/src/shade/renderer/deferred/chunk_shade_directional_lights.js +7 -3
  82. package/src/shade/renderer/deferred/chunk_standard_material_direct_light_lobe.js +1 -1
  83. package/src/shade/renderer/extension/ShadowAtlas.d.ts +77 -0
  84. package/src/shade/renderer/extension/ShadowAtlas.d.ts.map +1 -0
  85. package/src/shade/renderer/extension/ShadowAtlas.js +135 -0
  86. package/src/shade/renderer/fluid/GPUFluidCascade.d.ts +3 -3
  87. package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts +1 -1
  88. package/src/shade/renderer/fluid/forcing/GPUFluidForcing.d.ts +7 -7
  89. package/src/shade/renderer/fluid/pressure/GPUFluidPressureSolve.d.ts +1 -1
  90. package/src/shade/renderer/fluid/query/GPUFluidQueries.d.ts +1 -1
  91. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts +1 -1
  92. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUSceneBrickClipmap.d.ts +37 -7
  93. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUSceneBrickClipmap.d.ts.map +1 -1
  94. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUSceneBrickClipmap.js +132 -8
  95. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.d.ts +3 -1
  96. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.d.ts.map +1 -1
  97. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.js +6 -2
  98. package/src/shade/renderer/global_illumination/sharc/sharc_constants.d.ts +0 -18
  99. package/src/shade/renderer/global_illumination/sharc/sharc_constants.d.ts.map +1 -1
  100. package/src/shade/renderer/global_illumination/sharc/sharc_constants.js +1 -21
  101. package/src/shade/renderer/hair/GPUHairSystem.d.ts +121 -2
  102. package/src/shade/renderer/hair/GPUHairSystem.d.ts.map +1 -1
  103. package/src/shade/renderer/hair/GPUHairSystem.js +1187 -56
  104. package/src/shade/renderer/hair/HAIR.d.ts +22 -3
  105. package/src/shade/renderer/hair/HAIR.d.ts.map +1 -1
  106. package/src/shade/renderer/hair/HAIR.js +25 -4
  107. package/src/shade/renderer/hair/HAIR_DATABASE_SPEC.d.ts.map +1 -1
  108. package/src/shade/renderer/hair/HAIR_DATABASE_SPEC.js +33 -0
  109. package/src/shade/renderer/hair/HAIR_FRAME_STRUCTS.d.ts +4 -0
  110. package/src/shade/renderer/hair/HAIR_FRAME_STRUCTS.d.ts.map +1 -1
  111. package/src/shade/renderer/hair/HAIR_FRAME_STRUCTS.js +24 -2
  112. package/src/shade/renderer/hair/HAIR_SIMULATION.d.ts +139 -0
  113. package/src/shade/renderer/hair/HAIR_SIMULATION.d.ts.map +1 -0
  114. package/src/shade/renderer/hair/HAIR_SIMULATION.js +160 -0
  115. package/src/shade/renderer/hair/chunk_hair_dual_scattering.d.ts +9 -2
  116. package/src/shade/renderer/hair/chunk_hair_dual_scattering.d.ts.map +1 -1
  117. package/src/shade/renderer/hair/chunk_hair_dual_scattering.js +40 -13
  118. package/src/shade/renderer/hair/chunk_hair_guide.d.ts +59 -0
  119. package/src/shade/renderer/hair/chunk_hair_guide.d.ts.map +1 -0
  120. package/src/shade/renderer/hair/chunk_hair_guide.js +179 -0
  121. package/src/shade/renderer/hair/chunk_hair_volume.d.ts +4 -3
  122. package/src/shade/renderer/hair/chunk_hair_volume.d.ts.map +1 -1
  123. package/src/shade/renderer/hair/chunk_hair_volume.js +21 -12
  124. package/src/shade/renderer/hair/hair_lighting.d.ts.map +1 -1
  125. package/src/shade/renderer/hair/hair_lighting.js +16 -7
  126. package/src/shade/renderer/hair/hair_scattering_lut.js +13 -13
  127. package/src/shade/renderer/hair/hair_shadow_draw.d.ts +32 -0
  128. package/src/shade/renderer/hair/hair_shadow_draw.d.ts.map +1 -0
  129. package/src/shade/renderer/hair/hair_shadow_draw.js +123 -0
  130. package/src/shade/renderer/hair/shader_hair_classes.d.ts +2 -1
  131. package/src/shade/renderer/hair/shader_hair_classes.d.ts.map +1 -1
  132. package/src/shade/renderer/hair/shader_hair_classes.js +6 -2
  133. package/src/shade/renderer/hair/shader_hair_cull.d.ts +8 -2
  134. package/src/shade/renderer/hair/shader_hair_cull.d.ts.map +1 -1
  135. package/src/shade/renderer/hair/shader_hair_cull.js +74 -17
  136. package/src/shade/renderer/hair/shader_hair_lod.d.ts +9 -3
  137. package/src/shade/renderer/hair/shader_hair_lod.d.ts.map +1 -1
  138. package/src/shade/renderer/hair/shader_hair_lod.js +125 -31
  139. package/src/shade/renderer/hair/shader_hair_roots.d.ts +36 -0
  140. package/src/shade/renderer/hair/shader_hair_roots.d.ts.map +1 -0
  141. package/src/shade/renderer/hair/shader_hair_roots.js +261 -0
  142. package/src/shade/renderer/hair/shader_hair_shadow_list.d.ts +44 -0
  143. package/src/shade/renderer/hair/shader_hair_shadow_list.d.ts.map +1 -0
  144. package/src/shade/renderer/hair/shader_hair_shadow_list.js +240 -0
  145. package/src/shade/renderer/hair/shader_hair_simulate.d.ts +55 -0
  146. package/src/shade/renderer/hair/shader_hair_simulate.d.ts.map +1 -0
  147. package/src/shade/renderer/hair/shader_hair_simulate.js +563 -0
  148. package/src/shade/renderer/hair/shader_hair_volume.d.ts +3 -3
  149. package/src/shade/renderer/hair/shader_hair_volume.d.ts.map +1 -1
  150. package/src/shade/renderer/hair/shader_hair_volume.js +4 -17
  151. package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
  152. package/src/shade/renderer/loader/usd/usd_groom_extension.d.ts +8 -3
  153. package/src/shade/renderer/loader/usd/usd_groom_extension.d.ts.map +1 -1
  154. package/src/shade/renderer/loader/usd/usd_groom_extension.js +58 -5
  155. package/src/shade/renderer/particles/GPUParticleSystem.d.ts +8 -0
  156. package/src/shade/renderer/particles/GPUParticleSystem.d.ts.map +1 -1
  157. package/src/shade/renderer/particles/GPUParticleSystem.js +28 -0
  158. package/src/shade/renderer/particles/graph/ParticleNodeRegistry.d.ts.map +1 -1
  159. package/src/shade/renderer/particles/graph/ParticleNodeRegistry.js +22 -0
  160. package/src/shade/renderer/particles/graph/groups/particle_builtin_groups.d.ts.map +1 -1
  161. package/src/shade/renderer/particles/graph/groups/particle_builtin_groups.js +4 -0
  162. package/src/shade/renderer/particles/graph/groups/particle_groups_scene.d.ts +32 -0
  163. package/src/shade/renderer/particles/graph/groups/particle_groups_scene.d.ts.map +1 -0
  164. package/src/shade/renderer/particles/graph/groups/particle_groups_scene.js +80 -0
  165. package/src/shade/renderer/particles/graph/particle_node_parameters.d.ts.map +1 -1
  166. package/src/shade/renderer/particles/graph/particle_node_parameters.js +1 -0
  167. package/src/shade/renderer/particles/graph/particle_node_presentation.d.ts.map +1 -1
  168. package/src/shade/renderer/particles/graph/particle_node_presentation.js +12 -0
  169. package/src/shade/renderer/particles/graph_particles.d.ts +5 -1
  170. package/src/shade/renderer/particles/graph_particles.d.ts.map +1 -1
  171. package/src/shade/renderer/particles/graph_particles.js +18 -3
  172. package/src/shade/renderer/particles/isa/InstructionStream.d.ts +25 -0
  173. package/src/shade/renderer/particles/isa/InstructionStream.d.ts.map +1 -1
  174. package/src/shade/renderer/particles/isa/InstructionStream.js +25 -0
  175. package/src/shade/renderer/particles/isa/ParticleVMISA.d.ts +9 -0
  176. package/src/shade/renderer/particles/isa/ParticleVMISA.d.ts.map +1 -1
  177. package/src/shade/renderer/particles/isa/ParticleVMISA.js +20 -0
  178. package/src/shade/renderer/particles/isa/particle_program_reads_scene_sdf.d.ts +9 -0
  179. package/src/shade/renderer/particles/isa/particle_program_reads_scene_sdf.d.ts.map +1 -0
  180. package/src/shade/renderer/particles/isa/particle_program_reads_scene_sdf.js +29 -0
  181. package/src/shade/renderer/particles/optimizer/particle_program_equivalence.d.ts +2 -1
  182. package/src/shade/renderer/particles/optimizer/particle_program_equivalence.d.ts.map +1 -1
  183. package/src/shade/renderer/particles/optimizer/particle_program_equivalence.js +27 -5
  184. package/src/shade/renderer/particles/optimizer/particle_program_fuzz.js +1 -1
  185. package/src/shade/renderer/particles/optimizer/particle_vm_semantics.d.ts.map +1 -1
  186. package/src/shade/renderer/particles/optimizer/particle_vm_semantics.js +5 -0
  187. package/src/shade/renderer/particles/runtime/EmitterRegistry.d.ts +7 -0
  188. package/src/shade/renderer/particles/runtime/EmitterRegistry.d.ts.map +1 -1
  189. package/src/shade/renderer/particles/runtime/EmitterRegistry.js +10 -0
  190. package/src/shade/renderer/particles/runtime/ParticleEmitter.d.ts +5 -0
  191. package/src/shade/renderer/particles/runtime/ParticleEmitter.d.ts.map +1 -1
  192. package/src/shade/renderer/particles/runtime/ParticleEmitter.js +5 -0
  193. package/src/shade/renderer/particles/runtime/ProgramHeap.d.ts +8 -0
  194. package/src/shade/renderer/particles/runtime/ProgramHeap.d.ts.map +1 -1
  195. package/src/shade/renderer/particles/runtime/ProgramHeap.js +25 -0
  196. package/src/shade/renderer/particles/shaders/shader_particle_emit.d.ts +1 -1
  197. package/src/shade/renderer/particles/shaders/shader_particle_emit.d.ts.map +1 -1
  198. package/src/shade/renderer/particles/shaders/shader_particle_emit.js +9 -3
  199. package/src/shade/renderer/particles/shaders/shader_particle_emit_wide.d.ts.map +1 -1
  200. package/src/shade/renderer/particles/shaders/shader_particle_emit_wide.js +4 -2
  201. package/src/shade/renderer/particles/shaders/shader_particle_simulate.d.ts +2 -2
  202. package/src/shade/renderer/particles/shaders/shader_particle_simulate.d.ts.map +1 -1
  203. package/src/shade/renderer/particles/shaders/shader_particle_simulate.js +10 -4
  204. package/src/shade/renderer/particles/shaders/shader_particle_simulate_wide.d.ts.map +1 -1
  205. package/src/shade/renderer/particles/shaders/shader_particle_simulate_wide.js +4 -2
  206. package/src/shade/renderer/particles/vm/ParticleVMReference.d.ts +14 -1
  207. package/src/shade/renderer/particles/vm/ParticleVMReference.d.ts.map +1 -1
  208. package/src/shade/renderer/particles/vm/ParticleVMReference.js +34 -1
  209. package/src/shade/renderer/particles/vm/chunk_particle_vm.d.ts.map +1 -1
  210. package/src/shade/renderer/particles/vm/chunk_particle_vm.js +10 -0
  211. package/src/shade/renderer/particles/vm/chunk_particle_vm_scene_sdf.d.ts +39 -0
  212. package/src/shade/renderer/particles/vm/chunk_particle_vm_scene_sdf.d.ts.map +1 -0
  213. package/src/shade/renderer/particles/vm/chunk_particle_vm_scene_sdf.js +90 -0
  214. package/src/shade/renderer/particles/warmup/graph_particle_warmup.d.ts +4 -1
  215. package/src/shade/renderer/particles/warmup/graph_particle_warmup.d.ts.map +1 -1
  216. package/src/shade/renderer/particles/warmup/graph_particle_warmup.js +14 -2
  217. package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance.d.ts +1 -1
  218. package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance.d.ts.map +1 -1
  219. package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance.js +9 -3
  220. package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance_wide.d.ts.map +1 -1
  221. package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance_wide.js +4 -2
  222. package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
  223. package/src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.d.ts +7 -4
  224. package/src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.d.ts.map +1 -1
  225. package/src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.js +26 -16
  226. package/src/shade/renderer/rasterize/draw/chunk_meshlet_draw_vertex.d.ts +7 -4
  227. package/src/shade/renderer/rasterize/draw/chunk_meshlet_draw_vertex.d.ts.map +1 -1
  228. package/src/shade/renderer/rasterize/draw/chunk_meshlet_draw_vertex.js +66 -14
  229. package/src/shade/renderer/rasterize/native/depth/shadow_cascade_rasterization_pass_descriptor.d.ts +20 -0
  230. package/src/shade/renderer/rasterize/native/depth/shadow_cascade_rasterization_pass_descriptor.d.ts.map +1 -0
  231. package/src/shade/renderer/rasterize/native/depth/shadow_cascade_rasterization_pass_descriptor.js +149 -0
  232. package/src/shade/renderer/rasterize/native/depth/shadow_rasterization_alpha_tested_pass_descriptor.d.ts +8 -0
  233. package/src/shade/renderer/rasterize/native/depth/shadow_rasterization_alpha_tested_pass_descriptor.d.ts.map +1 -1
  234. package/src/shade/renderer/rasterize/native/depth/shadow_rasterization_alpha_tested_pass_descriptor.js +100 -33
  235. package/src/shade/renderer/rasterize/native/rasterization_shader_resources.d.ts +11 -0
  236. package/src/shade/renderer/rasterize/native/rasterization_shader_resources.d.ts.map +1 -1
  237. package/src/shade/renderer/rasterize/native/rasterization_shader_resources.js +24 -11
  238. package/src/shade/renderer/scene/GPUSceneContext.d.ts +7 -0
  239. package/src/shade/renderer/scene/GPUSceneContext.d.ts.map +1 -1
  240. package/src/shade/renderer/scene/GPUSceneContext.js +18 -0
  241. package/src/shade/renderer/shader/chunk/geometry/meshlet/chunk_read_meshlet_vertex_normal.d.ts +13 -0
  242. package/src/shade/renderer/shader/chunk/geometry/meshlet/chunk_read_meshlet_vertex_normal.d.ts.map +1 -0
  243. package/src/shade/renderer/shader/chunk/geometry/meshlet/chunk_read_meshlet_vertex_normal.js +42 -0
  244. package/src/shade/renderer/shader/chunk/sdf/chunk_shape_record_signed_distance_gradient.d.ts +20 -0
  245. package/src/shade/renderer/shader/chunk/sdf/chunk_shape_record_signed_distance_gradient.d.ts.map +1 -0
  246. package/src/shade/renderer/shader/chunk/sdf/chunk_shape_record_signed_distance_gradient.js +134 -0
  247. package/src/shade/renderer/shadow/map/GPUSceneShadowmapContext.d.ts +15 -0
  248. package/src/shade/renderer/shadow/map/GPUSceneShadowmapContext.d.ts.map +1 -1
  249. package/src/shade/renderer/shadow/map/GPUSceneShadowmapContext.js +83 -5
  250. package/src/shade/renderer/shadow/map/shader/chunk_sample_shadowmap_cascade.d.ts +34 -0
  251. package/src/shade/renderer/shadow/map/shader/chunk_sample_shadowmap_cascade.d.ts.map +1 -0
  252. package/src/shade/renderer/shadow/map/shader/chunk_sample_shadowmap_cascade.js +106 -0
  253. package/src/shade/renderer/shadow/map/shader/chunk_shadow_cascade_caster_position.d.ts +16 -0
  254. package/src/shade/renderer/shadow/map/shader/chunk_shadow_cascade_caster_position.d.ts.map +1 -0
  255. package/src/shade/renderer/shadow/map/shader/chunk_shadow_cascade_caster_position.js +50 -0
  256. package/src/shade/renderer/shadow/map/shader/chunk_shadow_caster_depth_bias.d.ts +25 -0
  257. package/src/shade/renderer/shadow/map/shader/chunk_shadow_caster_depth_bias.d.ts.map +1 -0
  258. package/src/shade/renderer/shadow/map/shader/chunk_shadow_caster_depth_bias.js +42 -0
  259. package/src/shade/renderer/shadow/map/shader/chunk_shadowmap_directional_atlas_casters.d.ts +10 -0
  260. package/src/shade/renderer/shadow/map/shader/chunk_shadowmap_directional_atlas_casters.d.ts.map +1 -0
  261. package/src/shade/renderer/shadow/map/shader/chunk_shadowmap_directional_atlas_casters.js +22 -0
  262. package/src/shade/renderer/shadow/map/shader/chunk_shadowmap_sample_directional_cascades.d.ts +1 -1
  263. package/src/shade/renderer/shadow/map/shader/chunk_shadowmap_sample_directional_cascades.js +5 -5
  264. package/src/shade/renderer/water/query/GPUWaterQueries.d.ts +1 -1
  265. package/src/shade/renderer/wind/GPUSceneWind.d.ts +1 -1
@@ -2,14 +2,18 @@
2
2
  * The words and bits the hair passes share.
3
3
  *
4
4
  * **A frame's deformed points** are one buffer of `vec4<u32>`, two halves of `point capacity` each: in the first,
5
- * a point as it is now (x, y, z in f32 bits, then half its drawn width, f32 bits, negative for a point drawn at no
6
- * width); in the second, at the same index
5
+ * a point as it is now (x, y, z in f32 bits, then half its drawn width, f32 bits, negated for a point the view draws at
6
+ * no width, which a view of a finer floor may still draw); in the second, at the same index
7
7
  * plus the capacity, where it was a frame ago (x, y, z in f32 bits) and its tag: the row of its instance in the
8
8
  * low {@link HAIR_ROW_BITS} bits, its strand's variation byte above them. A strand's points are consecutive, root
9
9
  * first; the index of a strand's first point is its **slot**.
10
10
  *
11
11
  * **A draw list entry** is a strand: its slot, with its point class above {@link HAIR_CLASS_SHIFT}. A strand of
12
- * class `c` has `2^c` segments.
12
+ * class `c` has `2^c` segments. A class's region of the list holds first the strands of instances the view draws,
13
+ * from its start, then those of instances only the shadow views draw, from its start plus the first's count. Where
14
+ * the strands cast shadows, the list is followed, at its capacity, by two words an entry
15
+ * ({@link HAIR_LIST_SHADOW_WORDS}): the widest half width any point of the strand is drawn at, then the farthest any
16
+ * point of it is from its root, metres, f32 bits.
13
17
  *
14
18
  * **An instance's density volume** is a box of voxels around its strands, cubes of one edge, in the frame's voxel
15
19
  * buffer (`u32`) from its LOD record's `voxel_base`: {@link HAIR_VOLUME_MIPS} levels one after another, x fastest,
@@ -76,6 +80,12 @@ export const HAIR_VOLUME_MIPS: number;
76
80
  * @type {number}
77
81
  */
78
82
  export const HAIR_VOLUME_DIMENSION_LIMIT: number;
83
+ /**
84
+ * The most steps a segment is laid into a volume at, two thirds of a voxel each: a segment lies inside its
85
+ * instance's box, so it is no longer than the box's diagonal, `√3 · HAIR_VOLUME_DIMENSION_LIMIT` voxels.
86
+ * @type {number}
87
+ */
88
+ export const HAIR_VOLUME_LAY_STEP_LIMIT: number;
79
89
  /**
80
90
  * Words of the frame's counters (`u32`), cleared when made:
81
91
  *
@@ -85,6 +95,8 @@ export const HAIR_VOLUME_DIMENSION_LIMIT: number;
85
95
  * 9 voxels asked for, every level of every volume
86
96
  * 16 .. 23 where each class's region of the draw list starts
87
97
  * 24 .. 31 each class's append cursor, from its region's start
98
+ * 32 .. 39 strands each point class can be asked to hold for instances only the shadow views draw
99
+ * 40 .. 47 each class's append cursor for those, from its region's start plus its count above
88
100
  * ```
89
101
  *
90
102
  * @type {number}
@@ -94,6 +106,13 @@ export const HAIR_COUNTER_POINTS: 8;
94
106
  export const HAIR_COUNTER_VOXELS: 9;
95
107
  export const HAIR_COUNTER_BASES: 16;
96
108
  export const HAIR_COUNTER_CURSORS: 24;
109
+ export const HAIR_COUNTER_SHADOW_STRANDS: 32;
110
+ export const HAIR_COUNTER_SHADOW_CURSORS: 40;
111
+ /**
112
+ * Words an entry of the draw list carries past the list's capacity where the strands cast shadows.
113
+ * @type {number}
114
+ */
115
+ export const HAIR_LIST_SHADOW_WORDS: number;
97
116
  /**
98
117
  * Words of one indirect draw: vertex count, instance count, first vertex, first instance.
99
118
  * @type {number}
@@ -1 +1 @@
1
- {"version":3,"file":"HAIR.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/hair/HAIR.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH;;GAEG;AACH,8CAAwC;AAExC;;;GAGG;AACH,2BAFU,MAAM,CAEc;AAE9B;;;GAGG;AACH,iCAFU,MAAM,CAEoB;AAEpC;;;GAGG;AACH,+BAFU,MAAM,CAEmB;AAEnC;;;GAGG;AACH,+BAFU,MAAM,CAEkB;AAElC;;;GAGG;AACH,wCAFU,MAAM,CAEmD;AAEnE;;;GAGG;AACH,4BAFU,MAAM,CAEgB;AAEhC;;;;GAIG;AACH,6BAFU,MAAM,CAEiB;AAEjC;;;GAGG;AACH,oCAFU,MAAM,CAE2B;AAE3C;;;GAGG;AACH,+BAFU,MAAM,CAEkB;AAElC;;;GAGG;AACH,0CAFU,MAAM,CAE+B;AAE/C;;;;;;;;;;;;GAYG;AACH,iCAFU,MAAM,CAEqB;AAErC,oCAAqC;AACrC,oCAAqC;AACrC,oCAAqC;AACrC,sCAAuC;AAEvC;;;GAGG;AACH,mCAFU,MAAM,CAEsB"}
1
+ {"version":3,"file":"HAIR.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/hair/HAIR.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH;;GAEG;AACH,8CAAwC;AAExC;;;GAGG;AACH,2BAFU,MAAM,CAEc;AAE9B;;;GAGG;AACH,iCAFU,MAAM,CAEoB;AAEpC;;;GAGG;AACH,+BAFU,MAAM,CAEmB;AAEnC;;;GAGG;AACH,+BAFU,MAAM,CAEkB;AAElC;;;GAGG;AACH,wCAFU,MAAM,CAEmD;AAEnE;;;GAGG;AACH,4BAFU,MAAM,CAEgB;AAEhC;;;;GAIG;AACH,6BAFU,MAAM,CAEiB;AAEjC;;;GAGG;AACH,oCAFU,MAAM,CAE2B;AAE3C;;;GAGG;AACH,+BAFU,MAAM,CAEkB;AAElC;;;GAGG;AACH,0CAFU,MAAM,CAE+B;AAE/C;;;;GAIG;AACH,yCAFU,MAAM,CAEsF;AAEtG;;;;;;;;;;;;;;GAcG;AACH,iCAFU,MAAM,CAEqB;AAErC,oCAAqC;AACrC,oCAAqC;AACrC,oCAAqC;AACrC,sCAAuC;AACvC,6CAA8C;AAC9C,6CAA8C;AAE9C;;;GAGG;AACH,qCAFU,MAAM,CAEwB;AAExC;;;GAGG;AACH,mCAFU,MAAM,CAEsB"}
@@ -2,14 +2,18 @@
2
2
  * The words and bits the hair passes share.
3
3
  *
4
4
  * **A frame's deformed points** are one buffer of `vec4<u32>`, two halves of `point capacity` each: in the first,
5
- * a point as it is now (x, y, z in f32 bits, then half its drawn width, f32 bits, negative for a point drawn at no
6
- * width); in the second, at the same index
5
+ * a point as it is now (x, y, z in f32 bits, then half its drawn width, f32 bits, negated for a point the view draws at
6
+ * no width, which a view of a finer floor may still draw); in the second, at the same index
7
7
  * plus the capacity, where it was a frame ago (x, y, z in f32 bits) and its tag: the row of its instance in the
8
8
  * low {@link HAIR_ROW_BITS} bits, its strand's variation byte above them. A strand's points are consecutive, root
9
9
  * first; the index of a strand's first point is its **slot**.
10
10
  *
11
11
  * **A draw list entry** is a strand: its slot, with its point class above {@link HAIR_CLASS_SHIFT}. A strand of
12
- * class `c` has `2^c` segments.
12
+ * class `c` has `2^c` segments. A class's region of the list holds first the strands of instances the view draws,
13
+ * from its start, then those of instances only the shadow views draw, from its start plus the first's count. Where
14
+ * the strands cast shadows, the list is followed, at its capacity, by two words an entry
15
+ * ({@link HAIR_LIST_SHADOW_WORDS}): the widest half width any point of the strand is drawn at, then the farthest any
16
+ * point of it is from its root, metres, f32 bits.
13
17
  *
14
18
  * **An instance's density volume** is a box of voxels around its strands, cubes of one edge, in the frame's voxel
15
19
  * buffer (`u32`) from its LOD record's `voxel_base`: {@link HAIR_VOLUME_MIPS} levels one after another, x fastest,
@@ -88,6 +92,13 @@ export const HAIR_VOLUME_MIPS = 3;
88
92
  */
89
93
  export const HAIR_VOLUME_DIMENSION_LIMIT = 128;
90
94
 
95
+ /**
96
+ * The most steps a segment is laid into a volume at, two thirds of a voxel each: a segment lies inside its
97
+ * instance's box, so it is no longer than the box's diagonal, `√3 · HAIR_VOLUME_DIMENSION_LIMIT` voxels.
98
+ * @type {number}
99
+ */
100
+ export const HAIR_VOLUME_LAY_STEP_LIMIT = Math.ceil(1.5 * Math.sqrt(3) * HAIR_VOLUME_DIMENSION_LIMIT);
101
+
91
102
  /**
92
103
  * Words of the frame's counters (`u32`), cleared when made:
93
104
  *
@@ -97,16 +108,26 @@ export const HAIR_VOLUME_DIMENSION_LIMIT = 128;
97
108
  * 9 voxels asked for, every level of every volume
98
109
  * 16 .. 23 where each class's region of the draw list starts
99
110
  * 24 .. 31 each class's append cursor, from its region's start
111
+ * 32 .. 39 strands each point class can be asked to hold for instances only the shadow views draw
112
+ * 40 .. 47 each class's append cursor for those, from its region's start plus its count above
100
113
  * ```
101
114
  *
102
115
  * @type {number}
103
116
  */
104
- export const HAIR_COUNTER_WORDS = 32;
117
+ export const HAIR_COUNTER_WORDS = 48;
105
118
 
106
119
  export const HAIR_COUNTER_POINTS = 8;
107
120
  export const HAIR_COUNTER_VOXELS = 9;
108
121
  export const HAIR_COUNTER_BASES = 16;
109
122
  export const HAIR_COUNTER_CURSORS = 24;
123
+ export const HAIR_COUNTER_SHADOW_STRANDS = 32;
124
+ export const HAIR_COUNTER_SHADOW_CURSORS = 40;
125
+
126
+ /**
127
+ * Words an entry of the draw list carries past the list's capacity where the strands cast shadows.
128
+ * @type {number}
129
+ */
130
+ export const HAIR_LIST_SHADOW_WORDS = 2;
110
131
 
111
132
  /**
112
133
  * Words of one indirect draw: vertex count, instance count, first vertex, first instance.
@@ -1 +1 @@
1
- {"version":3,"file":"HAIR_DATABASE_SPEC.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/hair/HAIR_DATABASE_SPEC.js"],"names":[],"mappings":"AAMA;;;GAGG;AACH,gDAkC0B;AAE1B,oCAA4C;AAE5C,gDAAwD;AAExD,mDAAoD;AAEpD;;;GAGG;AACH,uDAEmB;AAYnB,oHAAoF;6BAlEvD,gCAAgC;sCAHvB,0CAA0C"}
1
+ {"version":3,"file":"HAIR_DATABASE_SPEC.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/hair/HAIR_DATABASE_SPEC.js"],"names":[],"mappings":"AAMA;;;GAGG;AACH,gDAmE0B;AAE1B,oCAA4C;AAE5C,gDAAwD;AAExD,mDAAoD;AAEpD;;;GAGG;AACH,uDAEmB;AAYnB,oHAAoF;6BAnGvD,gCAAgC;sCAHvB,0CAA0C"}
@@ -42,6 +42,39 @@ export const HAIR_INSTANCE_STRUCT = WebGPUStruct.from({
42
42
  roughness: f32,
43
43
  /** how far apart the strands grow, groom metres (`GroomGroup#root_spacing`) */
44
44
  root_spacing: f32,
45
+ /** the group's first guide record in the groom pool, in words (`HAIR_SIMULATION.js`) */
46
+ guides: u32,
47
+ guide_count: u32,
48
+ /** nodes a guide is simulated at, `2^j + 1` */
49
+ guide_point_count: u32,
50
+ /** the instance's first vector in the guide state pool, or `HAIR_STATE_NONE` for strands that ride the entity */
51
+ state: u32,
52
+ /** which tenant of its guide state the instance is: a state made for another is laid at rest */
53
+ epoch: u32,
54
+ /** the farthest a rest point is from its guide's chord, groom metres (`GroomGroup#guide_reach`) */
55
+ guide_reach: f32,
56
+ /** the longest guide, groom metres */
57
+ guide_length_max: f32,
58
+ /** how fast a node's own motion dies away, per second */
59
+ damping: f32,
60
+ /** how fast a node is pulled to its rest place in the entity's frame at the root, per second */
61
+ global_shape_rate: f32,
62
+ /** the share of a guide's length over which that pull falls to nothing */
63
+ global_shape_range: f32,
64
+ /** how fast a segment is turned back to its rest direction from its parent's, per second */
65
+ local_shape_rate: f32,
66
+ /** the share of a node's sliding along a collider that a contact takes away, for a push out as deep as it */
67
+ friction: f32,
68
+ /** how far past its wisp's radius a guide is held from a collider, metres */
69
+ thickness: f32,
70
+ /** the `transforms` row of the entity whose mesh the roots are bound to, or `HAIR_BINDING_NONE` */
71
+ mesh_node: u32,
72
+ /** the bound mesh's first meshlet row, as its geometry is laid out now */
73
+ meshlet_base: u32,
74
+ /** the group's first binding record in the groom pool, in words (`groom_bind_to_mesh`) */
75
+ bindings: u32,
76
+ /** the instance's first root frame in the guide state pool, `HAIR_ROOT_FRAME_VECTORS` a strand */
77
+ roots: u32,
45
78
  }, "HairInstance").pack();
46
79
 
47
80
  export const HAIR_PAGE_SIZE = 16 * KILOBYTE;
@@ -2,6 +2,10 @@
2
2
  * An instance's level of detail for the frame, by row (`HAIR_LOD_WORDS`).
3
3
  */
4
4
  export const HAIR_LOD_STRUCT: WebGPUStruct;
5
+ /**
6
+ * A shadow view the strands draw into, as the hair passes read it from the frame's table of them.
7
+ */
8
+ export const HAIR_SHADOW_VIEW_STRUCT: WebGPUStruct;
5
9
  /**
6
10
  * What every hair pass of a view reads of it: its internal size, the narrowest a strand is drawn, the frame's
7
11
  * point capacity (where the deformed points' second half starts) and the rows the instance passes draw.
@@ -1 +1 @@
1
- {"version":3,"file":"HAIR_FRAME_STRUCTS.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/hair/HAIR_FRAME_STRUCTS.js"],"names":[],"mappings":"AAKA;;GAEG;AACH,2CAwBc;AAId;;;GAGG;AACH,4CAOe;6BA7Cc,gCAAgC"}
1
+ {"version":3,"file":"HAIR_FRAME_STRUCTS.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/hair/HAIR_FRAME_STRUCTS.js"],"names":[],"mappings":"AAMA;;GAEG;AACH,2CA4Bc;AAId;;GAEG;AACH,mDAUqB;AAErB;;;GAGG;AACH,4CASe;6BAlEc,gCAAgC"}
@@ -1,5 +1,6 @@
1
1
  import { assert } from "../../../core/assert.js";
2
- import { f32, u32, vec2f, vec3f, vec3u } from "../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
2
+ import { f32, u32, vec2f, vec3f, vec3u, vec4f } from "../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
3
+ import { WebGPUArray } from "../shader/type/WebGPUArray.js";
3
4
  import { WebGPUStruct } from "../shader/type/WebGPUStruct.js";
4
5
  import { HAIR_LOD_WORDS } from "./HAIR.js";
5
6
 
@@ -29,11 +30,30 @@ export const HAIR_LOD_STRUCT = WebGPUStruct.from({
29
30
  voxel_size: f32,
30
31
  /** voxels along each axis, at most `HAIR_VOLUME_DIMENSION_LIMIT` */
31
32
  volume_dims: vec3u,
32
- unused: u32,
33
+ /**
34
+ * for an instance only the shadow views draw, the world size of a texel its strands are thinned at, 0 where it
35
+ * cannot be bounded; negative for an instance the view draws, whose strands are thinned at their roots' depth
36
+ */
37
+ fixed_pixel: f32,
33
38
  }, "HairLod");
34
39
 
35
40
  assert.equal(HAIR_LOD_STRUCT.size, HAIR_LOD_WORDS * 4, "HAIR_LOD_STRUCT is the size HAIR_LOD_WORDS says");
36
41
 
42
+ /**
43
+ * A shadow view the strands draw into, as the hair passes read it from the frame's table of them.
44
+ */
45
+ export const HAIR_SHADOW_VIEW_STRUCT = WebGPUStruct.from({
46
+ /** the world frustum's left, right, bottom, top and far planes (`Camera#frustum`); the near one is not bound */
47
+ planes: WebGPUArray.from(vec4f, 5),
48
+ /** the view-projection's last row: a world point's clip w is its dot with `(point, 1)` */
49
+ depth: vec4f,
50
+ /** the view's rectangle, texels */
51
+ resolution: vec2f,
52
+ /** the world size of the view's finer texel axis where the clip w is one; it grows with w */
53
+ texel: f32,
54
+ unused: u32,
55
+ }, "HairShadowView");
56
+
37
57
  /**
38
58
  * What every hair pass of a view reads of it: its internal size, the narrowest a strand is drawn, the frame's
39
59
  * point capacity (where the deformed points' second half starts) and the rows the instance passes draw.
@@ -45,4 +65,6 @@ export const HAIR_VIEW_STRUCT = WebGPUStruct.from({
45
65
  pixel_floor: f32,
46
66
  /** the frame's deformed point capacity */
47
67
  point_capacity: u32,
68
+ /** 1 where the strands draw into the shadow maps and are shadowed toward a light by its map where the map holds them, 0 where the density volume shadows them toward every light */
69
+ casts_shadows: u32,
48
70
  }, "HairView");
@@ -0,0 +1,139 @@
1
+ /**
2
+ * The rate a node's velocity relaxes toward the air's by drag, per second: the drag of the wisp its guide stands for,
3
+ * a cylinder of diameter `diameter` across the flow at relative speed `speed`, over the wisp's mass a unit length,
4
+ * `k = ½ ρ C_d(Re) D |w| / μ`. The cylinder's drag coefficient is White's correlation, `C_d = 1 + 10 Re^(-2/3)`
5
+ * (good to ±10% for `1 < Re < 2·10⁵`), so `k = (½ ρ D / μ)(|w| + 10 |w|^(1/3) (ρ D / μ_air)^(-2/3))`, which goes to
6
+ * zero with the speed. The WGSL `hair_drag_rate` is its twin.
7
+ *
8
+ * @param {number} speed metres a second
9
+ * @param {number} diameter metres
10
+ * @param {number} mass_per_length kg a metre
11
+ * @returns {number}
12
+ */
13
+ export function hair_drag_rate(speed: number, diameter: number, mass_per_length: number): number;
14
+ /**
15
+ * The words, limits and physical constants of the hair's simulation.
16
+ *
17
+ * **A bound instance's root frames** are a run of `vec4<f32>` in the same pool, from its record's `roots`,
18
+ * {@link HAIR_ROOT_FRAME_VECTORS} a strand in rank order: where its root's triangle of the bound mesh carries the
19
+ * groom's rest space now, and a frame ago (`shader_hair_roots.js`).
20
+ *
21
+ * **A simulated instance's guide state** is a run of `vec4<f32>` in the guide state pool, from its instance record's
22
+ * `state`: a header of {@link HAIR_STATE_HEADER} vectors, then {@link HAIR_STATE_PLANES} planes of a vector a node of
23
+ * every guide, **node-interleaved**: node `i` of guide `g` of plane `p` at `HAIR_STATE_HEADER + (p · P + i) · G + g`,
24
+ * for `P` nodes a guide and `G` guides, so the threads of neighbouring guides read neighbouring vectors.
25
+ *
26
+ * Positions are metres from the instance's **anchor**, its entity's translation this frame, along the world's axes:
27
+ * near zero wherever the entity is, so a substep's small moves keep their precision far from the world's origin.
28
+ *
29
+ * ```
30
+ * header 0 the anchor, world metres; w: the epoch the state was made for, u32 bits
31
+ * 1 the anchor's move since the state was last stepped; w: 1 when the state is to be laid at rest
32
+ * 2..4 the entity's world matrix now, its columns' x, y and z, translation dropped
33
+ * 5..7 the same a frame ago
34
+ * 8 where the entity's origin was a frame ago, from the anchor
35
+ * plane 0 a node's position
36
+ * 1 its velocity, metres a second
37
+ * 2 its frame: the rotation, a unit quaternion, from its rest frame carried by the entity to where it is
38
+ * 3 its position a frame ago, from this frame's anchor
39
+ * 4 its frame a frame ago
40
+ * ```
41
+ */
42
+ /**
43
+ * An instance record's `state` for a groom that is not simulated: its strands ride its entity's frame.
44
+ * @type {number}
45
+ */
46
+ export const HAIR_STATE_NONE: number;
47
+ /**
48
+ * An instance record's `mesh_node` for strands that ride their own entity: no mesh holds their roots.
49
+ * @type {number}
50
+ */
51
+ export const HAIR_BINDING_NONE: number;
52
+ /**
53
+ * Vectors of a bound strand's root frame in the guide state pool: the frame now, then a frame ago, each the three
54
+ * rows of an affine 3 × 4 matrix (`HAIR_SIMULATION.js`) that takes the groom's rest points to the world.
55
+ * @type {number}
56
+ */
57
+ export const HAIR_ROOT_FRAME_VECTORS: number;
58
+ /**
59
+ * Vectors of a guide state's header.
60
+ * @type {number}
61
+ */
62
+ export const HAIR_STATE_HEADER: number;
63
+ /**
64
+ * Planes of a guide state, a vector a node each.
65
+ * @type {number}
66
+ */
67
+ export const HAIR_STATE_PLANES: number;
68
+ export const HAIR_STATE_POSITION: 0;
69
+ export const HAIR_STATE_VELOCITY: 1;
70
+ export const HAIR_STATE_FRAME: 2;
71
+ export const HAIR_STATE_LAST_POSITION: 3;
72
+ export const HAIR_STATE_LAST_FRAME: 4;
73
+ /**
74
+ * Words of a guide's record in the groom pool: its strand's rank, its wisp's strand count, its wisp's diameter and
75
+ * its length (f32 bits each, groom metres).
76
+ * @type {number}
77
+ */
78
+ export const HAIR_GUIDE_RECORD_WORDS: number;
79
+ /**
80
+ * The longest substep, seconds: a frame is cut into as many as keep each within it.
81
+ * @type {number}
82
+ */
83
+ export const HAIR_SUBSTEP_MAX: number;
84
+ /**
85
+ * The longest frame the simulation steps, seconds, as the animation clamps its own: a stall slows the hair rather
86
+ * than throwing it.
87
+ * @type {number}
88
+ */
89
+ export const HAIR_FRAME_STEP_MAX: number;
90
+ /**
91
+ * Density of air at sea level and 15 °C, kg/m³.
92
+ * @type {number}
93
+ */
94
+ export const HAIR_AIR_DENSITY: number;
95
+ /**
96
+ * Dynamic viscosity of air at 15 °C, Pa·s.
97
+ * @type {number}
98
+ */
99
+ export const HAIR_AIR_VISCOSITY: number;
100
+ /**
101
+ * Density of a hair fibre, kg/m³: keratin, 1.3 g/cm³ (Robbins, "Chemical and Physical Behavior of Human Hair").
102
+ * @type {number}
103
+ */
104
+ export const HAIR_FIBRE_DENSITY: number;
105
+ /**
106
+ * The share of a node's follow-the-leader correction taken back out of its parent's velocity (Müller et al. 2012's
107
+ * `s`), which keeps the correction from feeding the velocity it was made to undo.
108
+ * @type {number}
109
+ */
110
+ export const HAIR_FOLLOW_THE_LEADER_DAMPING: number;
111
+ /**
112
+ * The most colliders an instance collides with in a frame.
113
+ * @type {number}
114
+ */
115
+ export const HAIR_COLLIDER_LIMIT: number;
116
+ /**
117
+ * Words of a collider in the frame's collider list (`u32`, f32 bits where a number):
118
+ *
119
+ * ```
120
+ * 0 its core shape record's kind (ShapeRecordKind)
121
+ * 1 the transforms row of its entity
122
+ * 2, 3 its friction and its inflation, metres
123
+ * 4 .. 7 its shape record's four parameters
124
+ * 8 .. 11 from the world to its own frame, as the pose pass writes it: the rotation, a unit quaternion
125
+ * 12 .. 14 the translation after it
126
+ * 15 the scale after that: distances in its frame are the world's times it
127
+ * ```
128
+ *
129
+ * @type {number}
130
+ */
131
+ export const HAIR_COLLIDER_WORDS: number;
132
+ /**
133
+ * Words of an instance's guide bounds a row: the largest of each coordinate over its nodes, then the smallest, as
134
+ * ordered `u32` (the smallest inverted), so that zero is empty for both and `atomicMax` gathers both; then the
135
+ * epoch of the instance they were gathered for, which a row's next tenant does not match.
136
+ * @type {number}
137
+ */
138
+ export const HAIR_GUIDE_BOUNDS_WORDS: number;
139
+ //# sourceMappingURL=HAIR_SIMULATION.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HAIR_SIMULATION.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/hair/HAIR_SIMULATION.js"],"names":[],"mappings":"AA8IA;;;;;;;;;;;GAWG;AACH,sCALW,MAAM,YACN,MAAM,mBACN,MAAM,GACJ,MAAM,CAOlB;AA/JD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH;;;GAGG;AACH,8BAFU,MAAM,CAE0B;AAE1C;;;GAGG;AACH,gCAFU,MAAM,CAE4B;AAE5C;;;;GAIG;AACH,sCAFU,MAAM,CAEyB;AAEzC;;;GAGG;AACH,gCAFU,MAAM,CAEmB;AAEnC;;;GAGG;AACH,gCAFU,MAAM,CAEmB;AAEnC,oCAAqC;AACrC,oCAAqC;AACrC,iCAAkC;AAClC,yCAA0C;AAC1C,sCAAuC;AAEvC;;;;GAIG;AACH,sCAFU,MAAM,CAEyB;AAEzC;;;GAGG;AACH,+BAFU,MAAM,CAEuB;AAEvC;;;;GAIG;AACH,kCAFU,MAAM,CAE0B;AAE1C;;;GAGG;AACH,+BAFU,MAAM,CAEsB;AAEtC;;;GAGG;AACH,iCAFU,MAAM,CAE0B;AAE1C;;;GAGG;AACH,iCAFU,MAAM,CAEuB;AAEvC;;;;GAIG;AACH,6CAFU,MAAM,CAEkC;AAElD;;;GAGG;AACH,kCAFU,MAAM,CAEsB;AAEtC;;;;;;;;;;;;;;GAcG;AACH,kCAFU,MAAM,CAEsB;AAEtC;;;;;GAKG;AACH,sCAFU,MAAM,CAEyB"}
@@ -0,0 +1,160 @@
1
+ /**
2
+ * The words, limits and physical constants of the hair's simulation.
3
+ *
4
+ * **A bound instance's root frames** are a run of `vec4<f32>` in the same pool, from its record's `roots`,
5
+ * {@link HAIR_ROOT_FRAME_VECTORS} a strand in rank order: where its root's triangle of the bound mesh carries the
6
+ * groom's rest space now, and a frame ago (`shader_hair_roots.js`).
7
+ *
8
+ * **A simulated instance's guide state** is a run of `vec4<f32>` in the guide state pool, from its instance record's
9
+ * `state`: a header of {@link HAIR_STATE_HEADER} vectors, then {@link HAIR_STATE_PLANES} planes of a vector a node of
10
+ * every guide, **node-interleaved**: node `i` of guide `g` of plane `p` at `HAIR_STATE_HEADER + (p · P + i) · G + g`,
11
+ * for `P` nodes a guide and `G` guides, so the threads of neighbouring guides read neighbouring vectors.
12
+ *
13
+ * Positions are metres from the instance's **anchor**, its entity's translation this frame, along the world's axes:
14
+ * near zero wherever the entity is, so a substep's small moves keep their precision far from the world's origin.
15
+ *
16
+ * ```
17
+ * header 0 the anchor, world metres; w: the epoch the state was made for, u32 bits
18
+ * 1 the anchor's move since the state was last stepped; w: 1 when the state is to be laid at rest
19
+ * 2..4 the entity's world matrix now, its columns' x, y and z, translation dropped
20
+ * 5..7 the same a frame ago
21
+ * 8 where the entity's origin was a frame ago, from the anchor
22
+ * plane 0 a node's position
23
+ * 1 its velocity, metres a second
24
+ * 2 its frame: the rotation, a unit quaternion, from its rest frame carried by the entity to where it is
25
+ * 3 its position a frame ago, from this frame's anchor
26
+ * 4 its frame a frame ago
27
+ * ```
28
+ */
29
+
30
+ /**
31
+ * An instance record's `state` for a groom that is not simulated: its strands ride its entity's frame.
32
+ * @type {number}
33
+ */
34
+ export const HAIR_STATE_NONE = 0xFFFFFFFF;
35
+
36
+ /**
37
+ * An instance record's `mesh_node` for strands that ride their own entity: no mesh holds their roots.
38
+ * @type {number}
39
+ */
40
+ export const HAIR_BINDING_NONE = 0xFFFFFFFF;
41
+
42
+ /**
43
+ * Vectors of a bound strand's root frame in the guide state pool: the frame now, then a frame ago, each the three
44
+ * rows of an affine 3 × 4 matrix (`HAIR_SIMULATION.js`) that takes the groom's rest points to the world.
45
+ * @type {number}
46
+ */
47
+ export const HAIR_ROOT_FRAME_VECTORS = 6;
48
+
49
+ /**
50
+ * Vectors of a guide state's header.
51
+ * @type {number}
52
+ */
53
+ export const HAIR_STATE_HEADER = 9;
54
+
55
+ /**
56
+ * Planes of a guide state, a vector a node each.
57
+ * @type {number}
58
+ */
59
+ export const HAIR_STATE_PLANES = 5;
60
+
61
+ export const HAIR_STATE_POSITION = 0;
62
+ export const HAIR_STATE_VELOCITY = 1;
63
+ export const HAIR_STATE_FRAME = 2;
64
+ export const HAIR_STATE_LAST_POSITION = 3;
65
+ export const HAIR_STATE_LAST_FRAME = 4;
66
+
67
+ /**
68
+ * Words of a guide's record in the groom pool: its strand's rank, its wisp's strand count, its wisp's diameter and
69
+ * its length (f32 bits each, groom metres).
70
+ * @type {number}
71
+ */
72
+ export const HAIR_GUIDE_RECORD_WORDS = 4;
73
+
74
+ /**
75
+ * The longest substep, seconds: a frame is cut into as many as keep each within it.
76
+ * @type {number}
77
+ */
78
+ export const HAIR_SUBSTEP_MAX = 1 / 60;
79
+
80
+ /**
81
+ * The longest frame the simulation steps, seconds, as the animation clamps its own: a stall slows the hair rather
82
+ * than throwing it.
83
+ * @type {number}
84
+ */
85
+ export const HAIR_FRAME_STEP_MAX = 1 / 15;
86
+
87
+ /**
88
+ * Density of air at sea level and 15 °C, kg/m³.
89
+ * @type {number}
90
+ */
91
+ export const HAIR_AIR_DENSITY = 1.225;
92
+
93
+ /**
94
+ * Dynamic viscosity of air at 15 °C, Pa·s.
95
+ * @type {number}
96
+ */
97
+ export const HAIR_AIR_VISCOSITY = 1.81e-5;
98
+
99
+ /**
100
+ * Density of a hair fibre, kg/m³: keratin, 1.3 g/cm³ (Robbins, "Chemical and Physical Behavior of Human Hair").
101
+ * @type {number}
102
+ */
103
+ export const HAIR_FIBRE_DENSITY = 1300;
104
+
105
+ /**
106
+ * The share of a node's follow-the-leader correction taken back out of its parent's velocity (Müller et al. 2012's
107
+ * `s`), which keeps the correction from feeding the velocity it was made to undo.
108
+ * @type {number}
109
+ */
110
+ export const HAIR_FOLLOW_THE_LEADER_DAMPING = 0.9;
111
+
112
+ /**
113
+ * The most colliders an instance collides with in a frame.
114
+ * @type {number}
115
+ */
116
+ export const HAIR_COLLIDER_LIMIT = 32;
117
+
118
+ /**
119
+ * Words of a collider in the frame's collider list (`u32`, f32 bits where a number):
120
+ *
121
+ * ```
122
+ * 0 its core shape record's kind (ShapeRecordKind)
123
+ * 1 the transforms row of its entity
124
+ * 2, 3 its friction and its inflation, metres
125
+ * 4 .. 7 its shape record's four parameters
126
+ * 8 .. 11 from the world to its own frame, as the pose pass writes it: the rotation, a unit quaternion
127
+ * 12 .. 14 the translation after it
128
+ * 15 the scale after that: distances in its frame are the world's times it
129
+ * ```
130
+ *
131
+ * @type {number}
132
+ */
133
+ export const HAIR_COLLIDER_WORDS = 16;
134
+
135
+ /**
136
+ * Words of an instance's guide bounds a row: the largest of each coordinate over its nodes, then the smallest, as
137
+ * ordered `u32` (the smallest inverted), so that zero is empty for both and `atomicMax` gathers both; then the
138
+ * epoch of the instance they were gathered for, which a row's next tenant does not match.
139
+ * @type {number}
140
+ */
141
+ export const HAIR_GUIDE_BOUNDS_WORDS = 8;
142
+
143
+ /**
144
+ * The rate a node's velocity relaxes toward the air's by drag, per second: the drag of the wisp its guide stands for,
145
+ * a cylinder of diameter `diameter` across the flow at relative speed `speed`, over the wisp's mass a unit length,
146
+ * `k = ½ ρ C_d(Re) D |w| / μ`. The cylinder's drag coefficient is White's correlation, `C_d = 1 + 10 Re^(-2/3)`
147
+ * (good to ±10% for `1 < Re < 2·10⁵`), so `k = (½ ρ D / μ)(|w| + 10 |w|^(1/3) (ρ D / μ_air)^(-2/3))`, which goes to
148
+ * zero with the speed. The WGSL `hair_drag_rate` is its twin.
149
+ *
150
+ * @param {number} speed metres a second
151
+ * @param {number} diameter metres
152
+ * @param {number} mass_per_length kg a metre
153
+ * @returns {number}
154
+ */
155
+ export function hair_drag_rate(speed, diameter, mass_per_length) {
156
+ const reynolds_per_speed = HAIR_AIR_DENSITY * diameter / HAIR_AIR_VISCOSITY;
157
+
158
+ return 0.5 * HAIR_AIR_DENSITY * diameter / mass_per_length
159
+ * (speed + 10 * Math.cbrt(speed) * Math.pow(reynolds_per_speed, -2 / 3));
160
+ }
@@ -13,14 +13,21 @@ export const HAIR_SCATTERING_LUT_RESOURCE: ShaderResourceDescriptor;
13
13
  * ```wgsl
14
14
  * fn hair_scattering(l: vec3<f32>, v: vec3<f32>, t: vec3<f32>, absorption: vec3<f32>, roughness: f32,
15
15
  * hair_count: f32, backlit: f32, area: f32) -> vec3<f32>
16
+ * fn hair_forward_transmittance(l: vec3<f32>, t: vec3<f32>, absorption: vec3<f32>, roughness: f32,
17
+ * hair_count: f32) -> vec3<f32>
16
18
  * ```
17
19
  *
18
20
  * `hair_count` is the number of strands between the point and the light (the density volume's march); one is taken
19
21
  * off it for the strand's own. The global term passes the light through them, attenuated by the average front
20
22
  * scattering to the power of their count and spread by their roughness; the local term adds what scatters back
21
23
  * from the strands around the point. The average scatterings come from the table at the light's angle to the fibre,
22
- * the roughness and the colour. Unreal's clamp of the roughness to [0.18, 0.6] here, which its source calls "a bit
23
- * adhoc", is not taken. Its Kajiya-Kay term is not either: this is the multiple scattering it stands in for.
24
+ * the roughness and the colour. As in Unreal, the table is read at the fibre's roughness and the lobes' spreads take
25
+ * it clamped to [0.18, 0.6]: the spreads are Gaussians, and a narrower one would let a single smooth strand in front
26
+ * block all but the light along its own cone (at roughness 0.1 one strand passes a fortieth of what the clamp passes).
27
+ * Unreal's Kajiya-Kay term is not taken: this is the multiple scattering it stands in for.
28
+ *
29
+ * `hair_forward_transmittance` is the global term's energy alone, the average front scattering to the power of the
30
+ * strands passed: what reaches the point from a source as wide as the sky, over which the spread integrates to one.
24
31
  *
25
32
  * @type {CodeChunk}
26
33
  */
@@ -1 +1 @@
1
- {"version":3,"file":"chunk_hair_dual_scattering.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/hair/chunk_hair_dual_scattering.js"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,2CAFU,wBAAwB,CAE6E;AAE/G;;;;;;;;;;;;;;;;;;GAkBG;AACH,yCAFU,SAAS,CAiGhB;yCA9HsC,gDAAgD;0BAD/D,iCAAiC"}
1
+ {"version":3,"file":"chunk_hair_dual_scattering.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/hair/chunk_hair_dual_scattering.js"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,2CAFU,wBAAwB,CAE6E;AAE/G;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,yCAFU,SAAS,CAqHhB;yCAzJsC,gDAAgD;0BAD/D,iCAAiC"}