@woosh/meep-engine 3.78.2 → 3.78.4

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 (278) hide show
  1. package/CHANGELOG.md +46 -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/loaders/GroomAssetLoader.d.ts.map +1 -1
  15. package/src/engine/asset/loaders/GroomAssetLoader.js +2 -1
  16. package/src/engine/graphics/hair/Groom.d.ts +30 -0
  17. package/src/engine/graphics/hair/Groom.d.ts.map +1 -1
  18. package/src/engine/graphics/hair/Groom.js +35 -0
  19. package/src/engine/graphics/hair/GroomSerializationAdapter.d.ts +18 -2
  20. package/src/engine/graphics/hair/GroomSerializationAdapter.d.ts.map +1 -1
  21. package/src/engine/graphics/hair/GroomSerializationAdapter.js +36 -6
  22. package/src/engine/graphics/hair/GroomSerializationUpgrader_1_2.d.ts +8 -0
  23. package/src/engine/graphics/hair/GroomSerializationUpgrader_1_2.d.ts.map +1 -0
  24. package/src/engine/graphics/hair/GroomSerializationUpgrader_1_2.js +44 -0
  25. package/src/engine/graphics/hair/groom_bake_shelter.d.ts +33 -0
  26. package/src/engine/graphics/hair/groom_bake_shelter.d.ts.map +1 -0
  27. package/src/engine/graphics/hair/groom_bake_shelter.js +288 -0
  28. package/src/engine/graphics/hair/groom_bind_to_mesh.d.ts +1 -1
  29. package/src/engine/graphics/hair/groom_bind_to_mesh.js +1 -1
  30. package/src/engine/graphics/hair/groom_build_group.d.ts +10 -2
  31. package/src/engine/graphics/hair/groom_build_group.d.ts.map +1 -1
  32. package/src/engine/graphics/hair/groom_build_group.js +8 -2
  33. package/src/engine/graphics/hair/groom_build_guides.d.ts +1 -1
  34. package/src/engine/graphics/hair/groom_build_guides.js +1 -1
  35. package/src/engine/graphics/impostors/voxel/README.md +11 -11
  36. package/src/engine/physics/cloth/collider/ClothColliderKind.js +1 -1
  37. package/src/engine/physics/cloth/ecs/cloth_geodesic.d.ts +1 -1
  38. package/src/engine/physics/cloth/ecs/cloth_geodesic.js +1 -1
  39. package/src/engine/physics/cloth/solver/constraint/cloth_backstop_row.d.ts +2 -3
  40. package/src/engine/physics/cloth/solver/constraint/cloth_backstop_row.d.ts.map +1 -1
  41. package/src/engine/physics/cloth/solver/constraint/cloth_backstop_row.js +2 -3
  42. package/src/generation/filtering/numeric/sampling/AbstractCellFilterSampleGridLayer.d.ts +0 -2
  43. package/src/generation/filtering/numeric/sampling/AbstractCellFilterSampleGridLayer.d.ts.map +1 -1
  44. package/src/generation/filtering/numeric/sampling/AbstractCellFilterSampleGridLayer.js +0 -5
  45. package/src/generation/filtering/numeric/sampling/CellFilterSampleLayerCubic.d.ts.map +1 -1
  46. package/src/generation/filtering/numeric/sampling/CellFilterSampleLayerCubic.js +5 -3
  47. package/src/generation/filtering/numeric/sampling/CellFilterSampleLayerLinear.d.ts.map +1 -1
  48. package/src/generation/filtering/numeric/sampling/CellFilterSampleLayerLinear.js +5 -3
  49. package/src/generation/grid/coords/grid_to_texel.d.ts +7 -1
  50. package/src/generation/grid/coords/grid_to_texel.d.ts.map +1 -1
  51. package/src/generation/grid/coords/grid_to_texel.js +11 -1
  52. package/src/generation/grid/coords/grid_to_texel_span.d.ts +15 -0
  53. package/src/generation/grid/coords/grid_to_texel_span.d.ts.map +1 -0
  54. package/src/generation/grid/coords/grid_to_texel_span.js +38 -0
  55. package/src/generation/grid/coords/texel_to_grid.d.ts +2 -1
  56. package/src/generation/grid/coords/texel_to_grid.d.ts.map +1 -1
  57. package/src/generation/grid/coords/texel_to_grid.js +6 -1
  58. package/src/generation/grid/generation/discrete/GridTaskWaveFunctionCollapse.d.ts +32 -1
  59. package/src/generation/grid/generation/discrete/GridTaskWaveFunctionCollapse.d.ts.map +1 -1
  60. package/src/generation/grid/generation/discrete/GridTaskWaveFunctionCollapse.js +114 -9
  61. package/src/generation/grid/generation/discrete/layer/GridTaskBuildSourceDistanceMap.d.ts +8 -0
  62. package/src/generation/grid/generation/discrete/layer/GridTaskBuildSourceDistanceMap.d.ts.map +1 -1
  63. package/src/generation/grid/generation/discrete/layer/GridTaskBuildSourceDistanceMap.js +91 -29
  64. package/src/generation/grid/layers/GridDataLayer.d.ts +21 -2
  65. package/src/generation/grid/layers/GridDataLayer.d.ts.map +1 -1
  66. package/src/generation/grid/layers/GridDataLayer.js +43 -4
  67. package/src/generation/placement/action/GridCellActionPlaceTags.d.ts +7 -1
  68. package/src/generation/placement/action/GridCellActionPlaceTags.d.ts.map +1 -1
  69. package/src/generation/placement/action/GridCellActionPlaceTags.js +42 -16
  70. package/src/generation/placement/action/GridCellActionWriteFilterToLayer.d.ts +5 -0
  71. package/src/generation/placement/action/GridCellActionWriteFilterToLayer.d.ts.map +1 -1
  72. package/src/generation/placement/action/GridCellActionWriteFilterToLayer.js +32 -9
  73. package/src/generation/rules/CellMatcherLayerBitMaskTest.d.ts.map +1 -1
  74. package/src/generation/rules/CellMatcherLayerBitMaskTest.js +6 -2
  75. package/src/generation/wfc/GridWFCCompiledTileSet.d.ts +4 -2
  76. package/src/generation/wfc/GridWFCCompiledTileSet.d.ts.map +1 -1
  77. package/src/generation/wfc/GridWFCCompiledTileSet.js +2 -2
  78. package/src/generation/wfc/GridWFCTileSet.d.ts +16 -7
  79. package/src/generation/wfc/GridWFCTileSet.d.ts.map +1 -1
  80. package/src/generation/wfc/GridWFCTileSet.js +32 -8
  81. package/src/shade/playground/contact_shadows/shader_contact_lab_composite.js +2 -2
  82. package/src/shade/playground/particle_editor/README.md +2 -2
  83. package/src/shade/playground/probe_clipmap/index.html +1 -1
  84. package/src/shade/playground/screen_probes/README.md +5 -5
  85. package/src/shade/playground/screen_probes/main.js +1 -1
  86. package/src/shade/playground/tonemap_sdr/README.md +3 -2
  87. package/src/shade/playground/vgeo_scene/README.md +1 -3
  88. package/src/shade/playground/vgeo_scene/main.js +3 -3
  89. package/src/shade/renderer/Renderer.d.ts +3 -3
  90. package/src/shade/renderer/Renderer.js +4 -4
  91. package/src/shade/renderer/ShadeIndirectLightingMode.js +1 -1
  92. package/src/shade/renderer/camera/PerspectiveCamera.js +1 -1
  93. package/src/shade/renderer/deferred/tonemap/ColorGrade.d.ts +11 -13
  94. package/src/shade/renderer/deferred/tonemap/ColorGrade.d.ts.map +1 -1
  95. package/src/shade/renderer/deferred/tonemap/ColorGrade.js +11 -13
  96. package/src/shade/renderer/deferred/tonemap/TONE_MAP_OPERATOR_ACES.d.ts.map +1 -1
  97. package/src/shade/renderer/deferred/tonemap/TONE_MAP_OPERATOR_ACES.js +6 -7
  98. package/src/shade/renderer/deferred/tonemap/ToneMapper.d.ts +1 -1
  99. package/src/shade/renderer/deferred/tonemap/ToneMapper.js +1 -1
  100. package/src/shade/renderer/deferred/tonemap/m3_white_balance_rec709.d.ts +6 -8
  101. package/src/shade/renderer/deferred/tonemap/m3_white_balance_rec709.d.ts.map +1 -1
  102. package/src/shade/renderer/deferred/tonemap/m3_white_balance_rec709.js +7 -10
  103. package/src/shade/renderer/geometry/sdf/MESH_SDF.d.ts +1 -1
  104. package/src/shade/renderer/geometry/sdf/MESH_SDF.js +1 -1
  105. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_classify.d.ts +1 -1
  106. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_classify.js +1 -1
  107. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_evaluate.d.ts +1 -1
  108. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_evaluate.js +1 -1
  109. package/src/shade/renderer/geometry/sdf/chunk_blas_query_band_sdf.d.ts +1 -2
  110. package/src/shade/renderer/geometry/sdf/chunk_blas_query_band_sdf.d.ts.map +1 -1
  111. package/src/shade/renderer/geometry/sdf/chunk_blas_query_band_sdf.js +1 -2
  112. package/src/shade/renderer/geometry/sdf/chunk_scene_point_query_volume_sign.d.ts.map +1 -1
  113. package/src/shade/renderer/geometry/sdf/chunk_scene_point_query_volume_sign.js +2 -1
  114. package/src/shade/renderer/geometry/sdf/surface/MESH_SURFACE_BAKE.d.ts +1 -1
  115. package/src/shade/renderer/geometry/sdf/surface/MESH_SURFACE_BAKE.js +1 -1
  116. package/src/shade/renderer/geometry/virtual/build/level/vgeo_build_cluster_graph.js +1 -1
  117. package/src/shade/renderer/geometry/virtual/format/page/VGEO_DEFAULT_PAGE_SIZE.d.ts +2 -2
  118. package/src/shade/renderer/geometry/virtual/format/page/VGEO_DEFAULT_PAGE_SIZE.js +2 -2
  119. package/src/shade/renderer/geometry/virtual/runtime/cut/chunk_vgeo_cut_access.d.ts +2 -2
  120. package/src/shade/renderer/geometry/virtual/runtime/cut/chunk_vgeo_cut_access.js +4 -4
  121. package/src/shade/renderer/geometry/virtual/runtime/cut/chunk_vgeo_cut_instance.d.ts +1 -1
  122. package/src/shade/renderer/geometry/virtual/runtime/cut/chunk_vgeo_cut_instance.js +1 -1
  123. package/src/shade/renderer/geometry/virtual/runtime/cut/shader_vgeo_cut_collect.js +1 -1
  124. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_INSTANCE_OFFSET.d.ts +3 -3
  125. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_INSTANCE_OFFSET.js +3 -3
  126. package/src/shade/renderer/global_illumination/brick4/README.md +2 -1
  127. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.d.ts +4 -6
  128. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.d.ts.map +1 -1
  129. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.js +4 -6
  130. package/src/shade/renderer/global_illumination/probe_clipmap/brick/BRICK_MOVERS.d.ts +1 -1
  131. package/src/shade/renderer/global_illumination/probe_clipmap/brick/BRICK_MOVERS.js +1 -1
  132. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.d.ts +1 -1
  133. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.js +2 -2
  134. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_texel.d.ts +1 -1
  135. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_texel.js +1 -1
  136. package/src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.d.ts +1 -1
  137. package/src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.js +1 -1
  138. package/src/shade/renderer/global_illumination/screen_probe/SCREEN_PROBE.d.ts +28 -35
  139. package/src/shade/renderer/global_illumination/screen_probe/SCREEN_PROBE.d.ts.map +1 -1
  140. package/src/shade/renderer/global_illumination/screen_probe/SCREEN_PROBE.js +28 -35
  141. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.d.ts +21 -24
  142. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.d.ts.map +1 -1
  143. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.js +21 -24
  144. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe.d.ts +8 -8
  145. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe.js +8 -8
  146. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_brdf_density.d.ts +4 -4
  147. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_brdf_density.js +4 -4
  148. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_interpolate.d.ts +3 -5
  149. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_interpolate.d.ts.map +1 -1
  150. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_interpolate.js +3 -5
  151. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_lighting_history.d.ts +4 -4
  152. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_lighting_history.js +4 -4
  153. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_rough_specular.d.ts +2 -3
  154. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_rough_specular.d.ts.map +1 -1
  155. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_rough_specular.js +2 -3
  156. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_screen_march.d.ts +4 -4
  157. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_screen_march.js +4 -4
  158. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_surface.d.ts +2 -4
  159. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_surface.d.ts.map +1 -1
  160. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_surface.js +2 -4
  161. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_brick.d.ts +2 -4
  162. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_brick.d.ts.map +1 -1
  163. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_brick.js +2 -4
  164. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_gather.d.ts +13 -17
  165. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_gather.d.ts.map +1 -1
  166. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_gather.js +13 -17
  167. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_importance.d.ts +11 -14
  168. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_importance.d.ts.map +1 -1
  169. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_importance.js +11 -14
  170. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_pick.d.ts +2 -2
  171. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_pick.js +2 -2
  172. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_place.d.ts +9 -9
  173. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_place.js +9 -9
  174. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_resolve.d.ts +15 -18
  175. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_resolve.d.ts.map +1 -1
  176. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_resolve.js +16 -19
  177. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_trace_screen.d.ts +10 -11
  178. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_trace_screen.d.ts.map +1 -1
  179. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_trace_screen.js +11 -12
  180. package/src/shade/renderer/hair/GPUHairSystem.d.ts.map +1 -1
  181. package/src/shade/renderer/hair/GPUHairSystem.js +27 -2
  182. package/src/shade/renderer/hair/HAIR_DATABASE_SPEC.d.ts.map +1 -1
  183. package/src/shade/renderer/hair/HAIR_DATABASE_SPEC.js +4 -0
  184. package/src/shade/renderer/hair/HAIR_SIMULATION.d.ts +27 -6
  185. package/src/shade/renderer/hair/HAIR_SIMULATION.d.ts.map +1 -1
  186. package/src/shade/renderer/hair/HAIR_SIMULATION.js +33 -6
  187. package/src/shade/renderer/hair/chunk_hair_bsdf.d.ts +9 -8
  188. package/src/shade/renderer/hair/chunk_hair_bsdf.d.ts.map +1 -1
  189. package/src/shade/renderer/hair/chunk_hair_bsdf.js +10 -9
  190. package/src/shade/renderer/hair/chunk_hair_dual_scattering.d.ts +5 -6
  191. package/src/shade/renderer/hair/chunk_hair_dual_scattering.d.ts.map +1 -1
  192. package/src/shade/renderer/hair/chunk_hair_dual_scattering.js +5 -6
  193. package/src/shade/renderer/hair/chunk_hair_guide.d.ts +9 -2
  194. package/src/shade/renderer/hair/chunk_hair_guide.d.ts.map +1 -1
  195. package/src/shade/renderer/hair/chunk_hair_guide.js +30 -2
  196. package/src/shade/renderer/hair/hair_lighting.d.ts +3 -3
  197. package/src/shade/renderer/hair/hair_lighting.d.ts.map +1 -1
  198. package/src/shade/renderer/hair/hair_lighting.js +4 -5
  199. package/src/shade/renderer/hair/hair_scattering_lut.d.ts +5 -5
  200. package/src/shade/renderer/hair/hair_scattering_lut.js +5 -5
  201. package/src/shade/renderer/hair/shader_hair_roots.d.ts +2 -2
  202. package/src/shade/renderer/hair/shader_hair_roots.js +2 -2
  203. package/src/shade/renderer/hair/shader_hair_simulate.d.ts +5 -2
  204. package/src/shade/renderer/hair/shader_hair_simulate.d.ts.map +1 -1
  205. package/src/shade/renderer/hair/shader_hair_simulate.js +23 -5
  206. package/src/shade/renderer/light/environment/DEFINES.d.ts +1 -1
  207. package/src/shade/renderer/light/environment/DEFINES.js +1 -1
  208. package/src/shade/renderer/light/environment/shader_convolve_reflection_map_from_blurred.js +2 -2
  209. package/src/shade/renderer/material/dispatch/MaterialDispatch.d.ts +1 -2
  210. package/src/shade/renderer/material/dispatch/MaterialDispatch.d.ts.map +1 -1
  211. package/src/shade/renderer/material/dispatch/MaterialDispatch.js +1 -2
  212. package/src/shade/renderer/material/standard/fragment_gbuffer.d.ts.map +1 -1
  213. package/src/shade/renderer/material/standard/fragment_gbuffer.js +2 -1
  214. package/src/shade/renderer/material/util/dielectric_specular_color.d.ts +1 -1
  215. package/src/shade/renderer/material/util/dielectric_specular_color.js +1 -1
  216. package/src/shade/renderer/postprocess/dof/gather/DOF2_CONFIG.d.ts +1 -1
  217. package/src/shade/renderer/postprocess/dof/gather/DOF2_CONFIG.js +1 -1
  218. package/src/shade/renderer/postprocess/dof/gather/DOF2_PRESETS.js +1 -1
  219. package/src/shade/renderer/postprocess/dof/gather/DOF2_SETTINGS_STRUCT.d.ts +1 -1
  220. package/src/shade/renderer/postprocess/dof/gather/DOF2_SETTINGS_STRUCT.js +1 -1
  221. package/src/shade/renderer/postprocess/dof/gather/DOF2_TEXTURE_FORMAT.d.ts +1 -1
  222. package/src/shade/renderer/postprocess/dof/gather/DOF2_TEXTURE_FORMAT.js +1 -1
  223. package/src/shade/renderer/postprocess/dof/gather/DepthOfFieldU.d.ts +3 -4
  224. package/src/shade/renderer/postprocess/dof/gather/DepthOfFieldU.d.ts.map +1 -1
  225. package/src/shade/renderer/postprocess/dof/gather/DepthOfFieldU.js +3 -4
  226. package/src/shade/renderer/postprocess/dof/gather/graph_postprocess_dof2.d.ts +1 -1
  227. package/src/shade/renderer/postprocess/dof/gather/graph_postprocess_dof2.js +1 -1
  228. package/src/shade/renderer/postprocess/eye/GPUCameraExposureManager.d.ts +1 -1
  229. package/src/shade/renderer/postprocess/eye/GPUCameraExposureManager.js +1 -1
  230. package/src/shade/renderer/postprocess/gtao/ao_reproject_shader.d.ts.map +1 -1
  231. package/src/shade/renderer/postprocess/gtao/ao_reproject_shader.js +2 -3
  232. package/src/shade/renderer/postprocess/motion_blur/MOTION_BLUR_CONFIG.d.ts +1 -2
  233. package/src/shade/renderer/postprocess/motion_blur/MOTION_BLUR_CONFIG.d.ts.map +1 -1
  234. package/src/shade/renderer/postprocess/motion_blur/MOTION_BLUR_CONFIG.js +1 -2
  235. package/src/shade/renderer/postprocess/taa/chunk_fsr2_compute_depth_clip.d.ts +2 -3
  236. package/src/shade/renderer/postprocess/taa/chunk_fsr2_compute_depth_clip.d.ts.map +1 -1
  237. package/src/shade/renderer/postprocess/taa/chunk_fsr2_compute_depth_clip.js +2 -3
  238. package/src/shade/renderer/postprocess/taa/filter_blackman_harris.d.ts +1 -1
  239. package/src/shade/renderer/postprocess/taa/filter_blackman_harris.js +1 -1
  240. package/src/shade/renderer/rasterize/native/depth/shadow_cascade_rasterization_pass_descriptor.d.ts +1 -1
  241. package/src/shade/renderer/rasterize/native/depth/shadow_cascade_rasterization_pass_descriptor.js +1 -1
  242. package/src/shade/renderer/rasterize/native/depth/shadow_rasterization_alpha_tested_pass_descriptor.js +1 -1
  243. package/src/shade/renderer/restir/di/ReSTIRDI.d.ts +3 -3
  244. package/src/shade/renderer/restir/di/ReSTIRDI.js +3 -3
  245. package/src/shade/renderer/restir/di/chunk_restir_trace_visibility.d.ts +1 -1
  246. package/src/shade/renderer/restir/di/chunk_restir_trace_visibility.js +1 -1
  247. package/src/shade/renderer/shader/chunk/brdf/chunk_MIN_DIELECTRICS_F0.d.ts +1 -1
  248. package/src/shade/renderer/shader/chunk/brdf/chunk_MIN_DIELECTRICS_F0.js +1 -1
  249. package/src/shade/renderer/shader/chunk/brdf/chunk_shadowed_F90.d.ts +1 -2
  250. package/src/shade/renderer/shader/chunk/brdf/chunk_shadowed_F90.d.ts.map +1 -1
  251. package/src/shade/renderer/shader/chunk/brdf/chunk_shadowed_F90.js +1 -2
  252. package/src/shade/renderer/shader/chunk/color/conversion/chunk_CRM_REC709_AP1.d.ts +4 -5
  253. package/src/shade/renderer/shader/chunk/color/conversion/chunk_CRM_REC709_AP1.d.ts.map +1 -1
  254. package/src/shade/renderer/shader/chunk/color/conversion/chunk_CRM_REC709_AP1.js +4 -5
  255. package/src/shade/renderer/shader/chunk/color/grade/chunk_color_grade.js +2 -2
  256. package/src/shade/renderer/shader/chunk/color/tonemap/aces/chunk_aces_ue_matrices.d.ts +2 -2
  257. package/src/shade/renderer/shader/chunk/color/tonemap/aces/chunk_aces_ue_matrices.js +2 -2
  258. package/src/shade/renderer/shader/chunk/color/tonemap/aces/chunk_tonemap_ue_filmic.d.ts +14 -17
  259. package/src/shade/renderer/shader/chunk/color/tonemap/aces/chunk_tonemap_ue_filmic.d.ts.map +1 -1
  260. package/src/shade/renderer/shader/chunk/color/tonemap/aces/chunk_tonemap_ue_filmic.js +18 -21
  261. package/src/shade/renderer/shader/chunk/filter/chunk_filter_blackman_harris.d.ts +1 -1
  262. package/src/shade/renderer/shader/chunk/filter/chunk_filter_blackman_harris.js +1 -1
  263. package/src/shade/renderer/shader/chunk/filter/chunk_filter_blackman_harris229.d.ts +1 -1
  264. package/src/shade/renderer/shader/chunk/filter/chunk_filter_blackman_harris229.js +1 -1
  265. package/src/shade/renderer/shader/chunk/filter/chunk_multiscale_mean.d.ts +3 -4
  266. package/src/shade/renderer/shader/chunk/filter/chunk_multiscale_mean.d.ts.map +1 -1
  267. package/src/shade/renderer/shader/chunk/filter/chunk_multiscale_mean.js +3 -4
  268. package/src/shade/renderer/shader/chunk/material/chunk_re_direct_multiscatter.d.ts +1 -1
  269. package/src/shade/renderer/shader/chunk/material/chunk_re_direct_multiscatter.js +1 -1
  270. package/src/shade/renderer/shadow/map/GPUSceneShadowmapContext.js +3 -3
  271. package/src/shade/renderer/shadow/map/shader/chunk_sample_shadowmap_cascade.d.ts +6 -8
  272. package/src/shade/renderer/shadow/map/shader/chunk_sample_shadowmap_cascade.d.ts.map +1 -1
  273. package/src/shade/renderer/shadow/map/shader/chunk_sample_shadowmap_cascade.js +8 -10
  274. package/src/shade/renderer/shadow/map/shader/chunk_shadow_caster_depth_bias.d.ts +5 -7
  275. package/src/shade/renderer/shadow/map/shader/chunk_shadow_caster_depth_bias.d.ts.map +1 -1
  276. package/src/shade/renderer/shadow/map/shader/chunk_shadow_caster_depth_bias.js +5 -7
  277. package/src/shade/renderer/texture/virtual/README.md +257 -257
  278. package/src/shade/renderer/volumetrics/shader_volumetrics_build_lighting.js +2 -2
