@woosh/meep-engine 3.75.0 → 3.77.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 (369) hide show
  1. package/editor/particles/effect/ParticleReferenceSimulation.d.ts +11 -0
  2. package/editor/particles/effect/ParticleReferenceSimulation.d.ts.map +1 -1
  3. package/editor/particles/effect/ParticleReferenceSimulation.js +14 -0
  4. package/editor/view/particles/effect/ParticleGraphEditorView.js +1 -1
  5. package/package.json +1 -1
  6. package/src/engine/asset/GameAssetType.d.ts +1 -0
  7. package/src/engine/asset/GameAssetType.js +5 -1
  8. package/src/engine/asset/loaders/GroomAssetLoader.d.ts +33 -0
  9. package/src/engine/asset/loaders/GroomAssetLoader.d.ts.map +1 -0
  10. package/src/engine/asset/loaders/GroomAssetLoader.js +113 -0
  11. package/src/engine/graphics/ecs/hair/Hair.d.ts +54 -0
  12. package/src/engine/graphics/ecs/hair/Hair.d.ts.map +1 -0
  13. package/src/engine/graphics/ecs/hair/Hair.js +70 -0
  14. package/src/engine/graphics/ecs/hair/HairDynamics.d.ts +63 -0
  15. package/src/engine/graphics/ecs/hair/HairDynamics.d.ts.map +1 -0
  16. package/src/engine/graphics/ecs/hair/HairDynamics.js +82 -0
  17. package/src/engine/graphics/hair/Groom.d.ts +175 -0
  18. package/src/engine/graphics/hair/Groom.d.ts.map +1 -0
  19. package/src/engine/graphics/hair/Groom.js +249 -0
  20. package/src/engine/graphics/hair/GroomSerializationAdapter.d.ts +50 -0
  21. package/src/engine/graphics/hair/GroomSerializationAdapter.d.ts.map +1 -0
  22. package/src/engine/graphics/hair/GroomSerializationAdapter.js +150 -0
  23. package/src/engine/graphics/hair/GroomSerializationUpgrader_0_1.d.ts +8 -0
  24. package/src/engine/graphics/hair/GroomSerializationUpgrader_0_1.d.ts.map +1 -0
  25. package/src/engine/graphics/hair/GroomSerializationUpgrader_0_1.js +31 -0
  26. package/src/engine/graphics/hair/groom_bind_to_mesh.d.ts +85 -0
  27. package/src/engine/graphics/hair/groom_bind_to_mesh.d.ts.map +1 -0
  28. package/src/engine/graphics/hair/groom_bind_to_mesh.js +216 -0
  29. package/src/engine/graphics/hair/groom_build_group.d.ts +90 -0
  30. package/src/engine/graphics/hair/groom_build_group.d.ts.map +1 -0
  31. package/src/engine/graphics/hair/groom_build_group.js +496 -0
  32. package/src/engine/graphics/hair/groom_build_guides.d.ts +43 -0
  33. package/src/engine/graphics/hair/groom_build_guides.d.ts.map +1 -0
  34. package/src/engine/graphics/hair/groom_build_guides.js +267 -0
  35. package/src/engine/graphics/hair/groom_generate_scalp.d.ts +29 -0
  36. package/src/engine/graphics/hair/groom_generate_scalp.d.ts.map +1 -0
  37. package/src/engine/graphics/hair/groom_generate_scalp.js +184 -0
  38. package/src/engine/graphics/hair/groom_rank_order.d.ts +15 -0
  39. package/src/engine/graphics/hair/groom_rank_order.d.ts.map +1 -0
  40. package/src/engine/graphics/hair/groom_rank_order.js +53 -0
  41. package/src/engine/graphics/hair/groom_root_spacing.d.ts +14 -0
  42. package/src/engine/graphics/hair/groom_root_spacing.d.ts.map +1 -0
  43. package/src/engine/graphics/hair/groom_root_spacing.js +253 -0
  44. package/src/engine/graphics3/HairColliderSystem.d.ts +59 -0
  45. package/src/engine/graphics3/HairColliderSystem.d.ts.map +1 -0
  46. package/src/engine/graphics3/HairColliderSystem.js +270 -0
  47. package/src/engine/graphics3/HairSystem.d.ts +119 -0
  48. package/src/engine/graphics3/HairSystem.d.ts.map +1 -0
  49. package/src/engine/graphics3/HairSystem.js +722 -0
  50. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  51. package/src/shade/assets/textures/hair_scattering.bin +0 -0
  52. package/src/shade/device/pipeline/PipelineEnquiry.d.ts +11 -0
  53. package/src/shade/device/pipeline/PipelineEnquiry.d.ts.map +1 -1
  54. package/src/shade/device/pipeline/PipelineEnquiry.js +13 -0
  55. package/src/shade/playground/hair/index.html +50 -0
  56. package/src/shade/playground/hair/main.d.ts +2 -0
  57. package/src/shade/playground/hair/main.d.ts.map +1 -0
  58. package/src/shade/playground/hair/main.js +297 -0
  59. package/src/shade/playground/hair_skinned/index.html +192 -0
  60. package/src/shade/playground/hair_skinned/main.d.ts +7 -0
  61. package/src/shade/playground/hair_skinned/main.d.ts.map +1 -0
  62. package/src/shade/playground/hair_skinned/main.js +481 -0
  63. package/src/shade/playground/hair_skinned/skinned_hair.d.ts +49 -0
  64. package/src/shade/playground/hair_skinned/skinned_hair.d.ts.map +1 -0
  65. package/src/shade/playground/hair_skinned/skinned_hair.js +362 -0
  66. package/src/shade/playground/screen_probes/README.md +54 -0
  67. package/src/shade/playground/screen_probes/index.html +271 -0
  68. package/src/shade/playground/screen_probes/main.d.ts +8 -0
  69. package/src/shade/playground/screen_probes/main.d.ts.map +1 -0
  70. package/src/shade/playground/screen_probes/main.js +527 -0
  71. package/src/shade/playground/sparks/README.md +36 -0
  72. package/src/shade/playground/sparks/index.html +145 -0
  73. package/src/shade/playground/sparks/main.d.ts +7 -0
  74. package/src/shade/playground/sparks/main.d.ts.map +1 -0
  75. package/src/shade/playground/sparks/main.js +312 -0
  76. package/src/shade/playground/sparks/sparks_effect.d.ts +72 -0
  77. package/src/shade/playground/sparks/sparks_effect.d.ts.map +1 -0
  78. package/src/shade/playground/sparks/sparks_effect.js +180 -0
  79. package/src/shade/renderer/Renderer.d.ts.map +1 -1
  80. package/src/shade/renderer/Renderer.js +72 -11
  81. package/src/shade/renderer/STATIC_GRAPHICS_ENGINE_ASSETS.d.ts +6 -0
  82. package/src/shade/renderer/STATIC_GRAPHICS_ENGINE_ASSETS.d.ts.map +1 -1
  83. package/src/shade/renderer/STATIC_GRAPHICS_ENGINE_ASSETS.js +10 -0
  84. package/src/shade/renderer/acoustics/GPUAcousticLattice.d.ts +1 -1
  85. package/src/shade/renderer/acoustics/GPUAcousticProbes.d.ts +1 -1
  86. package/src/shade/renderer/acoustics/GPUAcoustics.d.ts +1 -1
  87. package/src/shade/renderer/animation/GPUAnimationManager.d.ts +3 -2
  88. package/src/shade/renderer/animation/GPUAnimationManager.d.ts.map +1 -1
  89. package/src/shade/renderer/animation/GPUAnimationManager.js +74 -3
  90. package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.d.ts +13 -3
  91. package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.d.ts.map +1 -1
  92. package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.js +16 -5
  93. package/src/shade/renderer/animation/skinning/shader_meshlet_apply_skinning.js +8 -8
  94. package/src/shade/renderer/deferred/chunk_read_gBuffer_material.d.ts.map +1 -1
  95. package/src/shade/renderer/deferred/chunk_read_gBuffer_material.js +3 -1
  96. package/src/shade/renderer/deferred/chunk_shade_direct_lights.d.ts +23 -0
  97. package/src/shade/renderer/deferred/chunk_shade_direct_lights.d.ts.map +1 -0
  98. package/src/shade/renderer/deferred/chunk_shade_direct_lights.js +111 -0
  99. package/src/shade/renderer/deferred/chunk_shade_directional_lights.d.ts +19 -6
  100. package/src/shade/renderer/deferred/chunk_shade_directional_lights.d.ts.map +1 -1
  101. package/src/shade/renderer/deferred/chunk_shade_directional_lights.js +30 -21
  102. package/src/shade/renderer/deferred/chunk_shade_standard_material_direct.d.ts +12 -22
  103. package/src/shade/renderer/deferred/chunk_shade_standard_material_direct.d.ts.map +1 -1
  104. package/src/shade/renderer/deferred/chunk_shade_standard_material_direct.js +20 -100
  105. package/src/shade/renderer/deferred/chunk_shade_standard_material_direct_restir.d.ts.map +1 -1
  106. package/src/shade/renderer/deferred/chunk_shade_standard_material_direct_restir.js +6 -4
  107. package/src/shade/renderer/deferred/chunk_standard_material_direct_light_lobe.d.ts +15 -0
  108. package/src/shade/renderer/deferred/chunk_standard_material_direct_light_lobe.d.ts.map +1 -0
  109. package/src/shade/renderer/deferred/chunk_standard_material_direct_light_lobe.js +47 -0
  110. package/src/shade/renderer/extension/ShadowAtlas.d.ts +75 -0
  111. package/src/shade/renderer/extension/ShadowAtlas.d.ts.map +1 -0
  112. package/src/shade/renderer/extension/ShadowAtlas.js +133 -0
  113. package/src/shade/renderer/extension/ViewLighting.d.ts +101 -0
  114. package/src/shade/renderer/extension/ViewLighting.d.ts.map +1 -0
  115. package/src/shade/renderer/extension/ViewLighting.js +168 -0
  116. package/src/shade/renderer/fluid/GPUFluidCascade.d.ts +3 -3
  117. package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts +1 -1
  118. package/src/shade/renderer/fluid/forcing/GPUFluidForcing.d.ts +7 -7
  119. package/src/shade/renderer/fluid/pressure/GPUFluidPressureSolve.d.ts +1 -1
  120. package/src/shade/renderer/fluid/query/GPUFluidQueries.d.ts +1 -1
  121. package/src/shade/renderer/global_illumination/brick4/gpu/draw/shader_brick4_indirect_lighting.d.ts.map +1 -1
  122. package/src/shade/renderer/global_illumination/brick4/gpu/draw/shader_brick4_indirect_lighting.js +3 -1
  123. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUSceneBrickClipmap.d.ts +37 -7
  124. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUSceneBrickClipmap.d.ts.map +1 -1
  125. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUSceneBrickClipmap.js +132 -8
  126. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.d.ts +3 -1
  127. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.d.ts.map +1 -1
  128. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.js +6 -2
  129. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_indirect_lighting.d.ts.map +1 -1
  130. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_indirect_lighting.js +3 -1
  131. package/src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.d.ts +15 -7
  132. package/src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.d.ts.map +1 -1
  133. package/src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.js +40 -9
  134. package/src/shade/renderer/global_illumination/screen_probe/SCREEN_PROBE.d.ts +23 -0
  135. package/src/shade/renderer/global_illumination/screen_probe/SCREEN_PROBE.d.ts.map +1 -1
  136. package/src/shade/renderer/global_illumination/screen_probe/SCREEN_PROBE.js +26 -0
  137. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeDebugView.d.ts +1 -0
  138. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeDebugView.js +6 -0
  139. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.d.ts +13 -1
  140. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.d.ts.map +1 -1
  141. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.js +23 -1
  142. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe.d.ts.map +1 -1
  143. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe.js +2 -0
  144. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_rough_specular.d.ts +29 -0
  145. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_rough_specular.d.ts.map +1 -0
  146. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_rough_specular.js +102 -0
  147. package/src/shade/renderer/global_illumination/screen_probe/graph_screen_probe_debug_view.d.ts +8 -1
  148. package/src/shade/renderer/global_illumination/screen_probe/graph_screen_probe_debug_view.d.ts.map +1 -1
  149. package/src/shade/renderer/global_illumination/screen_probe/graph_screen_probe_debug_view.js +27 -1
  150. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_gather.d.ts +4 -1
  151. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_gather.d.ts.map +1 -1
  152. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_gather.js +4 -1
  153. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_indirect_lighting.d.ts +11 -5
  154. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_indirect_lighting.d.ts.map +1 -1
  155. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_indirect_lighting.js +28 -10
  156. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_resolve.d.ts +36 -2
  157. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_resolve.d.ts.map +1 -1
  158. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_resolve.js +149 -4
  159. package/src/shade/renderer/global_illumination/shader_resolve_indirect_lighting.d.ts.map +1 -1
  160. package/src/shade/renderer/global_illumination/shader_resolve_indirect_lighting.js +3 -1
  161. package/src/shade/renderer/global_illumination/sharc/sharc_constants.d.ts +0 -18
  162. package/src/shade/renderer/global_illumination/sharc/sharc_constants.d.ts.map +1 -1
  163. package/src/shade/renderer/global_illumination/sharc/sharc_constants.js +1 -21
  164. package/src/shade/renderer/hair/GPUHairSystem.d.ts +278 -0
  165. package/src/shade/renderer/hair/GPUHairSystem.d.ts.map +1 -0
  166. package/src/shade/renderer/hair/GPUHairSystem.js +2263 -0
  167. package/src/shade/renderer/hair/HAIR.d.ts +121 -0
  168. package/src/shade/renderer/hair/HAIR.d.ts.map +1 -0
  169. package/src/shade/renderer/hair/HAIR.js +136 -0
  170. package/src/shade/renderer/hair/HAIR_DATABASE_SPEC.d.ts +17 -0
  171. package/src/shade/renderer/hair/HAIR_DATABASE_SPEC.d.ts.map +1 -0
  172. package/src/shade/renderer/hair/HAIR_DATABASE_SPEC.js +104 -0
  173. package/src/shade/renderer/hair/HAIR_FRAME_STRUCTS.d.ts +15 -0
  174. package/src/shade/renderer/hair/HAIR_FRAME_STRUCTS.d.ts.map +1 -0
  175. package/src/shade/renderer/hair/HAIR_FRAME_STRUCTS.js +70 -0
  176. package/src/shade/renderer/hair/HAIR_SIMULATION.d.ts +139 -0
  177. package/src/shade/renderer/hair/HAIR_SIMULATION.d.ts.map +1 -0
  178. package/src/shade/renderer/hair/HAIR_SIMULATION.js +160 -0
  179. package/src/shade/renderer/hair/HairFrame.d.ts +41 -0
  180. package/src/shade/renderer/hair/HairFrame.d.ts.map +1 -0
  181. package/src/shade/renderer/hair/HairFrame.js +76 -0
  182. package/src/shade/renderer/hair/chunk_hair_bsdf.d.ts +42 -0
  183. package/src/shade/renderer/hair/chunk_hair_bsdf.d.ts.map +1 -0
  184. package/src/shade/renderer/hair/chunk_hair_bsdf.js +170 -0
  185. package/src/shade/renderer/hair/chunk_hair_dual_scattering.d.ts +37 -0
  186. package/src/shade/renderer/hair/chunk_hair_dual_scattering.d.ts.map +1 -0
  187. package/src/shade/renderer/hair/chunk_hair_dual_scattering.js +158 -0
  188. package/src/shade/renderer/hair/chunk_hair_guide.d.ts +59 -0
  189. package/src/shade/renderer/hair/chunk_hair_guide.d.ts.map +1 -0
  190. package/src/shade/renderer/hair/chunk_hair_guide.js +179 -0
  191. package/src/shade/renderer/hair/chunk_hair_pixel.d.ts +32 -0
  192. package/src/shade/renderer/hair/chunk_hair_pixel.d.ts.map +1 -0
  193. package/src/shade/renderer/hair/chunk_hair_pixel.js +116 -0
  194. package/src/shade/renderer/hair/chunk_hair_strand.d.ts +40 -0
  195. package/src/shade/renderer/hair/chunk_hair_strand.d.ts.map +1 -0
  196. package/src/shade/renderer/hair/chunk_hair_strand.js +85 -0
  197. package/src/shade/renderer/hair/chunk_hair_volume.d.ts +32 -0
  198. package/src/shade/renderer/hair/chunk_hair_volume.d.ts.map +1 -0
  199. package/src/shade/renderer/hair/chunk_hair_volume.js +115 -0
  200. package/src/shade/renderer/hair/hair_id_draw.d.ts +24 -0
  201. package/src/shade/renderer/hair/hair_id_draw.d.ts.map +1 -0
  202. package/src/shade/renderer/hair/hair_id_draw.js +135 -0
  203. package/src/shade/renderer/hair/hair_lighting.d.ts +53 -0
  204. package/src/shade/renderer/hair/hair_lighting.d.ts.map +1 -0
  205. package/src/shade/renderer/hair/hair_lighting.js +279 -0
  206. package/src/shade/renderer/hair/hair_scattering_lut.d.ts +75 -0
  207. package/src/shade/renderer/hair/hair_scattering_lut.d.ts.map +1 -0
  208. package/src/shade/renderer/hair/hair_scattering_lut.js +271 -0
  209. package/src/shade/renderer/hair/hair_shadow_draw.d.ts +32 -0
  210. package/src/shade/renderer/hair/hair_shadow_draw.d.ts.map +1 -0
  211. package/src/shade/renderer/hair/hair_shadow_draw.js +123 -0
  212. package/src/shade/renderer/hair/hair_stamp.d.ts +33 -0
  213. package/src/shade/renderer/hair/hair_stamp.d.ts.map +1 -0
  214. package/src/shade/renderer/hair/hair_stamp.js +175 -0
  215. package/src/shade/renderer/hair/shader_hair_classes.d.ts +22 -0
  216. package/src/shade/renderer/hair/shader_hair_classes.d.ts.map +1 -0
  217. package/src/shade/renderer/hair/shader_hair_classes.js +90 -0
  218. package/src/shade/renderer/hair/shader_hair_cull.d.ts +37 -0
  219. package/src/shade/renderer/hair/shader_hair_cull.d.ts.map +1 -0
  220. package/src/shade/renderer/hair/shader_hair_cull.js +251 -0
  221. package/src/shade/renderer/hair/shader_hair_lod.d.ts +39 -0
  222. package/src/shade/renderer/hair/shader_hair_lod.d.ts.map +1 -0
  223. package/src/shade/renderer/hair/shader_hair_lod.js +362 -0
  224. package/src/shade/renderer/hair/shader_hair_roots.d.ts +36 -0
  225. package/src/shade/renderer/hair/shader_hair_roots.d.ts.map +1 -0
  226. package/src/shade/renderer/hair/shader_hair_roots.js +261 -0
  227. package/src/shade/renderer/hair/shader_hair_shadow_list.d.ts +44 -0
  228. package/src/shade/renderer/hair/shader_hair_shadow_list.d.ts.map +1 -0
  229. package/src/shade/renderer/hair/shader_hair_shadow_list.js +240 -0
  230. package/src/shade/renderer/hair/shader_hair_simulate.d.ts +55 -0
  231. package/src/shade/renderer/hair/shader_hair_simulate.d.ts.map +1 -0
  232. package/src/shade/renderer/hair/shader_hair_simulate.js +563 -0
  233. package/src/shade/renderer/hair/shader_hair_volume.d.ts +28 -0
  234. package/src/shade/renderer/hair/shader_hair_volume.d.ts.map +1 -0
  235. package/src/shade/renderer/hair/shader_hair_volume.js +154 -0
  236. package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
  237. package/src/shade/renderer/loader/usd/usd_build_scene.d.ts +31 -0
  238. package/src/shade/renderer/loader/usd/usd_build_scene.d.ts.map +1 -1
  239. package/src/shade/renderer/loader/usd/usd_build_scene.js +36 -21
  240. package/src/shade/renderer/loader/usd/usd_groom_extension.d.ts +65 -0
  241. package/src/shade/renderer/loader/usd/usd_groom_extension.d.ts.map +1 -0
  242. package/src/shade/renderer/loader/usd/usd_groom_extension.js +470 -0
  243. package/src/shade/renderer/particles/GPUParticleSystem.d.ts +8 -0
  244. package/src/shade/renderer/particles/GPUParticleSystem.d.ts.map +1 -1
  245. package/src/shade/renderer/particles/GPUParticleSystem.js +28 -0
  246. package/src/shade/renderer/particles/graph/ParticleNodeRegistry.d.ts.map +1 -1
  247. package/src/shade/renderer/particles/graph/ParticleNodeRegistry.js +22 -0
  248. package/src/shade/renderer/particles/graph/groups/particle_builtin_groups.d.ts.map +1 -1
  249. package/src/shade/renderer/particles/graph/groups/particle_builtin_groups.js +4 -0
  250. package/src/shade/renderer/particles/graph/groups/particle_groups_scene.d.ts +32 -0
  251. package/src/shade/renderer/particles/graph/groups/particle_groups_scene.d.ts.map +1 -0
  252. package/src/shade/renderer/particles/graph/groups/particle_groups_scene.js +80 -0
  253. package/src/shade/renderer/particles/graph/particle_node_parameters.d.ts.map +1 -1
  254. package/src/shade/renderer/particles/graph/particle_node_parameters.js +1 -0
  255. package/src/shade/renderer/particles/graph/particle_node_presentation.d.ts.map +1 -1
  256. package/src/shade/renderer/particles/graph/particle_node_presentation.js +12 -0
  257. package/src/shade/renderer/particles/graph_particles.d.ts +5 -1
  258. package/src/shade/renderer/particles/graph_particles.d.ts.map +1 -1
  259. package/src/shade/renderer/particles/graph_particles.js +18 -3
  260. package/src/shade/renderer/particles/isa/InstructionStream.d.ts +25 -0
  261. package/src/shade/renderer/particles/isa/InstructionStream.d.ts.map +1 -1
  262. package/src/shade/renderer/particles/isa/InstructionStream.js +25 -0
  263. package/src/shade/renderer/particles/isa/ParticleVMISA.d.ts +9 -0
  264. package/src/shade/renderer/particles/isa/ParticleVMISA.d.ts.map +1 -1
  265. package/src/shade/renderer/particles/isa/ParticleVMISA.js +20 -0
  266. package/src/shade/renderer/particles/isa/particle_program_reads_scene_sdf.d.ts +9 -0
  267. package/src/shade/renderer/particles/isa/particle_program_reads_scene_sdf.d.ts.map +1 -0
  268. package/src/shade/renderer/particles/isa/particle_program_reads_scene_sdf.js +29 -0
  269. package/src/shade/renderer/particles/optimizer/particle_program_equivalence.d.ts +2 -1
  270. package/src/shade/renderer/particles/optimizer/particle_program_equivalence.d.ts.map +1 -1
  271. package/src/shade/renderer/particles/optimizer/particle_program_equivalence.js +27 -5
  272. package/src/shade/renderer/particles/optimizer/particle_program_fuzz.js +1 -1
  273. package/src/shade/renderer/particles/optimizer/particle_vm_semantics.d.ts.map +1 -1
  274. package/src/shade/renderer/particles/optimizer/particle_vm_semantics.js +5 -0
  275. package/src/shade/renderer/particles/runtime/EmitterRegistry.d.ts +7 -0
  276. package/src/shade/renderer/particles/runtime/EmitterRegistry.d.ts.map +1 -1
  277. package/src/shade/renderer/particles/runtime/EmitterRegistry.js +10 -0
  278. package/src/shade/renderer/particles/runtime/ParticleEmitter.d.ts +5 -0
  279. package/src/shade/renderer/particles/runtime/ParticleEmitter.d.ts.map +1 -1
  280. package/src/shade/renderer/particles/runtime/ParticleEmitter.js +5 -0
  281. package/src/shade/renderer/particles/runtime/ProgramHeap.d.ts +8 -0
  282. package/src/shade/renderer/particles/runtime/ProgramHeap.d.ts.map +1 -1
  283. package/src/shade/renderer/particles/runtime/ProgramHeap.js +25 -0
  284. package/src/shade/renderer/particles/shaders/shader_particle_emit.d.ts +1 -1
  285. package/src/shade/renderer/particles/shaders/shader_particle_emit.d.ts.map +1 -1
  286. package/src/shade/renderer/particles/shaders/shader_particle_emit.js +9 -3
  287. package/src/shade/renderer/particles/shaders/shader_particle_emit_wide.d.ts.map +1 -1
  288. package/src/shade/renderer/particles/shaders/shader_particle_emit_wide.js +4 -2
  289. package/src/shade/renderer/particles/shaders/shader_particle_simulate.d.ts +2 -2
  290. package/src/shade/renderer/particles/shaders/shader_particle_simulate.d.ts.map +1 -1
  291. package/src/shade/renderer/particles/shaders/shader_particle_simulate.js +10 -4
  292. package/src/shade/renderer/particles/shaders/shader_particle_simulate_wide.d.ts.map +1 -1
  293. package/src/shade/renderer/particles/shaders/shader_particle_simulate_wide.js +4 -2
  294. package/src/shade/renderer/particles/vm/ParticleVMReference.d.ts +14 -1
  295. package/src/shade/renderer/particles/vm/ParticleVMReference.d.ts.map +1 -1
  296. package/src/shade/renderer/particles/vm/ParticleVMReference.js +34 -1
  297. package/src/shade/renderer/particles/vm/chunk_particle_vm.d.ts.map +1 -1
  298. package/src/shade/renderer/particles/vm/chunk_particle_vm.js +10 -0
  299. package/src/shade/renderer/particles/vm/chunk_particle_vm_scene_sdf.d.ts +39 -0
  300. package/src/shade/renderer/particles/vm/chunk_particle_vm_scene_sdf.d.ts.map +1 -0
  301. package/src/shade/renderer/particles/vm/chunk_particle_vm_scene_sdf.js +90 -0
  302. package/src/shade/renderer/particles/warmup/graph_particle_warmup.d.ts +4 -1
  303. package/src/shade/renderer/particles/warmup/graph_particle_warmup.d.ts.map +1 -1
  304. package/src/shade/renderer/particles/warmup/graph_particle_warmup.js +14 -2
  305. package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance.d.ts +1 -1
  306. package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance.d.ts.map +1 -1
  307. package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance.js +9 -3
  308. package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance_wide.d.ts.map +1 -1
  309. package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance_wide.js +4 -2
  310. package/src/shade/renderer/path_tracer/shader/chunk_sample_material_data.d.ts.map +1 -1
  311. package/src/shade/renderer/path_tracer/shader/chunk_sample_material_data.js +4 -1
  312. package/src/shade/renderer/path_tracer/shader/chunk_shading_closure_from_material_data.d.ts.map +1 -1
  313. package/src/shade/renderer/path_tracer/shader/chunk_shading_closure_from_material_data.js +3 -1
  314. package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
  315. package/src/shade/renderer/postprocess/ssr/SSR.d.ts +4 -1
  316. package/src/shade/renderer/postprocess/ssr/SSR.d.ts.map +1 -1
  317. package/src/shade/renderer/postprocess/ssr/SSR.js +9 -0
  318. package/src/shade/renderer/postprocess/ssr/resolve/chunk_ssr_sample_radiance.d.ts +16 -1
  319. package/src/shade/renderer/postprocess/ssr/resolve/chunk_ssr_sample_radiance.d.ts.map +1 -1
  320. package/src/shade/renderer/postprocess/ssr/resolve/chunk_ssr_sample_radiance.js +47 -3
  321. package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader.d.ts.map +1 -1
  322. package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader.js +5 -3
  323. package/src/shade/renderer/postprocess/ssr/ssr_combine_shader.d.ts.map +1 -1
  324. package/src/shade/renderer/postprocess/ssr/ssr_combine_shader.js +6 -5
  325. package/src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.d.ts +7 -4
  326. package/src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.d.ts.map +1 -1
  327. package/src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.js +26 -16
  328. package/src/shade/renderer/rasterize/forward/chunk_forward_shade_standard_fragment.d.ts.map +1 -1
  329. package/src/shade/renderer/rasterize/forward/chunk_forward_shade_standard_fragment.js +5 -2
  330. package/src/shade/renderer/rasterize/native/avboit/avboit_draw_fragment_body.d.ts.map +1 -1
  331. package/src/shade/renderer/rasterize/native/avboit/avboit_draw_fragment_body.js +5 -0
  332. package/src/shade/renderer/rasterize/native/avboit/shader_avboit_splat.d.ts.map +1 -1
  333. package/src/shade/renderer/rasterize/native/avboit/shader_avboit_splat.js +4 -1
  334. package/src/shade/renderer/rasterize/native/oit/oit_resolve_fragment_body.d.ts.map +1 -1
  335. package/src/shade/renderer/rasterize/native/oit/oit_resolve_fragment_body.js +5 -1
  336. package/src/shade/renderer/rasterize/native/oit/shader_oit_generate_moments.d.ts.map +1 -1
  337. package/src/shade/renderer/rasterize/native/oit/shader_oit_generate_moments.js +7 -4
  338. package/src/shade/renderer/scene/GPUSceneContext.d.ts +7 -0
  339. package/src/shade/renderer/scene/GPUSceneContext.d.ts.map +1 -1
  340. package/src/shade/renderer/scene/GPUSceneContext.js +18 -0
  341. package/src/shade/renderer/shader/chunk/brdf/chunk_shadowed_F90.d.ts +13 -8
  342. package/src/shade/renderer/shader/chunk/brdf/chunk_shadowed_F90.d.ts.map +1 -1
  343. package/src/shade/renderer/shader/chunk/brdf/chunk_shadowed_F90.js +18 -14
  344. package/src/shade/renderer/shader/chunk/light/chunk_compute_multiscattering_specular.d.ts +3 -2
  345. package/src/shade/renderer/shader/chunk/light/chunk_compute_multiscattering_specular.d.ts.map +1 -1
  346. package/src/shade/renderer/shader/chunk/light/chunk_compute_multiscattering_specular.js +12 -4
  347. package/src/shade/renderer/shader/chunk/material/MATERIAL_SHADING_INFO_STRUCT.d.ts.map +1 -1
  348. package/src/shade/renderer/shader/chunk/material/MATERIAL_SHADING_INFO_STRUCT.js +1 -0
  349. package/src/shade/renderer/shader/chunk/material/chunk_compute_indirect_specular.js +1 -1
  350. package/src/shade/renderer/shader/chunk/material/chunk_metalness_to_specular_F90.d.ts +16 -0
  351. package/src/shade/renderer/shader/chunk/material/chunk_metalness_to_specular_F90.d.ts.map +1 -0
  352. package/src/shade/renderer/shader/chunk/material/chunk_metalness_to_specular_F90.js +25 -0
  353. package/src/shade/renderer/shader/chunk/material/chunk_re_direct_multiscatter.js +2 -2
  354. package/src/shade/renderer/shader/chunk/sdf/chunk_shape_record_signed_distance_gradient.d.ts +20 -0
  355. package/src/shade/renderer/shader/chunk/sdf/chunk_shape_record_signed_distance_gradient.d.ts.map +1 -0
  356. package/src/shade/renderer/shader/chunk/sdf/chunk_shape_record_signed_distance_gradient.js +134 -0
  357. package/src/shade/renderer/shader/compiler/ShaderSwitch.d.ts +1 -1
  358. package/src/shade/renderer/shader/compiler/ShaderSwitchSet.d.ts +1 -1
  359. package/src/shade/renderer/shader/resource/ShaderResourceDescriptor.d.ts +1 -1
  360. package/src/shade/renderer/shadow/map/GPUSceneShadowmapContext.d.ts +15 -0
  361. package/src/shade/renderer/shadow/map/GPUSceneShadowmapContext.d.ts.map +1 -1
  362. package/src/shade/renderer/shadow/map/GPUSceneShadowmapContext.js +69 -0
  363. package/src/shade/renderer/shadow/map/shader/chunk_shadowmap_directional_atlas_casters.d.ts +10 -0
  364. package/src/shade/renderer/shadow/map/shader/chunk_shadowmap_directional_atlas_casters.d.ts.map +1 -0
  365. package/src/shade/renderer/shadow/map/shader/chunk_shadowmap_directional_atlas_casters.js +22 -0
  366. package/src/shade/renderer/shadow/map/shader/chunk_shadowmap_sample_point2.d.ts +2 -2
  367. package/src/shade/renderer/shadow/map/shader/chunk_shadowmap_sample_point2.js +2 -2
  368. package/src/shade/renderer/water/query/GPUWaterQueries.d.ts +1 -1
  369. package/src/shade/renderer/wind/GPUSceneWind.d.ts +1 -1
