@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
@@ -0,0 +1,188 @@
1
+ import {
2
+ GRASS_POOL_BAKED,
3
+ GRASS_POOL_FREE_COUNT,
4
+ GRASS_POOL_HEADER_WORDS,
5
+ GRASS_POOL_REMOVED,
6
+ GRASS_POOL_STARVED,
7
+ GRASS_SLOT_LAYER_COUNT,
8
+ GRASS_SLOT_LEVEL_LAYER,
9
+ GRASS_SLOT_STATE,
10
+ GRASS_SLOT_STATE_FREE,
11
+ GRASS_SLOT_SURFACE,
12
+ GRASS_SLOT_SURFEL_COUNT,
13
+ GRASS_SLOT_TILE_X,
14
+ GRASS_SLOT_TILE_Z,
15
+ GRASS_SLOT_WANTED_FRAME,
16
+ GRASS_SLOT_WORDS,
17
+ GRASS_TILE_COLUMNS
18
+ } from "../../renderer/grass/surface/GRASS_SURFACE.js";
19
+
20
+ /**
21
+ * @typedef {object} GrassSlotReading
22
+ * @property {number} slot
23
+ * @property {number} surface the surface's `transforms` row
24
+ * @property {number} level
25
+ * @property {number} layer
26
+ * @property {number[]} tile `[x, z]`, in tiles of the level
27
+ * @property {number} state `GRASS_SLOT_STATE_*`
28
+ * @property {number} wanted_frame
29
+ * @property {number} layer_count
30
+ * @property {number} surfel_count
31
+ */
32
+
33
+ /**
34
+ * @typedef {object} GrassSurfelReading
35
+ * @property {number} x column along the tile's x, `[0, GRASS_TILE_COLUMNS)`
36
+ * @property {number} z column along the tile's z
37
+ * @property {number} height along the frame's up axis
38
+ * @property {number} member the member's `meshes` row
39
+ * @property {number} clear_height
40
+ * @property {number} density
41
+ */
42
+
43
+ /**
44
+ * Copy a range of a buffer off the device.
45
+ *
46
+ * @param {GPUDevice} device
47
+ * @param {GPUBuffer} buffer needs `COPY_SRC`
48
+ * @param {number} size bytes, a multiple of 4
49
+ * @returns {Promise<ArrayBuffer>}
50
+ */
51
+ async function read_buffer(device, buffer, size) {
52
+ const staging = device.createBuffer({ size, usage: GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_DST });
53
+
54
+ const encoder = device.createCommandEncoder();
55
+
56
+ encoder.copyBufferToBuffer(buffer, 0, staging, 0, size);
57
+
58
+ device.queue.submit([encoder.finish()]);
59
+
60
+ await staging.mapAsync(GPUMapMode.READ);
61
+
62
+ const copy = staging.getMappedRange().slice(0);
63
+
64
+ staging.unmap();
65
+ staging.destroy();
66
+
67
+ return copy;
68
+ }
69
+
70
+ /**
71
+ * Read the grass surfaces' pool off the device: its counters, every slot that is not free, and on request
72
+ * the surfels the slots hold. A playground's inspection tool; nothing in a frame calls it.
73
+ *
74
+ * @param {GPUDevice} device
75
+ * @param {import("../../renderer/grass/surface/GPUGrassSurfaces.js").GPUGrassSurfaces} surfaces
76
+ * @param {boolean} [with_surfels] also read the atlas, and give every slot its `surfels`
77
+ * @returns {Promise<{capacity: number, free_count: number, starved: number, baked: number, removed: number, listed: number, slots: (GrassSlotReading & {surfels?: GrassSurfelReading[]})[]}>}
78
+ * `removed` is the records taken out of the directory since the pool was made, `listed` the records it holds
79
+ */
80
+ export async function read_grass_surfaces(device, surfaces, with_surfels = false) {
81
+ const capacity = surfaces.slot_capacity;
82
+
83
+ if (capacity === 0) {
84
+ return { capacity: 0, free_count: 0, starved: 0, baked: 0, removed: 0, listed: 0, slots: [] };
85
+ }
86
+
87
+ const words = new Uint32Array(await read_buffer(device, surfaces.pool_buffer, (GRASS_POOL_HEADER_WORDS + capacity * GRASS_SLOT_WORDS) * 4));
88
+
89
+ /** @type {GrassSlotReading[]} */
90
+ const slots = [];
91
+
92
+ for (let slot = 0; slot < capacity; slot++) {
93
+ const record = GRASS_POOL_HEADER_WORDS + slot * GRASS_SLOT_WORDS;
94
+
95
+ if (words[record + GRASS_SLOT_STATE] === GRASS_SLOT_STATE_FREE) {
96
+ continue;
97
+ }
98
+
99
+ const level_layer = words[record + GRASS_SLOT_LEVEL_LAYER];
100
+
101
+ slots.push({
102
+ slot,
103
+ surface: words[record + GRASS_SLOT_SURFACE],
104
+ level: level_layer & 0xff,
105
+ layer: (level_layer >> 8) & 0xff,
106
+ tile: [words[record + GRASS_SLOT_TILE_X] | 0, words[record + GRASS_SLOT_TILE_Z] | 0],
107
+ state: words[record + GRASS_SLOT_STATE],
108
+ wanted_frame: words[record + GRASS_SLOT_WANTED_FRAME],
109
+ layer_count: words[record + GRASS_SLOT_LAYER_COUNT],
110
+ surfel_count: words[record + GRASS_SLOT_SURFEL_COUNT],
111
+ });
112
+ }
113
+
114
+ const result = {
115
+ capacity,
116
+ free_count: words[GRASS_POOL_FREE_COUNT],
117
+ starved: words[GRASS_POOL_STARVED],
118
+ baked: words[GRASS_POOL_BAKED],
119
+ removed: words[GRASS_POOL_REMOVED],
120
+ listed: new Uint32Array(await read_buffer(device, surfaces.directory_buffer, 8))[0],
121
+ slots,
122
+ };
123
+
124
+ if (!with_surfels) {
125
+ return result;
126
+ }
127
+
128
+ const atlas = surfaces.atlas;
129
+ const width = atlas.width;
130
+ const height = atlas.height;
131
+
132
+ // four words a texel
133
+ const staging = device.createBuffer({ size: width * height * 16, usage: GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_DST });
134
+
135
+ const encoder = device.createCommandEncoder();
136
+
137
+ encoder.copyTextureToBuffer({ texture: atlas }, { buffer: staging, bytesPerRow: width * 16, rowsPerImage: height }, [width, height]);
138
+
139
+ device.queue.submit([encoder.finish()]);
140
+
141
+ await staging.mapAsync(GPUMapMode.READ);
142
+
143
+ const texels = new Uint32Array(staging.getMappedRange().slice(0));
144
+ const texel_floats = new Float32Array(texels.buffer);
145
+
146
+ staging.unmap();
147
+ staging.destroy();
148
+
149
+ const half = new Float16Array(1);
150
+ const half_bits = new Uint16Array(half.buffer);
151
+
152
+ for (const reading of slots) {
153
+ // a GPUTileAtlas2D: tiles in rows as wide as the texture
154
+ const row_slots = width / GRASS_TILE_COLUMNS;
155
+
156
+ const corner_x = (reading.slot % row_slots) * GRASS_TILE_COLUMNS;
157
+ const corner_z = Math.floor(reading.slot / row_slots) * GRASS_TILE_COLUMNS;
158
+
159
+ /** @type {GrassSurfelReading[]} */
160
+ const surfels = [];
161
+
162
+ for (let z = 0; z < GRASS_TILE_COLUMNS; z++) {
163
+ for (let x = 0; x < GRASS_TILE_COLUMNS; x++) {
164
+ const at = ((corner_z + z) * width + corner_x + x) * 4;
165
+ const member = texels[at + 2];
166
+
167
+ if (member === 0) {
168
+ continue;
169
+ }
170
+
171
+ half_bits[0] = texels[at + 3] & 0xffff;
172
+
173
+ surfels.push({
174
+ x,
175
+ z,
176
+ height: texel_floats[at],
177
+ member,
178
+ clear_height: half[0],
179
+ density: (texels[at + 3] >>> 16) / 65535,
180
+ });
181
+ }
182
+ }
183
+
184
+ reading.surfels = surfels;
185
+ }
186
+
187
+ return result;
188
+ }
@@ -28,6 +28,7 @@ has the two lines that put it there. Another scene loads with `?scene=/some/othe
28
28
  | Sun height, Sun turn | where the sun stands |
29
29
  | Point lights | eight shadowed point lights along the scene's long axis, which the probes' hits take as local lights |
30
30
  | TAA | the resolve the probe pick's noise is meant for |
31
+ | Auto exposure | the exposure metered from the frame and adapted to it; off, the factor is 2^compensation, 1 on this page |
31
32
  | Bake budget | mesh SDF bricks baked a frame while the caches fill; the page starts above the engine's default so Sponza bakes in seconds |
32
33
 
33
34
  Drag to orbit, wheel to zoom, WASD to move. The stats line reads the frame time and the mesh SDF bake's
@@ -151,6 +151,11 @@
151
151
  <span>TAA <span class="hint">— resolves the probe pick's noise</span></span>
152
152
  </label>
153
153
 
154
+ <label>
155
+ <input type="checkbox" id="auto_exposure" checked>
156
+ <span>Auto exposure <span class="hint">— off, the exposure is 1</span></span>
157
+ </label>
158
+
154
159
  <hr>
155
160
 
156
161
  <label>
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../../../src/shade/playground/probe_clipmap/main.js"],"names":[],"mappings":"AAyFA;;;;;GAKG;AACH,yBAFa,QAAQ,IAAI,CAAC,CAuUzB"}
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../../../src/shade/playground/probe_clipmap/main.js"],"names":[],"mappings":"AAyFA;;;;;GAKG;AACH,yBAFa,QAAQ,IAAI,CAAC,CA8UzB"}
@@ -279,6 +279,13 @@ export async function start() {
279
279
  renderer.feature_taa_enabled = event.target.checked;
280
280
  });
281
281
 
282
+ const auto_exposure_toggle = element('auto_exposure');
283
+
284
+ auto_exposure_toggle.checked = renderer.feature_automatic_exposure_enabled;
285
+ auto_exposure_toggle.addEventListener('change', event => {
286
+ renderer.feature_automatic_exposure_enabled = event.target.checked;
287
+ });
288
+
282
289
  /**
283
290
  * What TAA was before the tracer turned it off, to give it back when the tracer goes.
284
291
  * @type {boolean}
@@ -34,7 +34,8 @@ then open <http://localhost:5173/src/shade/playground/probe_clipmap_box/index.ht
34
34
  | Sun (1, 2, 3) | through the hole onto the red wall or the green wall, from 45°, or straight down onto the floor |
35
35
  | Hole open (H) | closed, a lid of the hole's size sits flush in the ceiling; it is placed into the scene and taken out again, so the bricks the rays march are rebuilt as a level's would be |
36
36
  | Indirect light | the probe clipmap, or IBL to compare against |
37
- | Debug view | the brick clipmap as the rays see it; the geometry caches' mesh SDF; the hits' albedo from the meshes' surface caches |
37
+ | Debug view | the brick clipmap as the rays see it; the geometry caches' mesh SDF; the hits' albedo from the meshes' surface caches; the probes' indirect diffuse and indirect specular, each before the surface's material |
38
+ | Roughness | every slab's, 1 as the box starts. The indirect specular view samples the probes at the surface's roughness: at 1 it is their SH alone, and toward 0.05 it is one tap of their radiance tiles along the reflection, the walls as the probes hold them. A slab keeps its geometry, so the bricks the rays march do not change |
38
39
  | Restart GI (K) | gives the clipmaps back and builds them again from nothing, the geometry caches kept: a cold start without a reload |
39
40
  | Path tracer (P) | the accumulating path tracer, three bounces, for context; TAA is off while it is on |
40
41
  | TAA | the resolve the probe pick's noise is meant for |
@@ -47,6 +48,9 @@ The stats line counts the frames since the sun or the hole last changed.
47
48
  - **Hole closed**: the inside should go black. Whatever light stays is what the probes still hold.
48
49
  - **Sun moved between the walls**: the colour bleeding onto the back wall and the floor should swap from red
49
50
  to green.
51
+ - **Indirect specular, roughness low**: the reflections are the probes' 16 × 16 radiance tiles, tapped along the
52
+ reflection with no parallax (the proposal's §9.3, "Parallax correction"): the walls show blurred, and placed as
53
+ if they were far.
50
54
  - **Restart**: until the brick clipmap has built (about 48 frames at the default build budget), the rays see
51
55
  no walls and every probe sees the sky; the light then has to drain out of the probes.
52
56
 
@@ -128,9 +128,21 @@
128
128
  <option value="BrickClipmap">Brick clipmap — what the rays see</option>
129
129
  <option value="MeshSDF">Mesh SDF — the geometry caches</option>
130
130
  <option value="MeshSurfaces">Mesh surfaces — each mesh's surface cache</option>
131
+ <option value="IndirectDiffuse">Indirect diffuse — the probes' irradiance / π, before the material</option>
132
+ <option value="IndirectSpecular">Indirect specular — the probes' radiance, before the material</option>
131
133
  </select>
132
134
  </label>
133
135
 
136
+ <label>
137
+ <span>Roughness</span>
138
+ <input type="range" id="roughness" min="0.05" max="1" step="0.05" value="1">
139
+ <output id="roughness_value"></output>
140
+ </label>
141
+ <p class="note">
142
+ Every slab's. At 1 the indirect specular view shows the probes' SH alone; lower it to see the reflections
143
+ their radiance tiles hold.
144
+ </p>
145
+
134
146
  <label>
135
147
  <span>Restart GI</span>
136
148
  <button id="restart">Restart</button>
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../../../src/shade/playground/probe_clipmap_box/main.js"],"names":[],"mappings":"AAsEA;;;;;GAKG;AACH,yBAFa,QAAQ,IAAI,CAAC,CAwPzB"}
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../../../src/shade/playground/probe_clipmap_box/main.js"],"names":[],"mappings":"AAsEA;;;;;GAKG;AACH,yBAFa,QAAQ,IAAI,CAAC,CAuQzB"}
@@ -123,6 +123,7 @@ export async function start() {
123
123
  const box = await build_hole_box(scene, scene_context, {
124
124
  aim: BoxSunAim[element('sun_aim').value],
125
125
  open: element('hole_open').checked,
126
+ roughness: Number(element('roughness').value),
126
127
  });
127
128
 
128
129
  // inside, against the front wall, looking at the back one: both coloured walls and the floor in view
@@ -210,6 +211,20 @@ export async function start() {
210
211
 
211
212
  element('restart').addEventListener('click', restart_gi);
212
213
 
214
+ const roughness_slider = element('roughness');
215
+
216
+ function show_roughness() {
217
+ element('roughness_value').textContent = Number(roughness_slider.value).toFixed(2);
218
+ }
219
+
220
+ show_roughness();
221
+ roughness_slider.addEventListener('input', show_roughness);
222
+ // on release: every stop on the way would be ten materials of its own
223
+ roughness_slider.addEventListener('change', () => {
224
+ box.roughness = Number(roughness_slider.value);
225
+ box_changed();
226
+ });
227
+
213
228
  const exposure_slider = element('exposure');
214
229
 
215
230
  function show_exposure() {
@@ -46,16 +46,23 @@ export function box_lid(): {
46
46
  * @param {number[]} [options.sky] linear radiance of the flat sky
47
47
  * @param {BoxSunAim} [options.aim]
48
48
  * @param {boolean} [options.open]
49
+ * @param {number} [options.roughness] every slab's, 1 the Cornell box's own
49
50
  */
50
- export function build_hole_box(scene: import("../../renderer/scene/Scene.js").Scene, scene_context: import("../../renderer/scene/GPUSceneContext.js").GPUSceneContext, { sun_intensity, sky, aim, open, }?: {
51
+ export function build_hole_box(scene: import("../../renderer/scene/Scene.js").Scene, scene_context: import("../../renderer/scene/GPUSceneContext.js").GPUSceneContext, { sun_intensity, sky, aim, open, roughness, }?: {
51
52
  sun_intensity?: number;
52
53
  sky?: number[];
53
54
  aim?: BoxSunAim;
54
55
  open?: boolean;
56
+ roughness?: number;
55
57
  }): Promise<{
56
58
  sun: import("../../renderer/light/model/DirectionalLight.js").DirectionalLight;
57
59
  aim: number;
58
60
  open: boolean;
61
+ /**
62
+ * Every slab's roughness.
63
+ * @returns {number}
64
+ */
65
+ roughness: number;
59
66
  }>;
60
67
  /**
61
68
  * The inside of the box, a side, metres: x and z in [−½, ½] of it, y in [0, 1] of it. Five probe spacings of
@@ -1 +1 @@
1
- {"version":3,"file":"scene.d.ts","sourceRoot":"","sources":["../../../../../src/shade/playground/probe_clipmap_box/scene.js"],"names":[],"mappings":"AA4DA;;;;;;GAMG;AACH,uCAJW,OAAO,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,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAC,CAI9E;AAiBD;;;;;;;;;;;;;;;;GAgBG;AACH,sCATW,OAAO,+BAA+B,EAAE,KAAK,iBAC7C,OAAO,yCAAyC,EAAE,eAAe;IAEhD,aAAa,GAA9B,MAAM;IACa,GAAG,GAAtB,MAAM,EAAE;IACY,GAAG,GAAvB,SAAS;IACS,IAAI,GAAtB,OAAO;IACU,SAAS,GAA1B,MAAM;;;;;IA+HT;;;OAGG;;GAsCV;AAtTD;;;;GAIG;AACH,yBAFU,MAAM,CAEY;AAE5B;;;;GAIG;AACH,uBAFU,MAAM,CAEa;AAE7B;;;GAGG;AACH,uBAFU,MAAM,CAEa;AAE7B;;;;GAIG;AACH,qCAFU,MAAM,CAEyB;;;;wBAY/B,MAAM;;;;;;oBAhDI,+BAA+B"}
@@ -7,6 +7,7 @@ import { MeshoptClusterizer } from "../../renderer/geometry/meshlet/build/meshop
7
7
  import { make_sunlight } from "../../renderer/light/make_sunlight.js";
8
8
  import { place_light } from "../../renderer/light/place_light.js";
9
9
  import { StandardShadeMaterial } from "../../renderer/material/StandardShadeMaterial.js";
10
+ import { ShadedGeometry } from "../../../engine/graphics/ecs/mesh-v2/ShadedGeometry.js";
10
11
  import { place_primitive, remove_primitive } from "../../renderer/scene/rows/place_primitive.js";
11
12
  import { make_flat_environment } from "../skinned_blas_refit/flat_environment.js";
12
13
 
@@ -124,13 +125,14 @@ export function box_lid() {
124
125
 
125
126
  /**
126
127
  * @param {number[]} rgb linear
128
+ * @param {number} roughness
127
129
  * @returns {StandardShadeMaterial}
128
130
  */
129
- function diffuse(rgb) {
131
+ function dielectric(rgb, roughness) {
130
132
  const material = new StandardShadeMaterial();
131
133
 
132
134
  material.diffuse_color.copy(new Color(rgb[0], rgb[1], rgb[2]));
133
- material.roughness_factor = 1;
135
+ material.roughness_factor = roughness;
134
136
  material.metallic_factor = 0;
135
137
 
136
138
  return material;
@@ -151,12 +153,14 @@ function diffuse(rgb) {
151
153
  * @param {number[]} [options.sky] linear radiance of the flat sky
152
154
  * @param {BoxSunAim} [options.aim]
153
155
  * @param {boolean} [options.open]
156
+ * @param {number} [options.roughness] every slab's, 1 the Cornell box's own
154
157
  */
155
158
  export async function build_hole_box(scene, scene_context, {
156
159
  sun_intensity = 7.2,
157
160
  sky = [0.2, 0.25, 0.35],
158
161
  aim = BoxSunAim.RedWall,
159
162
  open = true,
163
+ roughness = 1,
160
164
  } = {}) {
161
165
  // meshlet geometry is built as it is made
162
166
  await MeshoptClusterizer.ready;
@@ -176,13 +180,42 @@ export async function build_hole_box(scene, scene_context, {
176
180
  return place_primitive(scene_context, geometry, material, transform, { name: slab.name });
177
181
  }
178
182
 
179
- for (const slab of box_slabs()) {
180
- place(slab, new BoxGeometry(slab.size[0], slab.size[1], slab.size[2]), diffuse(slab.colour));
183
+ /**
184
+ * A slab's material at a roughness, made once. A material's GPU side does not change after its upload, so a
185
+ * slab at another roughness draws with another material.
186
+ * @type {Map<string, StandardShadeMaterial>}
187
+ */
188
+ const materials = new Map();
189
+
190
+ /**
191
+ * @param {{name: string, colour: number[]}} slab
192
+ * @param {number} value
193
+ * @returns {StandardShadeMaterial}
194
+ */
195
+ function material_of(slab, value) {
196
+ const key = `${slab.name}/${value}`;
197
+
198
+ let material = materials.get(key);
199
+
200
+ if (material === undefined) {
201
+ material = dielectric(slab.colour, value);
202
+
203
+ materials.set(key, material);
204
+ }
205
+
206
+ return material;
181
207
  }
182
208
 
209
+ let current_roughness = roughness;
210
+
211
+ const slabs = box_slabs().map(slab => {
212
+ const geometry = new BoxGeometry(slab.size[0], slab.size[1], slab.size[2]);
213
+
214
+ return { slab, geometry, entity: place(slab, geometry, material_of(slab, current_roughness)) };
215
+ });
216
+
183
217
  const lid = box_lid();
184
218
  const lid_geometry = new BoxGeometry(lid.size[0], lid.size[1], lid.size[2]);
185
- const lid_material = diffuse(lid.colour);
186
219
 
187
220
  /**
188
221
  * The lid's entity while it closes the hole, -1 while the hole is open.
@@ -243,7 +276,42 @@ export async function build_hole_box(scene, scene_context, {
243
276
  remove_primitive(scene_context, lid_entity);
244
277
  lid_entity = -1;
245
278
  } else {
246
- lid_entity = place(lid, lid_geometry, lid_material);
279
+ lid_entity = place(lid, lid_geometry, material_of(lid, current_roughness));
280
+ }
281
+ },
282
+
283
+ /**
284
+ * Every slab's roughness.
285
+ * @returns {number}
286
+ */
287
+ get roughness() {
288
+ return current_roughness;
289
+ },
290
+
291
+ /**
292
+ * Each slab keeps its entity and its geometry and draws with a material of the new roughness, so the
293
+ * distance field the rays march does not change.
294
+ *
295
+ * @param {number} v in [0, 1]
296
+ */
297
+ set roughness(v) {
298
+ if (v === current_roughness) {
299
+ return;
300
+ }
301
+
302
+ current_roughness = v;
303
+
304
+ const placed = slabs.map(s => [s.entity, s.slab, s.geometry]);
305
+
306
+ if (lid_entity !== -1) {
307
+ placed.push([lid_entity, lid, lid_geometry]);
308
+ }
309
+
310
+ for (const [entity, slab, geometry] of placed) {
311
+ const material = material_of(slab, v);
312
+
313
+ scene.dataset.getComponent(entity, ShadedGeometry).material = material;
314
+ scene_context.rows.attach_mesh(entity, geometry, material);
247
315
  }
248
316
  },
249
317
 
@@ -1 +1 @@
1
- {"version":3,"file":"Renderer.d.ts","sourceRoot":"","sources":["../../../../src/shade/renderer/Renderer.js"],"names":[],"mappings":"AA6IA;IAOI,0BAEC;IAED;;OAEG;IACH,0BAAQ;IAER;;;;;;OAMG;IACH,kDAEC;IAED;;OAEG;IACH,kBAAO;IAYP;;;OAGG;IACH,2BAEC;IAaD,wCAGC;IAED,uCAEC;IAED;;;;OAIG;IACH,wBAFU,yBAAyB,CAEoB;IAEvD;;;;;;;OAOG;IACH,mBAFU,gBAAgB,CAEgB;IAE1C;;;;OAIG;IACH,eAFU,oBAAoB,CAEa;IAY3C;;;;;;;OAOG;IACH,mBAFU,qBAAqB,CAEkB;IAEjD;;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826
2826
 
2827
- // The frame's surface handles exist now, so this is where the records that carry them are
2828
- // published. There is no colour yet, which is what makes this the phase for G-buffer work.
2829
- frame.phase = FramePhase.AfterGBuffer;
2830
-
2831
- const record_gbuffer = frame.create(GBufferTextures);
2832
- const record_view_textures = frame.create(ViewTextures);
2833
-
2834
- record_gbuffer.albedo = gr_texture_material_albedo_ao;
2835
- record_gbuffer.normal = gr_texture_normal;
2836
- record_gbuffer.pbr = gr_texture_pbr;
2837
- record_gbuffer.emissive = gr_texture_material_emissive;
2838
-
2839
- record_view_textures.depth = gr_texture_depth_current;
2840
- record_view_textures.depth_previous = gr_texture_depth_previous;
2841
- record_view_textures.visibility = gr_visibility;
2842
- record_view_textures.visible_meshlets = gr_visible_meshlets;
2843
-
2844
- this.#extensions.run(frame);
2845
-
2846
- /*
2847
- `GBufferTextures` is in/out at this phase, and frozen after it. An extension that wants to
2848
- *change* surface properties — decals are the reason this exists — cannot blend into these
2849
- targets: two of the four are integer formats, and one texture cannot be a render attachment
2850
- and a sampled source in the same pass. So it reads a copy — of the targets, or of the part
2851
- it changes — and writes, and publishes the handles it wrote. Everything downstream carries
2852
- what it left.
2853
-
2854
- Publishing is what makes it a contract. A written handle is a *renamed* clone of the same
2855
- physical resource, so a change written in place and not published would land in the
2856
- texture the shading pass reads only because the graph happens to execute in insertion
2857
- order, with no dependency edge saying so. Threading the handles makes the edge real,
2858
- whether they name replacements or the originals written through `write`.
2859
- */
2860
- gr_texture_pbr = record_gbuffer.pbr;
2861
- gr_texture_normal = record_gbuffer.normal;
2862
- gr_texture_material_albedo_ao = record_gbuffer.albedo;
2863
- gr_texture_material_emissive = record_gbuffer.emissive;
2864
-
2865
- gr_texture_depth_current = record_view_textures.depth;
2866
- gr_texture_depth_previous = record_view_textures.depth_previous;
2867
- gr_visibility = record_view_textures.visibility;
2868
- gr_visible_meshlets = record_view_textures.visible_meshlets;
2869
-
2827
+ // Ahead of the phase below, from the scene's own depth and visibility: an extension that draws
2828
+ // surfaces the visibility buffer cannot describe writes their motion over this.
2870
2829
  // Velocity pass with three branches: rotation-reprojection
2871
2830
  // background, rigid per-object foreground (mesh.global delta),
2872
2831
  // and skinned per-vertex foreground (barycentric interpolation
@@ -2924,6 +2883,51 @@ export class Renderer {
2924
2883
  view: view_ctx,
2925
2884
  });
2926
2885
 
2886
+ // The frame's surface handles exist now, so this is where the records that carry them are
2887
+ // published. There is no colour yet, which is what makes this the phase for G-buffer work.
2888
+ frame.phase = FramePhase.AfterGBuffer;
2889
+
2890
+ const record_gbuffer = frame.create(GBufferTextures);
2891
+ const record_view_textures = frame.create(ViewTextures);
2892
+
2893
+ record_gbuffer.albedo = gr_texture_material_albedo_ao;
2894
+ record_gbuffer.normal = gr_texture_normal;
2895
+ record_gbuffer.pbr = gr_texture_pbr;
2896
+ record_gbuffer.emissive = gr_texture_material_emissive;
2897
+
2898
+ record_view_textures.depth = gr_texture_depth_current;
2899
+ record_view_textures.depth_previous = gr_texture_depth_previous;
2900
+ record_view_textures.visibility = gr_visibility;
2901
+ record_view_textures.visible_meshlets = gr_visible_meshlets;
2902
+ record_view_textures.velocity = gr_velocity;
2903
+
2904
+ this.#extensions.run(frame);
2905
+
2906
+ /*
2907
+ `GBufferTextures` is in/out at this phase, and frozen after it. An extension that wants to
2908
+ *change* surface properties — decals are the reason this exists — cannot blend into these
2909
+ targets: two of the four are integer formats, and one texture cannot be a render attachment
2910
+ and a sampled source in the same pass. So it reads a copy — of the targets, or of the part
2911
+ it changes — and writes, and publishes the handles it wrote. Everything downstream carries
2912
+ what it left.
2913
+
2914
+ Publishing is what makes it a contract. A written handle is a *renamed* clone of the same
2915
+ physical resource, so a change written in place and not published would land in the
2916
+ texture the shading pass reads only because the graph happens to execute in insertion
2917
+ order, with no dependency edge saying so. Threading the handles makes the edge real,
2918
+ whether they name replacements or the originals written through `write`.
2919
+ */
2920
+ gr_texture_pbr = record_gbuffer.pbr;
2921
+ gr_texture_normal = record_gbuffer.normal;
2922
+ gr_texture_material_albedo_ao = record_gbuffer.albedo;
2923
+ gr_texture_material_emissive = record_gbuffer.emissive;
2924
+
2925
+ gr_texture_depth_current = record_view_textures.depth;
2926
+ gr_texture_depth_previous = record_view_textures.depth_previous;
2927
+ gr_visibility = record_view_textures.visibility;
2928
+ gr_visible_meshlets = record_view_textures.visible_meshlets;
2929
+ gr_velocity = record_view_textures.velocity;
2930
+
2927
2931
  // rg8unorm: r is the history confidence, g records which texel won the nearest-depth search,
2928
2932
  // so the TAA resolve can reproject with exactly the velocity this pass validated.
2929
2933
  let [gr_occlusion_clip] = graph_image_pass({
@@ -3400,8 +3404,6 @@ export class Renderer {
3400
3404
  });
3401
3405
  }
3402
3406
 
3403
- let exposure = -1;
3404
-
3405
3407
  /*
3406
3408
  The scene as it stands before bloom composites over it: what the metering reads, and what
3407
3409
  bloom reads too.
@@ -3433,21 +3435,22 @@ export class Renderer {
3433
3435
  current_color_out = bloom.composited;
3434
3436
  }
3435
3437
 
3436
- if (this.feature_automatic_exposure_enabled) {
3437
- // TODO force time_delta_second to a very high value on view transition
3438
+ const gr_exposure_adaptation = graph_import_buffer(graph, this.#autoexposure.adaptation, "exposure adaptation");
3438
3439
 
3439
- exposure = this.#autoexposure.update({
3440
+ // TODO force time_delta_second to a very high value on view transition
3441
+ const exposure = this.feature_automatic_exposure_enabled
3442
+ ? this.#autoexposure.update({
3440
3443
  graph,
3441
3444
  input_color: metered_color,
3442
3445
  multiplier: gr_exposure_multiplier,
3446
+ adaptation: gr_exposure_adaptation,
3443
3447
  time_delta_seconds,
3448
+ })
3449
+ : this.#autoexposure.unadapted({
3450
+ graph,
3451
+ multiplier: gr_exposure_multiplier,
3452
+ adaptation: gr_exposure_adaptation,
3444
3453
  });
3445
- }
3446
-
3447
-
3448
- if (this.feature_automatic_exposure_enabled === false) {
3449
- exposure = this.#autoexposure.unadapted({ graph, multiplier: gr_exposure_multiplier });
3450
- }
3451
3454
 
3452
3455
 
3453
3456
  // current_color_out = graph_draw_texture_as_rgba({
@@ -3473,7 +3476,8 @@ export class Renderer {
3473
3476
  current_color_out = this.tone_mapper.render({
3474
3477
  graph,
3475
3478
  input_color: current_color_out,
3476
- exposure,
3479
+ exposure: exposure.multiplier,
3480
+ adaptation: exposure.adaptation,
3477
3481
  hdr: this.#hdr_supported,
3478
3482
  target: gr_texture_canvas,
3479
3483
  });