@woosh/meep-engine 3.64.1 → 3.67.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 (372) hide show
  1. package/CHANGELOG.md +85 -0
  2. package/build/bundle-worker-image-decoder.js +1 -1
  3. package/build/bundle-worker-terrain.js +1 -1
  4. package/package.json +1 -1
  5. package/src/core/binary/BinaryBuffer.d.ts +5 -0
  6. package/src/core/binary/BinaryBuffer.d.ts.map +1 -1
  7. package/src/core/binary/BinaryBuffer.js +39 -5
  8. package/src/core/geom/3d/topology/struct/binary/io/bt_boundary_loop.d.ts +65 -6
  9. package/src/core/geom/3d/topology/struct/binary/io/bt_boundary_loop.d.ts.map +1 -1
  10. package/src/core/geom/3d/topology/struct/binary/io/bt_boundary_loop.js +451 -101
  11. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_close_boundary_holes.d.ts +4 -2
  12. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_close_boundary_holes.d.ts.map +1 -1
  13. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_close_boundary_holes.js +4 -2
  14. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_fill_small_holes.d.ts +8 -1
  15. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_fill_small_holes.d.ts.map +1 -1
  16. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_fill_small_holes.js +45 -10
  17. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_face_find_path_polyanya.d.ts.map +1 -1
  18. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_face_find_path_polyanya.js +237 -119
  19. package/src/engine/graphics/ecs/grass/GrassSpecies.d.ts +143 -0
  20. package/src/engine/graphics/ecs/grass/GrassSpecies.d.ts.map +1 -0
  21. package/src/engine/graphics/ecs/grass/GrassSpecies.js +189 -0
  22. package/src/engine/graphics/ecs/grass/GrassSurface.d.ts +25 -0
  23. package/src/engine/graphics/ecs/grass/GrassSurface.d.ts.map +1 -0
  24. package/src/engine/graphics/ecs/grass/GrassSurface.js +32 -0
  25. package/src/engine/graphics/ecs/grass/GroundCover.d.ts +68 -0
  26. package/src/engine/graphics/ecs/grass/GroundCover.d.ts.map +1 -0
  27. package/src/engine/graphics/ecs/grass/GroundCover.js +85 -0
  28. package/src/engine/graphics3/GrassSurfaceSystem.d.ts +153 -0
  29. package/src/engine/graphics3/GrassSurfaceSystem.d.ts.map +1 -0
  30. package/src/engine/graphics3/GrassSurfaceSystem.js +1076 -0
  31. package/src/engine/graphics3/GroundCoverSystem.d.ts +33 -0
  32. package/src/engine/graphics3/GroundCoverSystem.d.ts.map +1 -0
  33. package/src/engine/graphics3/GroundCoverSystem.js +58 -0
  34. package/src/engine/network/NetworkSession.d.ts.map +1 -1
  35. package/src/engine/network/NetworkSession.js +372 -110
  36. package/src/engine/network/orchestrator/NetworkPeer.d.ts.map +1 -1
  37. package/src/engine/network/orchestrator/NetworkPeer.js +6 -1
  38. package/src/engine/network/orchestrator/ServerAuthoritativeClient.d.ts.map +1 -1
  39. package/src/engine/network/orchestrator/ServerAuthoritativeClient.js +9 -2
  40. package/src/engine/network/orchestrator/ServerAuthoritativeServer.d.ts.map +1 -1
  41. package/src/engine/network/orchestrator/ServerAuthoritativeServer.js +325 -140
  42. package/src/engine/network/sim/SimActionExecutor.d.ts +4 -1
  43. package/src/engine/network/sim/SimActionExecutor.d.ts.map +1 -1
  44. package/src/engine/network/sim/SimActionExecutor.js +65 -9
  45. package/src/engine/network/state/PredictionHistory.d.ts.map +1 -1
  46. package/src/engine/network/state/PredictionHistory.js +6 -1
  47. package/src/engine/network/time/AdaptiveRenderDelay.d.ts +25 -14
  48. package/src/engine/network/time/AdaptiveRenderDelay.d.ts.map +1 -1
  49. package/src/engine/network/time/AdaptiveRenderDelay.js +38 -20
  50. package/src/engine/network/time/RenderPlayout.d.ts +23 -3
  51. package/src/engine/network/time/RenderPlayout.d.ts.map +1 -1
  52. package/src/engine/network/time/RenderPlayout.js +40 -4
  53. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  54. package/src/engine/physics/fluid/obstacle/chunk_fluid_obstacle_record.d.ts +5 -1
  55. package/src/engine/physics/fluid/obstacle/chunk_fluid_obstacle_record.d.ts.map +1 -1
  56. package/src/engine/physics/fluid/obstacle/chunk_fluid_obstacle_record.js +27 -1
  57. package/src/format/lut/cube/CubeLut.d.ts +38 -0
  58. package/src/format/lut/cube/CubeLut.d.ts.map +1 -0
  59. package/src/format/lut/cube/CubeLut.js +23 -0
  60. package/src/format/lut/cube/cube_read.d.ts +23 -0
  61. package/src/format/lut/cube/cube_read.d.ts.map +1 -0
  62. package/src/format/lut/cube/cube_read.js +199 -0
  63. package/src/format/lut/cube/cube_write.d.ts +15 -0
  64. package/src/format/lut/cube/cube_write.d.ts.map +1 -0
  65. package/src/format/lut/cube/cube_write.js +90 -0
  66. package/src/shade/device/shader/ShaderModuleCompiler.d.ts +2 -0
  67. package/src/shade/device/shader/ShaderModuleCompiler.d.ts.map +1 -1
  68. package/src/shade/device/shader/ShaderModuleCompiler.js +25 -2
  69. package/src/shade/playground/grass_surfaces/index.html +75 -0
  70. package/src/shade/playground/grass_surfaces/main.d.ts +2 -0
  71. package/src/shade/playground/grass_surfaces/main.d.ts.map +1 -0
  72. package/src/shade/playground/grass_surfaces/main.js +593 -0
  73. package/src/shade/playground/grass_surfaces/read_grass_surfaces.d.ts +62 -0
  74. package/src/shade/playground/grass_surfaces/read_grass_surfaces.d.ts.map +1 -0
  75. package/src/shade/playground/grass_surfaces/read_grass_surfaces.js +188 -0
  76. package/src/shade/playground/probe_clipmap/README.md +1 -0
  77. package/src/shade/playground/probe_clipmap/index.html +5 -0
  78. package/src/shade/playground/probe_clipmap/main.d.ts.map +1 -1
  79. package/src/shade/playground/probe_clipmap/main.js +7 -0
  80. package/src/shade/playground/probe_clipmap_box/README.md +5 -1
  81. package/src/shade/playground/probe_clipmap_box/index.html +12 -0
  82. package/src/shade/playground/probe_clipmap_box/main.d.ts.map +1 -1
  83. package/src/shade/playground/probe_clipmap_box/main.js +15 -0
  84. package/src/shade/playground/probe_clipmap_box/scene.d.ts +8 -1
  85. package/src/shade/playground/probe_clipmap_box/scene.d.ts.map +1 -1
  86. package/src/shade/playground/probe_clipmap_box/scene.js +74 -6
  87. package/src/shade/renderer/Renderer.d.ts.map +1 -1
  88. package/src/shade/renderer/Renderer.js +59 -55
  89. package/src/shade/renderer/deferred/tonemap/ColorGrade.d.ts +73 -4
  90. package/src/shade/renderer/deferred/tonemap/ColorGrade.d.ts.map +1 -1
  91. package/src/shade/renderer/deferred/tonemap/ColorGrade.js +113 -7
  92. package/src/shade/renderer/deferred/tonemap/TONEMAP_PURKINJE_SHIFT.d.ts +12 -0
  93. package/src/shade/renderer/deferred/tonemap/TONEMAP_PURKINJE_SHIFT.d.ts.map +1 -0
  94. package/src/shade/renderer/deferred/tonemap/TONEMAP_PURKINJE_SHIFT.js +12 -0
  95. package/src/shade/renderer/deferred/tonemap/ToneMapper.d.ts +15 -1
  96. package/src/shade/renderer/deferred/tonemap/ToneMapper.d.ts.map +1 -1
  97. package/src/shade/renderer/deferred/tonemap/ToneMapper.js +31 -3
  98. package/src/shade/renderer/deferred/tonemap/chunk_tonemap_purkinje.d.ts +25 -0
  99. package/src/shade/renderer/deferred/tonemap/chunk_tonemap_purkinje.d.ts.map +1 -0
  100. package/src/shade/renderer/deferred/tonemap/chunk_tonemap_purkinje.js +51 -0
  101. package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR_lut.d.ts +2 -2
  102. package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR_lut.d.ts.map +1 -1
  103. package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR_lut.js +6 -3
  104. package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR_lut.d.ts +3 -2
  105. package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR_lut.d.ts.map +1 -1
  106. package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR_lut.js +7 -3
  107. package/src/shade/renderer/extension/ViewTextures.d.ts +12 -5
  108. package/src/shade/renderer/extension/ViewTextures.d.ts.map +1 -1
  109. package/src/shade/renderer/extension/ViewTextures.js +19 -5
  110. package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts +3 -1
  111. package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts.map +1 -1
  112. package/src/shade/renderer/fluid/GPUFluidCascadeStack.js +6 -1
  113. package/src/shade/renderer/fluid/forcing/GPUFluidForcing.d.ts +7 -0
  114. package/src/shade/renderer/fluid/forcing/GPUFluidForcing.d.ts.map +1 -1
  115. package/src/shade/renderer/fluid/forcing/GPUFluidForcing.js +10 -0
  116. package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.d.ts +7 -1
  117. package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.d.ts.map +1 -1
  118. package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.js +46 -15
  119. package/src/shade/renderer/geometry/sdf/bundle/ModelCacheBundle.d.ts +3 -2
  120. package/src/shade/renderer/geometry/sdf/bundle/ModelCacheBundle.d.ts.map +1 -1
  121. package/src/shade/renderer/geometry/sdf/bundle/ModelCacheBundle.js +3 -2
  122. package/src/shade/renderer/geometry/sdf/bundle/model_cache_bundle_sort_morton.d.ts +22 -0
  123. package/src/shade/renderer/geometry/sdf/bundle/model_cache_bundle_sort_morton.d.ts.map +1 -0
  124. package/src/shade/renderer/geometry/sdf/bundle/model_cache_bundle_sort_morton.js +247 -0
  125. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts +50 -0
  126. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts.map +1 -1
  127. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.js +101 -0
  128. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.d.ts +2 -1
  129. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.d.ts.map +1 -1
  130. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.js +2 -1
  131. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.d.ts +8 -0
  132. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.d.ts.map +1 -1
  133. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.js +12 -0
  134. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.d.ts +12 -6
  135. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.d.ts.map +1 -1
  136. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.js +35 -29
  137. package/src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_brick_clipmap.d.ts.map +1 -1
  138. package/src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_brick_clipmap.js +4 -2
  139. package/src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_brick_material.d.ts.map +1 -1
  140. package/src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_brick_material.js +6 -4
  141. package/src/shade/renderer/global_illumination/probe_clipmap/material/GPUBrickMaterial.d.ts.map +1 -1
  142. package/src/shade/renderer/global_illumination/probe_clipmap/material/GPUBrickMaterial.js +2 -1
  143. package/src/shade/renderer/global_illumination/probe_clipmap/material/chunk_brick_material.d.ts +6 -5
  144. package/src/shade/renderer/global_illumination/probe_clipmap/material/chunk_brick_material.d.ts.map +1 -1
  145. package/src/shade/renderer/global_illumination/probe_clipmap/material/chunk_brick_material.js +15 -14
  146. package/src/shade/renderer/global_illumination/probe_clipmap/material/shader_brick_material_gather.d.ts.map +1 -1
  147. package/src/shade/renderer/global_illumination/probe_clipmap/material/shader_brick_material_gather.js +4 -2
  148. package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.d.ts +19 -2
  149. package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.d.ts.map +1 -1
  150. package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.js +128 -10
  151. package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP.d.ts +19 -1
  152. package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP.d.ts.map +1 -1
  153. package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP.js +27 -2
  154. package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapScreenWants.d.ts +19 -11
  155. package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapScreenWants.d.ts.map +1 -1
  156. package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapScreenWants.js +35 -11
  157. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap.d.ts.map +1 -1
  158. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap.js +3 -1
  159. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_box_cages.d.ts +40 -0
  160. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_box_cages.d.ts.map +1 -0
  161. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_box_cages.js +174 -0
  162. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_hit_material.d.ts +4 -4
  163. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_hit_material.js +10 -10
  164. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_parallax.d.ts +31 -0
  165. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_parallax.d.ts.map +1 -0
  166. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_parallax.js +54 -0
  167. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_sample_radiance.d.ts +8 -4
  168. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_sample_radiance.d.ts.map +1 -1
  169. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_sample_radiance.js +10 -21
  170. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_want.d.ts +7 -2
  171. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_want.d.ts.map +1 -1
  172. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_want.js +33 -29
  173. package/src/shade/renderer/global_illumination/probe_clipmap/probe/graph_probe_clipmap_want_meshlets.d.ts +28 -0
  174. package/src/shade/renderer/global_illumination/probe_clipmap/probe/graph_probe_clipmap_want_meshlets.d.ts.map +1 -0
  175. package/src/shade/renderer/global_illumination/probe_clipmap/probe/graph_probe_clipmap_want_meshlets.js +138 -0
  176. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_due.d.ts +13 -9
  177. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_due.d.ts.map +1 -1
  178. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_due.js +18 -11
  179. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.js +1 -1
  180. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_relocate.d.ts.map +1 -1
  181. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_relocate.js +4 -2
  182. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_retire.d.ts.map +1 -1
  183. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_retire.js +2 -3
  184. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_schedule.d.ts +5 -3
  185. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_schedule.d.ts.map +1 -1
  186. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_schedule.js +15 -30
  187. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_shade.js +1 -1
  188. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.d.ts.map +1 -1
  189. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.js +4 -2
  190. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want.d.ts +11 -0
  191. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want.d.ts.map +1 -1
  192. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want.js +29 -2
  193. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_late.d.ts +40 -0
  194. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_late.d.ts.map +1 -0
  195. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_late.js +126 -0
  196. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_meshlets.d.ts +36 -0
  197. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_meshlets.d.ts.map +1 -0
  198. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_meshlets.js +221 -0
  199. package/src/shade/renderer/gpu_primitive/age_eviction/chunk_age_eviction.d.ts +40 -0
  200. package/src/shade/renderer/gpu_primitive/age_eviction/chunk_age_eviction.d.ts.map +1 -0
  201. package/src/shade/renderer/gpu_primitive/age_eviction/chunk_age_eviction.js +86 -0
  202. package/src/shade/renderer/grass/blade/GPUGrassBlades.d.ts +135 -0
  203. package/src/shade/renderer/grass/blade/GPUGrassBlades.d.ts.map +1 -0
  204. package/src/shade/renderer/grass/blade/GPUGrassBlades.js +676 -0
  205. package/src/shade/renderer/grass/blade/GRASS_BLADE.d.ts +145 -0
  206. package/src/shade/renderer/grass/blade/GRASS_BLADE.d.ts.map +1 -0
  207. package/src/shade/renderer/grass/blade/GRASS_BLADE.js +179 -0
  208. package/src/shade/renderer/grass/blade/chunk_grass_blade.d.ts +63 -0
  209. package/src/shade/renderer/grass/blade/chunk_grass_blade.d.ts.map +1 -0
  210. package/src/shade/renderer/grass/blade/chunk_grass_blade.js +244 -0
  211. package/src/shade/renderer/grass/blade/chunk_grass_blade_wind.d.ts +58 -0
  212. package/src/shade/renderer/grass/blade/chunk_grass_blade_wind.d.ts.map +1 -0
  213. package/src/shade/renderer/grass/blade/chunk_grass_blade_wind.js +174 -0
  214. package/src/shade/renderer/grass/blade/grass_blade_id_draw.d.ts +25 -0
  215. package/src/shade/renderer/grass/blade/grass_blade_id_draw.d.ts.map +1 -0
  216. package/src/shade/renderer/grass/blade/grass_blade_id_draw.js +133 -0
  217. package/src/shade/renderer/grass/blade/grass_blade_mechanics.d.ts +80 -0
  218. package/src/shade/renderer/grass/blade/grass_blade_mechanics.d.ts.map +1 -0
  219. package/src/shade/renderer/grass/blade/grass_blade_mechanics.js +92 -0
  220. package/src/shade/renderer/grass/blade/grass_blade_resolve.d.ts +29 -0
  221. package/src/shade/renderer/grass/blade/grass_blade_resolve.d.ts.map +1 -0
  222. package/src/shade/renderer/grass/blade/grass_blade_resolve.js +175 -0
  223. package/src/shade/renderer/grass/blade/shader_grass_blade_draw_args.d.ts +14 -0
  224. package/src/shade/renderer/grass/blade/shader_grass_blade_draw_args.d.ts.map +1 -0
  225. package/src/shade/renderer/grass/blade/shader_grass_blade_draw_args.js +45 -0
  226. package/src/shade/renderer/grass/blade/shader_grass_blade_expand.d.ts +61 -0
  227. package/src/shade/renderer/grass/blade/shader_grass_blade_expand.d.ts.map +1 -0
  228. package/src/shade/renderer/grass/blade/shader_grass_blade_expand.js +340 -0
  229. package/src/shade/renderer/grass/blade/shader_grass_cell_count.d.ts +46 -0
  230. package/src/shade/renderer/grass/blade/shader_grass_cell_count.d.ts.map +1 -0
  231. package/src/shade/renderer/grass/blade/shader_grass_cell_count.js +280 -0
  232. package/src/shade/renderer/grass/population/chunk_grass_population.d.ts +60 -0
  233. package/src/shade/renderer/grass/population/chunk_grass_population.d.ts.map +1 -0
  234. package/src/shade/renderer/grass/population/chunk_grass_population.js +171 -0
  235. package/src/shade/renderer/grass/press/GPUGrassPress.d.ts +99 -0
  236. package/src/shade/renderer/grass/press/GPUGrassPress.d.ts.map +1 -0
  237. package/src/shade/renderer/grass/press/GPUGrassPress.js +436 -0
  238. package/src/shade/renderer/grass/press/GRASS_PRESS.d.ts +179 -0
  239. package/src/shade/renderer/grass/press/GRASS_PRESS.d.ts.map +1 -0
  240. package/src/shade/renderer/grass/press/GRASS_PRESS.js +217 -0
  241. package/src/shade/renderer/grass/press/chunk_grass_press.d.ts +65 -0
  242. package/src/shade/renderer/grass/press/chunk_grass_press.d.ts.map +1 -0
  243. package/src/shade/renderer/grass/press/chunk_grass_press.js +296 -0
  244. package/src/shade/renderer/grass/press/shader_grass_press_mark.d.ts +31 -0
  245. package/src/shade/renderer/grass/press/shader_grass_press_mark.d.ts.map +1 -0
  246. package/src/shade/renderer/grass/press/shader_grass_press_mark.js +169 -0
  247. package/src/shade/renderer/grass/press/shader_grass_press_stamp.d.ts +27 -0
  248. package/src/shade/renderer/grass/press/shader_grass_press_stamp.d.ts.map +1 -0
  249. package/src/shade/renderer/grass/press/shader_grass_press_stamp.js +183 -0
  250. package/src/shade/renderer/grass/surface/GPUGrassSurfaces.d.ts +193 -0
  251. package/src/shade/renderer/grass/surface/GPUGrassSurfaces.d.ts.map +1 -0
  252. package/src/shade/renderer/grass/surface/GPUGrassSurfaces.js +1253 -0
  253. package/src/shade/renderer/grass/surface/GRASS_SURFACE.d.ts +211 -0
  254. package/src/shade/renderer/grass/surface/GRASS_SURFACE.d.ts.map +1 -0
  255. package/src/shade/renderer/grass/surface/GRASS_SURFACE.js +241 -0
  256. package/src/shade/renderer/grass/surface/GRASS_SURFACE_VIEW.d.ts +82 -0
  257. package/src/shade/renderer/grass/surface/GRASS_SURFACE_VIEW.d.ts.map +1 -0
  258. package/src/shade/renderer/grass/surface/GRASS_SURFACE_VIEW.js +111 -0
  259. package/src/shade/renderer/grass/surface/chunk_grass_column_cross.d.ts +39 -0
  260. package/src/shade/renderer/grass/surface/chunk_grass_column_cross.d.ts.map +1 -0
  261. package/src/shade/renderer/grass/surface/chunk_grass_column_cross.js +85 -0
  262. package/src/shade/renderer/grass/surface/chunk_grass_directory.d.ts +29 -0
  263. package/src/shade/renderer/grass/surface/chunk_grass_directory.d.ts.map +1 -0
  264. package/src/shade/renderer/grass/surface/chunk_grass_directory.js +112 -0
  265. package/src/shade/renderer/grass/surface/chunk_grass_slot.d.ts +27 -0
  266. package/src/shade/renderer/grass/surface/chunk_grass_slot.d.ts.map +1 -0
  267. package/src/shade/renderer/grass/surface/chunk_grass_slot.js +50 -0
  268. package/src/shade/renderer/grass/surface/chunk_grass_surface_frame.d.ts +21 -0
  269. package/src/shade/renderer/grass/surface/chunk_grass_surface_frame.d.ts.map +1 -0
  270. package/src/shade/renderer/grass/surface/chunk_grass_surface_frame.js +41 -0
  271. package/src/shade/renderer/grass/surface/chunk_grass_surface_window.d.ts +32 -0
  272. package/src/shade/renderer/grass/surface/chunk_grass_surface_window.d.ts.map +1 -0
  273. package/src/shade/renderer/grass/surface/chunk_grass_surface_window.js +136 -0
  274. package/src/shade/renderer/grass/surface/chunk_grass_surfel.d.ts +37 -0
  275. package/src/shade/renderer/grass/surface/chunk_grass_surfel.d.ts.map +1 -0
  276. package/src/shade/renderer/grass/surface/chunk_grass_surfel.js +85 -0
  277. package/src/shade/renderer/grass/surface/chunk_grass_tile.d.ts +25 -0
  278. package/src/shade/renderer/grass/surface/chunk_grass_tile.d.ts.map +1 -0
  279. package/src/shade/renderer/grass/surface/chunk_grass_tile.js +52 -0
  280. package/src/shade/renderer/grass/surface/shader_grass_directory_fill.d.ts +23 -0
  281. package/src/shade/renderer/grass/surface/shader_grass_directory_fill.d.ts.map +1 -0
  282. package/src/shade/renderer/grass/surface/shader_grass_directory_fill.js +87 -0
  283. package/src/shade/renderer/grass/surface/shader_grass_surface_bake.d.ts +43 -0
  284. package/src/shade/renderer/grass/surface/shader_grass_surface_bake.d.ts.map +1 -0
  285. package/src/shade/renderer/grass/surface/shader_grass_surface_bake.js +265 -0
  286. package/src/shade/renderer/grass/surface/shader_grass_surface_bake_command.d.ts +13 -0
  287. package/src/shade/renderer/grass/surface/shader_grass_surface_bake_command.d.ts.map +1 -0
  288. package/src/shade/renderer/grass/surface/shader_grass_surface_bake_command.js +49 -0
  289. package/src/shade/renderer/grass/surface/shader_grass_surface_invalidate.d.ts +62 -0
  290. package/src/shade/renderer/grass/surface/shader_grass_surface_invalidate.d.ts.map +1 -0
  291. package/src/shade/renderer/grass/surface/shader_grass_surface_invalidate.js +162 -0
  292. package/src/shade/renderer/grass/surface/shader_grass_surface_retire.d.ts +40 -0
  293. package/src/shade/renderer/grass/surface/shader_grass_surface_retire.d.ts.map +1 -0
  294. package/src/shade/renderer/grass/surface/shader_grass_surface_retire.js +155 -0
  295. package/src/shade/renderer/grass/surface/shader_grass_surface_schedule.d.ts +19 -0
  296. package/src/shade/renderer/grass/surface/shader_grass_surface_schedule.d.ts.map +1 -0
  297. package/src/shade/renderer/grass/surface/shader_grass_surface_schedule.js +58 -0
  298. package/src/shade/renderer/grass/surface/shader_grass_surface_want.d.ts +30 -0
  299. package/src/shade/renderer/grass/surface/shader_grass_surface_want.d.ts.map +1 -0
  300. package/src/shade/renderer/grass/surface/shader_grass_surface_want.js +251 -0
  301. package/src/shade/renderer/grass/surface/shader_grass_surface_window_count.d.ts +21 -0
  302. package/src/shade/renderer/grass/surface/shader_grass_surface_window_count.d.ts.map +1 -0
  303. package/src/shade/renderer/grass/surface/shader_grass_surface_window_count.js +75 -0
  304. package/src/shade/renderer/postprocess/eye/GPUCameraExposureManager.d.ts +35 -9
  305. package/src/shade/renderer/postprocess/eye/GPUCameraExposureManager.d.ts.map +1 -1
  306. package/src/shade/renderer/postprocess/eye/GPUCameraExposureManager.js +81 -11
  307. package/src/shade/renderer/postprocess/eye/shader_autoexposure_adapt.d.ts.map +1 -1
  308. package/src/shade/renderer/postprocess/eye/shader_autoexposure_adapt.js +4 -1
  309. package/src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.d.ts.map +1 -1
  310. package/src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.js +4 -23
  311. package/src/shade/renderer/postprocess/velocity/view_velocity_matrices.d.ts +12 -0
  312. package/src/shade/renderer/postprocess/velocity/view_velocity_matrices.d.ts.map +1 -0
  313. package/src/shade/renderer/postprocess/velocity/view_velocity_matrices.js +29 -0
  314. package/src/shade/renderer/rasterize/native/avboit/graph_rasterize_meshes_transparent_avboit.d.ts.map +1 -1
  315. package/src/shade/renderer/rasterize/native/avboit/graph_rasterize_meshes_transparent_avboit.js +22 -0
  316. package/src/shade/renderer/scene/GPUSceneContext.d.ts.map +1 -1
  317. package/src/shade/renderer/scene/GPUSceneContext.js +3 -0
  318. package/src/shade/renderer/scene/GRASS_SURFACE_PARAMS_STRUCT.d.ts +27 -0
  319. package/src/shade/renderer/scene/GRASS_SURFACE_PARAMS_STRUCT.d.ts.map +1 -0
  320. package/src/shade/renderer/scene/GRASS_SURFACE_PARAMS_STRUCT.js +38 -0
  321. package/src/shade/renderer/scene/MESH_GROUND_COVER_STRUCT.d.ts +28 -0
  322. package/src/shade/renderer/scene/MESH_GROUND_COVER_STRUCT.d.ts.map +1 -0
  323. package/src/shade/renderer/scene/MESH_GROUND_COVER_STRUCT.js +58 -0
  324. package/src/shade/renderer/scene/SCENE_DATABASE_SPEC.d.ts.map +1 -1
  325. package/src/shade/renderer/scene/SCENE_DATABASE_SPEC.js +8 -0
  326. package/src/shade/renderer/shader/chunk/color/conversion/chunk_CRM_REC709_AP1.d.ts +6 -0
  327. package/src/shade/renderer/shader/chunk/color/conversion/chunk_CRM_REC709_AP1.d.ts.map +1 -1
  328. package/src/shade/renderer/shader/chunk/color/conversion/chunk_CRM_REC709_AP1.js +7 -0
  329. package/src/shade/renderer/shader/chunk/color/grade/chunk_color_grade.d.ts +4 -4
  330. package/src/shade/renderer/shader/chunk/color/grade/chunk_color_grade.d.ts.map +1 -1
  331. package/src/shade/renderer/shader/chunk/color/grade/chunk_color_grade.js +86 -5
  332. package/src/shade/renderer/shader/chunk/color/tonemap/purkinje/chunk_apply_purkinje_shift.d.ts +65 -0
  333. package/src/shade/renderer/shader/chunk/color/tonemap/purkinje/chunk_apply_purkinje_shift.d.ts.map +1 -0
  334. package/src/shade/renderer/shader/chunk/color/tonemap/purkinje/chunk_apply_purkinje_shift.js +136 -0
  335. package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_nearest_among.d.ts +37 -0
  336. package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_nearest_among.d.ts.map +1 -0
  337. package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_nearest_among.js +148 -0
  338. package/src/shade/renderer/shader/chunk/sdf/chunk_shape_record_line_span.d.ts +20 -0
  339. package/src/shade/renderer/shader/chunk/sdf/chunk_shape_record_line_span.d.ts.map +1 -0
  340. package/src/shade/renderer/shader/chunk/sdf/chunk_shape_record_line_span.js +169 -0
  341. package/src/shade/renderer/texture/atlas/chunk_tile_atlas_slot_origin.d.ts +18 -0
  342. package/src/shade/renderer/texture/atlas/chunk_tile_atlas_slot_origin.d.ts.map +1 -1
  343. package/src/shade/renderer/texture/atlas/chunk_tile_atlas_slot_origin.js +28 -0
  344. package/src/shade/renderer/texture/atlas/tile_atlas_slot_shift.d.ts +13 -0
  345. package/src/shade/renderer/texture/atlas/tile_atlas_slot_shift.d.ts.map +1 -0
  346. package/src/shade/renderer/texture/atlas/tile_atlas_slot_shift.js +22 -0
  347. package/src/shade/renderer/water/GPUWaterRenderer.d.ts.map +1 -1
  348. package/src/shade/renderer/water/GPUWaterRenderer.js +4 -0
  349. package/src/shade/renderer/wind/GPUSceneWind.d.ts +52 -5
  350. package/src/shade/renderer/wind/GPUSceneWind.d.ts.map +1 -1
  351. package/src/shade/renderer/wind/GPUSceneWind.js +164 -8
  352. package/src/shade/renderer/wind/WIND_FIELD_UNIFORM.d.ts +3 -1
  353. package/src/shade/renderer/wind/WIND_FIELD_UNIFORM.d.ts.map +1 -1
  354. package/src/shade/renderer/wind/WIND_FIELD_UNIFORM.js +3 -1
  355. package/src/shade/renderer/wind/chunk_wind_field_sample_cascades.d.ts +2 -1
  356. package/src/shade/renderer/wind/chunk_wind_field_sample_cascades.d.ts.map +1 -1
  357. package/src/shade/renderer/wind/chunk_wind_field_sample_cascades.js +18 -13
  358. package/src/shade/renderer/wind/chunk_wind_field_sample_previous.d.ts +13 -0
  359. package/src/shade/renderer/wind/chunk_wind_field_sample_previous.d.ts.map +1 -0
  360. package/src/shade/renderer/wind/chunk_wind_field_sample_previous.js +23 -0
  361. package/src/shade/renderer/wind/chunk_wind_field_sample_uniform.d.ts +1 -0
  362. package/src/shade/renderer/wind/chunk_wind_field_sample_uniform.d.ts.map +1 -1
  363. package/src/shade/renderer/wind/chunk_wind_field_sample_uniform.js +6 -1
  364. package/src/shade/renderer/wind/wind_field_add_resources.d.ts +11 -0
  365. package/src/shade/renderer/wind/wind_field_add_resources.d.ts.map +1 -1
  366. package/src/shade/renderer/wind/wind_field_add_resources.js +15 -0
  367. package/src/shade/wgsl/emulator/WGSLJavaScriptCompiler.js +1 -1
  368. package/src/shade/wgsl/emulator/WGSLLanguageCore.d.ts.map +1 -1
  369. package/src/shade/wgsl/emulator/WGSLLanguageCore.js +2 -0
  370. package/src/shade/renderer/shader/chunk/color/tonemap/purkinjie/chunk_apply_purkinjie_shift.d.ts +0 -11
  371. package/src/shade/renderer/shader/chunk/color/tonemap/purkinjie/chunk_apply_purkinjie_shift.d.ts.map +0 -1
  372. package/src/shade/renderer/shader/chunk/color/tonemap/purkinjie/chunk_apply_purkinjie_shift.js +0 -56