@@ -0,0 +1,288 @@
1
+ import { assert } from "../../../core/assert.js";
2
+ import { shape3_voxelize_to_grid } from "../../../core/geom/3d/shape/util/shape3_voxelize_to_grid.js";
3
+ import { sphere_fibonacci_point } from "../../../core/geom/3d/sphere/sphere_fibonacci_point.js";
4
+ import { GROOM_SHELTER_OPAQUE, GROOM_SHELTER_WORDS } from "./Groom.js";
5
+
6
+ /**
7
+ * The most cells the bake's grid has, a safety net: a group whose cells would be more takes larger ones.
8
+ * @type {number}
9
+ */
10
+ export const GROOM_SHELTER_CELL_LIMIT = 1 << 24;
11
+
12
+ /**
13
+ * Directions the mean silhouette is taken over, evenly over the sphere.
14
+ */
15
+ const SILHOUETTE_DIRECTIONS = 2048;
16
+
17
+ /**
18
+ * Average a grid with its two neighbours along one axis, `source` into `target`; past the grid there is nothing.
19
+ *
20
+ * @param {Float32Array} source
21
+ * @param {Float32Array} target
22
+ * @param {number} count cells
23
+ * @param {number} stride cells from a cell to its neighbour along the axis
24
+ * @param {number} size cells along the axis
25
+ */
26
+ function blur_axis(source, target, count, stride, size) {
27
+ const span = stride * size;
28
+
29
+ for (let i = 0; i < count; i++) {
30
+ const along = Math.floor((i % span) / stride);
31
+
32
+ let sum = source[i];
33
+
34
+ if (along > 0) {
35
+ sum += source[i - stride];
36
+ }
37
+
38
+ if (along < size - 1) {
39
+ sum += source[i + stride];
40
+ }
41
+
42
+ target[i] = sum / 3;
43
+ }
44
+ }
45
+
46
+ /**
47
+ * Work out how a group's hair shelters itself from the air, from its strands at rest: for every node of every guide,
48
+ * how much hair stands between it and the open air along each axis ({@link GroomGroup#guide_shelter}); and for the
49
+ * group, the area it stands in the wind's way with ({@link GroomGroup#silhouette}) and its fibres' length
50
+ * ({@link GroomGroup#fibre_length}). The guides are to be chosen already (`groom_build_guides`).
51
+ *
52
+ * **The hair as a density.** Every strand's frontal area, its length times the group's mean width, is laid into a
53
+ * grid a cell at a time, as frontal area a unit volume, and the grid is averaged with a 3 × 3 × 3 box so no one
54
+ * strand stands out of it. A cell is as wide as the wisp a guide stands for, the mean of the guides' diameters, or
55
+ * as the strands grow apart ({@link GroomGroup#root_spacing}) where that is wider, and wider still where the grid
56
+ * would pass {@link GROOM_SHELTER_CELL_LIMIT}.
57
+ *
58
+ * **A node's depths.** Air crossing hair is slowed by the fibres' drag: over a path whose frontal area a unit area
59
+ * crossed is `N`, a wind keeps `e^(−C_d N / 2)` of its speed, `C_d` a fibre's drag coefficient at that speed.
60
+ * A node keeps `N` along the way out toward each of +x, −x, +y, −y, +z and −z, from where it is to the grid's edge,
61
+ * and the wind's speed is applied by whoever reads them. A cell `solid` reaches into is one nothing passes
62
+ * (`shape3_voxelize_to_grid`), and a depth stops at {@link GROOM_SHELTER_OPAQUE}.
63
+ *
64
+ * **The silhouette.** The cells any strand passes through, seen along each axis, give three areas; the mean over
65
+ * every direction is taken of the ellipsoid with those three, whose area seen along a unit `n` is
66
+ * `√((A_x n_x)² + (A_y n_y)² + (A_z n_z)²)`.
67
+ *
68
+ * @param {import("./Groom.js").GroomGroup} group with its points and its guides
69
+ * @param {import("../../../core/geom/3d/shape/AbstractShape3D.js").AbstractShape3D|null} [solid] what the air does
70
+ * not pass, in the group's metres: the head the hair grows on
71
+ */
72
+ export function groom_bake_shelter(group, solid = null) {
73
+ const strand_count = group.strand_count;
74
+ const point_count = group.point_count;
75
+ const guide_count = group.guide_count;
76
+ const node_count = group.guide_point_count;
77
+
78
+ assert.greaterThan(guide_count, 0, 'the group has guides');
79
+
80
+ const bounds = group.bounds;
81
+
82
+ let cell = 0;
83
+
84
+ for (let g = 0; g < guide_count; g++) {
85
+ cell += group.guide_diameter[g];
86
+ }
87
+
88
+ cell = Math.max(cell / guide_count, group.root_spacing);
89
+
90
+ assert.greaterThan(cell, 0, 'cell');
91
+
92
+ const extent_x = bounds[3] - bounds[0];
93
+ const extent_y = bounds[4] - bounds[1];
94
+ const extent_z = bounds[5] - bounds[2];
95
+
96
+ // a cell of margin every side, which the averaging spills into
97
+ let nx = Math.ceil(extent_x / cell) + 3;
98
+ let ny = Math.ceil(extent_y / cell) + 3;
99
+ let nz = Math.ceil(extent_z / cell) + 3;
100
+
101
+ if (nx * ny * nz > GROOM_SHELTER_CELL_LIMIT) {
102
+ cell *= Math.cbrt(nx * ny * nz / GROOM_SHELTER_CELL_LIMIT);
103
+
104
+ nx = Math.ceil(extent_x / cell) + 3;
105
+ ny = Math.ceil(extent_y / cell) + 3;
106
+ nz = Math.ceil(extent_z / cell) + 3;
107
+ }
108
+
109
+ const origin_x = bounds[0] - cell;
110
+ const origin_y = bounds[1] - cell;
111
+ const origin_z = bounds[2] - cell;
112
+
113
+ const count = nx * ny * nz;
114
+ const stride_y = nx;
115
+ const stride_z = nx * ny;
116
+
117
+ let density = new Float32Array(count);
118
+ let scratch = new Float32Array(count);
119
+
120
+ // what the strands cover, seen along x, y and z
121
+ const cover_x = new Uint8Array(ny * nz);
122
+ const cover_y = new Uint8Array(nx * nz);
123
+ const cover_z = new Uint8Array(nx * ny);
124
+
125
+ const a = [0, 0, 0];
126
+ const b = [0, 0, 0];
127
+
128
+ const frontal = group.width_mean / (cell * cell * cell);
129
+
130
+ let fibre_length = 0;
131
+
132
+ for (let s = 0; s < strand_count; s++) {
133
+ group.read_point(a, 0, s, 0);
134
+
135
+ for (let i = 1; i < point_count; i++) {
136
+ group.read_point(b, 0, s, i);
137
+
138
+ const dx = b[0] - a[0];
139
+ const dy = b[1] - a[1];
140
+ const dz = b[2] - a[2];
141
+
142
+ const length = Math.sqrt(dx * dx + dy * dy + dz * dz);
143
+
144
+ fibre_length += length;
145
+
146
+ // pieces no longer than half a cell, each laid where its middle is
147
+ const pieces = Math.max(1, Math.ceil(2 * length / cell));
148
+ const share = frontal * length / pieces;
149
+
150
+ for (let k = 0; k < pieces; k++) {
151
+ const t = (k + 0.5) / pieces;
152
+
153
+ const x = Math.floor((a[0] + dx * t - origin_x) / cell);
154
+ const y = Math.floor((a[1] + dy * t - origin_y) / cell);
155
+ const z = Math.floor((a[2] + dz * t - origin_z) / cell);
156
+
157
+ density[x + stride_y * y + stride_z * z] += share;
158
+
159
+ cover_x[y + ny * z] = 1;
160
+ cover_y[x + nx * z] = 1;
161
+ cover_z[x + nx * y] = 1;
162
+ }
163
+
164
+ a[0] = b[0];
165
+ a[1] = b[1];
166
+ a[2] = b[2];
167
+ }
168
+ }
169
+
170
+ blur_axis(density, scratch, count, 1, nx);
171
+ blur_axis(scratch, density, count, stride_y, ny);
172
+ blur_axis(density, scratch, count, stride_z, nz);
173
+
174
+ const swap = density;
175
+
176
+ density = scratch;
177
+ scratch = swap;
178
+
179
+ if (solid !== null) {
180
+ // a cell's index to its middle, and back
181
+ const grid_to_world = new Float64Array(16);
182
+ const world_to_grid = new Float64Array(16);
183
+
184
+ grid_to_world[0] = grid_to_world[5] = grid_to_world[10] = cell;
185
+ grid_to_world[12] = origin_x + 0.5 * cell;
186
+ grid_to_world[13] = origin_y + 0.5 * cell;
187
+ grid_to_world[14] = origin_z + 0.5 * cell;
188
+ grid_to_world[15] = 1;
189
+
190
+ world_to_grid[0] = world_to_grid[5] = world_to_grid[10] = 1 / cell;
191
+ world_to_grid[12] = -grid_to_world[12] / cell;
192
+ world_to_grid[13] = -grid_to_world[13] / cell;
193
+ world_to_grid[14] = -grid_to_world[14] / cell;
194
+ world_to_grid[15] = 1;
195
+
196
+ const inside = new Uint8Array(count);
197
+
198
+ shape3_voxelize_to_grid(solid, world_to_grid, grid_to_world, inside, nx, ny, nz);
199
+
200
+ for (let i = 0; i < count; i++) {
201
+ if (inside[i] !== 0) {
202
+ density[i] = Infinity;
203
+ }
204
+ }
205
+ }
206
+
207
+ const shelter = new Float32Array(guide_count * node_count * GROOM_SHELTER_WORDS);
208
+ const stride = (point_count - 1) / (node_count - 1);
209
+
210
+ const sizes = [nx, ny, nz];
211
+ const strides = [1, stride_y, stride_z];
212
+ const place = [0, 0, 0];
213
+ const index = [0, 0, 0];
214
+
215
+ for (let g = 0; g < guide_count; g++) {
216
+ const strand = group.guide_strand[g];
217
+
218
+ for (let i = 0; i < node_count; i++) {
219
+ group.read_point(a, 0, strand, i * stride);
220
+
221
+ place[0] = (a[0] - origin_x) / cell;
222
+ place[1] = (a[1] - origin_y) / cell;
223
+ place[2] = (a[2] - origin_z) / cell;
224
+
225
+ index[0] = Math.floor(place[0]);
226
+ index[1] = Math.floor(place[1]);
227
+ index[2] = Math.floor(place[2]);
228
+
229
+ const home = index[0] + stride_y * index[1] + stride_z * index[2];
230
+ const at = (g * node_count + i) * GROOM_SHELTER_WORDS;
231
+
232
+ for (let axis = 0; axis < 3; axis++) {
233
+ const within = place[axis] - index[axis];
234
+
235
+ for (let side = 0; side < 2; side++) {
236
+ const step = side === 0 ? strides[axis] : -strides[axis];
237
+ const cells = side === 0 ? sizes[axis] - 1 - index[axis] : index[axis];
238
+
239
+ // what is left of the node's own cell, then every cell to the edge
240
+ let depth = density[home] * cell * (side === 0 ? 1 - within : within);
241
+
242
+ for (let k = 1; k <= cells && depth < GROOM_SHELTER_OPAQUE; k++) {
243
+ depth += density[home + step * k] * cell;
244
+ }
245
+
246
+ // a node inside something solid is no depth of nothing: opaque as well
247
+ shelter[at + axis * 2 + side] = depth < GROOM_SHELTER_OPAQUE ? depth : GROOM_SHELTER_OPAQUE;
248
+ }
249
+ }
250
+ }
251
+ }
252
+
253
+ let area_x = 0;
254
+ let area_y = 0;
255
+ let area_z = 0;
256
+
257
+ for (let i = 0; i < cover_x.length; i++) {
258
+ area_x += cover_x[i];
259
+ }
260
+
261
+ for (let i = 0; i < cover_y.length; i++) {
262
+ area_y += cover_y[i];
263
+ }
264
+
265
+ for (let i = 0; i < cover_z.length; i++) {
266
+ area_z += cover_z[i];
267
+ }
268
+
269
+ area_x *= cell * cell;
270
+ area_y *= cell * cell;
271
+ area_z *= cell * cell;
272
+
273
+ let silhouette = 0;
274
+
275
+ for (let i = 0; i < SILHOUETTE_DIRECTIONS; i++) {
276
+ sphere_fibonacci_point(a, 0, i, SILHOUETTE_DIRECTIONS);
277
+
278
+ const sx = area_x * a[0];
279
+ const sy = area_y * a[1];
280
+ const sz = area_z * a[2];
281
+
282
+ silhouette += Math.sqrt(sx * sx + sy * sy + sz * sz);
283
+ }
284
+
285
+ group.guide_shelter = shelter;
286
+ group.silhouette = silhouette / SILHOUETTE_DIRECTIONS;
287
+ group.fibre_length = fibre_length;
288
+ }
@@ -19,7 +19,7 @@
19
19
  export function groom_mesh_binder(geometry: import("../../../shade/renderer/geometry/MeshletGeometry.js").MeshletGeometry): GroomMeshBinder;
