@woosh/meep-engine 3.74.0 → 3.76.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (363) hide show
  1. package/CHANGELOG.md +20 -19
  2. package/package.json +1 -1
  3. package/src/core/geom/2d/hilbert/v2_hilbert_encode.d.ts +11 -0
  4. package/src/core/geom/2d/hilbert/v2_hilbert_encode.d.ts.map +1 -0
  5. package/src/core/geom/2d/hilbert/v2_hilbert_encode.js +46 -0
  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 +99 -0
  11. package/src/engine/graphics/ecs/hair/Hair.d.ts +47 -0
  12. package/src/engine/graphics/ecs/hair/Hair.d.ts.map +1 -0
  13. package/src/engine/graphics/ecs/hair/Hair.js +61 -0
  14. package/src/engine/graphics/hair/Groom.d.ts +130 -0
  15. package/src/engine/graphics/hair/Groom.d.ts.map +1 -0
  16. package/src/engine/graphics/hair/Groom.js +193 -0
  17. package/src/engine/graphics/hair/GroomSerializationAdapter.d.ts +24 -0
  18. package/src/engine/graphics/hair/GroomSerializationAdapter.d.ts.map +1 -0
  19. package/src/engine/graphics/hair/GroomSerializationAdapter.js +77 -0
  20. package/src/engine/graphics/hair/groom_build_group.d.ts +85 -0
  21. package/src/engine/graphics/hair/groom_build_group.d.ts.map +1 -0
  22. package/src/engine/graphics/hair/groom_build_group.js +487 -0
  23. package/src/engine/graphics/hair/groom_generate_scalp.d.ts +29 -0
  24. package/src/engine/graphics/hair/groom_generate_scalp.d.ts.map +1 -0
  25. package/src/engine/graphics/hair/groom_generate_scalp.js +184 -0
  26. package/src/engine/graphics/hair/groom_rank_order.d.ts +15 -0
  27. package/src/engine/graphics/hair/groom_rank_order.d.ts.map +1 -0
  28. package/src/engine/graphics/hair/groom_rank_order.js +53 -0
  29. package/src/engine/graphics/hair/groom_root_spacing.d.ts +12 -0
  30. package/src/engine/graphics/hair/groom_root_spacing.d.ts.map +1 -0
  31. package/src/engine/graphics/hair/groom_root_spacing.js +120 -0
  32. package/src/engine/graphics/render/frame_graph/FrameGraph.d.ts +6 -0
  33. package/src/engine/graphics/render/frame_graph/FrameGraph.d.ts.map +1 -1
  34. package/src/engine/graphics/render/frame_graph/FrameGraph.js +9 -0
  35. package/src/engine/graphics3/GPUAcousticSystem.d.ts +29 -32
  36. package/src/engine/graphics3/GPUAcousticSystem.d.ts.map +1 -1
  37. package/src/engine/graphics3/GPUAcousticSystem.js +87 -162
  38. package/src/engine/graphics3/HairSystem.d.ts +102 -0
  39. package/src/engine/graphics3/HairSystem.d.ts.map +1 -0
  40. package/src/engine/graphics3/HairSystem.js +456 -0
  41. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  42. package/src/engine/sound/ecs/audio/AudioEmitterSystem.d.ts.map +1 -1
  43. package/src/engine/sound/ecs/audio/AudioEmitterSystem.js +35 -17
  44. package/src/engine/sound/ecs/audio/LiveEmitterSet.d.ts.map +1 -1
  45. package/src/engine/sound/ecs/audio/LiveEmitterSet.js +2 -3
  46. package/src/engine/sound/simulation/AcousticSimulator.d.ts +7 -0
  47. package/src/engine/sound/simulation/AcousticSimulator.d.ts.map +1 -1
  48. package/src/engine/sound/simulation/AcousticSimulator.js +27 -0
  49. package/src/engine/sound/simulation/README.md +121 -107
  50. package/src/engine/sound/sopra/README.md +8 -3
  51. package/src/engine/sound/sopra/definition/effect/AcousticReverbEffect.d.ts +2 -2
  52. package/src/engine/sound/sopra/definition/effect/AcousticReverbEffect.d.ts.map +1 -1
  53. package/src/engine/sound/sopra/definition/effect/AcousticReverbEffect.js +4 -3
  54. package/src/engine/sound/sopra/runtime/AcousticReverbConvolution.d.ts +118 -0
  55. package/src/engine/sound/sopra/runtime/AcousticReverbConvolution.d.ts.map +1 -0
  56. package/src/engine/sound/sopra/runtime/AcousticReverbConvolution.js +472 -0
  57. package/src/engine/sound/sopra/runtime/AcousticReverbLines.d.ts +166 -0
  58. package/src/engine/sound/sopra/runtime/AcousticReverbLines.d.ts.map +1 -0
  59. package/src/engine/sound/sopra/runtime/AcousticReverbLines.js +447 -0
  60. package/src/engine/sound/sopra/runtime/AcousticReverbNetwork.d.ts +69 -113
  61. package/src/engine/sound/sopra/runtime/AcousticReverbNetwork.d.ts.map +1 -1
  62. package/src/engine/sound/sopra/runtime/AcousticReverbNetwork.js +143 -491
  63. package/src/engine/sound/sopra/runtime/AcousticSpeakers.d.ts +102 -0
  64. package/src/engine/sound/sopra/runtime/AcousticSpeakers.d.ts.map +1 -0
  65. package/src/engine/sound/sopra/runtime/AcousticSpeakers.js +232 -0
  66. package/src/engine/sound/sopra/runtime/BusGraph.d.ts +17 -3
  67. package/src/engine/sound/sopra/runtime/BusGraph.d.ts.map +1 -1
  68. package/src/engine/sound/sopra/runtime/BusGraph.js +55 -5
  69. package/src/engine/sound/sopra/runtime/EventInstance.d.ts +8 -6
  70. package/src/engine/sound/sopra/runtime/EventInstance.d.ts.map +1 -1
  71. package/src/engine/sound/sopra/runtime/EventInstance.js +113 -105
  72. package/src/engine/sound/sopra/runtime/acoustic_reverb_decay.d.ts +13 -0
  73. package/src/engine/sound/sopra/runtime/acoustic_reverb_decay.d.ts.map +1 -0
  74. package/src/engine/sound/sopra/runtime/acoustic_reverb_decay.js +15 -0
  75. package/src/generation/grid/generation/discrete/GridTaskConnectRooms.d.ts.map +1 -1
  76. package/src/generation/grid/generation/discrete/GridTaskConnectRooms.js +4 -6
  77. package/src/shade/assets/textures/hair_scattering.bin +0 -0
  78. package/src/shade/device/pipeline/PipelineEnquiry.d.ts +11 -0
  79. package/src/shade/device/pipeline/PipelineEnquiry.d.ts.map +1 -1
  80. package/src/shade/device/pipeline/PipelineEnquiry.js +13 -0
  81. package/src/shade/playground/hair/index.html +50 -0
  82. package/src/shade/playground/hair/main.d.ts +2 -0
  83. package/src/shade/playground/hair/main.d.ts.map +1 -0
  84. package/src/shade/playground/hair/main.js +274 -0
  85. package/src/shade/playground/screen_probes/README.md +54 -0
  86. package/src/shade/playground/screen_probes/index.html +271 -0
  87. package/src/shade/playground/screen_probes/main.d.ts +8 -0
  88. package/src/shade/playground/screen_probes/main.d.ts.map +1 -0
  89. package/src/shade/playground/screen_probes/main.js +527 -0
  90. package/src/shade/playground/skinned_blas_refit/diff_traced_against_rasterized.d.ts.map +1 -1
  91. package/src/shade/playground/skinned_blas_refit/diff_traced_against_rasterized.js +4 -5
  92. package/src/shade/playground/skinned_blas_refit/main.d.ts.map +1 -1
  93. package/src/shade/playground/skinned_blas_refit/main.js +6 -12
  94. package/src/shade/playground/skinned_mesh_soup/main.d.ts.map +1 -1
  95. package/src/shade/playground/skinned_mesh_soup/main.js +1 -2
  96. package/src/shade/playground/vgeo_scene/README.md +12 -2
  97. package/src/shade/playground/vgeo_scene/main.js +1 -1
  98. package/src/shade/playground/volumetrics_froxel/README.md +191 -191
  99. package/src/shade/playground/volumetrics_froxel/measure.d.ts +3 -3
  100. package/src/shade/playground/volumetrics_froxel/measure.d.ts.map +1 -1
  101. package/src/shade/playground/volumetrics_froxel/measure.js +11 -13
  102. package/src/shade/playground/vsm/main.d.ts.map +1 -1
  103. package/src/shade/playground/vsm/main.js +5 -6
  104. package/src/shade/renderer/Renderer.d.ts.map +1 -1
  105. package/src/shade/renderer/Renderer.js +85 -16
  106. package/src/shade/renderer/STATIC_GRAPHICS_ENGINE_ASSETS.d.ts +6 -0
  107. package/src/shade/renderer/STATIC_GRAPHICS_ENGINE_ASSETS.d.ts.map +1 -1
  108. package/src/shade/renderer/STATIC_GRAPHICS_ENGINE_ASSETS.js +10 -0
  109. package/src/shade/renderer/acoustics/ACOUSTIC_LISTENER_RESOURCES.d.ts +28 -0
  110. package/src/shade/renderer/acoustics/ACOUSTIC_LISTENER_RESOURCES.d.ts.map +1 -0
  111. package/src/shade/renderer/acoustics/ACOUSTIC_LISTENER_RESOURCES.js +42 -0
  112. package/src/shade/renderer/acoustics/ACOUSTIC_PROBE_DATABASE_SPEC.d.ts +58 -0
  113. package/src/shade/renderer/acoustics/ACOUSTIC_PROBE_DATABASE_SPEC.d.ts.map +1 -0
  114. package/src/shade/renderer/acoustics/ACOUSTIC_PROBE_DATABASE_SPEC.js +108 -0
  115. package/src/shade/renderer/acoustics/GPUAcousticLattice.d.ts +1 -1
  116. package/src/shade/renderer/acoustics/GPUAcousticProbes.d.ts +161 -0
  117. package/src/shade/renderer/acoustics/GPUAcousticProbes.d.ts.map +1 -0
  118. package/src/shade/renderer/acoustics/GPUAcousticProbes.js +760 -0
  119. package/src/shade/renderer/acoustics/GPUAcoustics.d.ts +1 -1
  120. package/src/shade/renderer/acoustics/acoustic_listener_order.d.ts +12 -0
  121. package/src/shade/renderer/acoustics/acoustic_listener_order.d.ts.map +1 -0
  122. package/src/shade/renderer/acoustics/acoustic_listener_order.js +56 -0
  123. package/src/shade/renderer/acoustics/chunk_acoustic_direct.d.ts.map +1 -1
  124. package/src/shade/renderer/acoustics/chunk_acoustic_direct.js +5 -0
  125. package/src/shade/renderer/acoustics/chunk_acoustic_direct_cone.d.ts +57 -0
  126. package/src/shade/renderer/acoustics/chunk_acoustic_direct_cone.d.ts.map +1 -0
  127. package/src/shade/renderer/acoustics/chunk_acoustic_direct_cone.js +314 -0
  128. package/src/shade/renderer/acoustics/chunk_acoustic_finite.d.ts +15 -0
  129. package/src/shade/renderer/acoustics/chunk_acoustic_finite.d.ts.map +1 -0
  130. package/src/shade/renderer/acoustics/chunk_acoustic_finite.js +21 -0
  131. package/src/shade/renderer/acoustics/chunk_acoustic_gather.js +1 -1
  132. package/src/shade/renderer/acoustics/chunk_acoustic_lean.d.ts +27 -0
  133. package/src/shade/renderer/acoustics/chunk_acoustic_lean.d.ts.map +1 -0
  134. package/src/shade/renderer/acoustics/chunk_acoustic_lean.js +42 -0
  135. package/src/shade/renderer/acoustics/chunk_acoustic_listener.d.ts +80 -0
  136. package/src/shade/renderer/acoustics/chunk_acoustic_listener.d.ts.map +1 -0
  137. package/src/shade/renderer/acoustics/chunk_acoustic_listener.js +274 -0
  138. package/src/shade/renderer/acoustics/chunk_acoustic_partials.d.ts +2 -2
  139. package/src/shade/renderer/acoustics/chunk_acoustic_partials.js +2 -2
  140. package/src/shade/renderer/acoustics/chunk_acoustic_phonon.d.ts +7 -0
  141. package/src/shade/renderer/acoustics/chunk_acoustic_phonon.d.ts.map +1 -1
  142. package/src/shade/renderer/acoustics/chunk_acoustic_phonon.js +24 -1
  143. package/src/shade/renderer/acoustics/chunk_acoustic_resample.js +1 -1
  144. package/src/shade/renderer/acoustics/chunk_acoustic_reservoir.js +1 -1
  145. package/src/shade/renderer/acoustics/chunk_acoustic_through.d.ts +43 -0
  146. package/src/shade/renderer/acoustics/chunk_acoustic_through.d.ts.map +1 -0
  147. package/src/shade/renderer/acoustics/chunk_acoustic_through.js +153 -0
  148. package/src/shade/renderer/acoustics/chunk_acoustic_trace.d.ts +3 -1
  149. package/src/shade/renderer/acoustics/chunk_acoustic_trace.d.ts.map +1 -1
  150. package/src/shade/renderer/acoustics/chunk_acoustic_trace.js +10 -1
  151. package/src/shade/renderer/acoustics/shader_acoustic_combine.d.ts +7 -3
  152. package/src/shade/renderer/acoustics/shader_acoustic_combine.d.ts.map +1 -1
  153. package/src/shade/renderer/acoustics/shader_acoustic_combine.js +22 -6
  154. package/src/shade/renderer/acoustics/shader_acoustic_coupling.d.ts +14 -0
  155. package/src/shade/renderer/acoustics/shader_acoustic_coupling.d.ts.map +1 -0
  156. package/src/shade/renderer/acoustics/shader_acoustic_coupling.js +102 -0
  157. package/src/shade/renderer/acoustics/shader_acoustic_listener.d.ts +12 -0
  158. package/src/shade/renderer/acoustics/shader_acoustic_listener.d.ts.map +1 -0
  159. package/src/shade/renderer/acoustics/shader_acoustic_listener.js +80 -0
  160. package/src/shade/renderer/acoustics/shader_acoustic_receive.d.ts.map +1 -1
  161. package/src/shade/renderer/acoustics/shader_acoustic_receive.js +27 -6
  162. package/src/shade/renderer/acoustics/shader_acoustic_room.d.ts +11 -0
  163. package/src/shade/renderer/acoustics/shader_acoustic_room.d.ts.map +1 -0
  164. package/src/shade/renderer/acoustics/shader_acoustic_room.js +111 -0
  165. package/src/shade/renderer/acoustics/shader_acoustic_source.d.ts +18 -0
  166. package/src/shade/renderer/acoustics/shader_acoustic_source.d.ts.map +1 -0
  167. package/src/shade/renderer/acoustics/shader_acoustic_source.js +130 -0
  168. package/src/shade/renderer/deferred/chunk_read_gBuffer_material.d.ts.map +1 -1
  169. package/src/shade/renderer/deferred/chunk_read_gBuffer_material.js +3 -1
  170. package/src/shade/renderer/deferred/chunk_shade_direct_lights.d.ts +23 -0
  171. package/src/shade/renderer/deferred/chunk_shade_direct_lights.d.ts.map +1 -0
  172. package/src/shade/renderer/deferred/chunk_shade_direct_lights.js +111 -0
  173. package/src/shade/renderer/deferred/chunk_shade_directional_lights.d.ts +17 -6
  174. package/src/shade/renderer/deferred/chunk_shade_directional_lights.d.ts.map +1 -1
  175. package/src/shade/renderer/deferred/chunk_shade_directional_lights.js +26 -21
  176. package/src/shade/renderer/deferred/chunk_shade_standard_material_direct.d.ts +12 -22
  177. package/src/shade/renderer/deferred/chunk_shade_standard_material_direct.d.ts.map +1 -1
  178. package/src/shade/renderer/deferred/chunk_shade_standard_material_direct.js +20 -100
  179. package/src/shade/renderer/deferred/chunk_shade_standard_material_direct_restir.d.ts.map +1 -1
  180. package/src/shade/renderer/deferred/chunk_shade_standard_material_direct_restir.js +6 -4
  181. package/src/shade/renderer/deferred/chunk_standard_material_direct_light_lobe.d.ts +15 -0
  182. package/src/shade/renderer/deferred/chunk_standard_material_direct_light_lobe.d.ts.map +1 -0
  183. package/src/shade/renderer/deferred/chunk_standard_material_direct_light_lobe.js +47 -0
  184. package/src/shade/renderer/extension/ViewLighting.d.ts +101 -0
  185. package/src/shade/renderer/extension/ViewLighting.d.ts.map +1 -0
  186. package/src/shade/renderer/extension/ViewLighting.js +168 -0
  187. package/src/shade/renderer/fluid/GPUFluidCascade.d.ts +3 -3
  188. package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts +1 -1
  189. package/src/shade/renderer/fluid/forcing/GPUFluidForcing.d.ts +7 -7
  190. package/src/shade/renderer/fluid/pressure/GPUFluidPressureSolve.d.ts +1 -1
  191. package/src/shade/renderer/fluid/query/GPUFluidQueries.d.ts +1 -1
  192. package/src/shade/renderer/geometry/virtual/build/level/VGeoFrontier.d.ts +2 -2
  193. package/src/shade/renderer/geometry/virtual/build/level/VGeoFrontier.js +2 -2
  194. package/src/shade/renderer/geometry/virtual/build/level/VGeoLevelOptions.d.ts +5 -2
  195. package/src/shade/renderer/geometry/virtual/build/level/VGeoLevelOptions.d.ts.map +1 -1
  196. package/src/shade/renderer/geometry/virtual/build/level/VGeoLevelOptions.js +5 -2
  197. package/src/shade/renderer/geometry/virtual/build/level/vgeo_build_group_step.d.ts +9 -2
  198. package/src/shade/renderer/geometry/virtual/build/level/vgeo_build_group_step.d.ts.map +1 -1
  199. package/src/shade/renderer/geometry/virtual/build/level/vgeo_build_group_step.js +48 -12
  200. package/src/shade/renderer/geometry/virtual/format/read/VGeoContainerReader.d.ts +0 -22
  201. package/src/shade/renderer/geometry/virtual/format/read/VGeoContainerReader.d.ts.map +1 -1
  202. package/src/shade/renderer/geometry/virtual/format/read/VGeoContainerReader.js +0 -42
  203. package/src/shade/renderer/geometry/virtual/format/read/VGeoReadOptions.d.ts +2 -18
  204. package/src/shade/renderer/geometry/virtual/format/read/VGeoReadOptions.d.ts.map +1 -1
  205. package/src/shade/renderer/geometry/virtual/format/read/VGeoReadOptions.js +2 -19
  206. package/src/shade/renderer/geometry/virtual/format/read/vgeo_page_worker_serve.d.ts.map +1 -1
  207. package/src/shade/renderer/geometry/virtual/format/read/vgeo_page_worker_serve.js +0 -1
  208. package/src/shade/renderer/geometry/virtual/runtime/GPUVirtualGeometryRuntime.d.ts +5 -4
  209. package/src/shade/renderer/geometry/virtual/runtime/GPUVirtualGeometryRuntime.d.ts.map +1 -1
  210. package/src/shade/renderer/geometry/virtual/runtime/GPUVirtualGeometryRuntime.js +3 -1
  211. package/src/shade/renderer/geometry/virtual/runtime/VGeoFeedbackLoop.d.ts.map +1 -1
  212. package/src/shade/renderer/geometry/virtual/runtime/VGeoFeedbackLoop.js +3 -1
  213. package/src/shade/renderer/geometry/virtual/runtime/VGeoPageFetcher.d.ts.map +1 -1
  214. package/src/shade/renderer/geometry/virtual/runtime/VGeoPageFetcher.js +0 -1
  215. package/src/shade/renderer/geometry/virtual/runtime/VGeoViewCut.d.ts +60 -14
  216. package/src/shade/renderer/geometry/virtual/runtime/VGeoViewCut.d.ts.map +1 -1
  217. package/src/shade/renderer/geometry/virtual/runtime/VGeoViewCut.js +75 -39
  218. package/src/shade/renderer/global_illumination/brick4/gpu/draw/shader_brick4_indirect_lighting.d.ts.map +1 -1
  219. package/src/shade/renderer/global_illumination/brick4/gpu/draw/shader_brick4_indirect_lighting.js +3 -1
  220. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts +1 -1
  221. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUSceneBrickClipmap.d.ts +0 -9
  222. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUSceneBrickClipmap.d.ts.map +1 -1
  223. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUSceneBrickClipmap.js +45 -17
  224. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.d.ts +7 -3
  225. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.d.ts.map +1 -1
  226. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.js +43 -7
  227. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_indirect_lighting.d.ts.map +1 -1
  228. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_indirect_lighting.js +3 -1
  229. package/src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.d.ts +15 -7
  230. package/src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.d.ts.map +1 -1
  231. package/src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.js +40 -9
  232. package/src/shade/renderer/global_illumination/screen_probe/SCREEN_PROBE.d.ts +23 -0
  233. package/src/shade/renderer/global_illumination/screen_probe/SCREEN_PROBE.d.ts.map +1 -1
  234. package/src/shade/renderer/global_illumination/screen_probe/SCREEN_PROBE.js +26 -0
  235. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeDebugView.d.ts +1 -0
  236. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeDebugView.js +6 -0
  237. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.d.ts +13 -1
  238. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.d.ts.map +1 -1
  239. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.js +23 -1
  240. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe.d.ts.map +1 -1
  241. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe.js +2 -0
  242. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_rough_specular.d.ts +29 -0
  243. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_rough_specular.d.ts.map +1 -0
  244. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_rough_specular.js +102 -0
  245. package/src/shade/renderer/global_illumination/screen_probe/graph_screen_probe_debug_view.d.ts +8 -1
  246. package/src/shade/renderer/global_illumination/screen_probe/graph_screen_probe_debug_view.d.ts.map +1 -1
  247. package/src/shade/renderer/global_illumination/screen_probe/graph_screen_probe_debug_view.js +27 -1
  248. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_gather.d.ts +4 -1
  249. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_gather.d.ts.map +1 -1
  250. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_gather.js +4 -1
  251. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_indirect_lighting.d.ts +11 -5
  252. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_indirect_lighting.d.ts.map +1 -1
  253. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_indirect_lighting.js +28 -10
  254. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_resolve.d.ts +36 -2
  255. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_resolve.d.ts.map +1 -1
  256. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_resolve.js +149 -4
  257. package/src/shade/renderer/global_illumination/shader_resolve_indirect_lighting.d.ts.map +1 -1
  258. package/src/shade/renderer/global_illumination/shader_resolve_indirect_lighting.js +3 -1
  259. package/src/shade/renderer/hair/GPUHairSystem.d.ts +159 -0
  260. package/src/shade/renderer/hair/GPUHairSystem.d.ts.map +1 -0
  261. package/src/shade/renderer/hair/GPUHairSystem.js +1132 -0
  262. package/src/shade/renderer/hair/HAIR.d.ts +102 -0
  263. package/src/shade/renderer/hair/HAIR.d.ts.map +1 -0
  264. package/src/shade/renderer/hair/HAIR.js +115 -0
  265. package/src/shade/renderer/hair/HAIR_DATABASE_SPEC.d.ts +17 -0
  266. package/src/shade/renderer/hair/HAIR_DATABASE_SPEC.d.ts.map +1 -0
  267. package/src/shade/renderer/hair/HAIR_DATABASE_SPEC.js +71 -0
  268. package/src/shade/renderer/hair/HAIR_FRAME_STRUCTS.d.ts +11 -0
  269. package/src/shade/renderer/hair/HAIR_FRAME_STRUCTS.d.ts.map +1 -0
  270. package/src/shade/renderer/hair/HAIR_FRAME_STRUCTS.js +48 -0
  271. package/src/shade/renderer/hair/HairFrame.d.ts +41 -0
  272. package/src/shade/renderer/hair/HairFrame.d.ts.map +1 -0
  273. package/src/shade/renderer/hair/HairFrame.js +76 -0
  274. package/src/shade/renderer/hair/chunk_hair_bsdf.d.ts +42 -0
  275. package/src/shade/renderer/hair/chunk_hair_bsdf.d.ts.map +1 -0
  276. package/src/shade/renderer/hair/chunk_hair_bsdf.js +170 -0
  277. package/src/shade/renderer/hair/chunk_hair_dual_scattering.d.ts +30 -0
  278. package/src/shade/renderer/hair/chunk_hair_dual_scattering.d.ts.map +1 -0
  279. package/src/shade/renderer/hair/chunk_hair_dual_scattering.js +131 -0
  280. package/src/shade/renderer/hair/chunk_hair_pixel.d.ts +32 -0
  281. package/src/shade/renderer/hair/chunk_hair_pixel.d.ts.map +1 -0
  282. package/src/shade/renderer/hair/chunk_hair_pixel.js +116 -0
  283. package/src/shade/renderer/hair/chunk_hair_strand.d.ts +40 -0
  284. package/src/shade/renderer/hair/chunk_hair_strand.d.ts.map +1 -0
  285. package/src/shade/renderer/hair/chunk_hair_strand.js +85 -0
  286. package/src/shade/renderer/hair/chunk_hair_volume.d.ts +31 -0
  287. package/src/shade/renderer/hair/chunk_hair_volume.d.ts.map +1 -0
  288. package/src/shade/renderer/hair/chunk_hair_volume.js +106 -0
  289. package/src/shade/renderer/hair/hair_id_draw.d.ts +24 -0
  290. package/src/shade/renderer/hair/hair_id_draw.d.ts.map +1 -0
  291. package/src/shade/renderer/hair/hair_id_draw.js +135 -0
  292. package/src/shade/renderer/hair/hair_lighting.d.ts +53 -0
  293. package/src/shade/renderer/hair/hair_lighting.d.ts.map +1 -0
  294. package/src/shade/renderer/hair/hair_lighting.js +270 -0
  295. package/src/shade/renderer/hair/hair_scattering_lut.d.ts +75 -0
  296. package/src/shade/renderer/hair/hair_scattering_lut.d.ts.map +1 -0
  297. package/src/shade/renderer/hair/hair_scattering_lut.js +271 -0
  298. package/src/shade/renderer/hair/hair_stamp.d.ts +33 -0
  299. package/src/shade/renderer/hair/hair_stamp.d.ts.map +1 -0
  300. package/src/shade/renderer/hair/hair_stamp.js +175 -0
  301. package/src/shade/renderer/hair/shader_hair_classes.d.ts +21 -0
  302. package/src/shade/renderer/hair/shader_hair_classes.d.ts.map +1 -0
  303. package/src/shade/renderer/hair/shader_hair_classes.js +86 -0
  304. package/src/shade/renderer/hair/shader_hair_cull.d.ts +31 -0
  305. package/src/shade/renderer/hair/shader_hair_cull.d.ts.map +1 -0
  306. package/src/shade/renderer/hair/shader_hair_cull.js +194 -0
  307. package/src/shade/renderer/hair/shader_hair_lod.d.ts +33 -0
  308. package/src/shade/renderer/hair/shader_hair_lod.d.ts.map +1 -0
  309. package/src/shade/renderer/hair/shader_hair_lod.js +268 -0
  310. package/src/shade/renderer/hair/shader_hair_volume.d.ts +28 -0
  311. package/src/shade/renderer/hair/shader_hair_volume.d.ts.map +1 -0
  312. package/src/shade/renderer/hair/shader_hair_volume.js +167 -0
  313. package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
  314. package/src/shade/renderer/loader/usd/usd_build_scene.d.ts +31 -0
  315. package/src/shade/renderer/loader/usd/usd_build_scene.d.ts.map +1 -1
  316. package/src/shade/renderer/loader/usd/usd_build_scene.js +36 -21
  317. package/src/shade/renderer/loader/usd/usd_groom_extension.d.ts +60 -0
  318. package/src/shade/renderer/loader/usd/usd_groom_extension.d.ts.map +1 -0
  319. package/src/shade/renderer/loader/usd/usd_groom_extension.js +417 -0
  320. package/src/shade/renderer/path_tracer/shader/chunk_sample_material_data.d.ts.map +1 -1
  321. package/src/shade/renderer/path_tracer/shader/chunk_sample_material_data.js +4 -1
  322. package/src/shade/renderer/path_tracer/shader/chunk_shading_closure_from_material_data.d.ts.map +1 -1
  323. package/src/shade/renderer/path_tracer/shader/chunk_shading_closure_from_material_data.js +3 -1
  324. package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
  325. package/src/shade/renderer/postprocess/ssr/SSR.d.ts +4 -1
  326. package/src/shade/renderer/postprocess/ssr/SSR.d.ts.map +1 -1
  327. package/src/shade/renderer/postprocess/ssr/SSR.js +9 -0
  328. package/src/shade/renderer/postprocess/ssr/resolve/chunk_ssr_sample_radiance.d.ts +16 -1
  329. package/src/shade/renderer/postprocess/ssr/resolve/chunk_ssr_sample_radiance.d.ts.map +1 -1
  330. package/src/shade/renderer/postprocess/ssr/resolve/chunk_ssr_sample_radiance.js +47 -3
  331. package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader.d.ts.map +1 -1
  332. package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader.js +5 -3
  333. package/src/shade/renderer/postprocess/ssr/ssr_combine_shader.d.ts.map +1 -1
  334. package/src/shade/renderer/postprocess/ssr/ssr_combine_shader.js +6 -5
  335. package/src/shade/renderer/rasterize/forward/chunk_forward_shade_standard_fragment.d.ts.map +1 -1
  336. package/src/shade/renderer/rasterize/forward/chunk_forward_shade_standard_fragment.js +5 -2
  337. package/src/shade/renderer/rasterize/native/avboit/avboit_draw_fragment_body.d.ts.map +1 -1
  338. package/src/shade/renderer/rasterize/native/avboit/avboit_draw_fragment_body.js +5 -0
  339. package/src/shade/renderer/rasterize/native/avboit/shader_avboit_splat.d.ts.map +1 -1
  340. package/src/shade/renderer/rasterize/native/avboit/shader_avboit_splat.js +4 -1
  341. package/src/shade/renderer/rasterize/native/oit/oit_resolve_fragment_body.d.ts.map +1 -1
  342. package/src/shade/renderer/rasterize/native/oit/oit_resolve_fragment_body.js +5 -1
  343. package/src/shade/renderer/rasterize/native/oit/shader_oit_generate_moments.d.ts.map +1 -1
  344. package/src/shade/renderer/rasterize/native/oit/shader_oit_generate_moments.js +7 -4
  345. package/src/shade/renderer/shader/chunk/brdf/chunk_shadowed_F90.d.ts +13 -8
  346. package/src/shade/renderer/shader/chunk/brdf/chunk_shadowed_F90.d.ts.map +1 -1
  347. package/src/shade/renderer/shader/chunk/brdf/chunk_shadowed_F90.js +18 -14
  348. package/src/shade/renderer/shader/chunk/light/chunk_compute_multiscattering_specular.d.ts +3 -2
  349. package/src/shade/renderer/shader/chunk/light/chunk_compute_multiscattering_specular.d.ts.map +1 -1
  350. package/src/shade/renderer/shader/chunk/light/chunk_compute_multiscattering_specular.js +12 -4
  351. package/src/shade/renderer/shader/chunk/material/MATERIAL_SHADING_INFO_STRUCT.d.ts.map +1 -1
  352. package/src/shade/renderer/shader/chunk/material/MATERIAL_SHADING_INFO_STRUCT.js +1 -0
  353. package/src/shade/renderer/shader/chunk/material/chunk_compute_indirect_specular.js +1 -1
  354. package/src/shade/renderer/shader/chunk/material/chunk_metalness_to_specular_F90.d.ts +16 -0
  355. package/src/shade/renderer/shader/chunk/material/chunk_metalness_to_specular_F90.d.ts.map +1 -0
  356. package/src/shade/renderer/shader/chunk/material/chunk_metalness_to_specular_F90.js +25 -0
  357. package/src/shade/renderer/shader/chunk/material/chunk_re_direct_multiscatter.js +2 -2
  358. package/src/shade/renderer/shader/compiler/ShaderSwitch.d.ts +1 -1
  359. package/src/shade/renderer/shader/compiler/ShaderSwitchSet.d.ts +1 -1
  360. package/src/shade/renderer/shader/resource/ShaderResourceDescriptor.d.ts +1 -1
  361. package/src/shade/renderer/shadow/map/shader/chunk_shadowmap_sample_point2.d.ts +2 -2
  362. package/src/shade/renderer/shadow/map/shader/chunk_shadowmap_sample_point2.js +2 -2
  363. package/src/shade/renderer/water/query/GPUWaterQueries.d.ts +1 -1
