@woosh/meep-engine 3.75.0 → 3.77.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 (369) 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 +1 -1
  6. package/src/engine/asset/GameAssetType.d.ts +1 -0
  7. package/src/engine/asset/GameAssetType.js +5 -1
  8. package/src/engine/asset/loaders/GroomAssetLoader.d.ts +33 -0
  9. package/src/engine/asset/loaders/GroomAssetLoader.d.ts.map +1 -0
  10. package/src/engine/asset/loaders/GroomAssetLoader.js +113 -0
  11. package/src/engine/graphics/ecs/hair/Hair.d.ts +54 -0
  12. package/src/engine/graphics/ecs/hair/Hair.d.ts.map +1 -0
  13. package/src/engine/graphics/ecs/hair/Hair.js +70 -0
  14. package/src/engine/graphics/ecs/hair/HairDynamics.d.ts +63 -0
  15. package/src/engine/graphics/ecs/hair/HairDynamics.d.ts.map +1 -0
  16. package/src/engine/graphics/ecs/hair/HairDynamics.js +82 -0
  17. package/src/engine/graphics/hair/Groom.d.ts +175 -0
  18. package/src/engine/graphics/hair/Groom.d.ts.map +1 -0
  19. package/src/engine/graphics/hair/Groom.js +249 -0
  20. package/src/engine/graphics/hair/GroomSerializationAdapter.d.ts +50 -0
  21. package/src/engine/graphics/hair/GroomSerializationAdapter.d.ts.map +1 -0
  22. package/src/engine/graphics/hair/GroomSerializationAdapter.js +150 -0
  23. package/src/engine/graphics/hair/GroomSerializationUpgrader_0_1.d.ts +8 -0
  24. package/src/engine/graphics/hair/GroomSerializationUpgrader_0_1.d.ts.map +1 -0
  25. package/src/engine/graphics/hair/GroomSerializationUpgrader_0_1.js +31 -0
  26. package/src/engine/graphics/hair/groom_bind_to_mesh.d.ts +85 -0
  27. package/src/engine/graphics/hair/groom_bind_to_mesh.d.ts.map +1 -0
  28. package/src/engine/graphics/hair/groom_bind_to_mesh.js +216 -0
  29. package/src/engine/graphics/hair/groom_build_group.d.ts +90 -0
  30. package/src/engine/graphics/hair/groom_build_group.d.ts.map +1 -0
  31. package/src/engine/graphics/hair/groom_build_group.js +496 -0
  32. package/src/engine/graphics/hair/groom_build_guides.d.ts +43 -0
  33. package/src/engine/graphics/hair/groom_build_guides.d.ts.map +1 -0
  34. package/src/engine/graphics/hair/groom_build_guides.js +267 -0
  35. package/src/engine/graphics/hair/groom_generate_scalp.d.ts +29 -0
  36. package/src/engine/graphics/hair/groom_generate_scalp.d.ts.map +1 -0
  37. package/src/engine/graphics/hair/groom_generate_scalp.js +184 -0
  38. package/src/engine/graphics/hair/groom_rank_order.d.ts +15 -0
  39. package/src/engine/graphics/hair/groom_rank_order.d.ts.map +1 -0
  40. package/src/engine/graphics/hair/groom_rank_order.js +53 -0
  41. package/src/engine/graphics/hair/groom_root_spacing.d.ts +14 -0
  42. package/src/engine/graphics/hair/groom_root_spacing.d.ts.map +1 -0
  43. package/src/engine/graphics/hair/groom_root_spacing.js +253 -0
  44. package/src/engine/graphics3/HairColliderSystem.d.ts +59 -0
  45. package/src/engine/graphics3/HairColliderSystem.d.ts.map +1 -0
  46. package/src/engine/graphics3/HairColliderSystem.js +270 -0
  47. package/src/engine/graphics3/HairSystem.d.ts +119 -0
  48. package/src/engine/graphics3/HairSystem.d.ts.map +1 -0
  49. package/src/engine/graphics3/HairSystem.js +722 -0
  50. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  51. package/src/shade/assets/textures/hair_scattering.bin +0 -0
  52. package/src/shade/device/pipeline/PipelineEnquiry.d.ts +11 -0
  53. package/src/shade/device/pipeline/PipelineEnquiry.d.ts.map +1 -1
  54. package/src/shade/device/pipeline/PipelineEnquiry.js +13 -0
  55. package/src/shade/playground/hair/index.html +50 -0
  56. package/src/shade/playground/hair/main.d.ts +2 -0
  57. package/src/shade/playground/hair/main.d.ts.map +1 -0
  58. package/src/shade/playground/hair/main.js +297 -0
  59. package/src/shade/playground/hair_skinned/index.html +192 -0
  60. package/src/shade/playground/hair_skinned/main.d.ts +7 -0
  61. package/src/shade/playground/hair_skinned/main.d.ts.map +1 -0
  62. package/src/shade/playground/hair_skinned/main.js +481 -0
  63. package/src/shade/playground/hair_skinned/skinned_hair.d.ts +49 -0
  64. package/src/shade/playground/hair_skinned/skinned_hair.d.ts.map +1 -0
  65. package/src/shade/playground/hair_skinned/skinned_hair.js +362 -0
  66. package/src/shade/playground/screen_probes/README.md +54 -0
  67. package/src/shade/playground/screen_probes/index.html +271 -0
  68. package/src/shade/playground/screen_probes/main.d.ts +8 -0
  69. package/src/shade/playground/screen_probes/main.d.ts.map +1 -0
  70. package/src/shade/playground/screen_probes/main.js +527 -0
  71. package/src/shade/playground/sparks/README.md +36 -0
  72. package/src/shade/playground/sparks/index.html +145 -0
  73. package/src/shade/playground/sparks/main.d.ts +7 -0
  74. package/src/shade/playground/sparks/main.d.ts.map +1 -0
  75. package/src/shade/playground/sparks/main.js +312 -0
  76. package/src/shade/playground/sparks/sparks_effect.d.ts +72 -0
  77. package/src/shade/playground/sparks/sparks_effect.d.ts.map +1 -0
  78. package/src/shade/playground/sparks/sparks_effect.js +180 -0
  79. package/src/shade/renderer/Renderer.d.ts.map +1 -1
  80. package/src/shade/renderer/Renderer.js +72 -11
  81. package/src/shade/renderer/STATIC_GRAPHICS_ENGINE_ASSETS.d.ts +6 -0
  82. package/src/shade/renderer/STATIC_GRAPHICS_ENGINE_ASSETS.d.ts.map +1 -1
  83. package/src/shade/renderer/STATIC_GRAPHICS_ENGINE_ASSETS.js +10 -0
  84. package/src/shade/renderer/acoustics/GPUAcousticLattice.d.ts +1 -1
  85. package/src/shade/renderer/acoustics/GPUAcousticProbes.d.ts +1 -1
  86. package/src/shade/renderer/acoustics/GPUAcoustics.d.ts +1 -1
  87. package/src/shade/renderer/animation/GPUAnimationManager.d.ts +3 -2
  88. package/src/shade/renderer/animation/GPUAnimationManager.d.ts.map +1 -1
  89. package/src/shade/renderer/animation/GPUAnimationManager.js +74 -3
  90. package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.d.ts +13 -3
  91. package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.d.ts.map +1 -1
  92. package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.js +16 -5
  93. package/src/shade/renderer/animation/skinning/shader_meshlet_apply_skinning.js +8 -8
  94. package/src/shade/renderer/deferred/chunk_read_gBuffer_material.d.ts.map +1 -1
  95. package/src/shade/renderer/deferred/chunk_read_gBuffer_material.js +3 -1
  96. package/src/shade/renderer/deferred/chunk_shade_direct_lights.d.ts +23 -0
  97. package/src/shade/renderer/deferred/chunk_shade_direct_lights.d.ts.map +1 -0
  98. package/src/shade/renderer/deferred/chunk_shade_direct_lights.js +111 -0
  99. package/src/shade/renderer/deferred/chunk_shade_directional_lights.d.ts +19 -6
  100. package/src/shade/renderer/deferred/chunk_shade_directional_lights.d.ts.map +1 -1
  101. package/src/shade/renderer/deferred/chunk_shade_directional_lights.js +30 -21
  102. package/src/shade/renderer/deferred/chunk_shade_standard_material_direct.d.ts +12 -22
  103. package/src/shade/renderer/deferred/chunk_shade_standard_material_direct.d.ts.map +1 -1
  104. package/src/shade/renderer/deferred/chunk_shade_standard_material_direct.js +20 -100
  105. package/src/shade/renderer/deferred/chunk_shade_standard_material_direct_restir.d.ts.map +1 -1
  106. package/src/shade/renderer/deferred/chunk_shade_standard_material_direct_restir.js +6 -4
  107. package/src/shade/renderer/deferred/chunk_standard_material_direct_light_lobe.d.ts +15 -0
  108. package/src/shade/renderer/deferred/chunk_standard_material_direct_light_lobe.d.ts.map +1 -0
  109. package/src/shade/renderer/deferred/chunk_standard_material_direct_light_lobe.js +47 -0
  110. package/src/shade/renderer/extension/ShadowAtlas.d.ts +75 -0
  111. package/src/shade/renderer/extension/ShadowAtlas.d.ts.map +1 -0
  112. package/src/shade/renderer/extension/ShadowAtlas.js +133 -0
  113. package/src/shade/renderer/extension/ViewLighting.d.ts +101 -0
  114. package/src/shade/renderer/extension/ViewLighting.d.ts.map +1 -0
  115. package/src/shade/renderer/extension/ViewLighting.js +168 -0
  116. package/src/shade/renderer/fluid/GPUFluidCascade.d.ts +3 -3
  117. package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts +1 -1
  118. package/src/shade/renderer/fluid/forcing/GPUFluidForcing.d.ts +7 -7
  119. package/src/shade/renderer/fluid/pressure/GPUFluidPressureSolve.d.ts +1 -1
  120. package/src/shade/renderer/fluid/query/GPUFluidQueries.d.ts +1 -1
  121. package/src/shade/renderer/global_illumination/brick4/gpu/draw/shader_brick4_indirect_lighting.d.ts.map +1 -1
  122. package/src/shade/renderer/global_illumination/brick4/gpu/draw/shader_brick4_indirect_lighting.js +3 -1
  123. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUSceneBrickClipmap.d.ts +37 -7
  124. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUSceneBrickClipmap.d.ts.map +1 -1
  125. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUSceneBrickClipmap.js +132 -8
  126. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.d.ts +3 -1
  127. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.d.ts.map +1 -1
  128. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.js +6 -2
  129. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_indirect_lighting.d.ts.map +1 -1
  130. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_indirect_lighting.js +3 -1
  131. package/src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.d.ts +15 -7
  132. package/src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.d.ts.map +1 -1
  133. package/src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.js +40 -9
  134. package/src/shade/renderer/global_illumination/screen_probe/SCREEN_PROBE.d.ts +23 -0
  135. package/src/shade/renderer/global_illumination/screen_probe/SCREEN_PROBE.d.ts.map +1 -1
  136. package/src/shade/renderer/global_illumination/screen_probe/SCREEN_PROBE.js +26 -0
  137. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeDebugView.d.ts +1 -0
  138. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeDebugView.js +6 -0
  139. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.d.ts +13 -1
  140. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.d.ts.map +1 -1
  141. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.js +23 -1
  142. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe.d.ts.map +1 -1
  143. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe.js +2 -0
  144. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_rough_specular.d.ts +29 -0
  145. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_rough_specular.d.ts.map +1 -0
  146. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_rough_specular.js +102 -0
  147. package/src/shade/renderer/global_illumination/screen_probe/graph_screen_probe_debug_view.d.ts +8 -1
  148. package/src/shade/renderer/global_illumination/screen_probe/graph_screen_probe_debug_view.d.ts.map +1 -1
  149. package/src/shade/renderer/global_illumination/screen_probe/graph_screen_probe_debug_view.js +27 -1
  150. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_gather.d.ts +4 -1
  151. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_gather.d.ts.map +1 -1
  152. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_gather.js +4 -1
  153. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_indirect_lighting.d.ts +11 -5
  154. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_indirect_lighting.d.ts.map +1 -1
  155. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_indirect_lighting.js +28 -10
  156. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_resolve.d.ts +36 -2
  157. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_resolve.d.ts.map +1 -1
  158. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_resolve.js +149 -4
  159. package/src/shade/renderer/global_illumination/shader_resolve_indirect_lighting.d.ts.map +1 -1
  160. package/src/shade/renderer/global_illumination/shader_resolve_indirect_lighting.js +3 -1
  161. package/src/shade/renderer/global_illumination/sharc/sharc_constants.d.ts +0 -18
  162. package/src/shade/renderer/global_illumination/sharc/sharc_constants.d.ts.map +1 -1
  163. package/src/shade/renderer/global_illumination/sharc/sharc_constants.js +1 -21
  164. package/src/shade/renderer/hair/GPUHairSystem.d.ts +278 -0
  165. package/src/shade/renderer/hair/GPUHairSystem.d.ts.map +1 -0
  166. package/src/shade/renderer/hair/GPUHairSystem.js +2263 -0
  167. package/src/shade/renderer/hair/HAIR.d.ts +121 -0
  168. package/src/shade/renderer/hair/HAIR.d.ts.map +1 -0
  169. package/src/shade/renderer/hair/HAIR.js +136 -0
  170. package/src/shade/renderer/hair/HAIR_DATABASE_SPEC.d.ts +17 -0
  171. package/src/shade/renderer/hair/HAIR_DATABASE_SPEC.d.ts.map +1 -0
  172. package/src/shade/renderer/hair/HAIR_DATABASE_SPEC.js +104 -0
  173. package/src/shade/renderer/hair/HAIR_FRAME_STRUCTS.d.ts +15 -0
  174. package/src/shade/renderer/hair/HAIR_FRAME_STRUCTS.d.ts.map +1 -0
  175. package/src/shade/renderer/hair/HAIR_FRAME_STRUCTS.js +70 -0
  176. package/src/shade/renderer/hair/HAIR_SIMULATION.d.ts +139 -0
  177. package/src/shade/renderer/hair/HAIR_SIMULATION.d.ts.map +1 -0
  178. package/src/shade/renderer/hair/HAIR_SIMULATION.js +160 -0
  179. package/src/shade/renderer/hair/HairFrame.d.ts +41 -0
  180. package/src/shade/renderer/hair/HairFrame.d.ts.map +1 -0
  181. package/src/shade/renderer/hair/HairFrame.js +76 -0
  182. package/src/shade/renderer/hair/chunk_hair_bsdf.d.ts +42 -0
  183. package/src/shade/renderer/hair/chunk_hair_bsdf.d.ts.map +1 -0
  184. package/src/shade/renderer/hair/chunk_hair_bsdf.js +170 -0
  185. package/src/shade/renderer/hair/chunk_hair_dual_scattering.d.ts +37 -0
  186. package/src/shade/renderer/hair/chunk_hair_dual_scattering.d.ts.map +1 -0
  187. package/src/shade/renderer/hair/chunk_hair_dual_scattering.js +158 -0
  188. package/src/shade/renderer/hair/chunk_hair_guide.d.ts +59 -0
  189. package/src/shade/renderer/hair/chunk_hair_guide.d.ts.map +1 -0
  190. package/src/shade/renderer/hair/chunk_hair_guide.js +179 -0
  191. package/src/shade/renderer/hair/chunk_hair_pixel.d.ts +32 -0
  192. package/src/shade/renderer/hair/chunk_hair_pixel.d.ts.map +1 -0
  193. package/src/shade/renderer/hair/chunk_hair_pixel.js +116 -0
  194. package/src/shade/renderer/hair/chunk_hair_strand.d.ts +40 -0
  195. package/src/shade/renderer/hair/chunk_hair_strand.d.ts.map +1 -0
  196. package/src/shade/renderer/hair/chunk_hair_strand.js +85 -0
  197. package/src/shade/renderer/hair/chunk_hair_volume.d.ts +32 -0
  198. package/src/shade/renderer/hair/chunk_hair_volume.d.ts.map +1 -0
  199. package/src/shade/renderer/hair/chunk_hair_volume.js +115 -0
  200. package/src/shade/renderer/hair/hair_id_draw.d.ts +24 -0
  201. package/src/shade/renderer/hair/hair_id_draw.d.ts.map +1 -0
  202. package/src/shade/renderer/hair/hair_id_draw.js +135 -0
  203. package/src/shade/renderer/hair/hair_lighting.d.ts +53 -0
  204. package/src/shade/renderer/hair/hair_lighting.d.ts.map +1 -0
  205. package/src/shade/renderer/hair/hair_lighting.js +279 -0
  206. package/src/shade/renderer/hair/hair_scattering_lut.d.ts +75 -0
  207. package/src/shade/renderer/hair/hair_scattering_lut.d.ts.map +1 -0
  208. package/src/shade/renderer/hair/hair_scattering_lut.js +271 -0
  209. package/src/shade/renderer/hair/hair_shadow_draw.d.ts +32 -0
  210. package/src/shade/renderer/hair/hair_shadow_draw.d.ts.map +1 -0
  211. package/src/shade/renderer/hair/hair_shadow_draw.js +123 -0
  212. package/src/shade/renderer/hair/hair_stamp.d.ts +33 -0
  213. package/src/shade/renderer/hair/hair_stamp.d.ts.map +1 -0
  214. package/src/shade/renderer/hair/hair_stamp.js +175 -0
  215. package/src/shade/renderer/hair/shader_hair_classes.d.ts +22 -0
  216. package/src/shade/renderer/hair/shader_hair_classes.d.ts.map +1 -0
  217. package/src/shade/renderer/hair/shader_hair_classes.js +90 -0
  218. package/src/shade/renderer/hair/shader_hair_cull.d.ts +37 -0
  219. package/src/shade/renderer/hair/shader_hair_cull.d.ts.map +1 -0
  220. package/src/shade/renderer/hair/shader_hair_cull.js +251 -0
  221. package/src/shade/renderer/hair/shader_hair_lod.d.ts +39 -0
  222. package/src/shade/renderer/hair/shader_hair_lod.d.ts.map +1 -0
  223. package/src/shade/renderer/hair/shader_hair_lod.js +362 -0
  224. package/src/shade/renderer/hair/shader_hair_roots.d.ts +36 -0
  225. package/src/shade/renderer/hair/shader_hair_roots.d.ts.map +1 -0
  226. package/src/shade/renderer/hair/shader_hair_roots.js +261 -0
  227. package/src/shade/renderer/hair/shader_hair_shadow_list.d.ts +44 -0
  228. package/src/shade/renderer/hair/shader_hair_shadow_list.d.ts.map +1 -0
  229. package/src/shade/renderer/hair/shader_hair_shadow_list.js +240 -0
  230. package/src/shade/renderer/hair/shader_hair_simulate.d.ts +55 -0
  231. package/src/shade/renderer/hair/shader_hair_simulate.d.ts.map +1 -0
  232. package/src/shade/renderer/hair/shader_hair_simulate.js +563 -0
  233. package/src/shade/renderer/hair/shader_hair_volume.d.ts +28 -0
  234. package/src/shade/renderer/hair/shader_hair_volume.d.ts.map +1 -0
  235. package/src/shade/renderer/hair/shader_hair_volume.js +154 -0
  236. package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
  237. package/src/shade/renderer/loader/usd/usd_build_scene.d.ts +31 -0
  238. package/src/shade/renderer/loader/usd/usd_build_scene.d.ts.map +1 -1
  239. package/src/shade/renderer/loader/usd/usd_build_scene.js +36 -21
  240. package/src/shade/renderer/loader/usd/usd_groom_extension.d.ts +65 -0
  241. package/src/shade/renderer/loader/usd/usd_groom_extension.d.ts.map +1 -0
  242. package/src/shade/renderer/loader/usd/usd_groom_extension.js +470 -0
  243. package/src/shade/renderer/particles/GPUParticleSystem.d.ts +8 -0
  244. package/src/shade/renderer/particles/GPUParticleSystem.d.ts.map +1 -1
  245. package/src/shade/renderer/particles/GPUParticleSystem.js +28 -0
  246. package/src/shade/renderer/particles/graph/ParticleNodeRegistry.d.ts.map +1 -1
  247. package/src/shade/renderer/particles/graph/ParticleNodeRegistry.js +22 -0
  248. package/src/shade/renderer/particles/graph/groups/particle_builtin_groups.d.ts.map +1 -1
  249. package/src/shade/renderer/particles/graph/groups/particle_builtin_groups.js +4 -0
  250. package/src/shade/renderer/particles/graph/groups/particle_groups_scene.d.ts +32 -0
  251. package/src/shade/renderer/particles/graph/groups/particle_groups_scene.d.ts.map +1 -0
  252. package/src/shade/renderer/particles/graph/groups/particle_groups_scene.js +80 -0
  253. package/src/shade/renderer/particles/graph/particle_node_parameters.d.ts.map +1 -1
  254. package/src/shade/renderer/particles/graph/particle_node_parameters.js +1 -0
  255. package/src/shade/renderer/particles/graph/particle_node_presentation.d.ts.map +1 -1
  256. package/src/shade/renderer/particles/graph/particle_node_presentation.js +12 -0
  257. package/src/shade/renderer/particles/graph_particles.d.ts +5 -1
  258. package/src/shade/renderer/particles/graph_particles.d.ts.map +1 -1
  259. package/src/shade/renderer/particles/graph_particles.js +18 -3
  260. package/src/shade/renderer/particles/isa/InstructionStream.d.ts +25 -0
  261. package/src/shade/renderer/particles/isa/InstructionStream.d.ts.map +1 -1
  262. package/src/shade/renderer/particles/isa/InstructionStream.js +25 -0
  263. package/src/shade/renderer/particles/isa/ParticleVMISA.d.ts +9 -0
  264. package/src/shade/renderer/particles/isa/ParticleVMISA.d.ts.map +1 -1
  265. package/src/shade/renderer/particles/isa/ParticleVMISA.js +20 -0
  266. package/src/shade/renderer/particles/isa/particle_program_reads_scene_sdf.d.ts +9 -0
  267. package/src/shade/renderer/particles/isa/particle_program_reads_scene_sdf.d.ts.map +1 -0
  268. package/src/shade/renderer/particles/isa/particle_program_reads_scene_sdf.js +29 -0
  269. package/src/shade/renderer/particles/optimizer/particle_program_equivalence.d.ts +2 -1
  270. package/src/shade/renderer/particles/optimizer/particle_program_equivalence.d.ts.map +1 -1
  271. package/src/shade/renderer/particles/optimizer/particle_program_equivalence.js +27 -5
  272. package/src/shade/renderer/particles/optimizer/particle_program_fuzz.js +1 -1
  273. package/src/shade/renderer/particles/optimizer/particle_vm_semantics.d.ts.map +1 -1
  274. package/src/shade/renderer/particles/optimizer/particle_vm_semantics.js +5 -0
  275. package/src/shade/renderer/particles/runtime/EmitterRegistry.d.ts +7 -0
  276. package/src/shade/renderer/particles/runtime/EmitterRegistry.d.ts.map +1 -1
  277. package/src/shade/renderer/particles/runtime/EmitterRegistry.js +10 -0
  278. package/src/shade/renderer/particles/runtime/ParticleEmitter.d.ts +5 -0
  279. package/src/shade/renderer/particles/runtime/ParticleEmitter.d.ts.map +1 -1
  280. package/src/shade/renderer/particles/runtime/ParticleEmitter.js +5 -0
  281. package/src/shade/renderer/particles/runtime/ProgramHeap.d.ts +8 -0
  282. package/src/shade/renderer/particles/runtime/ProgramHeap.d.ts.map +1 -1
  283. package/src/shade/renderer/particles/runtime/ProgramHeap.js +25 -0
  284. package/src/shade/renderer/particles/shaders/shader_particle_emit.d.ts +1 -1
  285. package/src/shade/renderer/particles/shaders/shader_particle_emit.d.ts.map +1 -1
  286. package/src/shade/renderer/particles/shaders/shader_particle_emit.js +9 -3
  287. package/src/shade/renderer/particles/shaders/shader_particle_emit_wide.d.ts.map +1 -1
  288. package/src/shade/renderer/particles/shaders/shader_particle_emit_wide.js +4 -2
  289. package/src/shade/renderer/particles/shaders/shader_particle_simulate.d.ts +2 -2
  290. package/src/shade/renderer/particles/shaders/shader_particle_simulate.d.ts.map +1 -1
  291. package/src/shade/renderer/particles/shaders/shader_particle_simulate.js +10 -4
  292. package/src/shade/renderer/particles/shaders/shader_particle_simulate_wide.d.ts.map +1 -1
  293. package/src/shade/renderer/particles/shaders/shader_particle_simulate_wide.js +4 -2
  294. package/src/shade/renderer/particles/vm/ParticleVMReference.d.ts +14 -1
  295. package/src/shade/renderer/particles/vm/ParticleVMReference.d.ts.map +1 -1
  296. package/src/shade/renderer/particles/vm/ParticleVMReference.js +34 -1
  297. package/src/shade/renderer/particles/vm/chunk_particle_vm.d.ts.map +1 -1
  298. package/src/shade/renderer/particles/vm/chunk_particle_vm.js +10 -0
  299. package/src/shade/renderer/particles/vm/chunk_particle_vm_scene_sdf.d.ts +39 -0
  300. package/src/shade/renderer/particles/vm/chunk_particle_vm_scene_sdf.d.ts.map +1 -0
  301. package/src/shade/renderer/particles/vm/chunk_particle_vm_scene_sdf.js +90 -0
  302. package/src/shade/renderer/particles/warmup/graph_particle_warmup.d.ts +4 -1
  303. package/src/shade/renderer/particles/warmup/graph_particle_warmup.d.ts.map +1 -1
  304. package/src/shade/renderer/particles/warmup/graph_particle_warmup.js +14 -2
  305. package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance.d.ts +1 -1
  306. package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance.d.ts.map +1 -1
  307. package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance.js +9 -3
  308. package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance_wide.d.ts.map +1 -1
  309. package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance_wide.js +4 -2
  310. package/src/shade/renderer/path_tracer/shader/chunk_sample_material_data.d.ts.map +1 -1
  311. package/src/shade/renderer/path_tracer/shader/chunk_sample_material_data.js +4 -1
  312. package/src/shade/renderer/path_tracer/shader/chunk_shading_closure_from_material_data.d.ts.map +1 -1
  313. package/src/shade/renderer/path_tracer/shader/chunk_shading_closure_from_material_data.js +3 -1
  314. package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
  315. package/src/shade/renderer/postprocess/ssr/SSR.d.ts +4 -1
  316. package/src/shade/renderer/postprocess/ssr/SSR.d.ts.map +1 -1
  317. package/src/shade/renderer/postprocess/ssr/SSR.js +9 -0
  318. package/src/shade/renderer/postprocess/ssr/resolve/chunk_ssr_sample_radiance.d.ts +16 -1
  319. package/src/shade/renderer/postprocess/ssr/resolve/chunk_ssr_sample_radiance.d.ts.map +1 -1
  320. package/src/shade/renderer/postprocess/ssr/resolve/chunk_ssr_sample_radiance.js +47 -3
  321. package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader.d.ts.map +1 -1
  322. package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader.js +5 -3
  323. package/src/shade/renderer/postprocess/ssr/ssr_combine_shader.d.ts.map +1 -1
  324. package/src/shade/renderer/postprocess/ssr/ssr_combine_shader.js +6 -5
  325. package/src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.d.ts +7 -4
  326. package/src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.d.ts.map +1 -1
  327. package/src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.js +26 -16
  328. package/src/shade/renderer/rasterize/forward/chunk_forward_shade_standard_fragment.d.ts.map +1 -1
  329. package/src/shade/renderer/rasterize/forward/chunk_forward_shade_standard_fragment.js +5 -2
  330. package/src/shade/renderer/rasterize/native/avboit/avboit_draw_fragment_body.d.ts.map +1 -1
  331. package/src/shade/renderer/rasterize/native/avboit/avboit_draw_fragment_body.js +5 -0
  332. package/src/shade/renderer/rasterize/native/avboit/shader_avboit_splat.d.ts.map +1 -1
  333. package/src/shade/renderer/rasterize/native/avboit/shader_avboit_splat.js +4 -1
  334. package/src/shade/renderer/rasterize/native/oit/oit_resolve_fragment_body.d.ts.map +1 -1
  335. package/src/shade/renderer/rasterize/native/oit/oit_resolve_fragment_body.js +5 -1
  336. package/src/shade/renderer/rasterize/native/oit/shader_oit_generate_moments.d.ts.map +1 -1
  337. package/src/shade/renderer/rasterize/native/oit/shader_oit_generate_moments.js +7 -4
  338. package/src/shade/renderer/scene/GPUSceneContext.d.ts +7 -0
  339. package/src/shade/renderer/scene/GPUSceneContext.d.ts.map +1 -1
  340. package/src/shade/renderer/scene/GPUSceneContext.js +18 -0
  341. package/src/shade/renderer/shader/chunk/brdf/chunk_shadowed_F90.d.ts +13 -8
  342. package/src/shade/renderer/shader/chunk/brdf/chunk_shadowed_F90.d.ts.map +1 -1
  343. package/src/shade/renderer/shader/chunk/brdf/chunk_shadowed_F90.js +18 -14
  344. package/src/shade/renderer/shader/chunk/light/chunk_compute_multiscattering_specular.d.ts +3 -2
  345. package/src/shade/renderer/shader/chunk/light/chunk_compute_multiscattering_specular.d.ts.map +1 -1
  346. package/src/shade/renderer/shader/chunk/light/chunk_compute_multiscattering_specular.js +12 -4
  347. package/src/shade/renderer/shader/chunk/material/MATERIAL_SHADING_INFO_STRUCT.d.ts.map +1 -1
  348. package/src/shade/renderer/shader/chunk/material/MATERIAL_SHADING_INFO_STRUCT.js +1 -0
  349. package/src/shade/renderer/shader/chunk/material/chunk_compute_indirect_specular.js +1 -1
  350. package/src/shade/renderer/shader/chunk/material/chunk_metalness_to_specular_F90.d.ts +16 -0
  351. package/src/shade/renderer/shader/chunk/material/chunk_metalness_to_specular_F90.d.ts.map +1 -0
  352. package/src/shade/renderer/shader/chunk/material/chunk_metalness_to_specular_F90.js +25 -0
  353. package/src/shade/renderer/shader/chunk/material/chunk_re_direct_multiscatter.js +2 -2
  354. package/src/shade/renderer/shader/chunk/sdf/chunk_shape_record_signed_distance_gradient.d.ts +20 -0
  355. package/src/shade/renderer/shader/chunk/sdf/chunk_shape_record_signed_distance_gradient.d.ts.map +1 -0
  356. package/src/shade/renderer/shader/chunk/sdf/chunk_shape_record_signed_distance_gradient.js +134 -0
  357. package/src/shade/renderer/shader/compiler/ShaderSwitch.d.ts +1 -1
  358. package/src/shade/renderer/shader/compiler/ShaderSwitchSet.d.ts +1 -1
  359. package/src/shade/renderer/shader/resource/ShaderResourceDescriptor.d.ts +1 -1
  360. package/src/shade/renderer/shadow/map/GPUSceneShadowmapContext.d.ts +15 -0
  361. package/src/shade/renderer/shadow/map/GPUSceneShadowmapContext.d.ts.map +1 -1
  362. package/src/shade/renderer/shadow/map/GPUSceneShadowmapContext.js +69 -0
  363. package/src/shade/renderer/shadow/map/shader/chunk_shadowmap_directional_atlas_casters.d.ts +10 -0
  364. package/src/shade/renderer/shadow/map/shader/chunk_shadowmap_directional_atlas_casters.d.ts.map +1 -0
  365. package/src/shade/renderer/shadow/map/shader/chunk_shadowmap_directional_atlas_casters.js +22 -0
  366. package/src/shade/renderer/shadow/map/shader/chunk_shadowmap_sample_point2.d.ts +2 -2
  367. package/src/shade/renderer/shadow/map/shader/chunk_shadowmap_sample_point2.js +2 -2
  368. package/src/shade/renderer/water/query/GPUWaterQueries.d.ts +1 -1
  369. package/src/shade/renderer/wind/GPUSceneWind.d.ts +1 -1