20
20
  /**
21
21
  * Bind each strand of a group to the nearest triangle of a mesh at its bind pose: the triangle, the root's
22
- * barycentrics on it, and the triangle's frame (Unreal's: the tangent along the first edge, the normal of the face,
22
+ * barycentrics on it, and the triangle's frame (the tangent along the first edge, the normal of the face,
23
23
  * the bitangent between them) with the root's point as its origin. Every frame the same triangle of the deformed
24
24
  * mesh gives the frame again, and the strand rides the turn and the move from the rest frame to it.
25
25
  *
@@ -98,7 +98,7 @@ export function groom_mesh_binder(geometry) {
98
98
 
99
99
  /**
100
100
  * Bind each strand of a group to the nearest triangle of a mesh at its bind pose: the triangle, the root's
101
- * barycentrics on it, and the triangle's frame (Unreal's: the tangent along the first edge, the normal of the face,
101
+ * barycentrics on it, and the triangle's frame (the tangent along the first edge, the normal of the face,
102
102
  * the bitangent between them) with the root's point as its origin. Every frame the same triangle of the deformed
103
103
  * mesh gives the frame again, and the strand rides the turn and the move from the rest frame to it.
104
104
  *
@@ -14,6 +14,8 @@
14
14
  * @property {number} point_count points a strand is resampled to, `2^k + 1`
15
15
  * @property {number} [width] metres, for curves that carry no widths
16
16
  * @property {number} [guide_tolerance] metres: how far a strand strays from the guide it follows (`groom_build_guides`)
17
+ * @property {import("../../../core/geom/3d/shape/AbstractShape3D.js").AbstractShape3D|null} [solid] what the air
18
+ * does not pass, in the curves' metres, such as the head the hair grows on (`groom_bake_shelter`)
17
19
  */