@@ -4,7 +4,8 @@
4
4
  * its bricks from the scene's mesh fields, and the holds on the geometry caches those fields are baked into
5
5
  * ({@link ProbeClipmapSceneHolds}).
6
6
  *
7
- * Its readers hold it: the probe clipmap GI, under its two modes, and the acoustics, under any. Each that writes a
7
+ * Its readers hold it: the probe clipmap GI, under its two modes, the acoustics, under any, and the particle system
8
+ * while an effect it runs reads the distance field. Each that writes a
8
9
  * payload of its own over the bricks as they are built adds its writer ({@link add_material_writer}): the GI its
9
10
  * surface material, the acoustics their acoustic records. A plugin that writes bricks of its own adds a provider
10
11
  * ({@link add_provider}), run after the mesh provider over the same cells.
@@ -13,10 +14,17 @@
13
14
  * the surface caches' only when asked to (the GI's material reads them, nothing else does), the rows the holds
14
15
  * invalidated, and the build around the view's camera. Nothing while nobody holds it.
15
16
  *
17
+ * **Reading it.** A reader binds what {@link write_bindings} writes and passes {@link cascade_count} and
18
+ * {@link atlas_shift} in its immediate data, every frame. Until the clipmap is built, and after it is given back, those
19
+ * are a clipmap of no cascade: textures of one texel and a zero count, which a reader takes as no field at all, so a
20
+ * pass that reads the bricks binds the same way whether or not anything has built them.
21
+ *
16
22
  * **Lifetime.** Made with the scene, empty. The clipmap and the holds are made on the first frame something holds