@@ -1 +1 @@
1
- {"version":3,"file":"shader_autoexposure_adapt.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/postprocess/eye/shader_autoexposure_adapt.js"],"names":[],"mappings":"AASA,sDAsBE;AA+FF,sDAIG;6BAjI0B,mCAAmC;8BAElC,+BAA+B"}
1
+ {"version":3,"file":"shader_autoexposure_adapt.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/postprocess/eye/shader_autoexposure_adapt.js"],"names":[],"mappings":"AASA,sDAsBE;AAkGF,sDAIG;6BApI0B,mCAAmC;8BAElC,+BAA+B"}
@@ -41,6 +41,7 @@ resources.createGroup()
41
41
  .addUniform("previous", F32_CONTAINER_STRUCT)
42
42
  .addStorageBuffer("adapted", F32_CONTAINER_STRUCT, true)
43
43
  .addStorageBuffer("out_multiplier", F32_CONTAINER_STRUCT, true)
44
+ .addStorageBuffer("out_adaptation", F32_CONTAINER_STRUCT, true)
44
45
  ;
45
46
 
46
47
 
@@ -64,6 +65,7 @@ fn main(){
64
65
  */
65
66
  if (!(goal.value > 0.0)) {
66
67
  adapted.value = previous.value;
68
+ out_adaptation.value = previous.value;
67
69
 
68
70
  out_multiplier.value = (MIDDLE_GREY / current_linear) * exp2(settings.compensation);
69
71
 
@@ -113,7 +115,8 @@ fn main(){
113
115
  // convert back to linear space
114
116
  let new_linear = exp2(new_ev);
115
117
  adapted.value = new_linear;
116
-
118
+ out_adaptation.value = new_linear;
119
+
117
120
  // apply final transforms
118
121
 
119
122
  let shifted = MIDDLE_GREY / adapted.value;
@@ -1 +1 @@
1
- {"version":3,"file":"graph_add_per_object_velocity.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.js"],"names":[],"mappings":"AAkRA;;;;GAIG;AACH,+DAFW,eAAe,QAIzB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH;IAhB4B,KAAK;IACT,aAAa,EAA1B,MAAM;IACO,kBAAkB,EAA/B,MAAM;IACO,uBAAuB,EAApC,MAAM;IACO,qBAAqB,EAAlC,MAAM;IACO,uBAAuB,EAApC,MAAM;IACO,mBAAmB,EAAhC,MAAM;IACO,4BAA4B,EAAzC,MAAM;IACO,qBAAqB,EAAlC,MAAM;IACQ,eAAe,EAA7B,OAAO;IAGQ,UAAU,EAAzB,MAAM,EAAE;IACa,IAAI;IACvB,MAAM,CA8ElB;8BAhXY,OAAO,6CAA6C,EAAE,eAAe"}
1
+ {"version":3,"file":"graph_add_per_object_velocity.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.js"],"names":[],"mappings":"AA8QA;;;;GAIG;AACH,+DAFW,eAAe,QAIzB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH;IAhB4B,KAAK;IACT,aAAa,EAA1B,MAAM;IACO,kBAAkB,EAA/B,MAAM;IACO,uBAAuB,EAApC,MAAM;IACO,qBAAqB,EAAlC,MAAM;IACO,uBAAuB,EAApC,MAAM;IACO,mBAAmB,EAAhC,MAAM;IACO,4BAA4B,EAAzC,MAAM;IACO,qBAAqB,EAAlC,MAAM;IACQ,eAAe,EAA7B,OAAO;IAGQ,UAAU,EAAzB,MAAM,EAAE;IACa,IAAI;IACvB,MAAM,CA+DlB;8BA9VY,OAAO,6CAA6C,EAAE,eAAe"}
@@ -1,6 +1,4 @@
1
1
  import { assert } from "../../../../core/assert.js";
2
- import { m4_invert } from "../../../../core/geom/3d/mat4/m4_invert.js";
3
- import { m4_multiply } from "../../../../core/geom/3d/mat4/m4_multiply.js";
4
2
  import { mat4x4f, u32 } from "../../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
5
3
  import { WebGPUArray } from "../../shader/type/WebGPUArray.js";
6
4
  import { U32_CONTAINER_STRUCT } from "../../shader/type/U32_CONTAINER_STRUCT.js";
@@ -33,6 +31,7 @@ import { ImageShader } from "../../shader/ImageShader.js";
33
31
  import { ShaderResourceSetDescriptor } from "../../shader/resource/ShaderResourceSetDescriptor.js";
34
32
  import { ShaderDescriptor } from "../../shader/ShaderDescriptor.js";
35
33
  import { construct_pixel_reprojection_matrix } from "./construct_pixel_reprojection_matrix.js";
34
+ import { view_velocity_matrices } from "./view_velocity_matrices.js";
36
35
  import {
37
36
  construct_reprojection_matrix_rotation_only,
38
37
  } from "./construct_reprojection_matrix.js";
@@ -266,9 +265,6 @@ const shader = new ImageShader({
266
265
  }]
267
266
  });