18
20
  /**
19
21
  * Whether `n` is `2^k + 1` for some `k ≥ 0`, within what a group may hold.
@@ -42,13 +44,14 @@ export function groom_point_count_for(curves: GroomCurves, tolerance: number): n
42
44
  /**
43
45
  * Make a group from curves: each resampled to `point_count` points evenly along its arc length, the strands put in
44
46
  * rank order (`groom_rank_order`), the points quantized inside the group's bounds, and the decimation table taken
45
- * from what was quantized, and the guides chosen from it (`groom_build_guides`).
47
+ * from what was quantized, the guides chosen from it (`groom_build_guides`), and how the hair shelters itself from
48
+ * the air worked out for them (`groom_bake_shelter`).
46
49
  *
47
50
  * @param {GroomCurves} curves
48
51
  * @param {GroomBuildOptions} options
49
52
  * @returns {GroomGroup}
50
53
  */
51
- export function groom_build_group(curves: GroomCurves, { name, point_count, width, guide_tolerance }: GroomBuildOptions): GroomGroup;
54
+ export function groom_build_group(curves: GroomCurves, { name, point_count, width, guide_tolerance, solid }: GroomBuildOptions): GroomGroup;
52
55
  /**
53
56
  * Curves as an importer or a generator hands them over: any number of points a curve.
54
57
  */
