@woosh/meep-engine 3.78.3 → 3.79.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 (367) hide show
  1. package/CHANGELOG.md +80 -13
  2. package/editor/view/node-graph/NodeGraphView.d.ts +1 -1
  3. package/editor/view/node-graph/NodeGraphView.js +1 -1
  4. package/package.json +1 -1
  5. package/src/core/math/physics/brdf/fresnel_Schlick_optimized.d.ts +2 -1
  6. package/src/core/math/physics/brdf/fresnel_Schlick_optimized.d.ts.map +1 -1
  7. package/src/core/math/physics/brdf/fresnel_Schlick_optimized.js +2 -1
  8. package/src/core/math/snap_to_integer.d.ts +13 -0
  9. package/src/core/math/snap_to_integer.d.ts.map +1 -0
  10. package/src/core/math/snap_to_integer.js +20 -0
  11. package/src/core/model/node-graph/NodeGraph.d.ts +0 -1
  12. package/src/core/model/node-graph/NodeGraph.d.ts.map +1 -1
  13. package/src/core/model/node-graph/NodeGraph.js +0 -1
  14. package/src/engine/asset/GameAssetType.d.ts +2 -0
  15. package/src/engine/asset/GameAssetType.js +10 -0
  16. package/src/engine/asset/guessAssetType.d.ts.map +1 -1
  17. package/src/engine/asset/guessAssetType.js +4 -0
  18. package/src/engine/asset/load_model_scene_bundle.d.ts +1 -1
  19. package/src/engine/asset/load_model_scene_bundle.js +2 -2
  20. package/src/engine/asset/loaders/MTFSceneBundleAssetLoader.d.ts +42 -0
  21. package/src/engine/asset/loaders/MTFSceneBundleAssetLoader.d.ts.map +1 -0
  22. package/src/engine/asset/loaders/MTFSceneBundleAssetLoader.js +83 -0
  23. package/src/engine/asset/loaders/MTFTextureAssetLoader.d.ts +36 -0
  24. package/src/engine/asset/loaders/MTFTextureAssetLoader.d.ts.map +1 -0
  25. package/src/engine/asset/loaders/MTFTextureAssetLoader.js +78 -0
  26. package/src/engine/ecs/storage/binary/collection/BinaryCollectionSerializer.d.ts +6 -1
  27. package/src/engine/ecs/storage/binary/collection/BinaryCollectionSerializer.d.ts.map +1 -1
  28. package/src/engine/ecs/storage/binary/collection/BinaryCollectionSerializer.js +8 -2
  29. package/src/engine/graphics/hair/groom_bind_to_mesh.d.ts +1 -1
  30. package/src/engine/graphics/hair/groom_bind_to_mesh.js +1 -1
  31. package/src/engine/graphics/hair/groom_build_guides.d.ts +1 -1
  32. package/src/engine/graphics/hair/groom_build_guides.js +1 -1
  33. package/src/engine/graphics/impostors/voxel/README.md +11 -11
  34. package/src/engine/physics/cloth/collider/ClothColliderKind.js +1 -1
  35. package/src/engine/physics/cloth/ecs/cloth_geodesic.d.ts +1 -1
  36. package/src/engine/physics/cloth/ecs/cloth_geodesic.js +1 -1
  37. package/src/engine/physics/cloth/solver/constraint/cloth_backstop_row.d.ts +2 -3
  38. package/src/engine/physics/cloth/solver/constraint/cloth_backstop_row.d.ts.map +1 -1
  39. package/src/engine/physics/cloth/solver/constraint/cloth_backstop_row.js +2 -3
  40. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  41. package/src/generation/filtering/numeric/sampling/AbstractCellFilterSampleGridLayer.d.ts +0 -2
  42. package/src/generation/filtering/numeric/sampling/AbstractCellFilterSampleGridLayer.d.ts.map +1 -1
  43. package/src/generation/filtering/numeric/sampling/AbstractCellFilterSampleGridLayer.js +0 -5
  44. package/src/generation/filtering/numeric/sampling/CellFilterSampleLayerCubic.d.ts.map +1 -1
  45. package/src/generation/filtering/numeric/sampling/CellFilterSampleLayerCubic.js +5 -3
  46. package/src/generation/filtering/numeric/sampling/CellFilterSampleLayerLinear.d.ts.map +1 -1
  47. package/src/generation/filtering/numeric/sampling/CellFilterSampleLayerLinear.js +5 -3
  48. package/src/generation/grid/coords/grid_to_texel.d.ts +7 -1
  49. package/src/generation/grid/coords/grid_to_texel.d.ts.map +1 -1
  50. package/src/generation/grid/coords/grid_to_texel.js +11 -1
  51. package/src/generation/grid/coords/grid_to_texel_span.d.ts +15 -0
  52. package/src/generation/grid/coords/grid_to_texel_span.d.ts.map +1 -0
  53. package/src/generation/grid/coords/grid_to_texel_span.js +38 -0
  54. package/src/generation/grid/coords/texel_to_grid.d.ts +2 -1
  55. package/src/generation/grid/coords/texel_to_grid.d.ts.map +1 -1
  56. package/src/generation/grid/coords/texel_to_grid.js +6 -1
  57. package/src/generation/grid/generation/discrete/GridTaskWaveFunctionCollapse.d.ts +32 -1
  58. package/src/generation/grid/generation/discrete/GridTaskWaveFunctionCollapse.d.ts.map +1 -1
  59. package/src/generation/grid/generation/discrete/GridTaskWaveFunctionCollapse.js +114 -9
  60. package/src/generation/grid/generation/discrete/layer/GridTaskBuildSourceDistanceMap.d.ts +8 -0
  61. package/src/generation/grid/generation/discrete/layer/GridTaskBuildSourceDistanceMap.d.ts.map +1 -1
  62. package/src/generation/grid/generation/discrete/layer/GridTaskBuildSourceDistanceMap.js +91 -29
  63. package/src/generation/grid/layers/GridDataLayer.d.ts +21 -2
  64. package/src/generation/grid/layers/GridDataLayer.d.ts.map +1 -1
  65. package/src/generation/grid/layers/GridDataLayer.js +43 -4
  66. package/src/generation/placement/action/GridCellActionPlaceTags.d.ts +7 -1
  67. package/src/generation/placement/action/GridCellActionPlaceTags.d.ts.map +1 -1
  68. package/src/generation/placement/action/GridCellActionPlaceTags.js +42 -16
  69. package/src/generation/placement/action/GridCellActionWriteFilterToLayer.d.ts +5 -0
  70. package/src/generation/placement/action/GridCellActionWriteFilterToLayer.d.ts.map +1 -1
  71. package/src/generation/placement/action/GridCellActionWriteFilterToLayer.js +32 -9
  72. package/src/generation/rules/CellMatcherLayerBitMaskTest.d.ts.map +1 -1
  73. package/src/generation/rules/CellMatcherLayerBitMaskTest.js +6 -2
  74. package/src/generation/wfc/GridWFCCompiledTileSet.d.ts +4 -2
  75. package/src/generation/wfc/GridWFCCompiledTileSet.d.ts.map +1 -1
  76. package/src/generation/wfc/GridWFCCompiledTileSet.js +2 -2
  77. package/src/generation/wfc/GridWFCTileSet.d.ts +16 -7
  78. package/src/generation/wfc/GridWFCTileSet.d.ts.map +1 -1
  79. package/src/generation/wfc/GridWFCTileSet.js +32 -8
  80. package/src/shade/playground/contact_shadows/shader_contact_lab_composite.js +2 -2
  81. package/src/shade/playground/particle_editor/README.md +2 -2
  82. package/src/shade/playground/probe_clipmap/index.html +1 -1
  83. package/src/shade/playground/screen_probes/README.md +5 -5
  84. package/src/shade/playground/screen_probes/main.js +1 -1
  85. package/src/shade/playground/tonemap_sdr/README.md +3 -2
  86. package/src/shade/playground/vgeo_scene/README.md +1 -3
  87. package/src/shade/playground/vgeo_scene/main.js +3 -3
  88. package/src/shade/renderer/Renderer.d.ts +3 -3
  89. package/src/shade/renderer/Renderer.js +4 -4
  90. package/src/shade/renderer/ShadeIndirectLightingMode.js +1 -1
  91. package/src/shade/renderer/acoustics/GPUAcousticLattice.d.ts +1 -1
  92. package/src/shade/renderer/acoustics/GPUAcousticProbes.d.ts +1 -1
  93. package/src/shade/renderer/acoustics/GPUAcoustics.d.ts +1 -1
  94. package/src/shade/renderer/animation/ShadeAnimationClipSerializationAdapter.d.ts +33 -0
  95. package/src/shade/renderer/animation/ShadeAnimationClipSerializationAdapter.d.ts.map +1 -0
  96. package/src/shade/renderer/animation/ShadeAnimationClipSerializationAdapter.js +196 -0
  97. package/src/shade/renderer/animation/SkinSerializationAdapter.d.ts +25 -0
  98. package/src/shade/renderer/animation/SkinSerializationAdapter.d.ts.map +1 -0
  99. package/src/shade/renderer/animation/SkinSerializationAdapter.js +85 -0
  100. package/src/shade/renderer/camera/PerspectiveCamera.js +1 -1
  101. package/src/shade/renderer/deferred/tonemap/ColorGrade.d.ts +11 -13
  102. package/src/shade/renderer/deferred/tonemap/ColorGrade.d.ts.map +1 -1
  103. package/src/shade/renderer/deferred/tonemap/ColorGrade.js +11 -13
  104. package/src/shade/renderer/deferred/tonemap/TONE_MAP_OPERATOR_ACES.d.ts.map +1 -1
  105. package/src/shade/renderer/deferred/tonemap/TONE_MAP_OPERATOR_ACES.js +6 -7
  106. package/src/shade/renderer/deferred/tonemap/ToneMapper.d.ts +1 -1
  107. package/src/shade/renderer/deferred/tonemap/ToneMapper.js +1 -1
  108. package/src/shade/renderer/deferred/tonemap/m3_white_balance_rec709.d.ts +6 -8
  109. package/src/shade/renderer/deferred/tonemap/m3_white_balance_rec709.d.ts.map +1 -1
  110. package/src/shade/renderer/deferred/tonemap/m3_white_balance_rec709.js +7 -10
  111. package/src/shade/renderer/geometry/sdf/MESH_SDF.d.ts +1 -1
  112. package/src/shade/renderer/geometry/sdf/MESH_SDF.js +1 -1
  113. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_classify.d.ts +1 -1
  114. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_classify.js +1 -1
  115. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_evaluate.d.ts +1 -1
  116. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_evaluate.js +1 -1
  117. package/src/shade/renderer/geometry/sdf/chunk_blas_query_band_sdf.d.ts +1 -2
  118. package/src/shade/renderer/geometry/sdf/chunk_blas_query_band_sdf.d.ts.map +1 -1
  119. package/src/shade/renderer/geometry/sdf/chunk_blas_query_band_sdf.js +1 -2
  120. package/src/shade/renderer/geometry/sdf/chunk_scene_point_query_volume_sign.d.ts.map +1 -1
  121. package/src/shade/renderer/geometry/sdf/chunk_scene_point_query_volume_sign.js +2 -1
  122. package/src/shade/renderer/geometry/sdf/surface/MESH_SURFACE_BAKE.d.ts +1 -1
  123. package/src/shade/renderer/geometry/sdf/surface/MESH_SURFACE_BAKE.js +1 -1
  124. package/src/shade/renderer/geometry/virtual/build/level/vgeo_build_cluster_graph.js +1 -1
  125. package/src/shade/renderer/geometry/virtual/format/page/VGEO_DEFAULT_PAGE_SIZE.d.ts +2 -2
  126. package/src/shade/renderer/geometry/virtual/format/page/VGEO_DEFAULT_PAGE_SIZE.js +2 -2
  127. package/src/shade/renderer/geometry/virtual/runtime/cut/chunk_vgeo_cut_access.d.ts +2 -2
  128. package/src/shade/renderer/geometry/virtual/runtime/cut/chunk_vgeo_cut_access.js +4 -4
  129. package/src/shade/renderer/geometry/virtual/runtime/cut/chunk_vgeo_cut_instance.d.ts +1 -1
  130. package/src/shade/renderer/geometry/virtual/runtime/cut/chunk_vgeo_cut_instance.js +1 -1
  131. package/src/shade/renderer/geometry/virtual/runtime/cut/shader_vgeo_cut_collect.js +1 -1
  132. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_INSTANCE_OFFSET.d.ts +3 -3
  133. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_INSTANCE_OFFSET.js +3 -3
  134. package/src/shade/renderer/global_illumination/brick4/README.md +2 -1
  135. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.d.ts +4 -6
  136. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.d.ts.map +1 -1
  137. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.js +4 -6
  138. package/src/shade/renderer/global_illumination/probe_clipmap/brick/BRICK_MOVERS.d.ts +1 -1
  139. package/src/shade/renderer/global_illumination/probe_clipmap/brick/BRICK_MOVERS.js +1 -1
  140. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.d.ts +1 -1
  141. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.js +2 -2
  142. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_texel.d.ts +1 -1
  143. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_texel.js +1 -1
  144. package/src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.d.ts +1 -1
  145. package/src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.js +1 -1
  146. package/src/shade/renderer/global_illumination/screen_probe/SCREEN_PROBE.d.ts +28 -35
  147. package/src/shade/renderer/global_illumination/screen_probe/SCREEN_PROBE.d.ts.map +1 -1
  148. package/src/shade/renderer/global_illumination/screen_probe/SCREEN_PROBE.js +28 -35
  149. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.d.ts +21 -24
  150. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.d.ts.map +1 -1
  151. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.js +21 -24
  152. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe.d.ts +8 -8
  153. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe.js +8 -8
  154. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_brdf_density.d.ts +4 -4
  155. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_brdf_density.js +4 -4
  156. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_interpolate.d.ts +3 -5
  157. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_interpolate.d.ts.map +1 -1
  158. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_interpolate.js +3 -5
  159. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_lighting_history.d.ts +4 -4
  160. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_lighting_history.js +4 -4
  161. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_rough_specular.d.ts +2 -3
  162. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_rough_specular.d.ts.map +1 -1
  163. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_rough_specular.js +2 -3
  164. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_screen_march.d.ts +4 -4
  165. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_screen_march.js +4 -4
  166. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_surface.d.ts +2 -4
  167. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_surface.d.ts.map +1 -1
  168. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_surface.js +2 -4
  169. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_brick.d.ts +2 -4
  170. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_brick.d.ts.map +1 -1
  171. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_brick.js +2 -4
  172. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_gather.d.ts +13 -17
  173. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_gather.d.ts.map +1 -1
  174. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_gather.js +13 -17
  175. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_importance.d.ts +11 -14
  176. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_importance.d.ts.map +1 -1
  177. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_importance.js +11 -14
  178. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_pick.d.ts +2 -2
  179. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_pick.js +2 -2
  180. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_place.d.ts +9 -9
  181. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_place.js +9 -9
  182. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_resolve.d.ts +15 -18
  183. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_resolve.d.ts.map +1 -1
  184. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_resolve.js +16 -19
  185. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_trace_screen.d.ts +10 -11
  186. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_trace_screen.d.ts.map +1 -1
  187. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_trace_screen.js +11 -12
  188. package/src/shade/renderer/hair/GPUHairSystem.d.ts.map +1 -1
  189. package/src/shade/renderer/hair/GPUHairSystem.js +16 -7
  190. package/src/shade/renderer/hair/HAIR.d.ts +5 -3
  191. package/src/shade/renderer/hair/HAIR.d.ts.map +1 -1
  192. package/src/shade/renderer/hair/HAIR.js +6 -4
  193. package/src/shade/renderer/hair/chunk_hair_bsdf.d.ts +9 -8
  194. package/src/shade/renderer/hair/chunk_hair_bsdf.d.ts.map +1 -1
  195. package/src/shade/renderer/hair/chunk_hair_bsdf.js +10 -9
  196. package/src/shade/renderer/hair/chunk_hair_dual_scattering.d.ts +5 -6
  197. package/src/shade/renderer/hair/chunk_hair_dual_scattering.d.ts.map +1 -1
  198. package/src/shade/renderer/hair/chunk_hair_dual_scattering.js +5 -6
  199. package/src/shade/renderer/hair/hair_lighting.d.ts +3 -3
  200. package/src/shade/renderer/hair/hair_lighting.d.ts.map +1 -1
  201. package/src/shade/renderer/hair/hair_lighting.js +4 -5
  202. package/src/shade/renderer/hair/hair_scattering_lut.d.ts +5 -5
  203. package/src/shade/renderer/hair/hair_scattering_lut.js +5 -5
  204. package/src/shade/renderer/hair/hair_shadow_draw.d.ts +10 -10
  205. package/src/shade/renderer/hair/hair_shadow_draw.d.ts.map +1 -1
  206. package/src/shade/renderer/hair/hair_shadow_draw.js +21 -17
  207. package/src/shade/renderer/hair/shader_hair_cull.d.ts.map +1 -1
  208. package/src/shade/renderer/hair/shader_hair_cull.js +6 -2
  209. package/src/shade/renderer/hair/shader_hair_roots.d.ts +2 -2
  210. package/src/shade/renderer/hair/shader_hair_roots.js +2 -2
  211. package/src/shade/renderer/hair/shader_hair_shadow_list.d.ts +5 -4
  212. package/src/shade/renderer/hair/shader_hair_shadow_list.d.ts.map +1 -1
  213. package/src/shade/renderer/hair/shader_hair_shadow_list.js +10 -12
  214. package/src/shade/renderer/light/environment/DEFINES.d.ts +1 -1
  215. package/src/shade/renderer/light/environment/DEFINES.js +1 -1
  216. package/src/shade/renderer/light/environment/shader_convolve_reflection_map_from_blurred.js +2 -2
  217. package/src/shade/renderer/loader/SceneNodeSerializationAdapter.d.ts +38 -0
  218. package/src/shade/renderer/loader/SceneNodeSerializationAdapter.d.ts.map +1 -0
  219. package/src/shade/renderer/loader/SceneNodeSerializationAdapter.js +198 -0
  220. package/src/shade/renderer/loader/mtf/MTFTexture.d.ts +88 -0
  221. package/src/shade/renderer/loader/mtf/MTFTexture.d.ts.map +1 -0
  222. package/src/shade/renderer/loader/mtf/MTFTexture.js +159 -0
  223. package/src/shade/renderer/loader/mtf/MTFTextureSerializationAdapter.d.ts +30 -0
  224. package/src/shade/renderer/loader/mtf/MTFTextureSerializationAdapter.d.ts.map +1 -0
  225. package/src/shade/renderer/loader/mtf/MTFTextureSerializationAdapter.js +136 -0
  226. package/src/shade/renderer/loader/mtf/MTF_PACKAGE_MAGIC.d.ts +7 -0
  227. package/src/shade/renderer/loader/mtf/MTF_PACKAGE_MAGIC.d.ts.map +1 -0
  228. package/src/shade/renderer/loader/mtf/MTF_PACKAGE_MAGIC.js +6 -0
  229. package/src/shade/renderer/loader/mtf/MTF_PACKAGE_VERSION.d.ts +8 -0
  230. package/src/shade/renderer/loader/mtf/MTF_PACKAGE_VERSION.d.ts.map +1 -0
  231. package/src/shade/renderer/loader/mtf/MTF_PACKAGE_VERSION.js +7 -0
  232. package/src/shade/renderer/loader/mtf/MTF_TEXTURE_MAGIC.d.ts +7 -0
  233. package/src/shade/renderer/loader/mtf/MTF_TEXTURE_MAGIC.d.ts.map +1 -0
  234. package/src/shade/renderer/loader/mtf/MTF_TEXTURE_MAGIC.js +6 -0
  235. package/src/shade/renderer/loader/mtf/MTF_TEXTURE_VERSION.d.ts +7 -0
  236. package/src/shade/renderer/loader/mtf/MTF_TEXTURE_VERSION.d.ts.map +1 -0
  237. package/src/shade/renderer/loader/mtf/MTF_TEXTURE_VERSION.js +6 -0
  238. package/src/shade/renderer/loader/mtf/load_mtf.d.ts +41 -0
  239. package/src/shade/renderer/loader/mtf/load_mtf.d.ts.map +1 -0
  240. package/src/shade/renderer/loader/mtf/load_mtf.js +73 -0
  241. package/src/shade/renderer/loader/mtf/mtf_bundle_textures.d.ts +19 -0
  242. package/src/shade/renderer/loader/mtf/mtf_bundle_textures.d.ts.map +1 -0
  243. package/src/shade/renderer/loader/mtf/mtf_bundle_textures.js +57 -0
  244. package/src/shade/renderer/loader/mtf/mtf_encode_texture.d.ts +9 -0
  245. package/src/shade/renderer/loader/mtf/mtf_encode_texture.d.ts.map +1 -0
  246. package/src/shade/renderer/loader/mtf/mtf_encode_texture.js +78 -0
  247. package/src/shade/renderer/loader/mtf/mtf_export.d.ts +45 -0
  248. package/src/shade/renderer/loader/mtf/mtf_export.d.ts.map +1 -0
  249. package/src/shade/renderer/loader/mtf/mtf_export.js +161 -0
  250. package/src/shade/renderer/loader/mtf/mtf_is_texture.d.ts +9 -0
  251. package/src/shade/renderer/loader/mtf/mtf_is_texture.d.ts.map +1 -0
  252. package/src/shade/renderer/loader/mtf/mtf_is_texture.js +12 -0
  253. package/src/shade/renderer/loader/mtf/mtf_read_collection.d.ts +24 -0
  254. package/src/shade/renderer/loader/mtf/mtf_read_collection.d.ts.map +1 -0
  255. package/src/shade/renderer/loader/mtf/mtf_read_collection.js +37 -0
  256. package/src/shade/renderer/loader/mtf/mtf_read_scene.d.ts +27 -0
  257. package/src/shade/renderer/loader/mtf/mtf_read_scene.d.ts.map +1 -0
  258. package/src/shade/renderer/loader/mtf/mtf_read_scene.js +121 -0
  259. package/src/shade/renderer/loader/mtf/mtf_read_textures.d.ts +18 -0
  260. package/src/shade/renderer/loader/mtf/mtf_read_textures.d.ts.map +1 -0
  261. package/src/shade/renderer/loader/mtf/mtf_read_textures.js +51 -0
  262. package/src/shade/renderer/loader/mtf/mtf_resolve_uri.d.ts +21 -0
  263. package/src/shade/renderer/loader/mtf/mtf_resolve_uri.d.ts.map +1 -0
  264. package/src/shade/renderer/loader/mtf/mtf_resolve_uri.js +98 -0
  265. package/src/shade/renderer/loader/mtf/mtf_serialization_registry.d.ts +25 -0
  266. package/src/shade/renderer/loader/mtf/mtf_serialization_registry.d.ts.map +1 -0
  267. package/src/shade/renderer/loader/mtf/mtf_serialization_registry.js +51 -0
  268. package/src/shade/renderer/loader/mtf/mtf_texture_read.d.ts +20 -0
  269. package/src/shade/renderer/loader/mtf/mtf_texture_read.d.ts.map +1 -0
  270. package/src/shade/renderer/loader/mtf/mtf_texture_read.js +80 -0
  271. package/src/shade/renderer/loader/mtf/mtf_texture_select.d.ts +24 -0
  272. package/src/shade/renderer/loader/mtf/mtf_texture_select.d.ts.map +1 -0
  273. package/src/shade/renderer/loader/mtf/mtf_texture_select.js +42 -0
  274. package/src/shade/renderer/loader/mtf/mtf_texture_write.d.ts +31 -0
  275. package/src/shade/renderer/loader/mtf/mtf_texture_write.d.ts.map +1 -0
  276. package/src/shade/renderer/loader/mtf/mtf_texture_write.js +87 -0
  277. package/src/shade/renderer/loader/mtf/mtf_write.d.ts +36 -0
  278. package/src/shade/renderer/loader/mtf/mtf_write.d.ts.map +1 -0
  279. package/src/shade/renderer/loader/mtf/mtf_write.js +161 -0
  280. package/src/shade/renderer/material/StandardShadeMaterialSerializationAdapter.d.ts +39 -0
  281. package/src/shade/renderer/material/StandardShadeMaterialSerializationAdapter.d.ts.map +1 -0
  282. package/src/shade/renderer/material/StandardShadeMaterialSerializationAdapter.js +207 -0
  283. package/src/shade/renderer/material/dispatch/MaterialDispatch.d.ts +1 -2
  284. package/src/shade/renderer/material/dispatch/MaterialDispatch.d.ts.map +1 -1
  285. package/src/shade/renderer/material/dispatch/MaterialDispatch.js +1 -2
  286. package/src/shade/renderer/material/standard/fragment_gbuffer.d.ts.map +1 -1
  287. package/src/shade/renderer/material/standard/fragment_gbuffer.js +2 -1
  288. package/src/shade/renderer/material/util/dielectric_specular_color.d.ts +1 -1
  289. package/src/shade/renderer/material/util/dielectric_specular_color.js +1 -1
  290. package/src/shade/renderer/postprocess/dof/gather/DOF2_CONFIG.d.ts +1 -1
  291. package/src/shade/renderer/postprocess/dof/gather/DOF2_CONFIG.js +1 -1
  292. package/src/shade/renderer/postprocess/dof/gather/DOF2_PRESETS.js +1 -1
  293. package/src/shade/renderer/postprocess/dof/gather/DOF2_SETTINGS_STRUCT.d.ts +1 -1
  294. package/src/shade/renderer/postprocess/dof/gather/DOF2_SETTINGS_STRUCT.js +1 -1
  295. package/src/shade/renderer/postprocess/dof/gather/DOF2_TEXTURE_FORMAT.d.ts +1 -1
  296. package/src/shade/renderer/postprocess/dof/gather/DOF2_TEXTURE_FORMAT.js +1 -1
  297. package/src/shade/renderer/postprocess/dof/gather/DepthOfFieldU.d.ts +3 -4
  298. package/src/shade/renderer/postprocess/dof/gather/DepthOfFieldU.d.ts.map +1 -1
  299. package/src/shade/renderer/postprocess/dof/gather/DepthOfFieldU.js +3 -4
  300. package/src/shade/renderer/postprocess/dof/gather/graph_postprocess_dof2.d.ts +1 -1
  301. package/src/shade/renderer/postprocess/dof/gather/graph_postprocess_dof2.js +1 -1
  302. package/src/shade/renderer/postprocess/eye/GPUCameraExposureManager.d.ts +1 -1
  303. package/src/shade/renderer/postprocess/eye/GPUCameraExposureManager.js +1 -1
  304. package/src/shade/renderer/postprocess/gtao/ao_reproject_shader.d.ts.map +1 -1
  305. package/src/shade/renderer/postprocess/gtao/ao_reproject_shader.js +2 -3
  306. package/src/shade/renderer/postprocess/motion_blur/MOTION_BLUR_CONFIG.d.ts +1 -2
  307. package/src/shade/renderer/postprocess/motion_blur/MOTION_BLUR_CONFIG.d.ts.map +1 -1
  308. package/src/shade/renderer/postprocess/motion_blur/MOTION_BLUR_CONFIG.js +1 -2
  309. package/src/shade/renderer/postprocess/taa/chunk_fsr2_compute_depth_clip.d.ts +2 -3
  310. package/src/shade/renderer/postprocess/taa/chunk_fsr2_compute_depth_clip.d.ts.map +1 -1
  311. package/src/shade/renderer/postprocess/taa/chunk_fsr2_compute_depth_clip.js +2 -3
  312. package/src/shade/renderer/postprocess/taa/filter_blackman_harris.d.ts +1 -1
  313. package/src/shade/renderer/postprocess/taa/filter_blackman_harris.js +1 -1
  314. package/src/shade/renderer/rasterize/native/depth/shadow_cascade_rasterization_pass_descriptor.d.ts +1 -1
  315. package/src/shade/renderer/rasterize/native/depth/shadow_cascade_rasterization_pass_descriptor.js +1 -1
  316. package/src/shade/renderer/rasterize/native/depth/shadow_rasterization_alpha_tested_pass_descriptor.js +1 -1
  317. package/src/shade/renderer/restir/di/ReSTIRDI.d.ts +3 -3
  318. package/src/shade/renderer/restir/di/ReSTIRDI.js +3 -3
  319. package/src/shade/renderer/restir/di/chunk_restir_trace_visibility.d.ts +1 -1
  320. package/src/shade/renderer/restir/di/chunk_restir_trace_visibility.js +1 -1
  321. package/src/shade/renderer/scene/optimization/source_to_sampler2d.d.ts.map +1 -1
  322. package/src/shade/renderer/scene/optimization/source_to_sampler2d.js +3 -1
  323. package/src/shade/renderer/scene/serialization/STANDARD_MATERIAL_SERIALIZED_BYTE_SIZE.d.ts +5 -5
  324. package/src/shade/renderer/scene/serialization/STANDARD_MATERIAL_SERIALIZED_BYTE_SIZE.js +5 -5
  325. package/src/shade/renderer/scene/serialization/deserialize_scene.d.ts.map +1 -1
  326. package/src/shade/renderer/scene/serialization/deserialize_scene.js +491 -528
  327. package/src/shade/renderer/scene/serialization/serialize_scene.d.ts +0 -10
  328. package/src/shade/renderer/scene/serialization/serialize_scene.d.ts.map +1 -1
  329. package/src/shade/renderer/scene/serialization/serialize_scene.js +15 -71
  330. package/src/shade/renderer/shader/chunk/brdf/chunk_MIN_DIELECTRICS_F0.d.ts +1 -1
  331. package/src/shade/renderer/shader/chunk/brdf/chunk_MIN_DIELECTRICS_F0.js +1 -1
  332. package/src/shade/renderer/shader/chunk/brdf/chunk_shadowed_F90.d.ts +1 -2
  333. package/src/shade/renderer/shader/chunk/brdf/chunk_shadowed_F90.d.ts.map +1 -1
  334. package/src/shade/renderer/shader/chunk/brdf/chunk_shadowed_F90.js +1 -2
  335. package/src/shade/renderer/shader/chunk/color/conversion/chunk_CRM_REC709_AP1.d.ts +4 -5
  336. package/src/shade/renderer/shader/chunk/color/conversion/chunk_CRM_REC709_AP1.d.ts.map +1 -1
  337. package/src/shade/renderer/shader/chunk/color/conversion/chunk_CRM_REC709_AP1.js +4 -5
  338. package/src/shade/renderer/shader/chunk/color/grade/chunk_color_grade.js +2 -2
  339. package/src/shade/renderer/shader/chunk/color/tonemap/aces/chunk_aces_ue_matrices.d.ts +2 -2
  340. package/src/shade/renderer/shader/chunk/color/tonemap/aces/chunk_aces_ue_matrices.js +2 -2
  341. package/src/shade/renderer/shader/chunk/color/tonemap/aces/chunk_tonemap_ue_filmic.d.ts +14 -17
  342. package/src/shade/renderer/shader/chunk/color/tonemap/aces/chunk_tonemap_ue_filmic.d.ts.map +1 -1
  343. package/src/shade/renderer/shader/chunk/color/tonemap/aces/chunk_tonemap_ue_filmic.js +18 -21
  344. package/src/shade/renderer/shader/chunk/filter/chunk_filter_blackman_harris.d.ts +1 -1
  345. package/src/shade/renderer/shader/chunk/filter/chunk_filter_blackman_harris.js +1 -1
  346. package/src/shade/renderer/shader/chunk/filter/chunk_filter_blackman_harris229.d.ts +1 -1
  347. package/src/shade/renderer/shader/chunk/filter/chunk_filter_blackman_harris229.js +1 -1
  348. package/src/shade/renderer/shader/chunk/filter/chunk_multiscale_mean.d.ts +3 -4
  349. package/src/shade/renderer/shader/chunk/filter/chunk_multiscale_mean.d.ts.map +1 -1
  350. package/src/shade/renderer/shader/chunk/filter/chunk_multiscale_mean.js +3 -4
  351. package/src/shade/renderer/shader/chunk/material/chunk_re_direct_multiscatter.d.ts +1 -1
  352. package/src/shade/renderer/shader/chunk/material/chunk_re_direct_multiscatter.js +1 -1
  353. package/src/shade/renderer/shadow/map/GPUSceneShadowmapContext.js +3 -3
  354. package/src/shade/renderer/shadow/map/shader/chunk_sample_shadowmap_cascade.d.ts +6 -8
  355. package/src/shade/renderer/shadow/map/shader/chunk_sample_shadowmap_cascade.d.ts.map +1 -1
  356. package/src/shade/renderer/shadow/map/shader/chunk_sample_shadowmap_cascade.js +8 -10
  357. package/src/shade/renderer/shadow/map/shader/chunk_shadow_caster_depth_bias.d.ts +5 -7
  358. package/src/shade/renderer/shadow/map/shader/chunk_shadow_caster_depth_bias.d.ts.map +1 -1
  359. package/src/shade/renderer/shadow/map/shader/chunk_shadow_caster_depth_bias.js +5 -7
  360. package/src/shade/renderer/texture/format/gpu_texture_format_without_srgb.d.ts +11 -0
  361. package/src/shade/renderer/texture/format/gpu_texture_format_without_srgb.d.ts.map +1 -0
  362. package/src/shade/renderer/texture/format/gpu_texture_format_without_srgb.js +14 -0
  363. package/src/shade/renderer/texture/texture_role_image_quality.d.ts +10 -0
  364. package/src/shade/renderer/texture/texture_role_image_quality.d.ts.map +1 -0
  365. package/src/shade/renderer/texture/texture_role_image_quality.js +29 -0
  366. package/src/shade/renderer/texture/virtual/README.md +257 -257
  367. package/src/shade/renderer/volumetrics/shader_volumetrics_build_lighting.js +2 -2