268
267
 
269
- const scratch_unjit_view_proj_curr_f64 = new Float64Array(16);
270
- const scratch_unjit_view_proj_prev_f64 = new Float64Array(16);
271
- const scratch_unjit_inv_view_proj_curr_f64 = new Float64Array(16);
272
268
  const scratch_unjit_view_proj_prev_f32 = new Float32Array(16);
273
269
  const scratch_unjit_inv_view_proj_curr_f32 = new Float32Array(16);
274
270
 
@@ -359,24 +355,9 @@ export function graph_add_per_object_velocity({
359
355
  const current_camera = view.camera.camera;
360
356
  const previous_camera = view.gpu_previous_camera_state.camera;
361
357
 
362
- // Un-jittered current-frame inverse view-projection (for
363
- // unprojecting depth → world without folding in jitter shift).
364
- m4_multiply(
365
- scratch_unjit_view_proj_curr_f64,
366
- current_camera.projection_matrix,
367
- current_camera.view_matrix
368
- );
369
- m4_invert(scratch_unjit_inv_view_proj_curr_f64, scratch_unjit_view_proj_curr_f64);
370
-
371
- // Un-jittered previous-frame view-projection.
372
- m4_multiply(
373
- scratch_unjit_view_proj_prev_f64,
374
- previous_camera.projection_matrix,
375
- previous_camera.view_matrix
376
- );
377
-
378
- scratch_unjit_inv_view_proj_curr_f32.set(scratch_unjit_inv_view_proj_curr_f64);
379
- scratch_unjit_view_proj_prev_f32.set(scratch_unjit_view_proj_prev_f64);
358
+ // Un-jittered: this frame's inverse view-projection (depth → world without the jitter's shift)
359
+ // and last frame's view-projection.
360
+ view_velocity_matrices(view, scratch_unjit_inv_view_proj_curr_f32, scratch_unjit_view_proj_prev_f32);
380
361
 
381
362
  // Background rotation-only reprojection (pixel space).
382
363
  const reprojection_matrix_64 = new Float64Array(16);
@@ -0,0 +1,12 @@
1
+ /**
2
+ * The two matrices a pass needs to say how far a pixel's surface moved on screen: this frame's inverse
3
+ * view-projection, to take a pixel and its depth to the world, and last frame's view-projection, to take
4
+ * where that point was back to the screen. Both are free of the sub-pixel jitter, as the velocity buffer
5
+ * is: a still surface has no velocity however the frame is jittered.
6
+ *
7
+ * @param {GPUViewContext} view
8
+ * @param {Float32Array} inverse_view_projection receives this frame's, 16 elements
9
+ * @param {Float32Array} view_projection_previous receives last frame's, 16 elements
10
+ */
11
+ export function view_velocity_matrices(view: GPUViewContext, inverse_view_projection: Float32Array, view_projection_previous: Float32Array): void;
12
+ //# sourceMappingURL=view_velocity_matrices.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view_velocity_matrices.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/postprocess/velocity/view_velocity_matrices.js"],"names":[],"mappings":"AAMA;;;;;;;;;GASG;AACH,sFAHW,YAAY,4BACZ,YAAY,QActB"}
@@ -0,0 +1,29 @@
1
+ import { m4_invert } from "../../../../core/geom/3d/mat4/m4_invert.js";
2
+ import { m4_multiply } from "../../../../core/geom/3d/mat4/m4_multiply.js";
3
+
4
+ const scratch_view_projection = new Float64Array(16);
5
+ const scratch_inverse = new Float64Array(16);
6
+
7
+ /**
8
+ * The two matrices a pass needs to say how far a pixel's surface moved on screen: this frame's inverse
9
+ * view-projection, to take a pixel and its depth to the world, and last frame's view-projection, to take
10
+ * where that point was back to the screen. Both are free of the sub-pixel jitter, as the velocity buffer
11
+ * is: a still surface has no velocity however the frame is jittered.
12
+ *
13
+ * @param {GPUViewContext} view
14
+ * @param {Float32Array} inverse_view_projection receives this frame's, 16 elements
15
+ * @param {Float32Array} view_projection_previous receives last frame's, 16 elements
16
+ */
17
+ export function view_velocity_matrices(view, inverse_view_projection, view_projection_previous) {
18
+ const current = view.camera.camera;
19
+ const previous = view.gpu_previous_camera_state.camera;
20
+
21
+ m4_multiply(scratch_view_projection, current.projection_matrix, current.view_matrix);
22
+ m4_invert(scratch_inverse, scratch_view_projection);
23
+
24
+ inverse_view_projection.set(scratch_inverse);
25
+
26
+ m4_multiply(scratch_view_projection, previous.projection_matrix, previous.view_matrix);
27
+
28
+ view_projection_previous.set(scratch_view_projection);
29
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"graph_rasterize_meshes_transparent_avboit.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/rasterize/native/avboit/graph_rasterize_meshes_transparent_avboit.js"],"names":[],"mappings":"AA4DA;;;;;GAKG;AACH,oDAHW,UAAU,MAAM,CAAC,GACf,MAAM,EAAE,CAOpB;AAED;;;;;;;;;;;;GAYG;AACH;IAT+B,KAAK;IACA,KAAK;IACd,MAAM,EAAtB,MAAM;IACqB,kBAAkB,EAA7C,UAAU,MAAM,CAAC;IACD,kBAAkB,EAAlC,MAAM;IACU,wBAAwB,EAAxC,MAAM;IACW,SAAS,GAA1B,MAAM;IACJ,MAAM,CA4DlB;AAED;;;;;;;;;;GAUG;AACH;IAP+B,KAAK;IACT,SAAS,EAAzB,MAAM;IACY,gBAAgB,EAAlC,MAAM,EAAE;IACmB,kBAAkB,EAA7C,UAAU,MAAM,CAAC;IACQ,MAAM,GAA/B,cAAc;IACZ,MAAM,CAuDlB;AAED;;;;;;;;;;;;;;;GAeG;AACH,6KAFa;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAC,CAiJjE;AAED;;;;;;;;;;GAUG;AACH;IAP+B,KAAK;IACT,IAAI,EAApB,MAAM;IACU,UAAU,EAA1B,MAAM;IACU,QAAQ,EAAxB,MAAM;IACY,gBAAgB,EAAlC,MAAM,EAAE;IACN,MAAM,CAoClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,sUAFa;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAC,CA4M7D;AAED;;;;;;;;GAQG;AACH,+EAHW,UAAU,MAAM,CAAC,GACf;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAC,CAe/E;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH;IA3B+B,KAAK;IACT,OAAO,EAAvB,MAAM;IACkB,QAAQ;IACd,QAAQ,EAA1B,MAAM,EAAE;IACQ,aAAa,EAA7B,MAAM;IACU,aAAa,EAA7B,MAAM;IACuB,MAAM;IACnB,wBAAwB,EAAxC,MAAM;IACU,oBAAoB,EAApC,MAAM;IACU,kBAAkB,EAAlC,MAAM;IACU,eAAe,EAA/B,MAAM;IACU,eAAe,EAA/B,MAAM;IACU,oBAAoB,EAApC,MAAM;IAC6B,sBAAsB,EAAzD;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAC;IAGC,eAAe,GAAzC,eAAe;IAGsF,MAAM,EAA3G,OAAO,iEAAiE,EAAE,iBAAiB;IAGlE,MAAM,GAA/B,cAAc;IACiD,aAAa,GAA5E,OAAO,wBAAwB,EAAE,iBAAiB,EAAE;IAElD,MAAM,CAsTlB;+BAz9B8B,qBAAqB;gCAIpB,6CAA6C"}
1
+ {"version":3,"file":"graph_rasterize_meshes_transparent_avboit.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/rasterize/native/avboit/graph_rasterize_meshes_transparent_avboit.js"],"names":[],"mappings":"AA4DA;;;;;GAKG;AACH,oDAHW,UAAU,MAAM,CAAC,GACf,MAAM,EAAE,CAOpB;AAED;;;;;;;;;;;;GAYG;AACH;IAT+B,KAAK;IACA,KAAK;IACd,MAAM,EAAtB,MAAM;IACqB,kBAAkB,EAA7C,UAAU,MAAM,CAAC;IACD,kBAAkB,EAAlC,MAAM;IACU,wBAAwB,EAAxC,MAAM;IACW,SAAS,GAA1B,MAAM;IACJ,MAAM,CA4DlB;AAED;;;;;;;;;;GAUG;AACH;IAP+B,KAAK;IACT,SAAS,EAAzB,MAAM;IACY,gBAAgB,EAAlC,MAAM,EAAE;IACmB,kBAAkB,EAA7C,UAAU,MAAM,CAAC;IACQ,MAAM,GAA/B,cAAc;IACZ,MAAM,CAuDlB;AAED;;;;;;;;;;;;;;;GAeG;AACH,6KAFa;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAC,CAiJjE;AAED;;;;;;;;;;GAUG;AACH;IAP+B,KAAK;IACT,IAAI,EAApB,MAAM;IACU,UAAU,EAA1B,MAAM;IACU,QAAQ,EAAxB,MAAM;IACY,gBAAgB,EAAlC,MAAM,EAAE;IACN,MAAM,CAoClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,sUAFa;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAC,CA4M7D;AAED;;;;;;;;GAQG;AACH,+EAHW,UAAU,MAAM,CAAC,GACf;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAC,CAe/E;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH;IA3B+B,KAAK;IACT,OAAO,EAAvB,MAAM;IACkB,QAAQ;IACd,QAAQ,EAA1B,MAAM,EAAE;IACQ,aAAa,EAA7B,MAAM;IACU,aAAa,EAA7B,MAAM;IACuB,MAAM;IACnB,wBAAwB,EAAxC,MAAM;IACU,oBAAoB,EAApC,MAAM;IACU,kBAAkB,EAAlC,MAAM;IACU,eAAe,EAA/B,MAAM;IACU,eAAe,EAA/B,MAAM;IACU,oBAAoB,EAApC,MAAM;IAC6B,sBAAsB,EAAzD;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAC;IAGC,eAAe,GAAzC,eAAe;IAGsF,MAAM,EAA3G,OAAO,iEAAiE,EAAE,iBAAiB;IAGlE,MAAM,GAA/B,cAAc;IACiD,aAAa,GAA5E,OAAO,wBAAwB,EAAE,iBAAiB,EAAE;IAElD,MAAM,CA4UlB;+BA/+B8B,qBAAqB;gCAIpB,6CAA6C"}
@@ -867,6 +867,28 @@ export function graph_rasterize_meshes_transparent_avboit({
867
867
  label: `${view_ctx.label}/AVBOIT-double`,
868
868
  });