@@ -85,6 +88,11 @@ export type GroomBuildOptions = {
85
88
  * metres: how far a strand strays from the guide it follows (`groom_build_guides`)
86
89
  */
87
90
  guide_tolerance?: number;
91
+ /**
92
+ * what the air
93
+ * does not pass, in the curves' metres, such as the head the hair grows on (`groom_bake_shelter`)
94
+ */
95
+ solid?: import("../../../core/geom/3d/shape/AbstractShape3D.js").AbstractShape3D | null;
88
96
  };
89
97
  import { GroomGroup } from "./Groom.js";
90
98
  //# sourceMappingURL=groom_build_group.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"groom_build_group.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/hair/groom_build_group.js"],"names":[],"mappings":"AAYA;;;;;;;;;GASG;AAEH;;;;;;GAMG;AAEH;;;;;GAKG;AACH,8CAHW,MAAM,GACJ,OAAO,CAUnB;AA6ED;;;;;;GAMG;AACH,+CAHW,UAAU,GACR,YAAY,CA6CxB;AAED;;;;;;;GAOG;AACH,8CAJW,WAAW,aACX,MAAM,GACJ,MAAM,CA+ClB;AAkDD;;;;;;;;GAQG;AACH,0CAJW,WAAW,iDACX,iBAAiB,GACf,UAAU,CAwItB;;;;;;;;eApZa,YAAY,GAAC,YAAY;;;;YACzB,WAAW,GAAC,MAAM,EAAE;;;;;YACpB,YAAY,GAAC,YAAY,GAAC,IAAI;;;;gBAE9B,UAAU,GAAC,IAAI;;;WAKf,MAAM;;;;iBACN,MAAM;;;;YACN,MAAM;;;;sBACN,MAAM;;2BArBb,YAAY"}