@@ -1,7 +1,7 @@
1
1
  import { CodeChunk } from "../shader/compiler/CodeChunk.js";
2
2
 
3
3
  /**
4
- * `B` of Chiang et al.'s colour mapping, the azimuthal roughness it is fitted at; Unreal's default.
4
+ * `B` of Chiang et al.'s colour mapping, the azimuthal roughness it is fitted at.
5
5
  * @type {number}
6
6
  */
7
7
  const B = 0.3;
@@ -24,7 +24,8 @@ const D = 5.969 - 0.215 * B + 2.532 * B ** 2 - 10.73 * B ** 3 + 5.574 * B ** 4 +
24
24
  *
25
25
  * `melanin` from 0 (none) to 1 (black), `redness` the share of it that is pheomelanin, `dye` a colour whose
26
26
  * absorption adds to the pigments' (white adds none). The two mappings are each other's inverse: the colour is what
27
- * the hair looks after multiple scattering, at {@link B}. Unreal's `GetHairColorFromMelanin`, kept as absorption.
27
+ * the hair looks after multiple scattering, at {@link B}. `hair_absorption` gives the pigments' absorption, not
28
+ * the colour it maps to.
28
29
  *
29
30
  * @type {CodeChunk}
30
31
  */
@@ -54,8 +55,9 @@ fn hair_absorption(melanin: f32, redness: f32, dye: vec3<f32>) -> vec3<f32> {
54
55
  `);
55
56
 
56
57
  /**
57
- * Light scattered by a hair fibre, single scattering: Unreal 5.4's `HairShading` (HairBsdf.ush), Marschner et al.'s
58
- * three lobes in Karis's closed forms (Marschner et al. 2003; Pekelis et al. 2015 for the shapes):
58
+ * Light scattered by a hair fibre, single scattering: Marschner et al.'s three lobes in Karis's closed forms
59
+ * (Marschner et al. 2003; Karis 2016, "Physically Based Hair Shading in Unreal", SIGGRAPH course notes; Pekelis et
60
+ * al. 2015 for the shapes):
59
61
  *
60
62
  * ```wgsl
61
63
  * fn hair_shading(l: vec3<f32>, v: vec3<f32>, t: vec3<f32>, absorption: vec3<f32>, roughness: f32,
@@ -66,12 +68,11 @@ fn hair_absorption(melanin: f32, redness: f32, dye: vec3<f32>) -> vec3<f32> {
66
68
  * longitudinal roughness; `area` widens every lobe, for light from a solid angle (0 for a point light); `backlit`
67
69
  * scales the transmission and the back of the reflection, 1 for a light behind the hair to show through it.
68
70
  *
69
- * R reflects at the cuticle, its shift the cuticle's tilt and its azimuthal width separable (Unreal's strands);
70
- * TT passes through the fibre, attenuated by `absorption` over its path; TRT reflects once inside. The result is what
71
- * multiplies a light's radiance: no cosine is left to apply. Never negative.
71
+ * R reflects at the cuticle, its shift the cuticle's tilt and its azimuthal width separable; TT passes through the
72
+ * fibre, attenuated by `absorption` over its path; TRT reflects once inside. The result is what multiplies a light's
73
+ * radiance: no cosine is left to apply. Never negative.
72
74
  *
73
- * Unreal's Kajiya-Kay diffuse term, its own "hack approximation for multiple scattering", is not here: multiple
74
- * scattering is dual scattering's to add.
75
+ * No Kajiya-Kay diffuse term stands in for multiple scattering: multiple scattering is dual scattering's to add.
75
76
  *
76
77
  * @type {CodeChunk}
77
78
  */
@@ -7,8 +7,7 @@
7
7
  export const HAIR_SCATTERING_LUT_RESOURCE: ShaderResourceDescriptor;
8
8
  /**
9
9
  * Light scattered by hair with multiple scattering: dual scattering (Zinke et al. 2008) over the single-scattering
10
- * BSDF, as Unreal 5.4 composes it (ComputeDualScatteringTerms, HairStrandsDeepTransmittanceDualScattering.ush, and
11
- * HairShading's `GlobalScattering * (Fs + LocalScattering)`):
10
+ * BSDF, composed as `global * (single + local)`:
12
11
  *
13
12
  * ```wgsl
14
13
  * fn hair_scattering(l: vec3<f32>, v: vec3<f32>, t: vec3<f32>, absorption: vec3<f32>, roughness: f32,
@@ -21,10 +20,10 @@ export const HAIR_SCATTERING_LUT_RESOURCE: ShaderResourceDescriptor;
21
20
  * off it for the strand's own. The global term passes the light through them, attenuated by the average front
22
21
  * scattering to the power of their count and spread by their roughness; the local term adds what scatters back
23
22
  * from the strands around the point. The average scatterings come from the table at the light's angle to the fibre,
24
- * the roughness and the colour. As in Unreal, the table is read at the fibre's roughness and the lobes' spreads take
25
- * it clamped to [0.18, 0.6]: the spreads are Gaussians, and a narrower one would let a single smooth strand in front
26
- * block all but the light along its own cone (at roughness 0.1 one strand passes a fortieth of what the clamp passes).
27
- * Unreal's Kajiya-Kay term is not taken: this is the multiple scattering it stands in for.
23
+ * the roughness and the colour. The table is read at the fibre's roughness and the lobes' spreads take it clamped to
24
+ * [0.18, 0.6]: the spreads are Gaussians, and a narrower one would let a single smooth strand in front block all but
25
+ * the light along its own cone (at roughness 0.1 one strand passes a fortieth of what the clamp passes).
26
+ * No Kajiya-Kay term is added: this is the multiple scattering such a term stands in for.
28
27
  *
29
28
  * `hair_forward_transmittance` is the global term's energy alone, the average front scattering to the power of the
30
29
  * strands passed: what reaches the point from a source as wide as the sky, over which the spread integrates to one.
@@ -1 +1 @@
1
- {"version":3,"file":"chunk_hair_dual_scattering.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/hair/chunk_hair_dual_scattering.js"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,2CAFU,wBAAwB,CAE6E;AAE/G;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,yCAFU,SAAS,CAqHhB;yCAzJsC,gDAAgD;0BAD/D,iCAAiC"}
1
+ {"version":3,"file":"chunk_hair_dual_scattering.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/hair/chunk_hair_dual_scattering.js"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,2CAFU,wBAAwB,CAE6E;AAE/G;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,yCAFU,SAAS,CAqHhB;yCAxJsC,gDAAgD;0BAD/D,iCAAiC"}
@@ -13,8 +13,7 @@ export const HAIR_SCATTERING_LUT_RESOURCE = ShaderResourceDescriptor.texture("tH
13
13
 
14
14
  /**
15
15
  * Light scattered by hair with multiple scattering: dual scattering (Zinke et al. 2008) over the single-scattering
16
- * BSDF, as Unreal 5.4 composes it (ComputeDualScatteringTerms, HairStrandsDeepTransmittanceDualScattering.ush, and
17
- * HairShading's `GlobalScattering * (Fs + LocalScattering)`):
16
+ * BSDF, composed as `global * (single + local)`:
18
17
  *
19
18
  * ```wgsl
20
19
  * fn hair_scattering(l: vec3<f32>, v: vec3<f32>, t: vec3<f32>, absorption: vec3<f32>, roughness: f32,
@@ -27,10 +26,10 @@ export const HAIR_SCATTERING_LUT_RESOURCE = ShaderResourceDescriptor.texture("tH
27
26
  * off it for the strand's own. The global term passes the light through them, attenuated by the average front
28
27
  * scattering to the power of their count and spread by their roughness; the local term adds what scatters back
29
28
  * from the strands around the point. The average scatterings come from the table at the light's angle to the fibre,
30
- * the roughness and the colour. As in Unreal, the table is read at the fibre's roughness and the lobes' spreads take
31
- * it clamped to [0.18, 0.6]: the spreads are Gaussians, and a narrower one would let a single smooth strand in front
32
- * block all but the light along its own cone (at roughness 0.1 one strand passes a fortieth of what the clamp passes).
33
- * Unreal's Kajiya-Kay term is not taken: this is the multiple scattering it stands in for.
29
+ * the roughness and the colour. The table is read at the fibre's roughness and the lobes' spreads take it clamped to
30
+ * [0.18, 0.6]: the spreads are Gaussians, and a narrower one would let a single smooth strand in front block all but
31
+ * the light along its own cone (at roughness 0.1 one strand passes a fortieth of what the clamp passes).
32
+ * No Kajiya-Kay term is added: this is the multiple scattering such a term stands in for.
34
33
  *
35
34
  * `hair_forward_transmittance` is the global term's energy alone, the average front scattering to the power of the
36
35
  * strands passed: what reaches the point from a source as wide as the sky, over which the spread integrates to one.
@@ -3,12 +3,12 @@
3
3
  * rectangle (4 vertices, a triangle strip). One pipeline per switch set, which picks the shadow technique and the
4
4
  * indirect lighting the fragment links, and per format of the scene colour.
5
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
6
+ * A pixel's strand is lit by the shared light loop (`chunk_shade_direct_lights`) with the hair's lobe: the hair
7
7
  * BSDF with dual scattering (`chunk_hair_dual_scattering`), the strands between the point and each light counted
8
8
  * by a march through the instance's density volume (`chunk_hair_count_along`), each light's shadow taken from the
9
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.
10
+ * irradiance about the strand's normal, through the BSDF seen from the eye with every lobe widened (`area` 0.2) and
11
+ * dual scattering over the strands counted along the normal, which occludes the sky.
12
12
  * The marches' taps are jittered by the frame's blue noise.
13
13
  * The strand's colour is its instance's melanin, moved by the strand's variation byte, its redness and its dye.
14
14
  *
@@ -1 +1 @@
1
- {"version":3,"file":"hair_lighting.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/hair/hair_lighting.js"],"names":[],"mappings":"AAkOA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,iDAJW,OAAO,uCAAuC,EAAE,eAAe,6BAE7D,wBAAwB,CA+BpC;AAtPD;;;GAGG;AACH,uCAFU,6BAA6B,CAM8B;AAErE;;;;GAIG;AACH,uCAFU,6BAA6B,CAaA;AAYvC;;;;;GAKG;AACH,sCAFU,2BAA2B,CAEY;AAyIjD;;;;GAIG;AACH,qCAFU,gBAAgB,CAEgC;yCAxNjB,8DAA8D;8CAYzD,qDAAqD;4CACvD,mDAAmD;iCAC9D,+BAA+B"}
1
+ {"version":3,"file":"hair_lighting.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/hair/hair_lighting.js"],"names":[],"mappings":"AAiOA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,iDAJW,OAAO,uCAAuC,EAAE,eAAe,6BAE7D,wBAAwB,CA+BpC;AArPD;;;GAGG;AACH,uCAFU,6BAA6B,CAM8B;AAErE;;;;GAIG;AACH,uCAFU,6BAA6B,CAaA;AAYvC;;;;;GAKG;AACH,sCAFU,2BAA2B,CAEY;AAwIjD;;;;GAIG;AACH,qCAFU,gBAAgB,CAEgC;yCAvNjB,8DAA8D;8CAYzD,qDAAqD;4CACvD,mDAAmD;iCAC9D,+BAA+B"}
@@ -170,8 +170,7 @@ fn fs_main(in: HairQuadVertex) -> @location(0) vec4<f32> {
170
170
 
171
171
  shade_direct_lights(&context, position, view_direction, coord, view_depth);
172
172
 
173
- // the light around the strand's normal, through the fibre seen from the eye with every lobe widened, as Unreal's
174
- // strands take it from Lumen
173
+ // the light around the strand's normal, through the fibre seen from the eye with every lobe widened
175
174
  let normal = hair_normal(-towards_root, view_direction);
176
175
 
177
176
  var radiance: vec3<f32>;
@@ -229,12 +228,12 @@ const pipelines = new Map();
229
228
  * rectangle (4 vertices, a triangle strip). One pipeline per switch set, which picks the shadow technique and the
230
229
  * indirect lighting the fragment links, and per format of the scene colour.
231
230
  *
232
- * A pixel's strand is lit by the shared light loop (`chunk_shade_direct_lights`) with the hair's lobe: Unreal's hair
231
+ * A pixel's strand is lit by the shared light loop (`chunk_shade_direct_lights`) with the hair's lobe: the hair
233
232
  * BSDF with dual scattering (`chunk_hair_dual_scattering`), the strands between the point and each light counted
234
233
  * by a march through the instance's density volume (`chunk_hair_count_along`), each light's shadow taken from the
235
234
  * scene's maps at the strand point with the light's own way as the normal. Indirect light is the renderer's mode's
236
- * irradiance about the strand's normal, through the BSDF seen from the eye with every lobe widened (Unreal's strands
237
- * under Lumen, `area` 0.2) and dual scattering over the strands counted along the normal, which occludes the sky.
235
+ * irradiance about the strand's normal, through the BSDF seen from the eye with every lobe widened (`area` 0.2) and
236
+ * dual scattering over the strands counted along the normal, which occludes the sky.
238
237
  * The marches' taps are jittered by the frame's blue noise.
239
238
  * The strand's colour is its instance's melanin, moved by the strand's variation byte, its redness and its dye.
240
239
  *
@@ -51,12 +51,12 @@ export function hair_scattering_lut_generate({ phi_steps }?: {
51
51
  phi_steps?: number;
52
52
  }): Float32Array;
53
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].
54
+ * The hair's average scattering table, which dual scattering reads (Zinke et al. 2008): for a fibre seen at
55
+ * `sin θ_v = |V·T|`, of longitudinal roughness `r` and colour `C`, the single-scattering BSDF integrated over the
56
+ * hemisphere of directions in front of the view (`A_front`, what passes through) and behind it (`A_back`, what comes
57
+ * back), no cosine, each clamped to [0, 1].
58
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.
59
+ * Laid out with x `sin θ_v`, y `r`, z `sqrt(C)`, each at texel centres; two channels, front then back.
60
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
61
  * holds to the shader.
62
62
  */
@@ -1,10 +1,10 @@
1
1
  /**
2
- * The hair's average scattering table, which dual scattering reads (Zinke et al. 2008, as Unreal 5.4 tabulates it in
3
- * HairStrandsLUT.usf): for a fibre seen at `sin θ_v = |V·T|`, of longitudinal roughness `r` and colour `C`, the
4
- * single-scattering BSDF integrated over the hemisphere of directions in front of the view (`A_front`, what passes
5
- * through) and behind it (`A_back`, what comes back), no cosine, each clamped to [0, 1].
2
+ * The hair's average scattering table, which dual scattering reads (Zinke et al. 2008): for a fibre seen at
3
+ * `sin θ_v = |V·T|`, of longitudinal roughness `r` and colour `C`, the single-scattering BSDF integrated over the
4
+ * hemisphere of directions in front of the view (`A_front`, what passes through) and behind it (`A_back`, what comes
5
+ * back), no cosine, each clamped to [0, 1].
6
6
  *
7
- * 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.
7
+ * Laid out with x `sin θ_v`, y `r`, z `sqrt(C)`, each at texel centres; two channels, front then back.
8
8
  * The BSDF is `chunk_hair_shading` at area 0 and backlit 1, here as a lobe-wise twin that `hair_scattering_lut.spec.js`
9
9
  * holds to the shader.
10
10
  */
@@ -1,11 +1,11 @@
1
1
  /**
2
- * A shadow view's rectangle as the hair draws into it.
2
+ * A shadow view's rectangle as the hair draws into it, and where the frame's draw list keeps its shadow words.
3
3
  * @type {WebGPUStruct}
4
4
  */
5
5
  export const HAIR_SHADOW_TARGET_STRUCT: WebGPUStruct;
6
6
  /**
7
- * The bindings of {@link HAIR_SHADOW_PIPELINE}: `camera` (the shadow view's), `hair_shadow_view`, `hair_list` (the
8
- * shadow views' lists) and `hair_points` (the frame's deformed points).
7
+ * The bindings of {@link HAIR_SHADOW_PIPELINE}: `camera` (the shadow view's), `hair_shadow_view`, `hair_shadow_list`
8
+ * (the shadow views' lists), `hair_list` (the frame's draw list) and `hair_points` (the frame's deformed points).
9
9
  *
10
10
  * @type {ShaderResourceSetDescriptor}
11
11
  */
@@ -14,14 +14,14 @@ export const HAIR_SHADOW_RESOURCES: ShaderResourceSetDescriptor;
14
14
  * Draws the frame's strands into a shadow view's depth with the rasterizer's bias (`DEPTH_STENCIL_STATE_SHADOW`), in
15
15
  * cascades as well: a strand has no surface normal for the cascade casters' vertex-stage push to read.
16
16
  *
17
- * An instance is an entry of the view's list (`shader_hair_shadow_list`), a strand, drawn as `hair_id_draw.js` draws
18
- * it for the eye: a triangle strip a pair of vertices at each of its points, `2 (2^class + 1)` vertices, one draw a
19
- * point class (`shader_hair_shadow_draw_args`),
17
+ * An instance is an entry of the view's list (`shader_hair_shadow_list`), a strand, the place of its entry in the
18
+ * frame's draw list. It is drawn as `hair_id_draw.js` draws it for the eye: a triangle strip a pair of vertices at each
19
+ * of its points, `2 (2^class + 1)` vertices, one draw a point class (`shader_hair_shadow_draw_args`),
20
20
  * across the strand's tangent and the way to the light. Its width is the strand's own, as its point carries it, also
21
- * where the camera's view drew it at none. Under a texel, a point is drawn a texel wide by the strands whose
22
- * stratified share is under its width's fraction of the texel, and at none by the rest, so the covered area is the
23
- * strands' own at any texel size. A point nearer the light than the view's near plane is drawn on the plane. Both faces
24
- * are drawn.
21
+ * where the camera's view drew it at none. Under a texel, a point is drawn a texel wide by the strands whose share
22
+ * (their third shadow word, `HAIR.js`) is under its width's fraction of the texel, and at none by the rest, so the
23
+ * covered area is the strands' own at any texel size. A point nearer the light than the view's near plane is drawn on
24
+ * the plane. Both faces are drawn.
25
25
  *
26
26
  * @type {RenderPipelineDescriptor}
27
27
  */
@@ -1 +1 @@
1
- {"version":3,"file":"hair_shadow_draw.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/hair/hair_shadow_draw.js"],"names":[],"mappings":"AAWA;;;GAGG;AACH,wCAFU,YAAY,CAKQ;AA2E9B;;;;;GAKG;AACH,oCAFU,2BAA2B,CAEU;AAE/C;;;;;;;;;;;;;;GAcG;AACH,mCAFU,wBAAwB,CAQ/B;6BAlH0B,gCAAgC;4CAJjB,mDAAmD;yCAJtD,8DAA8D"}
1
+ {"version":3,"file":"hair_shadow_draw.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/hair/hair_shadow_draw.js"],"names":[],"mappings":"AAWA;;;GAGG;AACH,wCAFU,YAAY,CAOQ;AA6E9B;;;;;GAKG;AACH,oCAFU,2BAA2B,CAEU;AAE/C;;;;;;;;;;;;;;GAcG;AACH,mCAFU,wBAAwB,CAQ/B;6BAtH0B,gCAAgC;4CAJjB,mDAAmD;yCAJtD,8DAA8D"}
@@ -4,18 +4,20 @@ import { DEPTH_STENCIL_STATE_SHADOW } from "../rasterize/DEPTH_STENCIL_STATE_SHA
4
4
  import { CodeChunk } from "../shader/compiler/CodeChunk.js";