869
869
 
870
+ // The meshes' fragments pick the probes around them, which no pixel of the G-buffer asked for: their meshlets
871
+ // ask, for the frame after. A bucket of no material lists none.
872
+ if (material_count_front > 0) {
873
+ probes.graph_want_meshlets({
874
+ graph,
875
+ scene: scene_ctx,
876
+ camera: gr_camera,
877
+ meshlet_collection: prep_front.meshlet_collection,
878
+ meshlet_iterator_command: prep_front.meshlet_iterator_command,
879
+ });
880
+ }
881
+
882
+ if (material_count_double > 0) {
883
+ probes.graph_want_meshlets({
884
+ graph,
885
+ scene: scene_ctx,
886
+ camera: gr_camera,
887
+ meshlet_collection: prep_double.meshlet_collection,
888
+ meshlet_iterator_command: prep_double.meshlet_iterator_command,
889
+ });
890
+ }
891
+
870
892
  // Occupancy and warp
871
893
  // ======
872
894
 
@@ -1 +1 @@
1
- {"version":3,"file":"GPUSceneContext.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/scene/GPUSceneContext.js"],"names":[],"mappings":"AA4EA;;;;;;;;;GASG;AACH;IAEI;;;;;;;OAOG;IACH,iCAFW,eAAe,QASzB;IA4KD;;;;OAIG;IACH,sBAHW,eAAe,SACf,KAAK,EAyCf;IAtND;;;OAGG;IACH,aAFU,MAAM,CAEE;IAElB;;OAEG;IACH,YAFU,kBAAkB,CAEjB;IAEX;;OAEG;IACH,WAFU,kBAAkB,CAElB;IAGV;;OAEG;IACH,sBAFU,cAAc,CAEH;IASrB;;;OAGG;IACH,mBAEC;IAOD,uCAEC;IAOD;;;;;OAKG;IACH,yBAEC;IAUD;;;;;OAKG;IACH,kBAEC;IAQD;;;OAGG;IACH,iCAEC;IAOD;;;OAGG;IACH,8CAEC;IAOD;;;OAGG;IACH,8CAEC;IA2ID;;OAEG;IACH,kDAEC;IAED;;OAEG;IACH,gDAEC;IAED;;OAEG;IACH,kDAEC;IAED;;OAEG;IACH,+CAEC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH;QAH0C,SAAS,GAAxC,oBAAoB;QAClB,yBAAyB,CA4DrC;IAED;;OAEG;IACH,6CAEC;IAYD;;;;;OAKG;IACH,gEAEC;IAED;;;OAGG;IACH,kCAEC;IAED;;;;;OAKG;IACH,uCAEC;IAED;;;;;;;;;;;OAWG;IACH,uCAUC;IAED,+BAUC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,yBAEC;IAED;;;;;OAKG;IACH,sCAMC;IAOD;;;;;;;OAOG;IACH,8EAEC;IA6BD;;;;;OAKG;IACH,cAsEC;IAED;;;;;OAKG;IACH,YAFW,eAAe,QAyBzB;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,cAHW,sBAAsB,cACtB,MAAM,QAuBhB;IAUD;;;;;;;;;;;OAWG;IACH,oBAHW,UAAU,GACR,MAAM,CAQlB;IAoCD;;;;;;;OAOG;IACH,gBAuBC;IAwCL;;;OAGG;IACH,4BAFU,OAAO,CAE0B;;CAN1C;8BAl3BY,OAAO,0CAA0C,EAAE,eAAe;8BAClE,OAAO,uBAAuB,EAAE,eAAe;iCAC/C,OAAO,mCAAmC,EAAE,kBAAkB;iCAC9D,OAAO,mCAAmC,EAAE,kBAAkB;4BAC9D,OAAO,8BAA8B,EAAE,aAAa;8BACpD,OAAO,iDAAiD,EAAE,eAAe;yBACzE,OAAO,2DAA2D,EAAE,UAAU;+BA5B5D,iDAAiD;sBAM1D,YAAY;oCAFE,uCAAuC;6BAC9C,yBAAyB;uBAH/B,yBAAyB;mCACb,gCAAgC;oCAF/B,mDAAmD;kDAMrC,wCAAwC;0CAlBhD,0DAA0D;8BAItE,8CAA8C;iCAF3C,iDAAiD;+BAInD,2CAA2C;qCADrC,qDAAqD;oCAItD,qCAAqC;4BAC7C,gCAAgC;uCASrB,iDAAiD;6BAQ3D,wBAAwB;wCADb,mCAAmC;uCAlBpC,wCAAwC"}
1
+ {"version":3,"file":"GPUSceneContext.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/scene/GPUSceneContext.js"],"names":[],"mappings":"AA4EA;;;;;;;;;GASG;AACH;IAEI;;;;;;;OAOG;IACH,iCAFW,eAAe,QASzB;IA4KD;;;;OAIG;IACH,sBAHW,eAAe,SACf,KAAK,EAyCf;IAtND;;;OAGG;IACH,aAFU,MAAM,CAEE;IAElB;;OAEG;IACH,YAFU,kBAAkB,CAEjB;IAEX;;OAEG;IACH,WAFU,kBAAkB,CAElB;IAGV;;OAEG;IACH,sBAFU,cAAc,CAEH;IASrB;;;OAGG;IACH,mBAEC;IAOD,uCAEC;IAOD;;;;;OAKG;IACH,yBAEC;IAUD;;;;;OAKG;IACH,kBAEC;IAQD;;;OAGG;IACH,iCAEC;IAOD;;;OAGG;IACH,8CAEC;IAOD;;;OAGG;IACH,8CAEC;IA2ID;;OAEG;IACH,kDAEC;IAED;;OAEG;IACH,gDAEC;IAED;;OAEG;IACH,kDAEC;IAED;;OAEG;IACH,+CAEC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH;QAH0C,SAAS,GAAxC,oBAAoB;QAClB,yBAAyB,CA4DrC;IAED;;OAEG;IACH,6CAEC;IAYD;;;;;OAKG;IACH,gEAEC;IAED;;;OAGG;IACH,kCAEC;IAED;;;;;OAKG;IACH,uCAEC;IAED;;;;;;;;;;;OAWG;IACH,uCAUC;IAED,+BAUC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,yBAEC;IAED;;;;;OAKG;IACH,sCAMC;IAOD;;;;;;;OAOG;IACH,8EAEC;IA6BD;;;;;OAKG;IACH,cAsEC;IAED;;;;;OAKG;IACH,YAFW,eAAe,QA4BzB;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,cAHW,sBAAsB,cACtB,MAAM,QAuBhB;IAUD;;;;;;;;;;;OAWG;IACH,oBAHW,UAAU,GACR,MAAM,CAQlB;IAoCD;;;;;;;OAOG;IACH,gBAuBC;IAwCL;;;OAGG;IACH,4BAFU,OAAO,CAE0B;;CAN1C;8BAr3BY,OAAO,0CAA0C,EAAE,eAAe;8BAClE,OAAO,uBAAuB,EAAE,eAAe;iCAC/C,OAAO,mCAAmC,EAAE,kBAAkB;iCAC9D,OAAO,mCAAmC,EAAE,kBAAkB;4BAC9D,OAAO,8BAA8B,EAAE,aAAa;8BACpD,OAAO,iDAAiD,EAAE,eAAe;yBACzE,OAAO,2DAA2D,EAAE,UAAU;+BA5B5D,iDAAiD;sBAM1D,YAAY;oCAFE,uCAAuC;6BAC9C,yBAAyB;uBAH/B,yBAAyB;mCACb,gCAAgC;oCAF/B,mDAAmD;kDAMrC,wCAAwC;0CAlBhD,0DAA0D;8BAItE,8CAA8C;iCAF3C,iDAAiD;+BAInD,2CAA2C;qCADrC,qDAAqD;oCAItD,qCAAqC;4BAC7C,gCAAgC;uCASrB,iDAAiD;6BAQ3D,wBAAwB;wCADb,mCAAmC;uCAlBpC,wCAAwC"}
@@ -723,6 +723,9 @@ export class GPUSceneContext {
723
723
  this.#light_probe_volume.update();
724
724
  this.#lights.update(ctx);
725
725
  this.#volumetrics.update(ctx, 0);
726
+
727
+ // what the frame before read is this frame's history; producers write after this
728
+ this.#wind.advance_frame();
726
729
  this.#wind.update();
727
730
 
728
731
  // Per-frame animation database flush — picks up any new clips,
@@ -0,0 +1,27 @@
1
+ /**
2
+ * The `lattice_bits` of a surface whose densest species has `density` blades a square metre, on surfels
3
+ * `finest_spacing` apart: the least whole number of doublings of a surfel's side that reaches the density.
4
+ *
5
+ * @param {number} density blades a square metre, above zero
6
+ * @param {number} finest_spacing metres
7
+ * @returns {number}
8
+ */
9
+ export function grass_surface_lattice_bits(density: number, finest_spacing: number): number;
10
+ /**
11
+ * What grows on a grass surface, taken over every species its members grow: a record of the scene
12
+ * database's `grass_surface_params` table, at the surface's own `transforms` row. A row nothing has written
13
+ * reads as zeros, a surface on which nothing grows.
14
+ *
15
+ * - `lattice_bits`: the surface's blade lattice has `2^lattice_bits` points along a side of a finest
16
+ * surfel's square, the fewest that make the lattice as dense as the densest species.
17
+ * - `density`: the densest species' blades in a square metre.
18
+ * - `blade_length`, `blade_length_min`: the longest and the shortest species' blade, metres.
19
+ * - `blade_width_min`: the narrowest species' blade, metres.
20
+ * - `cover`: the greatest product of a species' density and its blade's width, a metre of blade a square
21
+ * metre of ground.
22
+ *
23
+ * @type {WebGPUStruct}
24
+ */
25
+ export const GRASS_SURFACE_PARAMS_STRUCT: WebGPUStruct;
26
+ import { WebGPUStruct } from "../shader/type/WebGPUStruct.js";
27
+ //# sourceMappingURL=GRASS_SURFACE_PARAMS_STRUCT.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GRASS_SURFACE_PARAMS_STRUCT.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/scene/GRASS_SURFACE_PARAMS_STRUCT.js"],"names":[],"mappings":"AA2BA;;;;;;;GAOG;AACH,oDAJW,MAAM,kBACN,MAAM,GACJ,MAAM,CAIlB;AAlCD;;;;;;;;;;;;;;GAcG;AACH,0CAFU,YAAY,CASU;6BAxBH,gCAAgC"}
@@ -0,0 +1,38 @@
1
+ import { f32, u32 } from "../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
2
+ import { WebGPUStruct } from "../shader/type/WebGPUStruct.js";
3
+
4
+ /**
5
+ * What grows on a grass surface, taken over every species its members grow: a record of the scene
6
+ * database's `grass_surface_params` table, at the surface's own `transforms` row. A row nothing has written
7
+ * reads as zeros, a surface on which nothing grows.
8
+ *
9
+ * - `lattice_bits`: the surface's blade lattice has `2^lattice_bits` points along a side of a finest
10
+ * surfel's square, the fewest that make the lattice as dense as the densest species.
11
+ * - `density`: the densest species' blades in a square metre.
12
+ * - `blade_length`, `blade_length_min`: the longest and the shortest species' blade, metres.
13
+ * - `blade_width_min`: the narrowest species' blade, metres.
14
+ * - `cover`: the greatest product of a species' density and its blade's width, a metre of blade a square
15
+ * metre of ground.
16
+ *
17
+ * @type {WebGPUStruct}
18
+ */
19
+ export const GRASS_SURFACE_PARAMS_STRUCT = WebGPUStruct.from({
20
+ lattice_bits: u32,
21
+ density: f32,
22
+ blade_length: f32,
23
+ blade_length_min: f32,
24
+ blade_width_min: f32,
25
+ cover: f32,
26
+ }, "GrassSurfaceParams").pack();
27
+
28
+ /**
29
+ * The `lattice_bits` of a surface whose densest species has `density` blades a square metre, on surfels
30
+ * `finest_spacing` apart: the least whole number of doublings of a surfel's side that reaches the density.
31
+ *
32
+ * @param {number} density blades a square metre, above zero
33
+ * @param {number} finest_spacing metres
34
+ * @returns {number}
35
+ */
36
+ export function grass_surface_lattice_bits(density, finest_spacing) {
37
+ return Math.max(0, Math.ceil(Math.log2(finest_spacing * Math.sqrt(density)) - 1e-9));
38
+ }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * A mesh row's membership of a grass surface: which surface it is ground of, what a column of that
3
+ * surface traces to find it, and what grows on it.
4
+ *
5
+ * A record of the scene database's `mesh_ground_covers` table, which shares the `meshes` table's index
6
+ * space: a row's ground cover is at the row's own index.
7
+ *
8
+ * **`flags` says what holds.** A row nothing has written, and a row on a page the table has never
9
+ * allocated, both read as a record of zeros, so zero flags is "not ground of any surface" and the other
10
+ * fields are read only when {@link MESH_GROUND_COVER_FLAG_MEMBER} is set.
11
+ */
12
+ export const MESH_GROUND_COVER_STRUCT: WebGPUStruct;
13
+ /**
14
+ * The row is a member of the surface its record names. Its faces are ground of that surface: they
15
+ * hold surfels, and they hide the ground of other members under them.
16
+ *
17
+ * @type {number}
18
+ */
19
+ export const MESH_GROUND_COVER_FLAG_MEMBER: number;
20
+ /**
21
+ * Something grows on the member, and its record's `species` holds. A member without it only hides
22
+ * ground.
23
+ *
24
+ * @type {number}
25
+ */
26
+ export const MESH_GROUND_COVER_FLAG_GROWS: number;
27
+ import { WebGPUStruct } from "../shader/type/WebGPUStruct.js";
28
+ //# sourceMappingURL=MESH_GROUND_COVER_STRUCT.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MESH_GROUND_COVER_STRUCT.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/scene/MESH_GROUND_COVER_STRUCT.js"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AACH,oDA2B6B;AAE7B;;;;;GAKG;AACH,4CAFU,MAAM,CAE+B;AAE/C;;;;;GAKG;AACH,2CAFU,MAAM,CAE8B;6BAxDjB,gCAAgC"}
@@ -0,0 +1,58 @@
1
+ import { f32, u32 } from "../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
2
+ import { WebGPUStruct } from "../shader/type/WebGPUStruct.js";
3
+
4
+ /**
5
+ * A mesh row's membership of a grass surface: which surface it is ground of, what a column of that
6
+ * surface traces to find it, and what grows on it.
7
+ *
8
+ * A record of the scene database's `mesh_ground_covers` table, which shares the `meshes` table's index
9
+ * space: a row's ground cover is at the row's own index.
10
+ *
11
+ * **`flags` says what holds.** A row nothing has written, and a row on a page the table has never
12
+ * allocated, both read as a record of zeros, so zero flags is "not ground of any surface" and the other
13
+ * fields are read only when {@link MESH_GROUND_COVER_FLAG_MEMBER} is set.
14
+ */
15
+ export const MESH_GROUND_COVER_STRUCT = WebGPUStruct.from({
16
+ /**
17
+ * {@link MESH_GROUND_COVER_FLAG_MEMBER}, {@link MESH_GROUND_COVER_FLAG_GROWS}.
18
+ */
19
+ flags: u32,
20
+
21
+ /**
22
+ * The `transforms` row of the grass surface the mesh is a member of: the surface's frame.
23
+ */
24
+ surface: u32,
25
+
26
+ /**
27
+ * The geometry a column traces for this member. The mesh's own, or a stand-in's for a geometry
28
+ * that cannot be ray traced itself.
29
+ */
30
+ geometry: u32,
31
+
32
+ /**
33
+ * Index of the species that grows on the member. Read only when
34
+ * {@link MESH_GROUND_COVER_FLAG_GROWS} is set.
35
+ */
36
+ species: u32,
37
+
38
+ /**
39
+ * Scale on the member's painted density, 0 to 1.
40
+ */
41
+ density: f32,
42
+ }, "MeshGroundCover").pack();
43
+
44
+ /**
45
+ * The row is a member of the surface its record names. Its faces are ground of that surface: they
46
+ * hold surfels, and they hide the ground of other members under them.
47
+ *
48
+ * @type {number}
49
+ */
50
+ export const MESH_GROUND_COVER_FLAG_MEMBER = 1;
51
+
52
+ /**
53
+ * Something grows on the member, and its record's `species` holds. A member without it only hides
54
+ * ground.
55
+ *
56
+ * @type {number}
57
+ */
58
+ export const MESH_GROUND_COVER_FLAG_GROWS = 2;
@@ -1 +1 @@
1
- {"version":3,"file":"SCENE_DATABASE_SPEC.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/scene/SCENE_DATABASE_SPEC.js"],"names":[],"mappings":"AAQA;;;;;GAKG;AACH,wDAYG;sCA1BmC,0CAA0C"}
1
+ {"version":3,"file":"SCENE_DATABASE_SPEC.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/scene/SCENE_DATABASE_SPEC.js"],"names":[],"mappings":"AAUA;;;;;GAKG;AACH,wDAkBG;sCAlCmC,0CAA0C"}
@@ -1,4 +1,6 @@
1
1
  import { GPUDatabaseDefinition } from "../buffer/table/GPUDatabaseDefinition.js";