1
+ {"version":3,"file":"groom_build_group.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/hair/groom_build_group.js"],"names":[],"mappings":"AAaA;;;;;;;;;GASG;AAEH;;;;;;;;GAQG;AAEH;;;;;GAKG;AACH,8CAHW,MAAM,GACJ,OAAO,CAUnB;AA6ED;;;;;;GAMG;AACH,+CAHW,UAAU,GACR,YAAY,CA6CxB;AAED;;;;;;;GAOG;AACH,8CAJW,WAAW,aACX,MAAM,GACJ,MAAM,CA+ClB;AAkDD;;;;;;;;;GASG;AACH,0CAJW,WAAW,wDACX,iBAAiB,GACf,UAAU,CA0ItB;;;;;;;;eAzZa,YAAY,GAAC,YAAY;;;;YACzB,WAAW,GAAC,MAAM,EAAE;;;;;YACpB,YAAY,GAAC,YAAY,GAAC,IAAI;;;;gBAE9B,UAAU,GAAC,IAAI;;;WAKf,MAAM;;;;iBACN,MAAM;;;;YACN,MAAM;;;;sBACN,MAAM;;;;;YACN,OAAO,gDAAgD,EAAE,eAAe,GAAC,IAAI;;2BAvBpF,YAAY"}
@@ -6,6 +6,7 @@ import {
6
6
  GROOM_POINT_WORDS,
7
7
  GroomGroup
8
8
  } from "./Groom.js";
9
+ import { groom_bake_shelter } from "./groom_bake_shelter.js";
9
10
  import { groom_build_guides, GROOM_GUIDE_DEFAULT_TOLERANCE } from "./groom_build_guides.js";
10
11
  import { groom_rank_order } from "./groom_rank_order.js";
11
12
  import { groom_root_spacing } from "./groom_root_spacing.js";
@@ -27,6 +28,8 @@ import { groom_root_spacing } from "./groom_root_spacing.js";
27
28
  * @property {number} point_count points a strand is resampled to, `2^k + 1`
28
29
  * @property {number} [width] metres, for curves that carry no widths
29
30
  * @property {number} [guide_tolerance] metres: how far a strand strays from the guide it follows (`groom_build_guides`)
31
+ * @property {import("../../../core/geom/3d/shape/AbstractShape3D.js").AbstractShape3D|null} [solid] what the air
32
+ * does not pass, in the curves' metres, such as the head the hair grows on (`groom_bake_shelter`)
30
33
  */
31
34
 
32
35
  /**
@@ -278,7 +281,8 @@ function sample_at(positions, lengths, first, count, s, out, out_offset) {
278
281
  /**
279
282
  * Make a group from curves: each resampled to `point_count` points evenly along its arc length, the strands put in
280
283
  * rank order (`groom_rank_order`), the points quantized inside the group's bounds, and the decimation table taken
281
- * from what was quantized, and the guides chosen from it (`groom_build_guides`).
284
+ * from what was quantized, the guides chosen from it (`groom_build_guides`), and how the hair shelters itself from
285
+ * the air worked out for them (`groom_bake_shelter`).
282
286
  *
283
287
  * @param {GroomCurves} curves
284
288
  * @param {GroomBuildOptions} options
@@ -288,7 +292,8 @@ export function groom_build_group(curves, {
288
292
  name = "",
289
293
  point_count,
290
294
  width = 70e-6,
291
- guide_tolerance = GROOM_GUIDE_DEFAULT_TOLERANCE
295
+ guide_tolerance = GROOM_GUIDE_DEFAULT_TOLERANCE,
296
+ solid = null
292
297
  }) {
293
298
  assert.ok(groom_point_count_is_valid(point_count), `point_count ${point_count} is not 2^k + 1 within ${GROOM_POINT_COUNT_MAX}`);
294
299
 
@@ -416,6 +421,7 @@ export function groom_build_group(curves, {
416
421
  group.root_spacing = groom_root_spacing(group);
417
422
 
418
423
  groom_build_guides(group, guide_tolerance);
424
+ groom_bake_shelter(group, solid);
419
425
 
420
426
  return group;
421
427
  }
@@ -36,7 +36,7 @@ export function groom_build_guides(group: import("./Groom.js").GroomGroup, toler
36
36
  /**
37
37
  * The wisp tolerance an import gives its groups when it is given none, metres: strands that stay within a centimetre
38
38
  * of one another along their whole length move as one wisp. On the test scalp, whose strands each wave on their own,
39
- * a fifth of the strands guide; Unreal makes a tenth of them guides by default.
39
+ * a fifth of the strands guide.
40
40
  * @type {number}
41
41
  */