@@ -0,0 +1,106 @@
1
+ import { CodeChunk } from "../shader/compiler/CodeChunk.js";
2
+ import { HAIR_VOLUME_FIXED_ONE, HAIR_VOLUME_MIPS } from "./HAIR.js";
3
+ import { HAIR_LOD_STRUCT } from "./HAIR_FRAME_STRUCTS.js";
4
+
5
+ /**
6
+ * An instance's density volume (`HAIR.js`), as its LOD record places it in the frame's voxels:
7
+ *
8
+ * ```wgsl
9
+ * fn hair_volume_dims(lod: HairLod, mip: u32) -> vec3<u32>
10
+ * fn hair_volume_index(lod: HairLod, cell: vec3<u32>, mip: u32) -> u32
11
+ * ```
12
+ *
13
+ * A voxel holds the strands a ray crosses along one voxel edge of the full resolution, in 16.16 fixed point; mip `m`
14
+ * holds the mean of the `2^m`-cubes under it, in the same units.
15
+ *
16
+ * @type {CodeChunk}
17
+ */
18
+ export const chunk_hair_volume_layout = CodeChunk.from(
19
+ //language=WGSL
20
+ `
21
+ fn hair_volume_dims(lod: ${HAIR_LOD_STRUCT.wgsl_ref}, mip: u32) -> vec3<u32> {
22
+ let round = vec3<u32>((1u << mip) - 1u);
23
+
24
+ return (lod.volume_dims + round) >> vec3<u32>(mip);
25
+ }
26
+
27
+ fn hair_volume_index(lod: ${HAIR_LOD_STRUCT.wgsl_ref}, cell: vec3<u32>, mip: u32) -> u32 {
28
+ var offset = lod.voxel_base;
29
+
30
+ for (var m = 0u; m < ${HAIR_VOLUME_MIPS}u; m++) {
31
+ if (m < mip) {
32
+ let d = hair_volume_dims(lod, m);
33
+
34
+ offset += d.x * d.y * d.z;
35
+ }
36
+ }
37
+
38
+ let d = hair_volume_dims(lod, mip);
39
+
40
+ return offset + (cell.z * d.y + cell.y) * d.x + cell.x;
41
+ }
42
+ `, [HAIR_LOD_STRUCT.declaration_chunk]);
43
+
44
+ /**
45
+ * The number of strands between a point and the edge of its instance's volume, along a direction:
46
+ *
47
+ * ```wgsl
48
+ * fn hair_count_along(lod: HairLod, position: vec3<f32>, direction: vec3<f32>, jitter: f32) -> f32
49
+ * ```
50
+ *
51
+ * Eight taps, a constant trip count: the march starts one voxel out, steps one voxel twice, then doubles its step
52
+ * each tap, reading the mip whose voxel matches the step (the last, past it), so it reaches 128 voxels. A tap outside
53
+ * the volume reads nothing. `jitter` in [0, 1) moves the taps along the ray by up to a step, for the frame's
54
+ * accumulation to filter the voxels' edges. Reads `hair_volume`.
55
+ *
56
+ * @type {CodeChunk}
57
+ */
58
+ export const chunk_hair_count_along = CodeChunk.from(
59
+ //language=WGSL
60
+ `
61
+ // the voxel of one level under a point, its level's size and first voxel given; nothing outside the volume
62
+ fn hair_volume_read(voxel: vec3<f32>, mip: u32, dims: vec3<u32>, offset: u32) -> f32 {
63
+ let cell = floor(voxel / f32(1u << mip));
64
+
65
+ if (any(cell < vec3<f32>(0.0)) || any(cell >= vec3<f32>(dims))) {
66
+ return 0.0;
67
+ }
68
+
69
+ let c = vec3<u32>(cell);
70
+
71
+ return f32(hair_volume[offset + (c.z * dims.y + c.y) * dims.x + c.x]) * (1.0 / ${HAIR_VOLUME_FIXED_ONE}.0);
72
+ }
73
+
74
+ fn hair_count_along(lod: ${HAIR_LOD_STRUCT.wgsl_ref}, position: vec3<f32>, direction: vec3<f32>, jitter: f32) -> f32 {
75
+ if (lod.voxel_size <= 0.0) {
76
+ return 0.0;
77
+ }
78
+
79
+ // the three levels' sizes and first voxels, once
80
+ let d0 = lod.volume_dims;
81
+ let d1 = hair_volume_dims(lod, 1u);
82
+ let d2 = hair_volume_dims(lod, 2u);
83
+ let o0 = lod.voxel_base;
84
+ let o1 = o0 + d0.x * d0.y * d0.z;
85
+ let o2 = o1 + d1.x * d1.y * d1.z;
86
+
87
+ let start = (position - lod.volume_origin) / lod.voxel_size;
88
+
89
+ // 1, 1, 2, 4, then 8, 16, 32, 64 voxels a tap, the last four from the coarsest level
90
+ var count = hair_volume_read(start + direction * (1.0 + jitter), 0u, d0, o0)
91
+ + hair_volume_read(start + direction * (2.0 + jitter), 0u, d0, o0)
92
+ + 2.0 * hair_volume_read(start + direction * (3.0 + 2.0 * jitter), 1u, d1, o1)
93
+ + 4.0 * hair_volume_read(start + direction * (5.0 + 4.0 * jitter), 2u, d2, o2);
94
+
95
+ var travelled = 9.0;
96
+
97
+ for (var k = 0u; k < 4u; k++) {
98
+ let size = f32(8u << k);
99
+
100
+ count += size * hair_volume_read(start + direction * (travelled + size * jitter), 2u, d2, o2);
101
+ travelled += size;
102
+ }
103
+
104
+ return count;
105
+ }
106
+ `, [chunk_hair_volume_layout]);
@@ -0,0 +1,24 @@
1
+ /**
2
+ * The bindings of {@link HAIR_ID_PIPELINE}: `camera`, `hair_view`, `hair_list` (the frame's draw list) and
3
+ * `hair_points` (the frame's deformed points).
4
+ *
5
+ * @type {ShaderResourceSetDescriptor}
6
+ */
7
+ export const HAIR_ID_RESOURCES: ShaderResourceSetDescriptor;
8
+ /**
9
+ * Draws the frame's strands into the hair id target, under the scene's depth, which it writes.
10
+ *
11
+ * An instance is a draw list entry, a strand, and its vertices a triangle strip along it: a pair at each of its
12
+ * points, `2 (2^class + 1)` vertices, one draw a point class (`shader_hair_draw_args`). The strip faces the eye
13
+ * across the strand's tangent, as wide as the strand is drawn and never narrower than the view's pixel floor,
14
+ * which is applied in clip space; a point the cull left undrawn (a negative width, `shader_hair_cull`) is drawn at
15
+ * no width, so the strip narrows to nothing there. Both faces are drawn.
16
+ *
17
+ * A covered pixel's id is `((segment slot + 1) << HAIR_ID_ALONG_BITS) | along` (`HAIR.js`).
18
+ *
19
+ * @type {RenderPipelineDescriptor}
20
+ */
21
+ export const HAIR_ID_PIPELINE: RenderPipelineDescriptor;
22
+ import { ShaderResourceSetDescriptor } from "../shader/resource/ShaderResourceSetDescriptor.js";
23
+ import { RenderPipelineDescriptor } from "../../descriptor/pipeline/render/RenderPipelineDescriptor.js";
24
+ //# sourceMappingURL=hair_id_draw.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hair_id_draw.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/hair/hair_id_draw.js"],"names":[],"mappings":"AAkGA;;;;;GAKG;AACH,gCAFU,2BAA2B,CAEM;AAE3C;;;;;;;;;;;;GAYG;AACH,+BAFU,wBAAwB,CAiB/B;4CAjIyC,mDAAmD;yCAHtD,8DAA8D"}
@@ -0,0 +1,135 @@
1
+ import { ColorTargetState } from "../../descriptor/pipeline/render/ColorTargetState.js";
2
+ import { DepthStencilState } from "../../descriptor/pipeline/render/DepthStencilState.js";
3
+ import { RenderPipelineDescriptor } from "../../descriptor/pipeline/render/RenderPipelineDescriptor.js";
4
+ import { CAMERA_RESOURCE } from "../camera/CAMERA_RESOURCE.js";
5
+ import { CodeChunk } from "../shader/compiler/CodeChunk.js";
6
+ import { ShaderResourceSetDescriptor } from "../shader/resource/ShaderResourceSetDescriptor.js";
7
+ import { ShaderDescriptor } from "../shader/ShaderDescriptor.js";
8
+ import { vec4u } from "../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
9
+ import { WebGPUArray } from "../shader/type/WebGPUArray.js";
10
+ import { HAIR_CLASS_SHIFT, HAIR_ID_ALONG_BITS, HAIR_ID_FORMAT } from "./HAIR.js";
11
+ import { HAIR_VIEW_STRUCT } from "./HAIR_FRAME_STRUCTS.js";
12
+
13
+ const resources = new ShaderResourceSetDescriptor();
14
+
15
+ resources.createGroup()
16
+ .add(CAMERA_RESOURCE)
17
+ .addUniform("hair_view", HAIR_VIEW_STRUCT)
18
+ .addStorageBuffer("hair_list", WebGPUArray.u32)
19
+ .addStorageBuffer("hair_points", WebGPUArray.from(vec4u));
20
+
21
+ const ALONG_STEPS = 2 ** HAIR_ID_ALONG_BITS - 1;
22
+
23
+ const body = CodeChunk.from(
24
+ //language=WGSL
25
+ `
26
+ struct HairIdVertex {
27
+ @builtin(position) position: vec4<f32>,
28
+ @location(0) @interpolate(flat) slot: u32,
29
+ @location(1) @interpolate(flat) segments: u32,
30
+ @location(2) along: f32,
31
+ }
32
+
33
+ // a deformed point as it is now: x, y, z, then half its drawn width
34
+ fn hair_point(slot: u32) -> vec4<f32> {
35
+ return bitcast<vec4<f32>>(hair_points[slot]);
36
+ }
37
+
38
+ @vertex
39
+ fn vs_main(@builtin(vertex_index) vertex: u32, @builtin(instance_index) instance: u32) -> HairIdVertex {
40
+ let entry = hair_list[instance];
41
+ let slot = entry & ${2 ** HAIR_CLASS_SHIFT - 1}u;
42
+ let segments = 1u << (entry >> ${HAIR_CLASS_SHIFT}u);
43
+
44
+ // a pair of vertices a point, one either side of it
45
+ let j = min(vertex >> 1u, segments);
46
+ let side = f32(vertex & 1u) * 2.0 - 1.0;
47
+
48
+ let point = hair_point(slot + j);
49
+ let before = hair_point(slot + max(j, 1u) - 1u).xyz;
50
+ let after = hair_point(slot + min(j + 1u, segments)).xyz;
51
+
52
+ // across the strand and across the way to the eye
53
+ let eye = camera.transform[3].xyz;
54
+ let raw = cross(after - before, eye - point.xyz);
55
+ let raw_length = length(raw);
56
+
57
+ // a strand seen end on is a dot: any way across will do
58
+ let across = select(camera.transform[0].xyz, raw / raw_length, raw_length > 1e-20);
59
+
60
+ let clip = camera.view_projection_matrix * vec4<f32>(point.xyz, 1.0);
61
+ let edge = camera.view_projection_matrix * vec4<f32>(point.xyz + across * point.w, 1.0);
62
+
63
+ // pixels a unit of normalised device coordinates spans
64
+ let pixels = 0.5 * hair_view.resolution;
65
+
66
+ // half the strand's width on screen as it is, in pixels, and the way it runs
67
+ let offset = (edge.xy / max(abs(edge.w), 1e-6) - clip.xy / max(abs(clip.w), 1e-6)) * pixels;
68
+ let real = length(offset);
69
+ let way = select(vec2<f32>(1.0, 0.0), offset / max(real, 1e-12), real >= 1e-6);
70
+
71
+ // never narrower than the floor: below a pixel, whether a strand is seen would be the jitter's to decide; a
72
+ // point the cull left undrawn (a negative width) is drawn at no width
73
+ let drawn = select(max(real, 0.5 * hair_view.pixel_floor), 0.0, point.w < 0.0);
74
+
75
+ var out: HairIdVertex;
76
+
77
+ out.position = clip + vec4<f32>(way * (drawn * side) / pixels * clip.w, 0.0, 0.0);
78
+ out.slot = slot;
79
+ out.segments = segments;
80
+ out.along = f32(j);
81
+
82
+ return out;
83
+ }
84
+
85
+ @fragment
86
+ fn fs_main(in: HairIdVertex) -> @location(0) u32 {
87
+ let t = clamp(in.along, 0.0, f32(in.segments));
88
+
89
+ // the segment the pixel is on; a pixel exactly at a point is the end of the segment before it
90
+ let segment = min(u32(max(ceil(t) - 1.0, 0.0)), in.segments - 1u);
91
+ let along = u32(saturate(t - f32(segment)) * ${ALONG_STEPS}.0 + 0.5);
92
+
93
+ return ((in.slot + segment + 1u) << ${HAIR_ID_ALONG_BITS}u) | along;
94
+ }
95
+ `);
96
+
97
+ const descriptor = ShaderDescriptor.from({ label: "Hair Ids", body, resources });
98
+
99
+ /**
100
+ * The bindings of {@link HAIR_ID_PIPELINE}: `camera`, `hair_view`, `hair_list` (the frame's draw list) and
101
+ * `hair_points` (the frame's deformed points).
102
+ *
103
+ * @type {ShaderResourceSetDescriptor}
104
+ */
105
+ export const HAIR_ID_RESOURCES = resources;
106
+
107
+ /**
108
+ * Draws the frame's strands into the hair id target, under the scene's depth, which it writes.
109
+ *
110
+ * An instance is a draw list entry, a strand, and its vertices a triangle strip along it: a pair at each of its
111
+ * points, `2 (2^class + 1)` vertices, one draw a point class (`shader_hair_draw_args`). The strip faces the eye
112
+ * across the strand's tangent, as wide as the strand is drawn and never narrower than the view's pixel floor,
113
+ * which is applied in clip space; a point the cull left undrawn (a negative width, `shader_hair_cull`) is drawn at
114
+ * no width, so the strip narrows to nothing there. Both faces are drawn.
115
+ *
116
+ * A covered pixel's id is `((segment slot + 1) << HAIR_ID_ALONG_BITS) | along` (`HAIR.js`).
117
+ *
118
+ * @type {RenderPipelineDescriptor}
119
+ */
120
+ export const HAIR_ID_PIPELINE = RenderPipelineDescriptor.from({
121
+ label: "Hair Ids",
122
+ layout: resources.generatePipelineLayout(GPUShaderStage.VERTEX | GPUShaderStage.FRAGMENT),
123
+ vertex: { module: { code: descriptor.source }, entryPoint: "vs_main" },
124
+ fragment: {
125
+ module: { code: descriptor.source },
126
+ entryPoint: "fs_main",
127
+ targets: [ColorTargetState.from({ format: HAIR_ID_FORMAT })],
128
+ },
129
+ depthStencil: DepthStencilState.from({
130
+ format: "depth32float",
131
+ depthWriteEnabled: true,
132
+ depthCompare: "greater",
133
+ }),
134
+ primitive: { topology: "triangle-strip", cullMode: "none" },
135
+ });
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Lights every pixel a strand covers and writes its colour into the scene colour, an instance a row over its screen
3
+ * rectangle (4 vertices, a triangle strip). One pipeline per switch set, which picks the shadow technique and the
4
+ * indirect lighting the fragment links, and per format of the scene colour.
5
+ *
6
+ * A pixel's strand is lit by the shared light loop (`chunk_shade_direct_lights`) with the hair's lobe: Unreal's hair
7
+ * BSDF with dual scattering (`chunk_hair_dual_scattering`), the strands between the point and each light counted
8
+ * by a march through the instance's density volume (`chunk_hair_count_along`), each light's shadow taken from the
9
+ * scene's maps at the strand point with the light's own way as the normal. Indirect light is the renderer's mode's
10
+ * irradiance about the strand's normal, through the BSDF seen from the eye with every lobe widened (Unreal's strands
11
+ * under Lumen, `area` 0.2) and dual scattering over the strands counted along the normal, which occludes the sky.
12
+ * The marches' taps are jittered by the frame's blue noise.
13
+ * The strand's colour is its instance's melanin, moved by the strand's variation byte, its redness and its dye.
14
+ *
15
+ * The pixel's colour is then **written**, not added, so it is the strand's whatever the passes before left there:
16
+ * the deferred passes lit it as a black metal, which is no light, and the fog composite put its in-scatter over
17
+ * that. The fog is put back as the composite put it: the strand's light attenuated by the transmittance at the
18
+ * pixel's depth, plus the in-scatter there (`sample_volumetrics`, the same call at the same depth).
19
+ *
20
+ * @param {import("../shader/compiler/ShaderSwitchSet.js").ShaderSwitchSet} switches the renderer's
21
+ * @param {GPUTextureFormat} format the scene colour's
22
+ * @returns {RenderPipelineDescriptor}
23
+ */
24
+ export function hair_lighting_pipeline(switches: import("../shader/compiler/ShaderSwitchSet.js").ShaderSwitchSet, format: GPUTextureFormat): RenderPipelineDescriptor;
25
+ /**
26
+ * Group 0, both stages: the view, and what places each instance's rectangle.
27
+ * @type {ShaderResourceGroupDescriptor}
28
+ */
29
+ export const HAIR_LIGHTING_VIEW_GROUP: ShaderResourceGroupDescriptor;
30
+ /**
31
+ * Group 2, the fragment stage's: the strands, and what every indirect lighting mode and the fog read. The probes are
32
+ * bound in every mode, as their owner says (`GPUProbeClipmapGI#write_sampling_bindings`).
33
+ * @type {ShaderResourceGroupDescriptor}
34
+ */
35
+ export const HAIR_LIGHTING_HAIR_GROUP: ShaderResourceGroupDescriptor;
36
+ /**
37
+ * The bindings of {@link hair_lighting_pipeline}: {@link HAIR_LIGHTING_VIEW_GROUP}, the lights
38
+ * (`SHADING_LIGHT_RESOURCE_GROUP`) and {@link HAIR_LIGHTING_HAIR_GROUP}.
39
+ *
40
+ * @type {ShaderResourceSetDescriptor}
41
+ */
42
+ export const HAIR_LIGHTING_RESOURCES: ShaderResourceSetDescriptor;
43
+ /**
44
+ * The fragment stage of {@link hair_lighting_pipeline}, before a switch set picks its variant.
45
+ *
46
+ * @type {ShaderDescriptor}
47
+ */
48
+ export const HAIR_LIGHTING_FRAGMENT: ShaderDescriptor;
49
+ import { RenderPipelineDescriptor } from "../../descriptor/pipeline/render/RenderPipelineDescriptor.js";
50
+ import { ShaderResourceGroupDescriptor } from "../shader/resource/ShaderResourceGroupDescriptor.js";
51
+ import { ShaderResourceSetDescriptor } from "../shader/resource/ShaderResourceSetDescriptor.js";
52
+ import { ShaderDescriptor } from "../shader/ShaderDescriptor.js";
53
+ //# sourceMappingURL=hair_lighting.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hair_lighting.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/hair/hair_lighting.js"],"names":[],"mappings":"AAyNA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,iDAJW,OAAO,uCAAuC,EAAE,eAAe,6BAE7D,wBAAwB,CA+BpC;AA7OD;;;GAGG;AACH,uCAFU,6BAA6B,CAM8B;AAErE;;;;GAIG;AACH,uCAFU,6BAA6B,CAaA;AAYvC;;;;;GAKG;AACH,sCAFU,2BAA2B,CAEY;AAgIjD;;;;GAIG;AACH,qCAFU,gBAAgB,CAEgC;yCA/MjB,8DAA8D;8CAYzD,qDAAqD;4CACvD,mDAAmD;iCAC9D,+BAA+B"}
@@ -0,0 +1,270 @@
1
+ import { PipelineLayoutDescriptor } from "../../descriptor/pipeline/PipelineLayoutDescriptor.js";
2
+ import { ColorTargetState } from "../../descriptor/pipeline/render/ColorTargetState.js";
3
+ import { RenderPipelineDescriptor } from "../../descriptor/pipeline/render/RenderPipelineDescriptor.js";
4
+ import { CAMERA_RESOURCE } from "../camera/CAMERA_RESOURCE.js";
5
+ import { chunk_sample_volumetrics } from "../deferred/chunk_sample_volumetrics.js";
6
+ import { chunk_shade_direct_lights } from "../deferred/chunk_shade_direct_lights.js";
7
+ import { SHADING_LIGHT_RESOURCE_GROUP } from "../deferred/SHADING_LIGHT_RESOURCE_GROUP.js";
8
+ import { BRICK4_RESOURCE } from "../global_illumination/brick4/gpu/BRICK4_RESOURCE.js";
9
+ import { PROBE_CLIPMAP_SAMPLING_GROUP } from "../global_illumination/probe_clipmap/probe/chunk_probe_clipmap_pick.js";
10
+ import { chunk_forward_sample_indirect } from "../rasterize/forward/chunk_forward_sample_indirect.js";
11
+ import { FORWARD_LIGHT_LAYOUT } from "../rasterize/forward/forward_template_pipeline.js";
12
+ import { INCIDENT_LIGHT_STRUCT } from "../shader/chunk/light/INCIDENT_LIGHT_STRUCT.js";
13
+ import { chunk_get_view_space_depth } from "../shader/chunk/depth/chunk_get_view_space_depth.js";
14
+ import { CodeChunk } from "../shader/compiler/CodeChunk.js";
15
+ import { ShaderResourceGroupDescriptor } from "../shader/resource/ShaderResourceGroupDescriptor.js";
16
+ import { ShaderResourceSetDescriptor } from "../shader/resource/ShaderResourceSetDescriptor.js";
17
+ import { ShaderDescriptor } from "../shader/ShaderDescriptor.js";
18
+ import { vec4u } from "../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
19
+ import { WebGPUArray } from "../shader/type/WebGPUArray.js";
20
+ import { WebGPUBufferType } from "../shader/type/WebGPUBufferType.js";
21
+ import { STBN_VEC3_RESOURCE } from "../STATIC_GRAPHICS_ENGINE_ASSET_RESOURCES.js";
22
+ import { SAMPLER_LINEAR_RESOURCE } from "../texture/SAMPLER_LINEAR_RESOURCE.js";
23
+ import { VIEW_RESOURCE } from "../view/VIEW_RESOURCE.js";
24
+ import { VOLUMETRICS_METADATA_RESOURCE, VOLUMETRICS_RESOURCE } from "../volumetrics/VOLUMETRICS_RESOURCES.js";
25
+ import { chunk_hair_absorption } from "./chunk_hair_bsdf.js";
26
+ import { chunk_hair_dual_scattering, HAIR_SCATTERING_LUT_RESOURCE } from "./chunk_hair_dual_scattering.js";
27
+ import { chunk_hair_count_along } from "./chunk_hair_volume.js";
28
+ import { chunk_stbn_sample_vec3 } from "../shader/chunk/noise/chunk_stbn_sample_vec3.js";
29
+ import { chunk_hair_pixel, chunk_hair_quad_vertex } from "./chunk_hair_pixel.js";
30
+ import { HAIR_INSTANCE_DESCRIPTOR } from "./HAIR_DATABASE_SPEC.js";
31
+ import { HAIR_LOD_STRUCT, HAIR_VIEW_STRUCT } from "./HAIR_FRAME_STRUCTS.js";
32
+
33
+ /**
34
+ * Group 0, both stages: the view, and what places each instance's rectangle.
35
+ * @type {ShaderResourceGroupDescriptor}
36
+ */
37
+ export const HAIR_LIGHTING_VIEW_GROUP = new ShaderResourceGroupDescriptor()
38
+ .add(CAMERA_RESOURCE)
39
+ .add(VIEW_RESOURCE)
40
+ .addUniform("hair_view", HAIR_VIEW_STRUCT)
41
+ .addStorageBuffer("hair_lod", WebGPUArray.from(HAIR_LOD_STRUCT));
42
+
43
+ /**
44
+ * Group 2, the fragment stage's: the strands, and what every indirect lighting mode and the fog read. The probes are
45
+ * bound in every mode, as their owner says (`GPUProbeClipmapGI#write_sampling_bindings`).
46
+ * @type {ShaderResourceGroupDescriptor}
47
+ */
48
+ export const HAIR_LIGHTING_HAIR_GROUP = new ShaderResourceGroupDescriptor()
49
+ .addStorageBuffer("hair_points", WebGPUArray.from(vec4u))
50
+ .addStorageBuffer("hair_database", WebGPUBufferType.unsized, false)
51
+ .addTexture("hair_ids", "uint")
52
+ .addTexture("scene_depth")
53
+ .add(BRICK4_RESOURCE)
54
+ .add(VOLUMETRICS_RESOURCE)
55
+ .add(VOLUMETRICS_METADATA_RESOURCE)
56
+ .add(STBN_VEC3_RESOURCE)
57
+ .add(SAMPLER_LINEAR_RESOURCE)
58
+ .addStorageBuffer("hair_volume", WebGPUArray.u32)
59
+ .add(HAIR_SCATTERING_LUT_RESOURCE);
60
+
61
+ for (const declaration of PROBE_CLIPMAP_SAMPLING_GROUP.resources) {
62
+ HAIR_LIGHTING_HAIR_GROUP.add(declaration);
63
+ }
64
+
65
+ const resources = new ShaderResourceSetDescriptor();
66
+
67
+ resources.addGroup(HAIR_LIGHTING_VIEW_GROUP);
68
+ resources.addGroup(SHADING_LIGHT_RESOURCE_GROUP);
69
+ resources.addGroup(HAIR_LIGHTING_HAIR_GROUP);
70
+
71
+ /**
72
+ * The bindings of {@link hair_lighting_pipeline}: {@link HAIR_LIGHTING_VIEW_GROUP}, the lights
73
+ * (`SHADING_LIGHT_RESOURCE_GROUP`) and {@link HAIR_LIGHTING_HAIR_GROUP}.
74
+ *
75
+ * @type {ShaderResourceSetDescriptor}
76
+ */
77
+ export const HAIR_LIGHTING_RESOURCES = resources;
78
+
79
+ const layout = PipelineLayoutDescriptor.from([
80
+ HAIR_LIGHTING_VIEW_GROUP.generateBindGroupLayoutDescriptor(GPUShaderStage.VERTEX | GPUShaderStage.FRAGMENT),
81
+ FORWARD_LIGHT_LAYOUT,
82
+ HAIR_LIGHTING_HAIR_GROUP.generateBindGroupLayoutDescriptor(GPUShaderStage.FRAGMENT),
83
+ ]);
84
+
85
+ /**
86
+ * The hair's lobe for the shared light loop (`chunk_shade_direct_lights`).
87
+ * @type {CodeChunk}
88
+ */
89
+ const chunk_hair_direct_light_lobe = CodeChunk.from(
90
+ //language=WGSL
91
+ `
92
+ struct DirectLightContext {
93
+ // along the strand, towards its root
94
+ tangent: vec3<f32>,
95
+ view_direction: vec3<f32>,
96
+ absorption: vec3<f32>,
97
+ roughness: f32,
98
+ radiance: vec3<f32>,
99
+ position: vec3<f32>,
100
+ // where along each step of the volume's march the taps fall, in [0, 1)
101
+ jitter: f32,
102
+ lod: ${HAIR_LOD_STRUCT.wgsl_ref},
103
+ }
104
+
105
+ // the strands between the point and the light, from the instance's density volume, scatter the light that reaches it
106
+ fn direct_light_lobe(context: ptr<function, DirectLightContext>, light: ${INCIDENT_LIGHT_STRUCT.wgsl_ref}) {
107
+ let count = hair_count_along((*context).lod, (*context).position, light.direction, (*context).jitter);
108
+
109
+ (*context).radiance += light.color * hair_scattering(light.direction, (*context).view_direction, (*context).tangent, (*context).absorption, (*context).roughness, count, 1.0, 0.0);
110
+ }
111
+
112
+ // a strand is in no shadow map and lights from every side: the light's own way takes the normal's place, which
113
+ // leaves the map's offsets and its cut at the horizon out
114
+ fn direct_light_visibility_normal(context: ptr<function, DirectLightContext>, light: ${INCIDENT_LIGHT_STRUCT.wgsl_ref}) -> vec3<f32> {
115
+ return light.direction;
116
+ }
117
+ `, [
118
+ INCIDENT_LIGHT_STRUCT.declaration_chunk,
119
+ HAIR_LOD_STRUCT.declaration_chunk,
120
+ chunk_hair_dual_scattering,
121
+ chunk_hair_count_along,
122
+ ]);
123
+
124
+ const vertex_body = CodeChunk.from(
125
+ //language=WGSL
126
+ `
127
+ @vertex
128
+ fn vs_main(@builtin(vertex_index) vertex: u32, @builtin(instance_index) row: u32) -> HairQuadVertex {
129
+ return hair_quad_vertex(vertex, row);
130
+ }
131
+ `, [chunk_hair_quad_vertex]);
132
+
133
+ const fragment_body = CodeChunk.from(
134
+ //language=WGSL
135
+ `
136
+ @fragment
137
+ fn fs_main(in: HairQuadVertex) -> @location(0) vec4<f32> {
138
+ var hair: HairPixel;
139
+
140
+ if (!hair_pixel(in.position.xy, in.row, &hair)) {
141
+ discard;
142
+ }
143
+
144
+ let instance = ${HAIR_INSTANCE_DESCRIPTOR.marshalling_method_read}(&hair_database, in.row);
145
+
146
+ let coord = in.position.xy;
147
+ let i_coord = vec2<i32>(coord);
148
+
149
+ // the depth the fog composite read here, so the in-scatter below is the one it added
150
+ let view_depth = get_view_space_depth(textureLoad(scene_depth, i_coord, 0).r, camera);
151
+
152
+ let position = mix(hair.a.xyz, hair.b.xyz, hair.along);
153
+ let view_direction = normalize(camera.transform[3].xyz - position);
154
+ let towards_root = -hair_pixel_tangent(hair);
155
+
156
+ let melanin = instance.melanin + (f32(hair.variation) - 128.0) / 255.0;
157
+ let absorption = hair_absorption(melanin, instance.redness, instance.dye);
158
+
159
+ let lod = hair_lod[in.row];
160
+ let noise = stbn_sample_vec3(vec3<u32>(vec2<u32>(coord), view.frame_index));
161
+
162
+ var context = DirectLightContext(towards_root, view_direction, absorption, instance.roughness, vec3<f32>(0.0), position, noise.x, lod);
163
+
164
+ shade_direct_lights(&context, position, view_direction, coord, view_depth);
165
+
166
+ // the light around the strand's normal, through the fibre seen from the eye with every lobe widened, as Unreal's
167
+ // strands take it from Lumen
168
+ let normal = hair_normal(-towards_root, view_direction);
169
+
170
+ var radiance: vec3<f32>;
171
+ var irradiance: vec3<f32>;
172
+
173
+ forward_sample_indirect(position, view_direction, normal, instance.roughness, &radiance, &irradiance);
174
+
175
+ // through the strands between the point and the open air about its normal: sky occlusion
176
+ let count_around = hair_count_along(lod, position, normal, noise.y);
177
+ let indirect_shading = min(vec3<f32>(1.0), 3.14159265 * hair_scattering(normal, view_direction, towards_root, absorption, instance.roughness, count_around, 0.0, 0.2));
178
+ let indirect = irradiance * (1.0 / 3.14159265) * indirect_shading;
179
+
180
+ // the fog between the eye and the strand: the composite has already put its in-scatter here, over a surface it
181
+ // took to be black metal; the strand's own light is attenuated by the same transmittance, and the colour
182
+ // written whole
183
+ let volumetrics = sample_volumetrics(view_depth, coord / vec2<f32>(f32(view.width), f32(view.height)), coord);
184
+
185
+ return vec4<f32>((context.radiance + indirect) * volumetrics.a + volumetrics.rgb, 1.0);
186
+ }
187
+ `, [
188
+ HAIR_INSTANCE_DESCRIPTOR.chunk_read,
189
+ chunk_hair_quad_vertex,
190
+ chunk_hair_pixel,
191
+ chunk_hair_absorption,
192
+ chunk_hair_dual_scattering,
193
+ chunk_hair_count_along,
194
+ chunk_stbn_sample_vec3,
195
+ chunk_hair_direct_light_lobe,
196
+ chunk_shade_direct_lights,
197
+ chunk_forward_sample_indirect,
198
+ chunk_get_view_space_depth,
199
+ chunk_sample_volumetrics,
200
+ ]);
201
+
202
+ const vertex_descriptor = ShaderDescriptor.from({ label: "Hair Lighting Rect", body: vertex_body, resources });
203
+ const fragment_descriptor = ShaderDescriptor.from({ label: "Hair Lighting", body: fragment_body, resources });
204
+
205
+ /**
206
+ * The fragment stage of {@link hair_lighting_pipeline}, before a switch set picks its variant.
207
+ *
208
+ * @type {ShaderDescriptor}
209
+ */
210
+ export const HAIR_LIGHTING_FRAGMENT = fragment_descriptor;
211
+
212
+ /**
213
+ * Pipelines by fragment variant, then by target format.
214
+ * @type {Map<ShaderDescriptor, Map<GPUTextureFormat, RenderPipelineDescriptor>>}
215
+ */
216
+ const pipelines = new Map();
217
+
218
+ /**
219
+ * Lights every pixel a strand covers and writes its colour into the scene colour, an instance a row over its screen
220
+ * rectangle (4 vertices, a triangle strip). One pipeline per switch set, which picks the shadow technique and the
221
+ * indirect lighting the fragment links, and per format of the scene colour.
222
+ *
223
+ * A pixel's strand is lit by the shared light loop (`chunk_shade_direct_lights`) with the hair's lobe: Unreal's hair
224
+ * BSDF with dual scattering (`chunk_hair_dual_scattering`), the strands between the point and each light counted
225
+ * by a march through the instance's density volume (`chunk_hair_count_along`), each light's shadow taken from the
226
+ * scene's maps at the strand point with the light's own way as the normal. Indirect light is the renderer's mode's
227
+ * irradiance about the strand's normal, through the BSDF seen from the eye with every lobe widened (Unreal's strands
228
+ * under Lumen, `area` 0.2) and dual scattering over the strands counted along the normal, which occludes the sky.
229
+ * The marches' taps are jittered by the frame's blue noise.
230
+ * The strand's colour is its instance's melanin, moved by the strand's variation byte, its redness and its dye.
231
+ *
232
+ * The pixel's colour is then **written**, not added, so it is the strand's whatever the passes before left there:
233
+ * the deferred passes lit it as a black metal, which is no light, and the fog composite put its in-scatter over
234
+ * that. The fog is put back as the composite put it: the strand's light attenuated by the transmittance at the
235
+ * pixel's depth, plus the in-scatter there (`sample_volumetrics`, the same call at the same depth).
236
+ *
237
+ * @param {import("../shader/compiler/ShaderSwitchSet.js").ShaderSwitchSet} switches the renderer's
238
+ * @param {GPUTextureFormat} format the scene colour's
239
+ * @returns {RenderPipelineDescriptor}
240
+ */
241
+ export function hair_lighting_pipeline(switches, format) {
242
+ const fragment = fragment_descriptor.variant(switches);
243
+
244
+ let by_format = pipelines.get(fragment);
245
+
246
+ if (by_format === undefined) {
247
+ by_format = new Map();
248
+ pipelines.set(fragment, by_format);
249
+ }
250
+
251
+ let pipeline = by_format.get(format);
252
+
253
+ if (pipeline === undefined) {
254
+ pipeline = RenderPipelineDescriptor.from({
255
+ label: fragment.label,
256
+ layout,
257
+ vertex: { module: { code: vertex_descriptor.source }, entryPoint: "vs_main" },
258
+ fragment: {
259
+ module: { code: fragment.source },
260
+ entryPoint: "fs_main",
261
+ targets: [ColorTargetState.from({ format })],
262
+ },
263
+ primitive: { topology: "triangle-strip", cullMode: "none" },
264
+ });
265
+
266
+ by_format.set(format, pipeline);
267
+ }
268
+
269
+ return pipeline;
270
+ }
@@ -0,0 +1,75 @@
1
+ /**
2
+ * The absorption whose colour after multiple scattering is `color` (`hair_color_to_absorption`).
3
+ *
4
+ * @param {number} color
5
+ * @returns {number}
6
+ */
7
+ export function hair_color_to_absorption(color: number): number;
8
+ /**
9
+ * One lobe of `hair_shading`, apart: the width and the centre in `sin θ_l` of its longitudinal Gaussian, and the rest
10
+ * of it at `sin θ_l = u`, for the fibre's tangent along +z (towards the root), the view at `sin θ_v = u_v` in the
11
+ * x-z plane and the light at azimuth `cos φ` from it.
12
+ *
13
+ * @param {number} lobe 0 R, 1 TT, 2 TRT
14
+ * @param {number} u sin θ_l
15
+ * @param {number} cos_phi
16
+ * @param {number} u_v sin θ_v
17
+ * @param {number} absorption
18
+ * @param {number} roughness
19
+ * @param {Float64Array} out width, centre, value
20
+ */
21
+ export function hair_lobe(lobe: number, u: number, cos_phi: number, u_v: number, absorption: number, roughness: number, out: Float64Array): void;
22
+ /**
23
+ * `hair_shading` at area 0 and backlit 1, summed from {@link hair_lobe}: the twin the spec compares with the shader.
24
+ *
25
+ * @param {number} u sin θ_l
26
+ * @param {number} cos_phi
27
+ * @param {number} u_v
28
+ * @param {number} absorption
29
+ * @param {number} roughness
30
+ * @returns {number}
31
+ */
32
+ export function hair_shading_twin(u: number, cos_phi: number, u_v: number, absorption: number, roughness: number): number;
33
+ /**
34
+ * The average front and back scattering of one table entry.
35
+ *
36
+ * @param {number} u_v sin θ_v
37
+ * @param {number} roughness
38
+ * @param {number} color
39
+ * @param {number} [phi_steps] over the whole turn
40
+ * @returns {number[]} [A_front, A_back]
41
+ */
42
+ export function hair_average_scattering(u_v: number, roughness: number, color: number, phi_steps?: number): number[];
43
+ /**
44
+ * The whole table, front and back interleaved, x fastest, then y, then z.
45
+ *
46
+ * @param {Object} [options]
47
+ * @param {number} [options.phi_steps]
48
+ * @returns {Float32Array}
49
+ */
50
+ export function hair_scattering_lut_generate({ phi_steps }?: {
51
+ phi_steps?: number;
52
+ }): Float32Array;
53
+ /**
54
+ * The hair's average scattering table, which dual scattering reads (Zinke et al. 2008, as Unreal 5.4 tabulates it in
55
+ * HairStrandsLUT.usf): for a fibre seen at `sin θ_v = |V·T|`, of longitudinal roughness `r` and colour `C`, the
56
+ * single-scattering BSDF integrated over the hemisphere of directions in front of the view (`A_front`, what passes
57
+ * through) and behind it (`A_back`, what comes back), no cosine, each clamped to [0, 1].
58
+ *
59
+ * Laid out as Unreal's: x is `sin θ_v`, y is `r`, z is `sqrt(C)`, each at texel centres; two channels, front then back.
60
+ * The BSDF is `chunk_hair_shading` at area 0 and backlit 1, here as a lobe-wise twin that `hair_scattering_lut.spec.js`
61
+ * holds to the shader.
62
+ */
63
+ /**
64
+ * @type {number}
65
+ */
66
+ export const HAIR_SCATTERING_LUT_THETA: number;
67
+ /**
68
+ * @type {number}
69
+ */
70
+ export const HAIR_SCATTERING_LUT_ROUGHNESS: number;
71
+ /**
72
+ * @type {number}
73
+ */
74
+ export const HAIR_SCATTERING_LUT_COLOR: number;
75
+ //# sourceMappingURL=hair_scattering_lut.d.ts.map