2
+ import { GRASS_SURFACE_PARAMS_STRUCT } from "./GRASS_SURFACE_PARAMS_STRUCT.js";
3
+ import { MESH_GROUND_COVER_STRUCT } from "./MESH_GROUND_COVER_STRUCT.js";
2
4
  import { MESH_INSTANCE_METADATA_STRUCT } from "./MESH_INSTANCE_METADATA_STRUCT.js";
3
5
  import { MESH_OUTLINE_STRUCT } from "./MESH_OUTLINE_STRUCT.js";
4
6
  import { NODE3D_STRUCT } from "./NODE3D_STRUCT.js";
@@ -24,6 +26,12 @@ export const SCENE_DATABASE_SPEC = GPUDatabaseDefinition.from({
24
26
  // which outline specs a mesh row is drawn with, at the row's own index; written by OutlineSystem
25
27
  // when a row's specs change, read by the outline classify pass
26
28
  mesh_outlines: MESH_OUTLINE_STRUCT,
29
+ // which grass surface a mesh row is ground of, at the row's own index; written by GrassSurfaceSystem
30
+ // when a membership changes, read by the grass surface bake and by the blades that stand on it
31
+ mesh_ground_covers: MESH_GROUND_COVER_STRUCT,
32
+ // what grows on a grass surface, at the surface's own row; written by GrassSurfaceSystem, read by
33
+ // the passes that count and make its blades
34
+ grass_surface_params: GRASS_SURFACE_PARAMS_STRUCT,
27
35
  });