42
42
  export const GROOM_GUIDE_DEFAULT_TOLERANCE: number;
@@ -4,7 +4,7 @@ import { GROOM_GUIDE_LIMIT } from "./Groom.js";
4
4
  /**
5
5
  * The wisp tolerance an import gives its groups when it is given none, metres: strands that stay within a centimetre
6
6
  * of one another along their whole length move as one wisp. On the test scalp, whose strands each wave on their own,
7
- * a fifth of the strands guide; Unreal makes a tenth of them guides by default.
7
+ * a fifth of the strands guide.
8
8
  * @type {number}
9
9
  */
10
10
  export const GROOM_GUIDE_DEFAULT_TOLERANCE = 0.01;
@@ -1,15 +1,15 @@
1
1
  # Voxel Impostor system
2
2
 
3
- Point-based ("voxel" / surfel) impostor inspired by the **Nanite Voxels**
4
- representation Epic and CD Projekt RED showed in the Witcher 4 / Unreal
5
- Engine 5 tech demo (Unreal Fest Stockholm 2025). At distance, dense
6
- alpha-tested foliage cards stop scaling cleanly — the new technique
7
- replaces them with a cloud of near-pixel-sized splats, each carrying a
8
- full G-buffer slice, so the LOD never has to fall back to a flat card.
3
+ Point-based ("voxel" / surfel) impostor. At distance, dense alpha-tested
4
+ foliage cards stop scaling cleanly — this technique replaces them with a
5
+ cloud of near-pixel-sized splats, each carrying a full G-buffer slice, so
6
+ the LOD never has to fall back to a flat card. A voxel representation of
7
+ distant foliage was presented publicly in the Witcher 4 tech demo talk
8
+ at Unreal Fest Stockholm 2025 (see References).
9
9
 
10
- This implementation is much simpler than UE's production system (we
11
- don't do streaming, meshlet hierarchy, or front-to-back depth binning),
12
- but the data model and rendering approach are the same:
10
+ This implementation is deliberately simple (no streaming, meshlet
11
+ hierarchy, or front-to-back depth binning). Its data model and rendering
12
+ approach:
13
13
 
14
14
  - Each "voxel" is a single splat with the same world-space size.