5
5
  import { ShaderResourceSetDescriptor } from "../shader/resource/ShaderResourceSetDescriptor.js";
6
6
  import { ShaderDescriptor } from "../shader/ShaderDescriptor.js";
7
- import { vec2f, vec4u } from "../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
7
+ import { u32, vec2f, vec4u } from "../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
8
8
  import { WebGPUArray } from "../shader/type/WebGPUArray.js";
9
9
  import { WebGPUStruct } from "../shader/type/WebGPUStruct.js";
10
- import { HAIR_CLASS_SHIFT } from "./HAIR.js";
10
+ import { HAIR_CLASS_SHIFT, HAIR_LIST_SHADOW_WORDS } from "./HAIR.js";
11
11
 
12
12
  /**
13
- * A shadow view's rectangle as the hair draws into it.
13
+ * A shadow view's rectangle as the hair draws into it, and where the frame's draw list keeps its shadow words.
14
14
  * @type {WebGPUStruct}
15
15
  */
16
16
  export const HAIR_SHADOW_TARGET_STRUCT = WebGPUStruct.from({
17
17
  /** the view's rectangle in the atlas, texels */
18
18
  resolution: vec2f,
19
+ /** entries the frame's draw list holds: its shadow words follow them */
20
+ list_capacity: u32,
19
21
  }, "HairShadowTarget").pack();