17
23
  * it, made again when a frame is for another view or for clipmap settings it was not built with, and given back
18
- * when the last holder lets go ({@link release}): the holds let go of every cache and trim nothing, so the fields
19
- * are there when someone holds it again (D28); the surface caches go, and are baked again.
24
+ * when the last holder lets go ({@link release}) — or, when it lets go while recording a frame whose build is
25
+ * recorded already, by the next frame's {@link graph_update}, so that the frame's graph still runs it; a holder
26
+ * that takes it again before then keeps it as it is. Given back, the holds let go of every cache and trim nothing,
27
+ * so the fields are there when someone holds it again (D28); the surface caches go, and are baked again.
20
28
  */
21
29
  export class GPUSceneBrickClipmap {
22
30
  /**
@@ -42,18 +50,40 @@ export class GPUSceneBrickClipmap {
42
50
  * which a pass reading the bricks reads to come after it; -1 before any
43
51
  */
44
52
  get bricks(): number;
53
+ /**
54
+ * @returns {number} the cascades a reader reads through, `GPUBrickClipmap#cascade_count`; 0 while there is no
55
+ * clipmap, which a reader takes as no field
56
+ */
57
+ get cascade_count(): number;
58
+ /**
59
+ * @returns {number} the atlas's footprint a reader passes to its samples, `GPUBrickClipmap#atlas_shift`; 0 while
60
+ * there is no clipmap
61
+ */
62
+ get atlas_shift(): number;
63
+ /**
64
+ * Put what a reader of the bricks binds into its bindings, under the names `chunk_brick_clipmap_trace.js` reads:
65
+ * the clipmap's (`GPUBrickClipmap#write_bindings`), or while there is none a clipmap of no cascade, read through
66
+ * a {@link cascade_count} of 0. The clipmap's atlas is replaced when it grows: take them each frame.
67
+ *
68
+ * @param {Object} bindings
69
+ * @returns {Object} bindings
70
+ */
71
+ write_bindings(bindings: any): any;
45
72
  /**
46
73
  * Hold it: from the next frame on it is built, until every holder has let go.
47
74
  * @param {Object} holder
48
75
  */
49
76
  acquire(holder: any): void;
50
77
  /**
51
- * Let go of it. The last holder to let go gives back the clipmap and the holds.
78
+ * Let go of it. The last holder to let go gives back the clipmap and the holds — at once, or, when it lets go
79
+ * while recording the graph this frame's build was recorded into, by the next frame's {@link graph_update}: that
80
+ * graph has passes over them still to run.
52
81
  *
53
82
  * @param {Object} holder
83
+ * @param {FrameGraph|null} [graph] the graph the holder is recording, when it lets go in the middle of a frame
54
84
  * @returns {boolean} whether `holder` held it
55
85
  */
56
- release(holder: any): boolean;
86
+ release(holder: any, graph?: FrameGraph | null): boolean;
57
87
  /**
58
88
  * Have a payload written over the bricks as they are built, after every writer added before it. The bricks
59
89
  * built before have none of it, so a clipmap already built is made again from the next frame, as for new
@@ -81,8 +111,8 @@ export class GPUSceneBrickClipmap {
81
111
  remove_provider(provider: BrickProvider): boolean;
82
112
  /**
83
113
  * Record the frame's bake and build, once a frame: a second call in the same graph records nothing and answers
84
- * the same. Records nothing while nothing holds it. Allocates nothing on a frame that changes neither the view
85
- * nor the clipmap's settings and has nothing to bake.
114
+ * the same. Records nothing while nothing holds it, and gives back what the last holder let go of. Allocates
115
+ * nothing on a frame that changes neither the view nor the clipmap's settings and has nothing to bake.
86
116
  *
87
117
  * @param {Object} options
88
118
  * @param {FrameGraph} options.graph
@@ -1 +1 @@
1
- {"version":3,"file":"GPUSceneBrickClipmap.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/global_illumination/probe_clipmap/brick/GPUSceneBrickClipmap.js"],"names":[],"mappings":"AA+BA;;;;;;;;;;;;;;;;;;;GAmBG;AACH;IAqDI;;;OAGG;IACH,sBAHW,eAAe,SACf,eAAe,EAQzB;IAED;;;OAGG;IACH,oBAEC;IAED;;OAEG;IACH,qCAEC;IAED;;OAEG;IACH,oCAEC;IAED;;;OAGG;IACH,qBAEC;IAED;;;OAGG;IACH,2BAKC;IAED;;;;;OAKG;IACH,sBAFa,OAAO,CAYnB;IAED;;;;;;OAMG;IACH,4BAFW,mBAAmB,QAU7B;IAED;;;OAGG;IACH,+BAHW,mBAAmB,GACjB,OAAO,CAYnB;IAED;;;;;OAKG;IACH,uBAFW,aAAa,QASvB;IAED;;;OAGG;IACH,0BAHW,aAAa,GACX,OAAO,CAanB;IAED;;;;;;;;;;;;;;;OAeG;IACH;QAV+B,KAAK,EAAzB,UAAU;QACc,IAAI,EAA5B,cAAc;QACgB,QAAQ,EAAtC,oBAAoB;QACH,MAAM,GAAvB,MAAM;QAEY,QAAQ,GAA1B,OAAO;QAEL,MAAM,CA2ElB;IAkED,gBASC;;CACJ;yBA9YY,OAAO,iEAAiE,EAAE,UAAU;8BACpF,OAAO,6BAA6B,EAAE,eAAe;8BACrD,OAAO,mCAAmC,EAAE,eAAe;6BAC3D,OAAO,iCAAiC,EAAE,cAAc;mCACxD,OAAO,4BAA4B,EAAE,oBAAoB;4BACzD,OAAO,sBAAsB,EAAE,aAAa;kCAC5C,OAAO,sBAAsB,EAAE,mBAAmB;gCAV/B,sBAAsB;uCADf,8BAA8B"}
1
+ {"version":3,"file":"GPUSceneBrickClipmap.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/global_illumination/probe_clipmap/brick/GPUSceneBrickClipmap.js"],"names":[],"mappings":"AAkCA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH;IAkEI;;;OAGG;IACH,sBAHW,eAAe,SACf,eAAe,EAQzB;IAED;;;OAGG;IACH,oBAEC;IAED;;OAEG;IACH,qCAEC;IAED;;OAEG;IACH,oCAEC;IAED;;;OAGG;IACH,qBAEC;IAED;;;OAGG;IACH,4BAEC;IAED;;;OAGG;IACH,0BAEC;IAED;;;;;;;OAOG;IACH,mCAUC;IAED;;;OAGG;IACH,2BAKC;IAED;;;;;;;;OAQG;IACH,6BAHW,UAAU,GAAC,IAAI,GACb,OAAO,CAkBnB;IAED;;;;;;OAMG;IACH,4BAFW,mBAAmB,QAU7B;IAED;;;OAGG;IACH,+BAHW,mBAAmB,GACjB,OAAO,CAYnB;IAED;;;;;OAKG;IACH,uBAFW,aAAa,QASvB;IAED;;;OAGG;IACH,0BAHW,aAAa,GACX,OAAO,CAanB;IAED;;;;;;;;;;;;;;;OAeG;IACH;QAV+B,KAAK,EAAzB,UAAU;QACc,IAAI,EAA5B,cAAc;QACgB,QAAQ,EAAtC,oBAAoB;QACH,MAAM,GAAvB,MAAM;QAEY,QAAQ,GAA1B,OAAO;QAEL,MAAM,CA+ElB;IAyGD,gBAqBC;;CACJ;yBAvgBY,OAAO,iEAAiE,EAAE,UAAU;8BACpF,OAAO,6BAA6B,EAAE,eAAe;8BACrD,OAAO,mCAAmC,EAAE,eAAe;6BAC3D,OAAO,iCAAiC,EAAE,cAAc;mCACxD,OAAO,4BAA4B,EAAE,oBAAoB;4BACzD,OAAO,sBAAsB,EAAE,aAAa;kCAC5C,OAAO,sBAAsB,EAAE,mBAAmB;gCAV/B,sBAAsB;uCADf,8BAA8B"}
@@ -1,4 +1,7 @@
1
1
  import { assert } from "../../../../../core/assert.js";
2
+ import { BufferDescriptor } from "../../../../descriptor/buffer/BufferDescriptor.js";
3
+ import { MESH_SDF_SAMPLER } from "../../../geometry/sdf/MESH_SDF_RESOURCES.js";
4
+ import { CLIPMAP_LEVEL_ARRAY } from "../../../shader/chunk/clipmap/CLIPMAP_LEVEL_STRUCT.js";
2
5
  import { ProbeClipmapSceneHolds } from "../ProbeClipmapSceneHolds.js";
3
6
  import { GPUBrickClipmap } from "./GPUBrickClipmap.js";
4
7
  import { MeshSDFBrickProvider } from "./mesh/MeshSDFBrickProvider.js";
@@ -35,7 +38,8 @@ class BrickBuildOptions {
35
38
  * its bricks from the scene's mesh fields, and the holds on the geometry caches those fields are baked into
36
39
  * ({@link ProbeClipmapSceneHolds}).
37
40
  *
38
- * Its readers hold it: the probe clipmap GI, under its two modes, and the acoustics, under any. Each that writes a
41
+ * Its readers hold it: the probe clipmap GI, under its two modes, the acoustics, under any, and the particle system
42
+ * while an effect it runs reads the distance field. Each that writes a
39
43
  * payload of its own over the bricks as they are built adds its writer ({@link add_material_writer}): the GI its
40
44
  * surface material, the acoustics their acoustic records. A plugin that writes bricks of its own adds a provider
41
45
  * ({@link add_provider}), run after the mesh provider over the same cells.
@@ -44,10 +48,17 @@ class BrickBuildOptions {
44
48
  * the surface caches' only when asked to (the GI's material reads them, nothing else does), the rows the holds
45
49
  * invalidated, and the build around the view's camera. Nothing while nobody holds it.
46
50
  *
51
+ * **Reading it.** A reader binds what {@link write_bindings} writes and passes {@link cascade_count} and
52
+ * {@link atlas_shift} in its immediate data, every frame. Until the clipmap is built, and after it is given back, those
53
+ * are a clipmap of no cascade: textures of one texel and a zero count, which a reader takes as no field at all, so a
54
+ * pass that reads the bricks binds the same way whether or not anything has built them.
55
+ *
47
56
  * **Lifetime.** Made with the scene, empty. The clipmap and the holds are made on the first frame something holds
48
57
  * it, made again when a frame is for another view or for clipmap settings it was not built with, and given back
49
- * when the last holder lets go ({@link release}): the holds let go of every cache and trim nothing, so the fields
50
- * are there when someone holds it again (D28); the surface caches go, and are baked again.
58
+ * when the last holder lets go ({@link release}) — or, when it lets go while recording a frame whose build is
59
+ * recorded already, by the next frame's {@link graph_update}, so that the frame's graph still runs it; a holder
60
+ * that takes it again before then keeps it as it is. Given back, the holds let go of every cache and trim nothing,
61
+ * so the fields are there when someone holds it again (D28); the surface caches go, and are baked again.
51
62
  */
52
63
  export class GPUSceneBrickClipmap {
53
64
  /** @type {GraphicsContext} */
@@ -93,6 +104,13 @@ export class GPUSceneBrickClipmap {
93
104
  */
94
105
  #material_writers = [];
95
106
 
107
+ /**
108
+ * The last holder let go while recording the frame the build was recorded into, and nothing has been given back
109
+ * yet: the next {@link graph_update} that finds nobody holding it does.
110
+ * @type {boolean}
111
+ */
112
+ #release_pending = false;
113
+
96
114
  /** {@link GPUViewContext#id} of the view the clipmap was made around. */
97
115
  #view_id = -1;
98
116
 
@@ -102,6 +120,12 @@ export class GPUSceneBrickClipmap {
102
120
 
103
121
  #destroyed = false;
104
122
 
123
+ /**
124
+ * What {@link write_bindings} writes while there is no clipmap: made on the first such write.
125
+ * @type {{textures: GPUTexture[], buffers: GPUBuffer[], bindings: Object}|undefined}
126
+ */
127
+ #placeholder = undefined;
128
+
105
129
  /**
106
130
  * @param {GraphicsContext} graphics
107
131
  * @param {GPUSceneContext} scene
@@ -144,6 +168,42 @@ export class GPUSceneBrickClipmap {
144
168
  return this.#bricks;
145
169
  }
146
170
 
171
+ /**
172
+ * @returns {number} the cascades a reader reads through, `GPUBrickClipmap#cascade_count`; 0 while there is no
173
+ * clipmap, which a reader takes as no field
174
+ */
175
+ get cascade_count() {
176
+ return this.#clipmap === undefined ? 0 : this.#clipmap.cascade_count;
177
+ }
178
+
179
+ /**
180
+ * @returns {number} the atlas's footprint a reader passes to its samples, `GPUBrickClipmap#atlas_shift`; 0 while
181
+ * there is no clipmap
182
+ */
183
+ get atlas_shift() {
184
+ return this.#clipmap === undefined ? 0 : this.#clipmap.atlas_shift;
185
+ }
186
+
187
+ /**
188
+ * Put what a reader of the bricks binds into its bindings, under the names `chunk_brick_clipmap_trace.js` reads:
189
+ * the clipmap's (`GPUBrickClipmap#write_bindings`), or while there is none a clipmap of no cascade, read through
190
+ * a {@link cascade_count} of 0. The clipmap's atlas is replaced when it grows: take them each frame.
191
+ *
192
+ * @param {Object} bindings
193
+ * @returns {Object} bindings
194
+ */
195
+ write_bindings(bindings) {
196
+ if (this.#clipmap !== undefined) {
197
+ return this.#clipmap.write_bindings(bindings);
198
+ }
199
+
200
+ if (this.#placeholder === undefined) {
201
+ this.#placeholder = this.#make_placeholder();
202
+ }
203
+
204
+ return Object.assign(bindings, this.#placeholder.bindings);
205
+ }
206
+
147
207
  /**
148
208
  * Hold it: from the next frame on it is built, until every holder has let go.
149
209
  * @param {Object} holder
@@ -156,17 +216,26 @@ export class GPUSceneBrickClipmap {
156
216
  }
157
217
 
158
218
  /**
159
- * Let go of it. The last holder to let go gives back the clipmap and the holds.
219
+ * Let go of it. The last holder to let go gives back the clipmap and the holds — at once, or, when it lets go
220
+ * while recording the graph this frame's build was recorded into, by the next frame's {@link graph_update}: that
221
+ * graph has passes over them still to run.
160
222
  *
161
223
  * @param {Object} holder
224
+ * @param {FrameGraph|null} [graph] the graph the holder is recording, when it lets go in the middle of a frame
162
225
  * @returns {boolean} whether `holder` held it
163
226
  */
164
- release(holder) {
227
+ release(holder, graph = null) {
165
228
  if (!this.#holders.delete(holder)) {
166
229
  return false;
167
230
  }
168
231
 
169
- if (this.#holders.size === 0) {
232
+ if (this.#holders.size > 0) {
233
+ return true;
234
+ }
235
+
236
+ if (graph !== null && graph === this.#graph) {
237
+ this.#release_pending = true;
238
+ } else {
170
239
  this.#release_device();
171
240
  }
172
241
 
@@ -240,8 +309,8 @@ export class GPUSceneBrickClipmap {
240
309
 
241
310
  /**
242
311
  * Record the frame's bake and build, once a frame: a second call in the same graph records nothing and answers
243
- * the same. Records nothing while nothing holds it. Allocates nothing on a frame that changes neither the view
244
- * nor the clipmap's settings and has nothing to bake.
312
+ * the same. Records nothing while nothing holds it, and gives back what the last holder let go of. Allocates
313
+ * nothing on a frame that changes neither the view nor the clipmap's settings and has nothing to bake.
245
314
  *
246
315
  * @param {Object} options
247
316
  * @param {FrameGraph} options.graph
@@ -266,6 +335,10 @@ export class GPUSceneBrickClipmap {
266
335
  }
267
336
 
268
337
  if (this.#holders.size === 0) {
338
+ if (this.#release_pending) {
339
+ this.#release_device();
340
+ }
341
+
269
342
  return -1;
270
343
  }
271
344
 
@@ -328,6 +401,43 @@ export class GPUSceneBrickClipmap {
328
401
  return this.#bricks;
329
402
  }
330
403
 
404
+ /**
405
+ * A clipmap of no cascade: one-texel textures of the formats the real one has, and its levels zeroed as made.
406
+ */
407
+ #make_placeholder() {
408
+ const device = this.#graphics.device;
409
+
410
+ const texture = (name, format) => device.createTexture({
411
+ label: `Scene brick clipmap / placeholder ${name}`,
412
+ size: [1, 1, 1],
413
+ dimension: '3d',
414
+ format,
415
+ usage: GPUTextureUsage.TEXTURE_BINDING,
416
+ });
417
+
418
+ const levels = device.createBuffer(BufferDescriptor.fromJSON({
419
+ label: 'Scene brick clipmap / placeholder levels',
420
+ size: CLIPMAP_LEVEL_ARRAY.size,
421
+ usage: GPUBufferUsage.UNIFORM,
422
+ }));
423
+
424
+ const map = texture('map', 'r32uint');
425
+ const occupancy = texture('occupancy', 'r32uint');
426
+ const atlas = texture('atlas', 'r8unorm');
427
+
428
+ return {
429
+ textures: [map, occupancy, atlas],
430
+ buffers: [levels],
431
+ bindings: {
432
+ brick_levels: levels,
433
+ brick_map: map.createView(),
434
+ brick_occupancy: occupancy.createView(),
435
+ brick_atlas: atlas.createView(),
436
+ brick_sampler: MESH_SDF_SAMPLER,
437
+ },
438
+ };
439
+ }
440
+
331
441
  #order_providers() {
332
442
  const providers = this.#providers;
333
443
 
@@ -364,6 +474,8 @@ export class GPUSceneBrickClipmap {
364
474
  * again from nothing.
365
475
  */
366
476
  #release_device() {
477
+ this.#release_pending = false;
478
+
367
479
  if (this.#holds !== undefined) {
368
480
  this.#holds.detach();
369
481
  this.#holds = undefined;
@@ -401,5 +513,17 @@ export class GPUSceneBrickClipmap {
401
513
 
402
514
  this.#holders.clear();
403
515
  this.#release_device();
516
+
517
+ if (this.#placeholder !== undefined) {
518
+ for (const texture of this.#placeholder.textures) {
519
+ texture.destroy();
520
+ }
521
+
522
+ for (const buffer of this.#placeholder.buffers) {
523
+ buffer.destroy();
524
+ }
525
+
526
+ this.#placeholder = undefined;
527
+ }
404
528
  }
405
529
  }
@@ -158,7 +158,9 @@ export const chunk_brick_clipmap_trace_through: CodeChunk;
158
158
  * The finest window holding the point answers, unless its cell is UNKNOWN, which defers to the
159
159
  * parent. EMPTY reads R of its cascade, EMPTY inside -R: the surface is at least that far. A point no
160
160
  * window holds, or that only UNKNOWN cells cover, reads R of the coarsest cascade, its entry UNKNOWN.
161
- * The point's `entry` is the answering cell's (a slot, EMPTY or EMPTY inside) and `voxel` its cascade's.
161
+ * The point's `entry` is the answering cell's (a slot, EMPTY or EMPTY inside), `voxel` its cascade's, and `local`
162
+ * the point in voxels from that cell's least corner, where a slot is sampled (`brick_clipmap_sample`,
163
+ * `brick_clipmap_normal`).
162
164
  *
163
165
  * @type {CodeChunk}
164
166
  */
@@ -1 +1 @@
1
- {"version":3,"file":"chunk_brick_clipmap_trace.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.js"],"names":[],"mappings":"AAoBA;;;;GAIG;AACH,gCAFU,MAAM,CAEoB;AAEpC;;;;GAIG;AACH,gCAFU,MAAM,CAEwB;AAExC;;;;GAIG;AACH,qCAFU,MAAM,CAE0B;AAE1C;;;GAGG;AACH,yCAFU,wBAAwB,CAEoE;AAEtG;;;GAGG;AACH,+CAFU,wBAAwB,CAEgF;AAElH;;;GAGG;AACH,2CAFU,wBAAwB,CAEyE;AAE3G;;;GAGG;AACH,qCAFU,wBAAwB,CAEqF;AAEvH;;;GAGG;AACH,oCAFU,wBAAwB,CAEyE;AAE3G;;;;;;;;;;;;;;;;;;GAkBG;AACH,yCAFU,SAAS,CAyCZ;AAKP;;;;;;;;;;;;GAYG;AACH,yCAFU,SAAS,CAyBZ;AAIP;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wCAFU,SAAS,CAmFZ;AAKP;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wCAFU,SAAS,CAgHZ;AAEP;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,gDAFU,SAAS,CA6FZ;AAEP;;;;;;;;;;;;;;;GAeG;AACH,2CAFU,SAAS,CA4DZ;AAIP;;;;;;;;;;;;;;GAcG;AACH,2CAFU,SAAS,CA0BZ;yCAjoBkC,sDAAsD;0BADrE,uCAAuC"}
1
+ {"version":3,"file":"chunk_brick_clipmap_trace.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.js"],"names":[],"mappings":"AAoBA;;;;GAIG;AACH,gCAFU,MAAM,CAEoB;AAEpC;;;;GAIG;AACH,gCAFU,MAAM,CAEwB;AAExC;;;;GAIG;AACH,qCAFU,MAAM,CAE0B;AAE1C;;;GAGG;AACH,yCAFU,wBAAwB,CAEoE;AAEtG;;;GAGG;AACH,+CAFU,wBAAwB,CAEgF;AAElH;;;GAGG;AACH,2CAFU,wBAAwB,CAEyE;AAE3G;;;GAGG;AACH,qCAFU,wBAAwB,CAEqF;AAEvH;;;GAGG;AACH,oCAFU,wBAAwB,CAEyE;AAE3G;;;;;;;;;;;;;;;;;;GAkBG;AACH,yCAFU,SAAS,CAyCZ;AAKP;;;;;;;;;;;;GAYG;AACH,yCAFU,SAAS,CAyBZ;AAIP;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wCAFU,SAAS,CAmFZ;AAKP;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wCAFU,SAAS,CAgHZ;AAEP;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,gDAFU,SAAS,CA6FZ;AAEP;;;;;;;;;;;;;;;;;GAiBG;AACH,2CAFU,SAAS,CA8DZ;AAIP;;;;;;;;;;;;;;GAcG;AACH,2CAFU,SAAS,CA0BZ;yCAroBkC,sDAAsD;0BADrE,uCAAuC"}
@@ -543,7 +543,9 @@ fn brick_clipmap_trace_through(origin: vec3<f32>, direction: vec3<f32>, t_min: f
543
543
  * The finest window holding the point answers, unless its cell is UNKNOWN, which defers to the
544
544
  * parent. EMPTY reads R of its cascade, EMPTY inside -R: the surface is at least that far. A point no
545
545
  * window holds, or that only UNKNOWN cells cover, reads R of the coarsest cascade, its entry UNKNOWN.
546
- * The point's `entry` is the answering cell's (a slot, EMPTY or EMPTY inside) and `voxel` its cascade's.
546
+ * The point's `entry` is the answering cell's (a slot, EMPTY or EMPTY inside), `voxel` its cascade's, and `local`
547
+ * the point in voxels from that cell's least corner, where a slot is sampled (`brick_clipmap_sample`,
548
+ * `brick_clipmap_normal`).
547
549
  *
548
550
  * @type {CodeChunk}
549
551
  */
@@ -554,6 +556,7 @@ struct BrickClipmapPoint {
554
556
  distance: f32,
555
557
  entry: u32,
556
558
  voxel: f32,
559
+ local: vec3<f32>,
557
560
  }
558
561
 
559
562
  fn brick_clipmap_point(position: vec3<f32>, cascade_count: u32, atlas_shift: u32) -> BrickClipmapPoint {
@@ -579,6 +582,7 @@ fn brick_clipmap_point(position: vec3<f32>, cascade_count: u32, atlas_shift: u32
579
582
 
580
583
  point.entry = entry;
581
584
  point.voxel = voxel;
585
+ point.local = (position - vec3<f32>(cell) * level.cell_size) / voxel;
582
586
 
583
587
  if (!brick_clipmap_entry_holds_slot(entry)) {
584
588
  point.distance = select(1.0, -1.0, entry == BRICK_CLIPMAP_EMPTY_INSIDE) * BRICK_CLIPMAP_BAND_VOXELS * voxel;
@@ -586,7 +590,7 @@ fn brick_clipmap_point(position: vec3<f32>, cascade_count: u32, atlas_shift: u32
586
590
  return point;
587
591
  }
588
592
 
589
- point.distance = brick_clipmap_sample(entry, (position - vec3<f32>(cell) * level.cell_size) / voxel, voxel, atlas_shift);
593
+ point.distance = brick_clipmap_sample(entry, point.local, voxel, atlas_shift);
590
594
 
591
595
  return point;
592
596
  }
@@ -1 +1 @@
1
- {"version":3,"file":"shader_probe_clipmap_indirect_lighting.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_indirect_lighting.js"],"names":[],"mappings":"AAyIA;;;;;;;;;;;;;GAaG;AACH,qDAFU,WAAW,CA0BlB;4BA1JyB,gCAAgC"}
1
+ {"version":3,"file":"shader_probe_clipmap_indirect_lighting.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_indirect_lighting.js"],"names":[],"mappings":"AA2IA;;;;;;;;;;;;;GAaG;AACH,qDAFU,WAAW,CA0BlB;4BA3JyB,gCAAgC"}
@@ -14,6 +14,7 @@ import { chunk_compute_indirect_specular } from "../../../shader/chunk/material/
14
14
  import { chunk_decode_g_buffer_metalness } from "../../../shader/chunk/material/chunk_decode_g_buffer_metalness.js";
15
15
  import { chunk_decode_g_buffer_roughness } from "../../../shader/chunk/material/chunk_decode_g_buffer_roughness.js";
16
16
  import { chunk_metalness_to_specular_color } from "../../../shader/chunk/material/chunk_metalness_to_specular_color.js";
17
+ import { chunk_metalness_to_specular_F90 } from "../../../shader/chunk/material/chunk_metalness_to_specular_F90.js";
17
18
  import { chunk_stbn_sample_vec2 } from "../../../shader/chunk/noise/chunk_stbn_sample_vec2.js";
18
19
  import {
19
20
  chunk_sh3_color_get_irradiance_at
@@ -107,7 +108,7 @@ fn main(
107
108
  metalness_to_specular_color(f_metalness, albedo),
108
109
  vec3(MIN_DIELECTRICS_F0),
109
110
  albedo,
110
- 1.0,
111
+ metalness_to_specular_F90(f_metalness, albedo),
111
112
  roughness,
112
113
  );
113
114
 
@@ -123,6 +124,7 @@ fn main(
123
124
  chunk_decode_g_buffer_metalness,
124
125
  chunk_decode_g_buffer_roughness,
125
126
  chunk_metalness_to_specular_color,
127
+ chunk_metalness_to_specular_F90,
126
128
  chunk_MIN_DIELECTRICS_F0,
127
129
  chunk_stbn_sample_vec2,
128
130
  chunk_probe_clipmap_pick,
@@ -12,12 +12,12 @@
12
12
  * it wants); its BRDF and lighting densities and its rays, reassigned to where its light is; the screen trace; the
13
13
  * bricks' trace, shade, local light and bounce of what the screen left; the hits' wants; the composite into each
14
14
  * probe's radiance, the spatial filter's passes, and the probes' SH3.
15
- * 3. **Resolve** ({@link graph_resolve}), once the bent normals exist: each pixel's irradiance from its probes, then
16
- * the temporal filter into the frame's diffuse, which the deferred passes read.
15
+ * 3. **Resolve** ({@link graph_resolve}), once the bent normals exist: each pixel's irradiance and rough specular from
16
+ * its probes, then the temporal filter into the frame's diffuse and specular, which the deferred passes read.
17
17
  * 4. **Capture** ({@link graph_capture}): the lit colour of the opaque surfaces, for the next frame's screen hits.
18
18
  *
19
- * **Its history**: last frame's probes (their records and filtered radiance, for the lighting density), its diffuse
20
- * and frames (for the temporal filter) and its colour (for the screen hits) are kept while the structure and the view
19
+ * **Its history**: last frame's probes (their records and filtered radiance, for the lighting density), its diffuse,
20
+ * specular and frames (for the temporal filter) and its colour (for the screen hits) are kept while the structure and the view
21
21
  * stay, until {@link reset_history}; any change starts it again. Nothing is allocated on a frame that changes neither: the adaptive probes' slots
22
22
  * are made with the rest, as many as the uniform probes (`screen_probe_adaptive_capacity`), and a frame that would
23
23
  * place more places no more.
@@ -80,13 +80,14 @@ export class GPUScreenProbeGI {
80
80
  exposure: number;
81
81
  }): void;
82
82
  /**
83
- * Take the frame's resolve, once the bent normals exist: each pixel's irradiance from its probes, then the temporal
84
- * filter into the frame's diffuse.
83
+ * Take the frame's resolve, once the bent normals exist: each pixel's irradiance and rough specular from its
84
+ * probes, then the temporal filter into the frame's diffuse and specular ({@link specular_handle}).
85
85
  *
86
86
  * @param {Object} options
87
87
  * @param {FrameGraph} options.graph
88
88
  * @param {number} options.depth graph handle of the view's reverse-Z depth
89
89
  * @param {number} options.depth_previous graph handle of last frame's
90
+ * @param {number} options.normal graph handle of the G-buffer's shading normals, which the specular lobe stands on
90
91
  * @param {number} options.pbr graph handle of the G-buffer's PBR target
91
92
  * @param {number} options.velocity graph handle of the frame's motion
92
93
  * @param {number} options.bent_normals graph handle of the bent normals (the shading normals where GTAO is off)
@@ -94,15 +95,22 @@ export class GPUScreenProbeGI {
94
95
  * was shown, the one {@link graph_update} took: what the probes' radiance is pre-exposed by
95
96
  * @returns {number} graph handle of the frame's diffuse, `rgba16float`: E at the bent normal, before AO
96
97
  */
97
- graph_resolve({ graph, depth, depth_previous, pbr, velocity, bent_normals, exposure }: {
98
+ graph_resolve({ graph, depth, depth_previous, normal, pbr, velocity, bent_normals, exposure }: {
98
99
  graph: FrameGraph;
99
100
  depth: number;
100
101
  depth_previous: number;
102
+ normal: number;
101
103
  pbr: number;
102
104
  velocity: number;
103
105
  bent_normals: number;
104
106
  exposure: number;
105
107
  }): number;
108
+ /**
109
+ * @returns {number} graph handle of the rough specular this frame's {@link graph_resolve} wrote, `rgba16float`: the
110
+ * screen probes' radiance along each pixel's specular lobe, and in alpha the share of the pixel's specular the
111
+ * world-space probes keep, so a pixel's specular light is `rgb · (1 − a) + world · a`
112
+ */
113
+ get specular_handle(): number;
106
114
  /**
107
115
  * @returns {number} graph handle of the diffuse this frame's {@link graph_resolve} wrote
108
116
  */
@@ -1 +1 @@
1
- {"version":3,"file":"GPUScreenProbeGI.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.js"],"names":[],"mappings":"AAqEA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH;IAsHI;;OAEG;IACH,+BAIC;IAED;;;OAGG;IACH,sBAEC;IAED;;OAEG;IACH,qBAEC;IAED;;OAEG;IACH,4BAEC;IAED;;OAEG;IACH,gCAEC;IAiBD;;;;;;;;;;;;;;;;;;;;OAoBG;IACH;QAf+B,KAAK,EAAzB,UAAU;QACc,IAAI,EAA5B,cAAc;QACe,QAAQ,EAArC,mBAAmB;QACQ,KAAK,EAAhC,iBAAiB;QAEN,IAAI;QACC,KAAK,EAArB,MAAM;QACU,MAAM,EAAtB,MAAM;QACU,GAAG,EAAnB,MAAM;QACU,QAAQ,EAAxB,MAAM;QACU,SAAS,EAAzB,MAAM;QACU,GAAG,EAAnB,MAAM;QACU,QAAQ,EAAxB,MAAM;aAoFhB;IAED;;;;;;;;;;;;;;OAcG;IACH;QAV+B,KAAK,EAAzB,UAAU;QACM,KAAK,EAArB,MAAM;QACU,cAAc,EAA9B,MAAM;QACU,GAAG,EAAnB,MAAM;QACU,QAAQ,EAAxB,MAAM;QACU,YAAY,EAA5B,MAAM;QACU,QAAQ,EAAxB,MAAM;QAEJ,MAAM,CAqBlB;IAED;;OAEG;IACH,6BAEC;IAED;;;;;;OAMG;IACH,yCASC;IAED;;;;;;;OAOG;IACH;QAH+B,KAAK,EAAzB,UAAU;QACM,KAAK,EAArB,MAAM;aAWhB;IA6bD;;;OAGG;IACH,gBA+BC;IAED,gBAQC;;CACJ;yBAh3BY,OAAO,8DAA8D,EAAE,UAAU;6BACjF,OAAO,8BAA8B,EAAE,cAAc;kCACrD,OAAO,0BAA0B,EAAE,mBAAmB;gCACtD,OAAO,uCAAuC,EAAE,iBAAiB"}
1
+ {"version":3,"file":"GPUScreenProbeGI.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.js"],"names":[],"mappings":"AAqEA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH;IA6HI;;OAEG;IACH,+BAIC;IAED;;;OAGG;IACH,sBAEC;IAED;;OAEG;IACH,qBAEC;IAED;;OAEG;IACH,4BAEC;IAED;;OAEG;IACH,gCAEC;IAiBD;;;;;;;;;;;;;;;;;;;;OAoBG;IACH;QAf+B,KAAK,EAAzB,UAAU;QACc,IAAI,EAA5B,cAAc;QACe,QAAQ,EAArC,mBAAmB;QACQ,KAAK,EAAhC,iBAAiB;QAEN,IAAI;QACC,KAAK,EAArB,MAAM;QACU,MAAM,EAAtB,MAAM;QACU,GAAG,EAAnB,MAAM;QACU,QAAQ,EAAxB,MAAM;QACU,SAAS,EAAzB,MAAM;QACU,GAAG,EAAnB,MAAM;QACU,QAAQ,EAAxB,MAAM;aAoFhB;IAED;;;;;;;;;;;;;;;OAeG;IACH;QAX+B,KAAK,EAAzB,UAAU;QACM,KAAK,EAArB,MAAM;QACU,cAAc,EAA9B,MAAM;QACU,MAAM,EAAtB,MAAM;QACU,GAAG,EAAnB,MAAM;QACU,QAAQ,EAAxB,MAAM;QACU,YAAY,EAA5B,MAAM;QACU,QAAQ,EAAxB,MAAM;QAEJ,MAAM,CAyBlB;IAED;;;;OAIG;IACH,8BAEC;IAED;;OAEG;IACH,6BAEC;IAED;;;;;;OAMG;IACH,yCASC;IAED;;;;;;;OAOG;IACH;QAH+B,KAAK,EAAzB,UAAU;QACM,KAAK,EAArB,MAAM;aAWhB;IAqcD;;;OAGG;IACH,gBAiCC;IAED,gBAQC;;CACJ;yBA/4BY,OAAO,8DAA8D,EAAE,UAAU;6BACjF,OAAO,8BAA8B,EAAE,cAAc;kCACrD,OAAO,0BAA0B,EAAE,mBAAmB;gCACtD,OAAO,uCAAuC,EAAE,iBAAiB"}
@@ -81,12 +81,12 @@ const frame_word = name => SCREEN_PROBE_FRAME_STRUCT.get(name).offset >>> 2;
81
81
  * it wants); its BRDF and lighting densities and its rays, reassigned to where its light is; the screen trace; the
82
82
  * bricks' trace, shade, local light and bounce of what the screen left; the hits' wants; the composite into each
83
83
  * probe's radiance, the spatial filter's passes, and the probes' SH3.
84
- * 3. **Resolve** ({@link graph_resolve}), once the bent normals exist: each pixel's irradiance from its probes, then
85
- * the temporal filter into the frame's diffuse, which the deferred passes read.
84
+ * 3. **Resolve** ({@link graph_resolve}), once the bent normals exist: each pixel's irradiance and rough specular from
85
+ * its probes, then the temporal filter into the frame's diffuse and specular, which the deferred passes read.
86
86
  * 4. **Capture** ({@link graph_capture}): the lit colour of the opaque surfaces, for the next frame's screen hits.
87
87
  *
88
- * **Its history**: last frame's probes (their records and filtered radiance, for the lighting density), its diffuse
89
- * and frames (for the temporal filter) and its colour (for the screen hits) are kept while the structure and the view
88
+ * **Its history**: last frame's probes (their records and filtered radiance, for the lighting density), its diffuse,
89
+ * specular and frames (for the temporal filter) and its colour (for the screen hits) are kept while the structure and the view
90
90
  * stay, until {@link reset_history}; any change starts it again. Nothing is allocated on a frame that changes neither: the adaptive probes' slots
91
91
  * are made with the rest, as many as the uniform probes (`screen_probe_adaptive_capacity`), and a frame that would
92
92
  * place more places no more.
@@ -159,9 +159,13 @@ export class GPUScreenProbeGI {
159
159
  #radiance_final = 0;
160
160
  /** @type {GPUTextureContext|null} */
161
161
  #integrated = null;
162
- /** This frame's and last frame's diffuse and frames; {@link #temporal_parity} names this frame's. @type {GPUTextureContext[]} */
162
+ /** @type {GPUTextureContext|null} */
163
+ #integrated_specular = null;
164
+ /** This frame's and last frame's diffuse, specular and frames; {@link #temporal_parity} names this frame's. @type {GPUTextureContext[]} */
163
165
  #diffuse = [];
164
166
  /** @type {GPUTextureContext[]} */
167
+ #specular = [];
168
+ /** @type {GPUTextureContext[]} */
165
169
  #frames = [];
166
170
  #temporal_parity = 0;
167
171
  /** @type {GPUTextureContext|null} */
@@ -209,6 +213,9 @@ export class GPUScreenProbeGI {
209
213
  /** The graph handle of the frame's diffuse, as {@link graph_resolve} wrote it. */
210
214
  #diffuse_handle = -1;
211
215
 
216
+ /** The graph handle of the frame's rough specular, as {@link graph_resolve} wrote it. */
217
+ #specular_handle = -1;
218
+
212
219
  /**
213
220
  * @param {GPUDevice} device
214
221
  */
@@ -367,13 +374,14 @@ export class GPUScreenProbeGI {
367
374
  }
368
375
 
369
376
  /**
370
- * Take the frame's resolve, once the bent normals exist: each pixel's irradiance from its probes, then the temporal
371
- * filter into the frame's diffuse.
377
+ * Take the frame's resolve, once the bent normals exist: each pixel's irradiance and rough specular from its
378
+ * probes, then the temporal filter into the frame's diffuse and specular ({@link specular_handle}).
372
379
  *
373
380
  * @param {Object} options
374
381
  * @param {FrameGraph} options.graph
375
382
  * @param {number} options.depth graph handle of the view's reverse-Z depth
376
383
  * @param {number} options.depth_previous graph handle of last frame's
384
+ * @param {number} options.normal graph handle of the G-buffer's shading normals, which the specular lobe stands on
377
385
  * @param {number} options.pbr graph handle of the G-buffer's PBR target
378
386
  * @param {number} options.velocity graph handle of the frame's motion
379
387
  * @param {number} options.bent_normals graph handle of the bent normals (the shading normals where GTAO is off)
@@ -381,27 +389,40 @@ export class GPUScreenProbeGI {
381
389
  * was shown, the one {@link graph_update} took: what the probes' radiance is pre-exposed by
382
390
  * @returns {number} graph handle of the frame's diffuse, `rgba16float`: E at the bent normal, before AO
383
391
  */
384
- graph_resolve({ graph, depth, depth_previous, pbr, velocity, bent_normals, exposure }) {
392
+ graph_resolve({ graph, depth, depth_previous, normal, pbr, velocity, bent_normals, exposure }) {
385
393
  assert.ok(this.#built, 'graph_update() first');
394
+ assert.isNonNegativeInteger(normal, 'normal');
386
395
 
387
396
  const data = this.#resolve_data;
388
397
  const pass = graph.add("Screen Probe Resolve", data, this.#execute_resolve);
389
398
 
390
399
  data.depth = pass.read(depth);
391
400
  data.depth_previous = pass.read(depth_previous);
401
+ data.normal = pass.read(normal);
392
402
  data.pbr = pass.read(pbr);
393
403
  data.velocity = pass.read(velocity);
394
404
  data.bent_normals = pass.read(bent_normals);
395
405
  data.exposure = pass.read(exposure);
396
406
  data.diffuse = pass.write(graph_import_texture(graph, this.#diffuse[this.#temporal_parity], 'screen probe diffuse'));
407
+ data.specular = pass.write(graph_import_texture(graph, this.#specular[this.#temporal_parity], 'screen probe specular'));
397
408
 
398
409
  pass.make_side_effect();
399
410
 
400
411
  this.#diffuse_handle = data.diffuse;
412
+ this.#specular_handle = data.specular;
401
413
 
402
414
  return data.diffuse;
403
415
  }
404
416
 
417
+ /**
418
+ * @returns {number} graph handle of the rough specular this frame's {@link graph_resolve} wrote, `rgba16float`: the
419
+ * screen probes' radiance along each pixel's specular lobe, and in alpha the share of the pixel's specular the
420
+ * world-space probes keep, so a pixel's specular light is `rgb · (1 − a) + world · a`
421
+ */
422
+ get specular_handle() {
423
+ return this.#specular_handle;
424
+ }
425
+
405
426
  /**
406
427
  * @returns {number} graph handle of the diffuse this frame's {@link graph_resolve} wrote
407
428
  */
@@ -482,6 +503,7 @@ export class GPUScreenProbeGI {
482
503
  f[frame_word('brick_t_max')] = Math.sqrt(3) * bricks.resolution * bricks.cell_size(coarsest);
483
504
  u[frame_word('importance_sampling')] = settings.importance_sampling && this.#octahedron_resolution <= SCREEN_PROBE_OCTAHEDRON_LIMIT ? 1 : 0;
484
505
  u[frame_word('screen_traces')] = settings.screen_traces ? 1 : 0;
506
+ u[frame_word('rough_specular')] = settings.rough_specular ? 1 : 0;
485
507
  u[frame_word('brick_cascade_count')] = bricks.cascade_count;
486
508
  u[frame_word('brick_atlas_shift')] = bricks.atlas_shift;
487
509
  f[frame_word('temporal_frames')] = settings.temporal_frames;
@@ -572,7 +594,9 @@ export class GPUScreenProbeGI {
572
594
  const view_texture = (name, format) => this.#texture(`screen probe ${name}`, [width, height], format);
573
595
 
574
596
  this.#integrated = view_texture('integrated', 'rgba16float');
597
+ this.#integrated_specular = view_texture('integrated specular', 'rgba16float');
575
598
  this.#diffuse = [view_texture('diffuse 0', 'rgba16float'), view_texture('diffuse 1', 'rgba16float')];
599
+ this.#specular = [view_texture('specular 0', 'rgba16float'), view_texture('specular 1', 'rgba16float')];
576
600
  this.#frames = [view_texture('frames 0', 'r32uint'), view_texture('frames 1', 'r32uint')];
577
601
  this.#color_history = view_texture('color history', 'rgba16float');
578
602
 
@@ -831,11 +855,14 @@ export class GPUScreenProbeGI {
831
855
  b.tSTBN_vec2 = this.#stbn;
832
856
  b.tDepth = resources.get(data.depth);
833
857
  b.tDepthPrevious = resources.get(data.depth_previous);
858
+ b.tNormal = resources.get(data.normal);
834
859
  b.tPBR = resources.get(data.pbr);
835
860
  b.tVelocity = resources.get(data.velocity);
836
861
  b.tBentNormals = resources.get(data.bent_normals);
837
862
  b.screen_probe_exposure = resources.get(data.exposure);
838
863
  b.screen_probe_integrated = this.#integrated.obtainView();
864
+ b.screen_probe_integrated_specular = this.#integrated_specular.obtainView();
865
+ b.screen_probe_radiance = this.#radiance[this.#radiance_final].obtainView();
839
866
 
840
867
  const x = Math.ceil(this.#view_width / groups);
841
868
  const y = Math.ceil(this.#view_height / groups);
@@ -847,6 +874,8 @@ export class GPUScreenProbeGI {
847
874
  b.screen_probe_diffuse_history = this.#diffuse[1 - now].obtainView();
848
875
  b.screen_probe_frames_history = this.#frames[1 - now].obtainView();
849
876
  b.screen_probe_diffuse = resources.get(data.diffuse);
877
+ b.screen_probe_specular_history = this.#specular[1 - now].obtainView();
878
+ b.screen_probe_specular = resources.get(data.specular);
850
879
  b.screen_probe_frames = this.#frames[now].obtainView();
851
880
 
852
881
  shader_screen_probe_temporal.dispatch({ encoder, bindings: b, group_count_x: x, group_count_y: y });
@@ -904,7 +933,7 @@ export class GPUScreenProbeGI {
904
933
  buffer?.destroy();
905
934
  }
906
935
 
907
- for (const texture of [this.#integrated, ...this.#diffuse, ...this.#frames, this.#color_history]) {
936
+ for (const texture of [this.#integrated, this.#integrated_specular, ...this.#diffuse, ...this.#specular, ...this.#frames, this.#color_history]) {
908
937
  texture?.destroy();
909
938
  }
910
939
 
@@ -915,7 +944,9 @@ export class GPUScreenProbeGI {
915
944
  this.#counters = null;
916
945
  this.#exposure_history = [];
917
946
  this.#integrated = null;
947
+ this.#integrated_specular = null;
918
948
  this.#diffuse = [];
949
+ this.#specular = [];
919
950
  this.#frames = [];
920
951
  this.#color_history = null;
921
952