@@ -0,0 +1,123 @@
1
+ import { RenderPipelineDescriptor } from "../../descriptor/pipeline/render/RenderPipelineDescriptor.js";
2
+ import { CAMERA_RESOURCE } from "../camera/CAMERA_RESOURCE.js";
3
+ import { DEPTH_STENCIL_STATE_SHADOW } from "../rasterize/DEPTH_STENCIL_STATE_SHADOW.js";
4
+ import { CodeChunk } from "../shader/compiler/CodeChunk.js";
5
+ import { ShaderResourceSetDescriptor } from "../shader/resource/ShaderResourceSetDescriptor.js";
6
+ import { ShaderDescriptor } from "../shader/ShaderDescriptor.js";
7
+ import { vec2f, vec4u } from "../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
8
+ import { WebGPUArray } from "../shader/type/WebGPUArray.js";
9
+ import { WebGPUStruct } from "../shader/type/WebGPUStruct.js";
10
+ import { HAIR_CLASS_SHIFT } from "./HAIR.js";
11
+
12
+ /**
13
+ * A shadow view's rectangle as the hair draws into it.
14
+ * @type {WebGPUStruct}
15
+ */
16
+ export const HAIR_SHADOW_TARGET_STRUCT = WebGPUStruct.from({
17
+ /** the view's rectangle in the atlas, texels */
18
+ resolution: vec2f,
19
+ }, "HairShadowTarget").pack();
20
+
21
+ const resources = new ShaderResourceSetDescriptor();
22
+
23
+ resources.createGroup()
24
+ .add(CAMERA_RESOURCE)
25
+ .addUniform("hair_shadow_view", HAIR_SHADOW_TARGET_STRUCT)
26
+ .addStorageBuffer("hair_list", WebGPUArray.u32)
27
+ .addStorageBuffer("hair_points", WebGPUArray.from(vec4u));
28
+
29
+ const body = CodeChunk.from(
30
+ //language=WGSL
31
+ `
32
+ // a deformed point as it is now: x, y, z, then half its drawn width, negative where the view drew it at none
33
+ fn hair_point(slot: u32) -> vec4<f32> {
34
+ return bitcast<vec4<f32>>(hair_points[slot]);
35
+ }
36
+
37
+ @vertex
38
+ fn vs_main(@builtin(vertex_index) vertex: u32, @builtin(instance_index) instance: u32) -> @builtin(position) vec4<f32> {
39
+ let entry = hair_list[instance];
40
+ let slot = entry & ${2 ** HAIR_CLASS_SHIFT - 1}u;
41
+ let segments = 1u << (entry >> ${HAIR_CLASS_SHIFT}u);
42
+
43
+ // a pair of vertices a point, one either side of it
44
+ let j = min(vertex >> 1u, segments);
45
+ let side = f32(vertex & 1u) * 2.0 - 1.0;
46
+
47
+ let point = hair_point(slot + j);
48
+ let before = hair_point(slot + max(j, 1u) - 1u).xyz;
49
+ let after = hair_point(slot + min(j + 1u, segments)).xyz;
50
+
51
+ // across the strand and across the way to the light: along a directional view's axis, its projection being
52
+ // orthographic, or to a spot light's eye
53
+ let orthographic = camera.projection_matrix[3][3] == 1.0;
54
+ let toward = select(camera.transform[3].xyz - point.xyz, camera.view_matrix_inverse[2].xyz, orthographic);
55
+ let raw = cross(after - before, toward);
56
+ let raw_length = length(raw);
57
+
58
+ // a strand seen end on is a dot: any way across will do
59
+ let across = select(camera.transform[0].xyz, raw / raw_length, raw_length > 1e-20);
60
+
61
+ // the strand's own width, whether or not the view drew it
62
+ let half_width = abs(point.w);
63
+
64
+ let clip = camera.view_projection_matrix * vec4<f32>(point.xyz, 1.0);
65
+ let edge = camera.view_projection_matrix * vec4<f32>(point.xyz + across * half_width, 1.0);
66
+
67
+ // texels a unit of normalised device coordinates spans
68
+ let texels = 0.5 * hair_shadow_view.resolution;
69
+
70
+ // half the strand's width in the map, texels, and the way it runs
71
+ let offset = (edge.xy / max(abs(edge.w), 1e-6) - clip.xy / max(abs(clip.w), 1e-6)) * texels;
72
+ let real = length(offset);
73
+ let way = select(vec2<f32>(1.0, 0.0), offset / max(real, 1e-12), real >= 1e-6);
74
+
75
+ // a point narrower than a texel is drawn a texel wide by as many strands as its width is of the texel: by those
76
+ // whose share of the texel, stratified over any run of strands, is under its width's; the depth covers then what
77
+ // the strands cover, which the map's filter takes as the light they let through
78
+ let strand = slot / (segments + 1u);
79
+ let share = fract(f32(strand) * 0.618034 + 0.5);
80
+ let drawn = select(select(0.0, 0.5, real > share * 0.5), real, real >= 0.5);
81
+
82
+ var position = clip + vec4<f32>(way * (drawn * side) / texels * clip.w, 0.0, 0.0);
83
+
84
+ // a view's near plane is fitted to the scene's meshes and the strands reach past them: a point nearer the light
85
+ // than the plane is held on it, reversed depth's 1, and shadows everything behind it as it would have
86
+ position.z = min(position.z, position.w);
87
+
88
+ return position;
89
+ }
90
+ `);
91
+
92
+ const descriptor = ShaderDescriptor.from({ label: "Hair Shadow", body, resources });
93
+
94
+ /**
95
+ * The bindings of {@link HAIR_SHADOW_PIPELINE}: `camera` (the shadow view's), `hair_shadow_view`, `hair_list` (the
96
+ * shadow views' lists) and `hair_points` (the frame's deformed points).
97
+ *
98
+ * @type {ShaderResourceSetDescriptor}
99
+ */
100
+ export const HAIR_SHADOW_RESOURCES = resources;
101
+
102
+ /**
103
+ * Draws the frame's strands into a shadow view's depth, as the scene's casters are drawn
104
+ * (`DEPTH_STENCIL_STATE_SHADOW`).
105
+ *
106
+ * An instance is an entry of the view's list (`shader_hair_shadow_list`), a strand, drawn as `hair_id_draw.js` draws
107
+ * it for the eye: a triangle strip a pair of vertices at each of its points, `2 (2^class + 1)` vertices, one draw a
108
+ * point class (`shader_hair_shadow_draw_args`),
109
+ * across the strand's tangent and the way to the light. Its width is the strand's own, as its point carries it, also
110
+ * where the camera's view drew it at none. Under a texel, a point is drawn a texel wide by the strands whose
111
+ * stratified share is under its width's fraction of the texel, and at none by the rest, so the covered area is the
112
+ * strands' own at any texel size. A point nearer the light than the view's near plane is drawn on the plane. Both faces
113
+ * are drawn.
114
+ *
115
+ * @type {RenderPipelineDescriptor}
116
+ */
117
+ export const HAIR_SHADOW_PIPELINE = RenderPipelineDescriptor.from({
118
+ label: "Hair Shadow",
119
+ layout: resources.generatePipelineLayout(GPUShaderStage.VERTEX),
120
+ vertex: { module: { code: descriptor.source }, entryPoint: "vs_main" },
121
+ depthStencil: DEPTH_STENCIL_STATE_SHADOW,
122
+ primitive: { topology: "triangle-strip", cullMode: "none" },
123
+ });
@@ -0,0 +1,33 @@
1
+ /**
2
+ * The bindings of {@link HAIR_STAMP_PIPELINE} and {@link HAIR_MOTION_PIPELINE}, one layout for both: `camera`,
3
+ * `hair_view`, `hair_lod`, `hair_points`, `hair_ids` (the hair id target), `scene_depth` (the depth the strands
4
+ * were drawn into) and the two matrices of `view_velocity_matrices`.
5
+ *
6
+ * @type {ShaderResourceSetDescriptor}
7
+ */
8
+ export const HAIR_STAMP_RESOURCES: ShaderResourceSetDescriptor;
9
+ /**
10
+ * Writes a black metal into the G-buffer under every pixel a strand covers, an instance a row of the instance table,
11
+ * each over its screen rectangle (4 vertices, a triangle strip): metalness one, albedo zero, roughness one, nothing
12
+ * occluded, no emission, both normals the strand's normal towards the eye, and `VISIBILITY_NONE`. A metal with no
13
+ * colour reflects nothing at any angle (`metalness_to_specular_F90`), direct or indirect, so the deferred passes
14
+ * leave the pixel unlit for the hair lighting pass. The normals are for what reads the G-buffer's geometry: ambient
15
+ * occlusion, the screen probes, reflections.
16
+ *
17
+ * Five targets, loaded: the four G-buffer targets in `G_BUFFER_COLOR_TARGETS`' order, then the visibility buffer.
18
+ *
19
+ * @type {RenderPipelineDescriptor}
20
+ */
21
+ export const HAIR_STAMP_PIPELINE: RenderPipelineDescriptor;
22
+ /**
23
+ * The velocity under every pixel a strand covers, over each instance's screen rectangle as
24
+ * {@link HAIR_STAMP_PIPELINE}: the pixel's point moved as the strand's point under it did, between its place a frame
25
+ * ago and now (`chunk_velocity_texel`). Its own pass: with the stamp's targets it would pass the device floor's
26
+ * attachment bytes.
27
+ *
28
+ * @type {RenderPipelineDescriptor}
29
+ */
30
+ export const HAIR_MOTION_PIPELINE: RenderPipelineDescriptor;
31
+ import { ShaderResourceSetDescriptor } from "../shader/resource/ShaderResourceSetDescriptor.js";
32
+ import { RenderPipelineDescriptor } from "../../descriptor/pipeline/render/RenderPipelineDescriptor.js";
33
+ //# sourceMappingURL=hair_stamp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hair_stamp.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/hair/hair_stamp.js"],"names":[],"mappings":"AAsHA;;;;;;GAMG;AACH,mCAFU,2BAA2B,CAES;AAI9C;;;;;;;;;;;GAWG;AACH,kCAFU,wBAAwB,CAe/B;AAEH;;;;;;;GAOG;AACH,mCAFU,wBAAwB,CAY/B;4CAnKyC,mDAAmD;yCAVtD,8DAA8D"}
@@ -0,0 +1,175 @@
1
+ import { ColorTargetState } from "../../descriptor/pipeline/render/ColorTargetState.js";
2
+ import { RenderPipelineDescriptor } from "../../descriptor/pipeline/render/RenderPipelineDescriptor.js";
3
+ import { CAMERA_RESOURCE } from "../camera/CAMERA_RESOURCE.js";
4
+ import { G_BUFFER_COLOR_TARGETS } from "../gbuffer/G_BUFFER_COLOR_TARGETS.js";
5
+ import { chunk_velocity_texel } from "../postprocess/velocity/chunk_velocity_texel.js";
6
+ import { VELOCITY_FORMAT } from "../postprocess/velocity/VELOCITY_BUFFER.js";
7
+ import { VISIBILITY_FORMAT, VISIBILITY_NONE } from "../rasterize/visibility/VISIBILITY_BUFFER.js";
8
+ import { chunk_rgbe9995_encode } from "../shader/chunk/color/rgbe9995/chunk_rgbe9995_encode.js";
9
+ import { chunk_encode_g_buffer_face_normal } from "../shader/chunk/geometry/normal/chunk_encode_g_buffer_face_normal.js";
10
+ import { chunk_encode_g_buffer_normal } from "../shader/chunk/geometry/normal/chunk_encode_g_buffer_normal.js";
11
+ import { CodeChunk } from "../shader/compiler/CodeChunk.js";
12
+ import { ShaderResourceSetDescriptor } from "../shader/resource/ShaderResourceSetDescriptor.js";
13
+ import { ShaderDescriptor } from "../shader/ShaderDescriptor.js";
14
+ import { mat4x4f, vec4u } from "../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
15
+ import { WebGPUArray } from "../shader/type/WebGPUArray.js";
16
+ import { chunk_hair_pixel, chunk_hair_quad_vertex } from "./chunk_hair_pixel.js";
17
+ import { HAIR_LOD_STRUCT, HAIR_VIEW_STRUCT } from "./HAIR_FRAME_STRUCTS.js";
18
+
19
+ const resources = new ShaderResourceSetDescriptor();
20
+
21
+ resources.createGroup()
22
+ .add(CAMERA_RESOURCE)
23
+ .addUniform("hair_view", HAIR_VIEW_STRUCT)
24
+ .addStorageBuffer("hair_lod", WebGPUArray.from(HAIR_LOD_STRUCT))
25
+ .addStorageBuffer("hair_points", WebGPUArray.from(vec4u))
26
+ .addTexture("hair_ids", "uint")
27
+ .addTexture("scene_depth")
28
+ .addUniform("inverse_view_projection", mat4x4f)
29
+ .addUniform("view_projection_previous", mat4x4f);
30
+
31
+ const vertex_body = CodeChunk.from(
32
+ //language=WGSL
33
+ `
34
+ @vertex
35
+ fn vs_main(@builtin(vertex_index) vertex: u32, @builtin(instance_index) row: u32) -> HairQuadVertex {
36
+ return hair_quad_vertex(vertex, row);
37
+ }
38
+ `, [chunk_hair_quad_vertex]);
39
+
40
+ const stamp_body = CodeChunk.from(
41
+ //language=WGSL
42
+ `
43
+ struct HairStampOutput {
44
+ @location(0) pbr: vec4<f32>,
45
+ @location(1) normal: u32,
46
+ @location(2) albedo: vec4<f32>,
47
+ @location(3) emissive: u32,
48
+ @location(4) visibility: u32,
49
+ }
50
+
51
+ @fragment
52
+ fn fs_main(in: HairQuadVertex) -> HairStampOutput {
53
+ var hair: HairPixel;
54
+
55
+ if (!hair_pixel(in.position.xy, in.row, &hair)) {
56
+ discard;
57
+ }
58
+
59
+ let tangent = hair_pixel_tangent(hair);
60
+ let point = mix(hair.a.xyz, hair.b.xyz, hair.along);
61
+ let normal = hair_normal(tangent, normalize(camera.transform[3].xyz - point));
62
+
63
+ var out: HairStampOutput;
64
+
65
+ // a black metal: the deferred passes light it with nothing, and the hair pass lights it instead
66
+ out.pbr = vec4<f32>(1.0, 1.0, encode_g_buffer_face_normal(normal));
67
+ out.normal = encode_g_buffer_normal(normal);
68
+ out.albedo = vec4<f32>(0.0, 0.0, 0.0, 1.0);
69
+ out.emissive = rgbe9995_encode(vec3<f32>(0.0));
70
+
71
+ // no meshlet is under a strand
72
+ out.visibility = ${VISIBILITY_NONE}u;
73
+
74
+ return out;
75
+ }
76
+ `, [
77
+ chunk_hair_quad_vertex,
78
+ chunk_hair_pixel,
79
+ chunk_encode_g_buffer_normal,
80
+ chunk_encode_g_buffer_face_normal,
81
+ chunk_rgbe9995_encode,
82
+ ]);
83
+
84
+ const motion_body = CodeChunk.from(
85
+ //language=WGSL
86
+ `
87
+ @fragment
88
+ fn fs_main(in: HairQuadVertex) -> @location(0) vec4<f32> {
89
+ var hair: HairPixel;
90
+
91
+ if (!hair_pixel(in.position.xy, in.row, &hair)) {
92
+ discard;
93
+ }
94
+
95
+ let pixel = in.position.xy;
96
+ let size = hair_view.resolution;
97
+
98
+ let depth = textureLoad(scene_depth, vec2<i32>(pixel), 0).r;
99
+ let here = inverse_view_projection * vec4<f32>(pixel.x / size.x * 2.0 - 1.0, 1.0 - pixel.y / size.y * 2.0, depth, 1.0);
100
+
101
+ // the pixel's point moved as the strand's point under it did
102
+ let moved = mix(hair.a.xyz, hair.b.xyz, hair.along) - mix(hair.a_before, hair.b_before, hair.along);
103
+
104
+ let before = view_projection_previous * vec4<f32>(here.xyz / here.w - moved, 1.0);
105
+
106
+ // this frame's clip w, the point's view depth, is the reciprocal of the w its unprojection came out with
107
+ return velocity_texel(pixel, 1.0 / here.w, before, size);
108
+ }
109
+ `, [
110
+ chunk_hair_quad_vertex,
111
+ chunk_hair_pixel,
112
+ chunk_velocity_texel,
113
+ ]);
114
+
115
+ const vertex_descriptor = ShaderDescriptor.from({ label: "Hair Rect", body: vertex_body, resources });
116
+ const stamp_descriptor = ShaderDescriptor.from({ label: "Hair Stamp", body: stamp_body, resources });
117
+ const motion_descriptor = ShaderDescriptor.from({ label: "Hair Motion", body: motion_body, resources });
118
+
119
+ /**
120
+ * The bindings of {@link HAIR_STAMP_PIPELINE} and {@link HAIR_MOTION_PIPELINE}, one layout for both: `camera`,
121
+ * `hair_view`, `hair_lod`, `hair_points`, `hair_ids` (the hair id target), `scene_depth` (the depth the strands
122
+ * were drawn into) and the two matrices of `view_velocity_matrices`.
123
+ *
124
+ * @type {ShaderResourceSetDescriptor}
125
+ */
126
+ export const HAIR_STAMP_RESOURCES = resources;
127
+
128
+ const layout = resources.generatePipelineLayout(GPUShaderStage.VERTEX | GPUShaderStage.FRAGMENT);
129
+
130
+ /**
131
+ * Writes a black metal into the G-buffer under every pixel a strand covers, an instance a row of the instance table,
132
+ * each over its screen rectangle (4 vertices, a triangle strip): metalness one, albedo zero, roughness one, nothing
133
+ * occluded, no emission, both normals the strand's normal towards the eye, and `VISIBILITY_NONE`. A metal with no
134
+ * colour reflects nothing at any angle (`metalness_to_specular_F90`), direct or indirect, so the deferred passes
135
+ * leave the pixel unlit for the hair lighting pass. The normals are for what reads the G-buffer's geometry: ambient
136
+ * occlusion, the screen probes, reflections.
137
+ *
138
+ * Five targets, loaded: the four G-buffer targets in `G_BUFFER_COLOR_TARGETS`' order, then the visibility buffer.
139
+ *
140
+ * @type {RenderPipelineDescriptor}
141
+ */
142
+ export const HAIR_STAMP_PIPELINE = RenderPipelineDescriptor.from({
143
+ label: "Hair Stamp",
144
+ layout,
145
+ vertex: { module: { code: vertex_descriptor.source }, entryPoint: "vs_main" },
146
+ fragment: {
147
+ module: { code: stamp_descriptor.source },
148
+ entryPoint: "fs_main",
149
+ targets: [
150
+ ...G_BUFFER_COLOR_TARGETS.map(target => ColorTargetState.from({ format: target.format })),
151
+ ColorTargetState.from({ format: VISIBILITY_FORMAT }),
152
+ ],
153
+ },
154
+ primitive: { topology: "triangle-strip", cullMode: "none" },
155
+ });
156
+
157
+ /**
158
+ * The velocity under every pixel a strand covers, over each instance's screen rectangle as
159
+ * {@link HAIR_STAMP_PIPELINE}: the pixel's point moved as the strand's point under it did, between its place a frame
160
+ * ago and now (`chunk_velocity_texel`). Its own pass: with the stamp's targets it would pass the device floor's
161
+ * attachment bytes.
162
+ *
163
+ * @type {RenderPipelineDescriptor}
164
+ */
165
+ export const HAIR_MOTION_PIPELINE = RenderPipelineDescriptor.from({
166
+ label: "Hair Motion",
167
+ layout,
168
+ vertex: { module: { code: vertex_descriptor.source }, entryPoint: "vs_main" },
169
+ fragment: {
170
+ module: { code: motion_descriptor.source },
171
+ entryPoint: "fs_main",
172
+ targets: [ColorTargetState.from({ format: VELOCITY_FORMAT })],
173
+ },
174
+ primitive: { topology: "triangle-strip", cullMode: "none" },
175
+ });
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Lays the frame's draw list out by point class, once the level of detail has added every instance's prefix to its
3
+ * class's: a thread a class, writing where its region starts, the classes' prefixes summed in class order, as its
4
+ * region's start and as its append cursor, and its start plus the strands of the instances the view draws as the
5
+ * cursor of those only the shadow views draw. A region holds every strand its class can be asked for. One workgroup.
6
+ *
7
+ * @type {ComputeShader}
8
+ */
9
+ export const shader_hair_regions: ComputeShader;
10
+ export const HAIR_DRAW_ARGS_SETTINGS: WebGPUStruct;
11
+ /**
12
+ * The id raster's indirect draws, one a point class (`HAIR_DRAW_ARGS_WORDS` words each, at the class's index): a
13
+ * triangle strip of `2 (2^class + 1)` vertices an instance, an instance a strand the cull appended to the class's
14
+ * region, the instances starting at the region's start (`first_instance`). What the list could not hold is not
15
+ * drawn. Written by a pass of its own, so the render pass that draws through it binds it read-only. One workgroup.
16
+ *
17
+ * @type {ComputeShader}
18
+ */
19
+ export const shader_hair_draw_args: ComputeShader;
20
+ import { ComputeShader } from "../shader/ComputeShader.js";
21
+ import { WebGPUStruct } from "../shader/type/WebGPUStruct.js";
22
+ //# sourceMappingURL=shader_hair_classes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shader_hair_classes.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/hair/shader_hair_classes.js"],"names":[],"mappings":"AAoBA;;;;;;;GAOG;AACH,kCAFU,aAAa,CAqBpB;AAEH,mDAG2B;AAU3B;;;;;;;GAOG;AACH,oCAFU,aAAa,CAqBpB;8BAxF2B,4BAA4B;6BAI7B,gCAAgC"}
@@ -0,0 +1,90 @@
1
+ import { CodeChunk } from "../shader/compiler/CodeChunk.js";
2
+ import { ComputeShader } from "../shader/ComputeShader.js";
3
+ import { ShaderResourceSetDescriptor } from "../shader/resource/ShaderResourceSetDescriptor.js";
4
+ import { atomic_u32, u32 } from "../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
5
+ import { WebGPUArray } from "../shader/type/WebGPUArray.js";
6
+ import { WebGPUStruct } from "../shader/type/WebGPUStruct.js";
7
+ import {
8
+ HAIR_CLASS_COUNT,
9
+ HAIR_COUNTER_BASES,
10
+ HAIR_COUNTER_CURSORS,
11
+ HAIR_COUNTER_SHADOW_CURSORS,
12
+ HAIR_COUNTER_SHADOW_STRANDS,
13
+ HAIR_DRAW_ARGS_WORDS
14
+ } from "./HAIR.js";
15
+
16
+ const regions_resources = new ShaderResourceSetDescriptor();
17
+
18
+ regions_resources.createGroup()
19
+ .addStorageBuffer("hair_counters", WebGPUArray.from(atomic_u32), true);
20
+
21
+ /**
22
+ * Lays the frame's draw list out by point class, once the level of detail has added every instance's prefix to its
23
+ * class's: a thread a class, writing where its region starts, the classes' prefixes summed in class order, as its
24
+ * region's start and as its append cursor, and its start plus the strands of the instances the view draws as the
25
+ * cursor of those only the shadow views draw. A region holds every strand its class can be asked for. One workgroup.
26
+ *
27
+ * @type {ComputeShader}
28
+ */
29
+ export const shader_hair_regions = ComputeShader.from({
30
+ label: "Hair Regions",
31
+ resources: regions_resources,
32
+ body: CodeChunk.from(
33
+ //language=WGSL
34
+ `
35
+ @compute @workgroup_size(${HAIR_CLASS_COUNT}, 1, 1)
36
+ fn main(@builtin(local_invocation_index) point_class: u32) {
37
+ var start = 0u;
38
+
39
+ for (var c = 0u; c < point_class; c++) {
40
+ start += atomicLoad(&hair_counters[c]) + atomicLoad(&hair_counters[${HAIR_COUNTER_SHADOW_STRANDS}u + c]);
41
+ }
42
+
43
+ atomicStore(&hair_counters[${HAIR_COUNTER_BASES}u + point_class], start);
44
+ atomicStore(&hair_counters[${HAIR_COUNTER_CURSORS}u + point_class], start);
45
+ atomicStore(&hair_counters[${HAIR_COUNTER_SHADOW_CURSORS}u + point_class], start + atomicLoad(&hair_counters[point_class]));
46
+ }
47
+ `),
48
+ });
49
+
50
+ export const HAIR_DRAW_ARGS_SETTINGS = WebGPUStruct.from({
51
+ /** entries the frame's draw list holds */
52
+ list_capacity: u32,
53
+ }, "HairDrawArgsSettings");
54
+
55
+ const args_resources = new ShaderResourceSetDescriptor();
56
+
57
+ args_resources.setImmediate("settings", HAIR_DRAW_ARGS_SETTINGS);
58
+
59
+ args_resources.createGroup()
60
+ .addStorageBuffer("hair_counters", WebGPUArray.u32, false)
61
+ .addStorageBuffer("hair_draw_args", WebGPUArray.u32, true);
62
+
63
+ /**
64
+ * The id raster's indirect draws, one a point class (`HAIR_DRAW_ARGS_WORDS` words each, at the class's index): a
65
+ * triangle strip of `2 (2^class + 1)` vertices an instance, an instance a strand the cull appended to the class's
66
+ * region, the instances starting at the region's start (`first_instance`). What the list could not hold is not
67
+ * drawn. Written by a pass of its own, so the render pass that draws through it binds it read-only. One workgroup.
68
+ *
69
+ * @type {ComputeShader}
70
+ */
71
+ export const shader_hair_draw_args = ComputeShader.from({
72
+ label: "Hair Draw Args",
73
+ resources: args_resources,
74
+ body: CodeChunk.from(
75
+ //language=WGSL
76
+ `
77
+ @compute @workgroup_size(${HAIR_CLASS_COUNT}, 1, 1)
78
+ fn main(@builtin(local_invocation_index) point_class: u32) {
79
+ let start = hair_counters[${HAIR_COUNTER_BASES}u + point_class];
80
+ let end = min(hair_counters[${HAIR_COUNTER_CURSORS}u + point_class], settings.list_capacity);
81
+
82
+ let at = point_class * ${HAIR_DRAW_ARGS_WORDS}u;
83
+
84
+ hair_draw_args[at] = 2u * ((1u << point_class) + 1u);
85
+ hair_draw_args[at + 1u] = select(0u, end - start, end > start);
86
+ hair_draw_args[at + 2u] = 0u;
87
+ hair_draw_args[at + 3u] = start;
88
+ }
89
+ `),
90
+ });
@@ -0,0 +1,37 @@
1
+ export const HAIR_CULL_SETTINGS: WebGPUStruct;
2
+ /**
3
+ * Deforms and lists the frame's strands, a thread a point of every instance's prefix (dispatched through
4
+ * `shader_prefix_sum_to_command`'s folded command over the sums of the instances' points, `prefix × (2^class + 1)`).
5
+ *
6
+ * A thread finds its row from the sums, and from its place among the row's threads its strand's rank and its point
7
+ * along the strand. The strand is kept when its rank is under its own share of the group (`hair_kept_fraction` at
8
+ * its root's view depth), and then drawn wider by the reciprocal of that share, the strand at the boundary narrowed
9
+ * by how far it is past it, so the kept strands' widths sum to the group's at every distance and none appears or
10
+ * vanishes at once.
11
+ *
12
+ * The point, every `2^level`-th of the strand's rest points, is carried by its entity's world matrix as it is and as
13
+ * it was a frame ago into its place in `hair_points` (`HAIR.js`); a simulated group's, by its strand's guide
14
+ * (`hair_guided_point`), its nodes and frames now and a frame ago. No point is drawn narrower than the view's pixel
15
+ * floor, so one narrower than it would be drawn wider than it is: a point of width `w` under the floor `p` at its
16
+ * own depth is drawn, at `p`, only by the strands whose share of the floor (a number in [0, 1) stratified over
17
+ * ranks) is under `w / p`, and at no width by the rest (a negative width). The drawn area is then the strands' own
18
+ * wherever they are, the tapering tips of a thinned fringe included.
19
+ *
20
+ * The thread also lays the segment from its point to the next into the instance's density volume (`HAIR.js`), at
21
+ * the strand's drawn width, which carries the share kept, so a prefix gives an unbiased estimate of the whole group.
22
+ * The volume was cleared by `shader_hair_volume_clear`.
23
+ *
24
+ * The thread of a kept strand's root appends it to its class's region of `hair_list` (`chunk_subgroup_keyed_append`
25
+ * on the class's cursor, or on its cursor for the shadow views' own strands) as its slot and class, and where the
26
+ * strands cast shadows, its shadow words past the list's capacity (`HAIR.js`). An entry the list cannot hold is
27
+ * dropped; the cursor still counts it.
28
+ *
29
+ * An instance only the shadow views draw (its LOD record's `fixed_pixel` not negative) is thinned at that texel, to
30
+ * a texel's width, in place of its roots' pixels at their depth.
31
+ *
32
+ * @type {ComputeShader}
33
+ */
34
+ export const shader_hair_cull: ComputeShader;
35
+ import { WebGPUStruct } from "../shader/type/WebGPUStruct.js";
36
+ import { ComputeShader } from "../shader/ComputeShader.js";
37
+ //# sourceMappingURL=shader_hair_cull.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shader_hair_cull.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/hair/shader_hair_cull.js"],"names":[],"mappings":"AAiCA,8CAWuB;AA0KvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,+BAFU,aAAa,CAMpB;6BA1O0B,gCAAgC;8BAL/B,4BAA4B"}