20
22
 
21
23
  const resources = new ShaderResourceSetDescriptor();
@@ -23,6 +25,7 @@ const resources = new ShaderResourceSetDescriptor();
23
25
  resources.createGroup()
24
26
  .add(CAMERA_RESOURCE)
25
27
  .addUniform("hair_shadow_view", HAIR_SHADOW_TARGET_STRUCT)
28
+ .addStorageBuffer("hair_shadow_list", WebGPUArray.u32)
26
29
  .addStorageBuffer("hair_list", WebGPUArray.u32)
27
30
  .addStorageBuffer("hair_points", WebGPUArray.from(vec4u));
28
31
 
@@ -36,7 +39,8 @@ fn hair_point(slot: u32) -> vec4<f32> {
36
39
 
37
40
  @vertex
38
41
  fn vs_main(@builtin(vertex_index) vertex: u32, @builtin(instance_index) instance: u32) -> @builtin(position) vec4<f32> {
39
- let entry = hair_list[instance];
42
+ let at = hair_shadow_list[instance];
43
+ let entry = hair_list[at];
40
44
  let slot = entry & ${2 ** HAIR_CLASS_SHIFT - 1}u;
41
45
  let segments = 1u << (entry >> ${HAIR_CLASS_SHIFT}u);
42
46
 
@@ -73,10 +77,10 @@ fn vs_main(@builtin(vertex_index) vertex: u32, @builtin(instance_index) instance
73
77
  let way = select(vec2<f32>(1.0, 0.0), offset / max(real, 1e-12), real >= 1e-6);
74
78
 
75
79
  // 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
+ // whose share, stratified over their group's ranks, is under its width's fraction of the texel; the depth covers
81
+ // then what the strands cover, which the map's filter takes as the light they let through. The share is the
82
+ // strand's own, its third shadow word, so the same strands are drawn wherever the frame placed their points
83
+ let share = bitcast<f32>(hair_list[hair_shadow_view.list_capacity + at * ${HAIR_LIST_SHADOW_WORDS}u + 2u]);
80
84
  let drawn = select(select(0.0, 0.5, real > share * 0.5), real, real >= 0.5);
81
85
 
82
86
  var position = clip + vec4<f32>(way * (drawn * side) / texels * clip.w, 0.0, 0.0);
@@ -92,8 +96,8 @@ fn vs_main(@builtin(vertex_index) vertex: u32, @builtin(instance_index) instance
92
96
  const descriptor = ShaderDescriptor.from({ label: "Hair Shadow", body, resources });
93
97
 
94
98
  /**
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).
99
+ * The bindings of {@link HAIR_SHADOW_PIPELINE}: `camera` (the shadow view's), `hair_shadow_view`, `hair_shadow_list`
100
+ * (the shadow views' lists), `hair_list` (the frame's draw list) and `hair_points` (the frame's deformed points).
97
101
  *
98
102
  * @type {ShaderResourceSetDescriptor}
99
103
  */
@@ -103,14 +107,14 @@ export const HAIR_SHADOW_RESOURCES = resources;
103
107
  * Draws the frame's strands into a shadow view's depth with the rasterizer's bias (`DEPTH_STENCIL_STATE_SHADOW`), in
104
108
  * cascades as well: a strand has no surface normal for the cascade casters' vertex-stage push to read.
105
109
  *
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`),
110
+ * An instance is an entry of the view's list (`shader_hair_shadow_list`), a strand, the place of its entry in the
111
+ * frame's draw list. It is drawn as `hair_id_draw.js` draws it for the eye: a triangle strip a pair of vertices at each
112
+ * of its points, `2 (2^class + 1)` vertices, one draw a point class (`shader_hair_shadow_draw_args`),
109
113
  * 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
+ * where the camera's view drew it at none. Under a texel, a point is drawn a texel wide by the strands whose share
115
+ * (their third shadow word, `HAIR.js`) is under its width's fraction of the texel, and at none by the rest, so the
116
+ * covered area is the strands' own at any texel size. A point nearer the light than the view's near plane is drawn on
117
+ * the plane. Both faces are drawn.
114
118
  *
115
119
  * @type {RenderPipelineDescriptor}
116
120
  */
@@ -1 +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"}
1
+ {"version":3,"file":"shader_hair_cull.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/hair/shader_hair_cull.js"],"names":[],"mappings":"AAiCA,8CAWuB;AA8KvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,+BAFU,aAAa,CAMpB;6BA9O0B,gCAAgC;8BAL/B,4BAA4B"}
@@ -88,6 +88,7 @@ fn main(
88
88
  var entry = 0u;
89
89
  var widest = 0.0;
90
90
  var reach = 0.0;
91
+ var strand_share = 0.0;
91
92
 
92
93
  if (row < rows) {
93
94
  var point = thread;
@@ -176,13 +177,15 @@ fn main(
176
177
  hair_points[settings.point_capacity + slot + j] = vec4<u32>(bitcast<vec3<u32>>(before), row | (variation << ${HAIR_ROW_BITS}u));
177
178
 
178
179
  // the root's thread lists the strand, in its class's part for the view or for the shadow views alone,
179
- // with the widest it is drawn and how far it reaches from its root (the reach the level of detail's box
180
- // allows a strand: its group's longest guide and the farthest a point strays from one)
180
+ // with the widest it is drawn, how far it reaches from its root (the reach the level of detail's box
181
+ // allows a strand: its group's longest guide and the farthest a point strays from one) and its share,
182
+ // which a shadow view thins it by as the floor does here
181
183
  if (j == 0u) {
182
184
  key = select(${HAIR_COUNTER_CURSORS}u, ${HAIR_COUNTER_SHADOW_CURSORS}u, shadow_only) + lod.point_class;
183
185
  entry = slot | (lod.point_class << ${HAIR_CLASS_SHIFT}u);
184
186
  widest = 0.5 * instance.width_max * saturate(presence) / kept * lod.scale;
185
187
  reach = (instance.guide_length_max + instance.guide_reach) * lod.scale + widest;
188
+ strand_share = share;
186
189
  }
187
190
  }
188
191
  }
@@ -197,6 +200,7 @@ fn main(
197
200
 
198
201
  hair_list[at] = bitcast<u32>(widest);
199
202
  hair_list[at + 1u] = bitcast<u32>(reach);
203
+ hair_list[at + 2u] = bitcast<u32>(strand_share);
200
204
  }
201
205
  }
202
206
  }
@@ -1,7 +1,7 @@
1
1
  export const HAIR_ROOTS_SETTINGS: WebGPUStruct;
2
2
  /**
3
- * A triangle's frame, Unreal's: the tangent along its first edge, the normal of its face, the bitangent the normal
4
- * across the tangent, as the columns of a rotation:
3
+ * A triangle's frame: the tangent along its first edge, the normal of its face, the bitangent the normal across the
4
+ * tangent, as the columns of a rotation:
5
5
  *
6
6
  * ```wgsl
7
7
  * fn hair_triangle_frame(a: vec3<f32>, b: vec3<f32>, c: vec3<f32>) -> mat3x3<f32>
@@ -42,8 +42,8 @@ resources.createGroup()
42
42
  .addStorageBuffer("hair_guide_bounds", WebGPUArray.from(atomic_u32), true);
43
43
 
44
44
  /**
45
- * A triangle's frame, Unreal's: the tangent along its first edge, the normal of its face, the bitangent the normal
46
- * across the tangent, as the columns of a rotation:
45
+ * A triangle's frame: the tangent along its first edge, the normal of its face, the bitangent the normal across the
46
+ * tangent, as the columns of a rotation:
47
47
  *
48
48
  * ```wgsl
49
49
  * fn hair_triangle_frame(a: vec3<f32>, b: vec3<f32>, c: vec3<f32>) -> mat3x3<f32>
@@ -3,7 +3,8 @@
3
3
  *
4
4
  * **A shadow view's list** is laid out as the frame's draw list is (`HAIR.js`): view `v`'s from entry
5
5
  * `v × list capacity`, each class's region from the draw list's start of it, its strands from the region's start, as
6
- * many as the view's count of the class (`hair_shadow_counts`, `v × HAIR_CLASS_COUNT + class`).
6
+ * many as the view's count of the class (`hair_shadow_counts`, `v × HAIR_CLASS_COUNT + class`). An entry is where the
7
+ * strand's entry is in the frame's draw list, which holds its slot, its class and its shadow words.
7
8
  */
8
9
  export const HAIR_SHADOW_LIST_SETTINGS: WebGPUStruct;
9
10
  /**
@@ -22,11 +23,11 @@ export const shader_hair_shadow_list_command: ComputeShader;
22
23
  *
23
24
  * - the ball about its root as wide as its reach (its shadow words) is inside the view's planes, the near one aside;
24
25
  * - its widest point, at the finest the view's texels are within that ball, is drawn by the shadow draw: wider than
25
- * its stratified share of half a texel, the share and the test of `hair_shadow_draw.js`. Where the ball reaches
26
+ * its share (its third shadow word) of half a texel, the test of `hair_shadow_draw.js`. Where the ball reaches
26
27
  * the eye of a perspective view, its texels are not bounded, and the strand is drawn.
27
28
  *
28
- * A drawn strand is appended to its class's region of the view's list (`chunk_subgroup_keyed_append` on the view's
29
- * count of the class).
29
+ * A drawn strand is appended to its class's region of the view's list, as the place of its entry in the frame's draw
30
+ * list (`chunk_subgroup_keyed_append` on the view's count of the class).
30
31
  *
31
32
  * @type {ComputeShader}
32
33
  */
@@ -1 +1 @@
1
- {"version":3,"file":"shader_hair_shadow_list.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/hair/shader_hair_shadow_list.js"],"names":[],"mappings":"AA2BA;;;;;;GAMG;AAEH,qDAK6B;AA6B7B;;;;;GAKG;AACH,8CAFU,aAAa,CAkBpB;AAcH;;;;;;;;;;;;;;;;GAgBG;AACH,sCAFU,aAAa,CA8EpB;AAWH;;;;;;GAMG;AACH,2CAFU,aAAa,CAyBpB;6BAjO0B,gCAAgC;8BAJ/B,4BAA4B"}
1
+ {"version":3,"file":"shader_hair_shadow_list.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/hair/shader_hair_shadow_list.js"],"names":[],"mappings":"AA2BA;;;;;;;GAOG;AAEH,qDAK6B;AA6B7B;;;;;GAKG;AACH,8CAFU,aAAa,CAkBpB;AAcH;;;;;;;;;;;;;;;;GAgBG;AACH,sCAFU,aAAa,CA2EpB;AAWH;;;;;;GAMG;AACH,2CAFU,aAAa,CAyBpB;6BA/N0B,gCAAgC;8BAJ/B,4BAA4B"}
@@ -30,7 +30,8 @@ import { HAIR_SHADOW_VIEW_STRUCT } from "./HAIR_FRAME_STRUCTS.js";
30
30
  *
31
31
  * **A shadow view's list** is laid out as the frame's draw list is (`HAIR.js`): view `v`'s from entry
32
32
  * `v × list capacity`, each class's region from the draw list's start of it, its strands from the region's start, as
33
- * many as the view's count of the class (`hair_shadow_counts`, `v × HAIR_CLASS_COUNT + class`).
33
+ * many as the view's count of the class (`hair_shadow_counts`, `v × HAIR_CLASS_COUNT + class`). An entry is where the
34
+ * strand's entry is in the frame's draw list, which holds its slot, its class and its shadow words.
34
35
  */
35
36
 
36
37
  export const HAIR_SHADOW_LIST_SETTINGS = WebGPUStruct.from({
@@ -112,11 +113,11 @@ list_resources.createGroup()
112
113
  *
113
114
  * - the ball about its root as wide as its reach (its shadow words) is inside the view's planes, the near one aside;
114
115
  * - its widest point, at the finest the view's texels are within that ball, is drawn by the shadow draw: wider than
115
- * its stratified share of half a texel, the share and the test of `hair_shadow_draw.js`. Where the ball reaches
116
+ * its share (its third shadow word) of half a texel, the test of `hair_shadow_draw.js`. Where the ball reaches
116
117
  * the eye of a perspective view, its texels are not bounded, and the strand is drawn.
117
118
  *
118
- * A drawn strand is appended to its class's region of the view's list (`chunk_subgroup_keyed_append` on the view's
119
- * count of the class).
119
+ * A drawn strand is appended to its class's region of the view's list, as the place of its entry in the frame's draw
120
+ * list (`chunk_subgroup_keyed_append` on the view's count of the class).
120
121
  *
121
122
  * @type {ComputeShader}
122
123
  */
@@ -132,7 +133,7 @@ fn main(@builtin(workgroup_id) workgroup_id: vec3<u32>, @builtin(local_invocatio
132
133
  let entries = hair_list_entries();
133
134
 
134
135
  var key = ${SUBGROUP_KEYED_APPEND_NONE}u;
135
- var entry = 0u;
136
+ var listed_at = 0u;
136
137
  var place_base = 0u;
137
138
 
138
139
  if (entries > 0u && thread < entries * settings.view_count) {
@@ -156,14 +157,12 @@ fn main(@builtin(workgroup_id) workgroup_id: vec3<u32>, @builtin(local_invocatio
156
157
  || (offset >= viewed && offset < hair_counters[${HAIR_COUNTER_SHADOW_CURSORS}u + point_class] - base);
157
158
 
158
159
  if (listed) {
159
- entry = hair_list[at];
160
-
161
- let slot = entry & ${2 ** HAIR_CLASS_SHIFT - 1}u;
162
- let segments = 1u << (entry >> ${HAIR_CLASS_SHIFT}u);
160
+ let slot = hair_list[at] & ${2 ** HAIR_CLASS_SHIFT - 1}u;
163
161
 
164
162
  let shadow_at = settings.list_capacity + at * ${HAIR_LIST_SHADOW_WORDS}u;
165
163
  let widest = bitcast<f32>(hair_list[shadow_at]);
166
164
  let reach = bitcast<f32>(hair_list[shadow_at + 1u]);
165
+ let share = bitcast<f32>(hair_list[shadow_at + 2u]);
167
166
 
168
167
  let root = bitcast<vec3<f32>>(hair_points[slot].xyz);
169
168
  let view = hair_shadow_views[view_index];
@@ -178,12 +177,11 @@ fn main(@builtin(workgroup_id) workgroup_id: vec3<u32>, @builtin(local_invocatio
178
177
 
179
178
  // the least clip w within the ball; drawn wherever it does not bound the texels
180
179
  let w = dot(view.depth.xyz, root) + view.depth.w - reach * length(view.depth.xyz);
181
- let strand = slot / (segments + 1u);
182
- let share = fract(f32(strand) * 0.618034 + 0.5);
183
180
  let drawn = w <= 0.0 || widest > share * 0.5 * view.texel * w;
184
181
 
185
182
  if (inside && drawn) {
186
183
  key = view_index * ${HAIR_CLASS_COUNT}u + point_class;
184
+ listed_at = at;
187
185
  place_base = view_index * settings.list_capacity + base;
188
186
  }
189
187
  }
@@ -192,7 +190,7 @@ fn main(@builtin(workgroup_id) workgroup_id: vec3<u32>, @builtin(local_invocatio
192
190
  let place = subgroup_keyed_append(&hair_shadow_counts, key);
193
191
 
194
192
  if (key != ${SUBGROUP_KEYED_APPEND_NONE}u) {
195
- hair_shadow_list[place_base + place] = entry;
193
+ hair_shadow_list[place_base + place] = listed_at;
196
194
  }
197
195
  }
198
196
  `, [chunk_hair_list_entries, chunk_folded_workgroup_index, chunk_subgroup_keyed_append]),
@@ -14,7 +14,7 @@ export const BSDF_ROUGHNESS_MINIMUM: 0.02;
14
14
  /**
15
15
  * Specifies minimal reflectance for dielectrics (when metalness is zero)
16
16
  * Nothing has lower reflectance than 2%.
17
- * Popular engines use 4% such as UE4, Frostbite, et al.
17
+ * Popular engines use 4%, such as Frostbite, et al.
18
18
  * @see "Physics and Math of Shading" by Natty Hoffman ( https://www.youtube.com/watch?v=j-A0mwsJRmk )
19
19
  * @type {number}
20
20
  */
@@ -16,7 +16,7 @@ export const BSDF_ROUGHNESS_MINIMUM = 0.02
16
16
  /**
17
17
  * Specifies minimal reflectance for dielectrics (when metalness is zero)
18
18
  * Nothing has lower reflectance than 2%.
19
- * Popular engines use 4% such as UE4, Frostbite, et al.
19
+ * Popular engines use 4%, such as Frostbite, et al.
20
20
  * @see "Physics and Math of Shading" by Natty Hoffman ( https://www.youtube.com/watch?v=j-A0mwsJRmk )
21
21
  * @type {number}
22
22
  */
@@ -46,8 +46,8 @@ resources.createGroup()
46
46
  * texel lands in level 1 once, whatever the sample pattern. The blur and the lobe are both Gaussians,
47
47
  * so the lobe narrows by the blur's variance and level 1 comes out the lobe it is asked for.
48
48
  *
49
- * Samples are uniform in the cone, so each stands for the same solid angle. UE importance-samples
50
- * and reads a coarser average in the lobe's tail than in its core; here the sun came out in blocks.
49
+ * Samples are uniform in the cone, so each stands for the same solid angle. Importance sampling
50
+ * instead reads a coarser average in the lobe's tail than in its core; here the sun came out in blocks.
51
51
  *
52
52
  * Level 1 only. The levels after it read the level above, already smooth at their sample spacing
53
53
  * (see shader_convolve_reflection_map).
@@ -0,0 +1,38 @@
1
+ /**
2
+ * A {@link SceneNode} on disk.
3
+ *
4
+ * <pre>
5
+ * UTF8 name
6
+ * i32 parent: a place in the nodes, or -1 for a root
7
+ * f64 x 10 local: translation xyz, rotation xyzw, scale xyz
8
+ * u32 geometry: a place in the geometries, or 0xFFFFFFFF for a node that only places others
9
+ * u32 material: a place in the materials, or 0xFFFFFFFF exactly when the geometry is
10
+ * </pre>
11
+ *
12
+ * The transform is written in full. {@link Transform64SerializationAdapter} packs a rotation into 32 bits, which
13
+ * a save can afford and a model cannot: the error is up to 0.14 degrees, 2.4 cm at the far end of a 10 m part.
14
+ *
15
+ * A node names its geometry and its material by their places in two lists, given before the first node is
16
+ * written or read ({@link initialize}).
17
+ *
18
+ * @extends BinaryClassSerializationAdapter<SceneNode>
19
+ *
20
+ * @author Alex Goldring
21
+ * @copyright Company Named Limited (c) 2026
22
+ */
23
+ export class SceneNodeSerializationAdapter extends BinaryClassSerializationAdapter<SceneNode> {
24
+ constructor();
25
+ klass: typeof SceneNode;
26
+ /**
27
+ * @param {MeshletGeometry[]} geometries what a node's geometry index is a place in
28
+ * @param {ShadeMaterial[]} materials what a node's material index is a place in
29
+ */
30
+ initialize(geometries: MeshletGeometry[], materials: ShadeMaterial[]): void;
31
+ #private;
32
+ }
33
+ export type BinaryBuffer = import("../../../core/binary/BinaryBuffer.js").BinaryBuffer;
34
+ export type MeshletGeometry = import("../geometry/MeshletGeometry.js").MeshletGeometry;
35
+ export type ShadeMaterial = import("../material/ShadeMaterial.js").ShadeMaterial;
36
+ import { SceneNode } from "./SceneNode.js";
37
+ import { BinaryClassSerializationAdapter } from "../../../engine/ecs/storage/binary/BinaryClassSerializationAdapter.js";
38
+ //# sourceMappingURL=SceneNodeSerializationAdapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SceneNodeSerializationAdapter.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/loader/SceneNodeSerializationAdapter.js"],"names":[],"mappings":"AA+BA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH;;IACI,wBAAkB;IAuBlB;;;OAGG;IACH,uBAHW,eAAe,EAAE,aACjB,aAAa,EAAE,QAQzB;;CA8GJ;2BAjMY,OAAO,sCAAsC,EAAE,YAAY;8BAC3D,OAAO,gCAAgC,EAAE,eAAe;4BACxD,OAAO,8BAA8B,EAAE,aAAa;0BALvC,gBAAgB;gDADM,uEAAuE"}