15
15
  - Per-splat attributes: position, normal, albedo, ORM (occlusion,
@@ -95,8 +95,8 @@ Shader set:
95
95
  | `VoxelImpostorShaderViewportDepthV0` | Debug — viewport depth as grayscale. |
96
96
 
97
97
  A `uDiscMask` uniform toggles between square and circular splats; the
98
- prototype harness uses square for slot 0 (matches the Witcher 4 "voxel"
99
- look) and disc for slot 1 (clearer view of the point distribution).
98
+ prototype harness uses square for slot 0 (the blocky "voxel" look) and
99
+ disc for slot 1 (clearer view of the point distribution).
100
100
 
101
101
  ---
102
102
 
@@ -4,7 +4,7 @@ import { ShapeRecordKind } from "../../../../core/geom/3d/shape/record/ShapeReco
4
4
  * The shapes cloth collides against.
5
5
  *
6
6
  * §8.2: analytic primitives only, which is universal in shipping cloth systems
7
- * — MagicaCloth2 offers sphere, capsule and plane; Chaos Cloth adds tapered
7
+ * — MagicaCloth2 offers sphere, capsule and plane; others add tapered
8
8
  * capsules and convex hulls — and is what makes the inner loop a handful of
9
9
  * arithmetic instead of a BVH descent. A `Collider` carrying a mesh or a
10
10
  * heightmap is skipped with one warning naming the entity, and the documented
@@ -15,7 +15,7 @@ export function cloth_edge_incidence(node_count: number, edge: Int32Array): {
15
15
  * edges, and which source that is.
16
16
  *
17
17
  * A node marked in `blocked` can be reached but is never passed through.
18
- * That is Chaos Cloth's rule for its long-range attachments:
18
+ * That is the rule for long-range attachments:
19
19
  * a path from one island of held particles does not run through another, because
20
20
  * the far side of another island is that island's business.
21
21
  *
@@ -66,7 +66,7 @@ export function cloth_edge_incidence(node_count, edge) {
66
66
  * edges, and which source that is.
67
67
  *
68
68
  * A node marked in `blocked` can be reached but is never passed through.
69
- * That is Chaos Cloth's rule for its long-range attachments:
69
+ * That is the rule for long-range attachments:
70
70
  * a path from one island of held particles does not run through another, because
71
71
  * the far side of another island is that island's business.
72
72
  *
@@ -16,9 +16,8 @@
16
16
  * without adding geometry: the plane is anchored to the particle's own
17
17
  * *animated* position and its own surface normal, both of which the garment
18
18
  * already knows, so it is a bound the mesh carries with it rather than a shape
19
- * somebody has to author. Chaos Cloth ships the same thing under the same name
20
- * and for the same reason (§15), and §7 P3 leans on it as one of the three
21
- * layers that stop a garment tunnelling through a character.
19
+ * somebody has to author. §7 P3 leans on it as one of the three layers that
20
+ * stop a garment tunnelling through a character.
22
21
  *
23
22
  * It is deliberately **not** a substitute for collision. A backstop is a plane
24
23
  * per particle: it knows which way is out and nothing about what is actually
@@ -1 +1 @@
1
- {"version":3,"file":"cloth_backstop_row.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/physics/cloth/solver/constraint/cloth_backstop_row.js"],"names":[],"mappings":"AAYA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AAEH;;;;;;;;;;;GAWG;AACH,kDANW,YAAY,GAAC,MAAM,EAAE,mBACrB,MAAM,0BAEN,MAAM,GACJ,MAAM,CAuBlB;AAED;;;;;;GAMG;AACH,uDAJW,YAAY,+BAEZ,MAAM,QA8EhB;AAED;;;;;;;;;;GAUG;AACH,oEANW,MAAM,SACN,MAAM,eACN,MAAM,eACN,MAAM,qBACN,MAAM,QAuChB;AAED;;;;;;;GAOG;AACH,oEAJW,MAAM,eACN,MAAM,qBACN,MAAM,QA2ChB"}
1
+ {"version":3,"file":"cloth_backstop_row.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/physics/cloth/solver/constraint/cloth_backstop_row.js"],"names":[],"mappings":"AAYA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AAEH;;;;;;;;;;;GAWG;AACH,kDANW,YAAY,GAAC,MAAM,EAAE,mBACrB,MAAM,0BAEN,MAAM,GACJ,MAAM,CAuBlB;AAED;;;;;;GAMG;AACH,uDAJW,YAAY,+BAEZ,MAAM,QA8EhB;AAED;;;;;;;;;;GAUG;AACH,oEANW,MAAM,SACN,MAAM,eACN,MAAM,eACN,MAAM,qBACN,MAAM,QAuChB;AAED;;;;;;;GAOG;AACH,oEAJW,MAAM,eACN,MAAM,qBACN,MAAM,QA2ChB"}
@@ -28,9 +28,8 @@ import {
28
28
  * without adding geometry: the plane is anchored to the particle's own
29
29
  * *animated* position and its own surface normal, both of which the garment
30
30
  * already knows, so it is a bound the mesh carries with it rather than a shape
31
- * somebody has to author. Chaos Cloth ships the same thing under the same name
32
- * and for the same reason (§15), and §7 P3 leans on it as one of the three
33
- * layers that stop a garment tunnelling through a character.
31
+ * somebody has to author. §7 P3 leans on it as one of the three layers that
32
+ * stop a garment tunnelling through a character.
34
33
  *
35
34
  * It is deliberately **not** a substitute for collision. A backstop is a plane
36
35
  * per particle: it knows which way is out and nothing about what is actually
@@ -10,8 +10,6 @@ export class AbstractCellFilterSampleGridLayer extends CellFilter {
10
10
  * @private
11
11
  */
12
12
  private __layer;
13
- __u_scale: number;
14
- __v_scale: number;
15
13
  /**
16
14
  *
17
15
  * @type {Sampler2D}
@@ -1 +1 @@
1
- {"version":3,"file":"AbstractCellFilterSampleGridLayer.d.ts","sourceRoot":"","sources":["../../../../../../src/generation/filtering/numeric/sampling/AbstractCellFilterSampleGridLayer.js"],"names":[],"mappings":"AAEA;IAGI;;;OAGG;IACH,SAFU,MAAM,CAED;IAEf;;;;OAIG;IACH,gBAAe;IAEf,kBAAc;IACd,kBAAc;IACd;;;;OAIG;IACH,kBAAiB;IAGjB,uCAgBC;CAEJ;2BA9C0B,qBAAqB"}
1
+ {"version":3,"file":"AbstractCellFilterSampleGridLayer.d.ts","sourceRoot":"","sources":["../../../../../../src/generation/filtering/numeric/sampling/AbstractCellFilterSampleGridLayer.js"],"names":[],"mappings":"AAEA;IAGI;;;OAGG;IACH,SAFU,MAAM,CAED;IAEf;;;;OAIG;IACH,gBAAe;IAEf;;;;OAIG;IACH,kBAAiB;IAGjB,uCAaC;CAEJ;2BAzC0B,qBAAqB"}
@@ -16,8 +16,6 @@ export class AbstractCellFilterSampleGridLayer extends CellFilter {
16
16
  */
17
17
  __layer = null;
18
18
 
19
- __u_scale = 0;
20
- __v_scale = 0;
21
19
  /**
22
20
  *
23
21
  * @type {Sampler2D}
@@ -39,9 +37,6 @@ export class AbstractCellFilterSampleGridLayer extends CellFilter {
39
37
 
40
38
  // cache required values
41
39
  this.__sampler = this.__layer.sampler;
42
-
43
- this.__u_scale = this.__sampler.width / grid.width;
44
- this.__v_scale = this.__sampler.height / grid.height;
45
40
  }
46
41
 
47
42
  }
@@ -1 +1 @@
1
- {"version":3,"file":"CellFilterSampleLayerCubic.d.ts","sourceRoot":"","sources":["../../../../../../src/generation/filtering/numeric/sampling/CellFilterSampleLayerCubic.js"],"names":[],"mappings":"AAGA;IAEI;;;;OAIG;IACH,mBAHW,MAAM,GACJ,0BAA0B,CAUtC;IAED,uDAcC;CACJ;kDAlCiD,wCAAwC"}
1
+ {"version":3,"file":"CellFilterSampleLayerCubic.d.ts","sourceRoot":"","sources":["../../../../../../src/generation/filtering/numeric/sampling/CellFilterSampleLayerCubic.js"],"names":[],"mappings":"AAIA;IAEI;;;;OAIG;IACH,mBAHW,MAAM,GACJ,0BAA0B,CAUtC;IAED,uDAeC;CACJ;kDAnCiD,wCAAwC"}
@@ -1,4 +1,5 @@
1
1
  import { assert } from "../../../../core/assert.js";
2
+ import { grid_to_texel } from "../../../grid/coords/grid_to_texel.js";
2
3
  import { AbstractCellFilterSampleGridLayer } from "./AbstractCellFilterSampleGridLayer.js";
3
4
 
4
5
  export class CellFilterSampleLayerCubic extends AbstractCellFilterSampleGridLayer {
@@ -20,9 +21,10 @@ export class CellFilterSampleLayerCubic extends AbstractCellFilterSampleGridLaye
20
21
 
21
22
  execute(grid, x, y, rotation) {
22
23
 
23
- //convert to UV
24
- const sampler_x = x * this.__u_scale;
25
- const sampler_y = y * this.__v_scale;
24
+ const layer = this.__layer;
25
+
26
+ const sampler_x = grid_to_texel(x, layer.resolution, layer.stretch);
27
+ const sampler_y = grid_to_texel(y, layer.resolution, layer.stretch);
26
28
 
27
29
 
28
30
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"CellFilterSampleLayerLinear.d.ts","sourceRoot":"","sources":["../../../../../../src/generation/filtering/numeric/sampling/CellFilterSampleLayerLinear.js"],"names":[],"mappings":"AAGA;IAEI;;;;OAIG;IACH,mBAHW,MAAM,GACJ,2BAA2B,CAUvC;IAED,uDAkBC;CACJ;kDAtCiD,wCAAwC"}
1
+ {"version":3,"file":"CellFilterSampleLayerLinear.d.ts","sourceRoot":"","sources":["../../../../../../src/generation/filtering/numeric/sampling/CellFilterSampleLayerLinear.js"],"names":[],"mappings":"AAIA;IAEI;;;;OAIG;IACH,mBAHW,MAAM,GACJ,2BAA2B,CAUvC;IAED,uDAmBC;CACJ;kDAvCiD,wCAAwC"}
@@ -1,4 +1,5 @@
1
1
  import { assert } from "../../../../core/assert.js";
2
+ import { grid_to_texel } from "../../../grid/coords/grid_to_texel.js";
2
3
  import { AbstractCellFilterSampleGridLayer } from "./AbstractCellFilterSampleGridLayer.js";
3
4
 
4
5
  export class CellFilterSampleLayerLinear extends AbstractCellFilterSampleGridLayer {
@@ -20,9 +21,10 @@ export class CellFilterSampleLayerLinear extends AbstractCellFilterSampleGridLay
20
21
 
21
22
  execute(grid, x, y, rotation) {
22
23
 
23
- //convert to UV
24
- const sampler_x = x * this.__u_scale;
25
- const sampler_y = y * this.__v_scale;
24
+ const layer = this.__layer;
25
+
26
+ const sampler_x = grid_to_texel(x, layer.resolution, layer.stretch);
27
+ const sampler_y = grid_to_texel(y, layer.resolution, layer.stretch);
26
28
 
27
29
 
28
30
  /**
@@ -1,9 +1,15 @@
1
1
  /**
2
2
  * Canonical grid → layer-texel mapping (see generation/COORDINATES.md).
3
3
  * Integer grid coordinates are cell centers, integer texel coordinates are texel centers.
4
+ *
5
+ * Unstretched, texel `t` is centred on grid `t / resolution`, so texel 0 sits on cell 0. Stretched, the layer is laid
6
+ * over the grid from its first corner and texel `t` covers cells `t / resolution` up to `(t + 1) / resolution`. At
7
+ * resolution 1 both are the identity.
8
+ *
4
9
  * @param {number} v grid coordinate
5
10
  * @param {number} resolution texels per grid cell ({@link GridDataLayer#resolution})
11
+ * @param {boolean} stretch {@link GridDataLayer#stretch}
6
12
  * @returns {number} texel coordinate
7
13
  */
8
- export function grid_to_texel(v: number, resolution: number): number;
14
+ export function grid_to_texel(v: number, resolution: number, stretch: boolean): number;
9
15
  //# sourceMappingURL=grid_to_texel.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"grid_to_texel.d.ts","sourceRoot":"","sources":["../../../../../src/generation/grid/coords/grid_to_texel.js"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,iCAJW,MAAM,cACN,MAAM,GACJ,MAAM,CAIlB"}
1
+ {"version":3,"file":"grid_to_texel.d.ts","sourceRoot":"","sources":["../../../../../src/generation/grid/coords/grid_to_texel.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,iCALW,MAAM,cACN,MAAM,WACN,OAAO,GACL,MAAM,CAQlB"}