28
36
 
29
37
  SCENE_DATABASE_SPEC.add_link({ table: 'water_bodies', field: 'node', target_database: SCENE_DATABASE_SPEC,
@@ -9,6 +9,12 @@ export const M3_REC709_TO_AP1: Float64Array;
9
9
  * @type {Float64Array}
10
10
  */
11
11
  export const M3_AP1_TO_REC709: Float64Array;
12
+ /**
13
+ * AP1's contribution of each channel to Y, the row Unreal calls `AP1_RGB2Y`: the shader's `AP1_LUMINANCE`, for code that
14
+ * measures AP1 luma on the CPU.
15
+ * @type {Float64Array}
16
+ */
17
+ export const AP1_LUMINANCE: Float64Array;
12
18
  /**
13
19
  * - `CRM_FROM_REC709_TO_AP1` and `CRM_FROM_AP1_TO_REC709`: {@link M3_REC709_TO_AP1} and its inverse.
14
20
  * - `AP1_LUMINANCE`: AP1's contribution of each channel to Y, the row Unreal calls `AP1_RGB2Y`.
@@ -1 +1 @@
1
- {"version":3,"file":"chunk_CRM_REC709_AP1.d.ts","sourceRoot":"","sources":["../../../../../../../../src/shade/renderer/shader/chunk/color/conversion/chunk_CRM_REC709_AP1.js"],"names":[],"mappings":"AAqBA;;;;GAIG;AACH,+BAFU,YAAY,CAE8B;AAIpD;;;GAGG;AACH,+BAFU,YAAY,CAE8B;AAYpD;;;;;;;GAOG;AACH,mCAFU,SAAS,CASjB;0BAzDwB,gCAAgC"}
1
+ {"version":3,"file":"chunk_CRM_REC709_AP1.d.ts","sourceRoot":"","sources":["../../../../../../../../src/shade/renderer/shader/chunk/color/conversion/chunk_CRM_REC709_AP1.js"],"names":[],"mappings":"AAqBA;;;;GAIG;AACH,+BAFU,YAAY,CAE8B;AAIpD;;;GAGG;AACH,+BAFU,YAAY,CAE8B;AAGpD;;;;GAIG;AACH,4BAFU,YAAY,CAEoE;AAW1F;;;;;;;GAOG;AACH,mCAFU,SAAS,CASjB;0BAhEwB,gCAAgC"}
@@ -35,6 +35,13 @@ m3_multiply(M3_REC709_TO_AP1, XYZ_TO_AP1, M3_REC709_TO_AP1);
35
35
  export const M3_AP1_TO_REC709 = new Float64Array(9);
36
36
  m3_invert(M3_AP1_TO_REC709, M3_REC709_TO_AP1);
37
37
 
38
+ /**
39
+ * AP1's contribution of each channel to Y, the row Unreal calls `AP1_RGB2Y`: the shader's `AP1_LUMINANCE`, for code that
40
+ * measures AP1 luma on the CPU.
41
+ * @type {Float64Array}
42
+ */
43
+ export const AP1_LUMINANCE = Float64Array.of(AP1_TO_XYZ[3], AP1_TO_XYZ[4], AP1_TO_XYZ[5]);
44
+
38
45
  /**
39
46
  * @param {Float64Array} m row-major
40
47
  * @returns {string} a WGSL `mat3x3<f32>` constructor, column by column
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * `color_grade(scene, grade, keys)`: exposed scene-linear Rec.709 through a {@link ColorGrade}, white balance, then
3
- * primaries, then hue curves, to Rec.709 again, not negative. `grade` is the grade's {@link COLOR_GRADE_STRUCT} and
4
- * `keys` the curves' keyframes. See `ColorGrade` for what each stage does.
3
+ * primaries, then saturation against luma, then hue curves, to Rec.709 again, not negative. `grade` is the grade's
4
+ * {@link COLOR_GRADE_STRUCT} and `keys` the curves' keyframes. See `ColorGrade` for what each stage does.
5
5
  *
6
- * Also defines each stage on its own: `color_grade_primaries(ap1, grade)` and
7
- * `color_grade_hue_curves(color, counts, keys)`.
6
+ * Also defines each stage on its own: `color_grade_primaries(ap1, grade)`,
7
+ * `color_grade_luma_saturation(ap1, counts, keys, first)` and `color_grade_hue_curves(color, counts, keys)`.
8
8
  *
9
9
  * @type {CodeChunk}
10
10
  */
@@ -1 +1 @@
1
- {"version":3,"file":"chunk_color_grade.d.ts","sourceRoot":"","sources":["../../../../../../../../src/shade/renderer/shader/chunk/color/grade/chunk_color_grade.js"],"names":[],"mappings":"AASA;;;;;;;;;GASG;AACH,gCAFU,SAAS,CA0HjB;0BAxIwB,gCAAgC"}
1
+ {"version":3,"file":"chunk_color_grade.d.ts","sourceRoot":"","sources":["../../../../../../../../src/shade/renderer/shader/chunk/color/grade/chunk_color_grade.js"],"names":[],"mappings":"AASA;;;;;;;;;GASG;AACH,gCAFU,SAAS,CA2MjB;0BAzNwB,gCAAgC"}
@@ -9,11 +9,11 @@ import { chunk_oklab_to_linear_srgb } from "../oklab/chunk_oklab_to_linear_srgb.
9
9
 
10
10
  /**
11
11
  * `color_grade(scene, grade, keys)`: exposed scene-linear Rec.709 through a {@link ColorGrade}, white balance, then
12
- * primaries, then hue curves, to Rec.709 again, not negative. `grade` is the grade's {@link COLOR_GRADE_STRUCT} and
13
- * `keys` the curves' keyframes. See `ColorGrade` for what each stage does.
12
+ * primaries, then saturation against luma, then hue curves, to Rec.709 again, not negative. `grade` is the grade's
13
+ * {@link COLOR_GRADE_STRUCT} and `keys` the curves' keyframes. See `ColorGrade` for what each stage does.
14
14
  *
15
- * Also defines each stage on its own: `color_grade_primaries(ap1, grade)` and
16
- * `color_grade_hue_curves(color, counts, keys)`.
15
+ * Also defines each stage on its own: `color_grade_primaries(ap1, grade)`,
16
+ * `color_grade_luma_saturation(ap1, counts, keys, first)` and `color_grade_hue_curves(color, counts, keys)`.
17
17
  *
18
18
  * @type {CodeChunk}
19
19
  */
@@ -65,6 +65,78 @@ fn color_grade_primaries(ap1: vec3<f32>, grade: ${COLOR_GRADE_STRUCT.wgsl_ref})
65
65
  return shadows * weight_shadows + midtones * weight_midtones + highlights * weight_highlights;
66
66
  }
67
67
 
68
+ // each AP1 channel drawn away from the luma by its factor, read at the luma's stops from middle grey: the all-channel
69
+ // curve times the channel's own; counts are the red, green, blue and all-channel curves' keys, in that order, starting
70
+ // at key 'first'
71
+ fn color_grade_luma_saturation(
72
+ ap1: vec3<f32>,
73
+ counts: vec4<u32>,
74
+ keys: ptr<storage, array<${ANIMATION_CURVE_KEYFRAME_STRUCT.wgsl_ref}>, read>,
75
+ first: u32,
76
+ ) -> vec3<f32> {
77
+ let luma = dot(ap1, AP1_LUMINANCE);
78
+
79
+ // a colour with no luma has no tonal place to read the curves at, and nothing to saturate
80
+ if (all(counts == vec4<u32>(0u)) || luma <= 0.0) {
81
+ return ap1;
82
+ }
83
+
84
+ let stops = log2(luma / 0.18);
85
+
86
+ var saturation = vec3<f32>(1.0);
87
+
88
+ if (counts.x > 0u) {
89
+ saturation.x = animation_curve_evaluate_keys(keys, first, counts.x, stops);
90
+ }
91
+ if (counts.y > 0u) {
92
+ saturation.y = animation_curve_evaluate_keys(keys, first + counts.x, counts.y, stops);
93
+ }
94
+ if (counts.z > 0u) {
95
+ saturation.z = animation_curve_evaluate_keys(keys, first + counts.x + counts.y, counts.z, stops);
96
+ }
97
+ if (counts.w > 0u) {
98
+ saturation *= animation_curve_evaluate_keys(keys, first + counts.x + counts.y + counts.z, counts.w, stops);
99
+ }
100
+
101
+ return max(vec3<f32>(0.0), mix(vec3<f32>(luma), ap1, saturation));
102
+ }
103
+
104
+ // each AP1 channel multiplied by its gain, and every channel by 2^exposure, read at the luma's stops from middle grey;
105
+ // counts are the red, green and blue gain curves' keys and the exposure curve's, in that order, starting at key 'first'
106
+ fn color_grade_luma_gain(
107
+ ap1: vec3<f32>,
108
+ counts: vec4<u32>,
109
+ keys: ptr<storage, array<${ANIMATION_CURVE_KEYFRAME_STRUCT.wgsl_ref}>, read>,
110
+ first: u32,
111
+ ) -> vec3<f32> {
112
+ let luma = dot(ap1, AP1_LUMINANCE);
113
+
114
+ // a colour with no luma has no tonal place to read the curves at
115
+ if (all(counts == vec4<u32>(0u)) || luma <= 0.0) {
116
+ return ap1;
117
+ }
118
+
119
+ let stops = log2(luma / 0.18);
120
+
121
+ var gain = vec3<f32>(1.0);
122
+ var exposure = 0.0;
123
+
124
+ if (counts.x > 0u) {
125
+ gain.x = animation_curve_evaluate_keys(keys, first, counts.x, stops);
126
+ }
127
+ if (counts.y > 0u) {
128
+ gain.y = animation_curve_evaluate_keys(keys, first + counts.x, counts.y, stops);
129
+ }
130
+ if (counts.z > 0u) {
131
+ gain.z = animation_curve_evaluate_keys(keys, first + counts.x + counts.y, counts.z, stops);
132
+ }
133
+ if (counts.w > 0u) {
134
+ exposure = animation_curve_evaluate_keys(keys, first + counts.x + counts.y + counts.z, counts.w, stops);
135
+ }
136
+
137
+ return max(vec3<f32>(0.0), ap1 * gain * exp2(exposure));
138
+ }
139
+
68
140
  // hue shift, chroma scale and lightness against OkLCh hue; counts.xyz are the three curves' keys, in that order
69
141
  fn color_grade_hue_curves(
70
142
  color: vec3<f32>,
@@ -123,7 +195,16 @@ fn color_grade(
123
195
  ) -> vec3<f32> {
124
196
  let white_balance = mat3x3<f32>(grade.white_balance_c0.xyz, grade.white_balance_c1.xyz, grade.white_balance_c2.xyz);
125
197
 
126
- let ap1 = color_grade_primaries(CRM_FROM_REC709_TO_AP1 * (white_balance * scene), grade);
198
+ let primaries = color_grade_primaries(CRM_FROM_REC709_TO_AP1 * (white_balance * scene), grade);
199
+
200
+ // the luma curves' keys follow the hue curves': saturation's, then gain's
201
+ let counts = grade.curve_counts;
202
+ let saturation_counts = grade.luma_curve_counts;
203
+ let hue_keys = counts.x + counts.y + counts.z;
204
+ let saturation_keys = saturation_counts.x + saturation_counts.y + saturation_counts.z + saturation_counts.w;
205
+
206
+ let gained = color_grade_luma_gain(primaries, grade.luma_gain_counts, keys, hue_keys + saturation_keys);
207
+ let ap1 = color_grade_luma_saturation(gained, saturation_counts, keys, hue_keys);
127
208
 
128
209
  let graded = max(CRM_FROM_AP1_TO_REC709 * ap1, vec3<f32>(0.0));
129
210
 
@@ -0,0 +1,65 @@
1
+ /**
2
+ * How much of the eye's response is the rods', at an adaptation: 1 at and below {@link PURKINJE_MESOPIC_MIN_NITS}, 0 at
3
+ * and above {@link PURKINJE_MESOPIC_MAX_NITS}, linear in log luminance in between. The share `apply_purkinje_shift`
4
+ * blends by, for code that needs it on the CPU.
5
+ *
6
+ * @param {number} adaptation_luminance cd/m²
7
+ * @returns {number} 0 to 1
8
+ */
9
+ export function purkinje_rod_share(adaptation_luminance: number): number;
10
+ /**
11
+ * Rec.709 photopic luminance weights: what the cones see of a linear Rec.709 colour.
12
+ * @type {ReadonlyArray<number>}
13
+ */
14
+ export const PURKINJE_REC709_PHOTOPIC: ReadonlyArray<number>;
15
+ /**
16
+ * Rec.709 scotopic luminance weights: what the rods see of a linear Rec.709 colour. They sum to 1, so a grey has the
17
+ * same scotopic luminance as photopic.
18
+ * @type {ReadonlyArray<number>}
19
+ */
20
+ export const PURKINJE_REC709_SCOTOPIC: ReadonlyArray<number>;
21
+ /**
22
+ * "Rod blue": the colour the scotopic signal is carried by. Artistic: (0.3, 0.5, 0.9) mimics the sensation of the
23
+ * rods' 507 nm peak.
24
+ * @type {ReadonlyArray<number>}
25
+ */
26
+ export const PURKINJE_NIGHT_TINT: ReadonlyArray<number>;
27
+ /**
28
+ * CIE 191's mesopic range, cd/m²: rods alone below the lower bound (scotopic), cones alone above the upper (photopic).
29
+ */
30
+ export const PURKINJE_MESOPIC_MIN_NITS: 0.005;
31
+ export const PURKINJE_MESOPIC_MAX_NITS: 5;
32
+ /**
33
+ * Purkinje shift.
34
+ * Human vision system shifts color perception away from red in night-time conditions.
35
+ *
36
+ * ```wgsl
37
+ * fn apply_purkinje_shift(color_rec709: vec3<f32>, adaptation_luminance: f32) -> vec3<f32>
38
+ * fn purkinje_rod_share(adaptation_luminance: f32) -> f32
39
+ * ```
40
+ *
41
+ * `color_rec709` is scene-linear Rec.709; `adaptation_luminance` is the luminance the eye is adapted to, cd/m². Above
42
+ * 5 cd/m² the colour is returned as it is; below 0.005 cd/m² it is the rod response alone, its scotopic luminance
43
+ * carried by a blue tint; in between the two blend linearly in log luminance, by `purkinje_rod_share`. The shift is
44
+ * linear in the colour, so it gives the same result ahead of the exposure as after it.
45
+ *
46
+ * The constants are the module's exports ({@link PURKINJE_REC709_SCOTOPIC} and the rest), and
47
+ * {@link purkinje_rod_share} is the share on the CPU.
48
+ *
49
+ * NOTE: this should go before the tonemapper.
50
+ *
51
+ * Notes on deriving it from the rod and cone responses: PURKINJE_PHYSICAL_DERIVATION_NOTES.md, beside this file.
52
+ *
53
+ * @see J. Patry, "Real-Time Samurai Cinema: Lighting, Atmosphere, and Tonemapping in Ghost of Tsushima", Advances in
54
+ * Real-Time Rendering in Games, SIGGRAPH 2021 — the primary reference.
55
+ * https://www.advances.realtimerendering.com/s2021/jpatry_advances2021/index.html
56
+ * @see A. G. Kirk, J. F. O'Brien, "Perceptually based tone mapping for low-light conditions", ACM TOG 30(4), 2011.
57
+ * https://www2.eecs.berkeley.edu/Pubs/TechRpts/2011/EECS-2011-91.pdf
58
+ * @see D. Cao, J. Pokorny, V. C. Smith, A. J. Zele, "Rod contributions to color perception: linear with rod
59
+ * contrast", Vision Research 48(26), 2008.
60
+ *
61
+ * @type {CodeChunk}
62
+ */
63
+ export const chunk_apply_purkinje_shift: CodeChunk;
64
+ import { CodeChunk } from "../../../../compiler/CodeChunk.js";
65
+ //# sourceMappingURL=chunk_apply_purkinje_shift.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk_apply_purkinje_shift.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/shade/renderer/shader/chunk/color/tonemap/purkinje/chunk_apply_purkinje_shift.js"],"names":[],"mappings":"AAiCA;;;;;;;GAOG;AACH,yDAHW,MAAM,GACJ,MAAM,CAQlB;AA7CD;;;GAGG;AACH,uCAFU,cAAc,MAAM,CAAC,CAEiD;AAEhF;;;;GAIG;AACH,uCAFU,cAAc,MAAM,CAAC,CAEiD;AAEhF;;;;GAIG;AACH,kCAFU,cAAc,MAAM,CAAC,CAEmC;AAElE;;GAEG;AACH,8CAA+C;AAC/C,0CAA2C;AAwC3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,yCAFU,SAAS,CAwCjB;0BAvIwB,mCAAmC"}