@woosh/meep-engine 3.53.0 → 3.55.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 (249) hide show
  1. package/package.json +1 -1
  2. package/src/core/math/noise/worley_noise_2d.d.ts +14 -0
  3. package/src/core/math/noise/worley_noise_2d.d.ts.map +1 -0
  4. package/src/core/math/noise/worley_noise_2d.js +74 -0
  5. package/src/engine/graphics/texture/atlas/CachingTextureAtlas.d.ts +6 -1
  6. package/src/engine/graphics/texture/atlas/CachingTextureAtlas.d.ts.map +1 -1
  7. package/src/engine/graphics/texture/atlas/CachingTextureAtlas.js +363 -325
  8. package/src/engine/graphics/texture/atlas/ManagedTextureAtlas.d.ts +93 -14
  9. package/src/engine/graphics/texture/atlas/ManagedTextureAtlas.d.ts.map +1 -1
  10. package/src/engine/graphics/texture/atlas/ManagedTextureAtlas.js +322 -183
  11. package/src/engine/graphics/texture/atlas/ReferencedTextureAtlas.d.ts +9 -0
  12. package/src/engine/graphics/texture/atlas/ReferencedTextureAtlas.d.ts.map +1 -1
  13. package/src/engine/graphics/texture/atlas/ReferencedTextureAtlas.js +110 -83
  14. package/src/engine/graphics/texture/atlas/SpriteAtlas.d.ts +42 -0
  15. package/src/engine/graphics/texture/atlas/SpriteAtlas.d.ts.map +1 -0
  16. package/src/engine/{graphics3/decal/DecalAtlas.js → graphics/texture/atlas/SpriteAtlas.js} +202 -194
  17. package/src/engine/{graphics3/decal/DecalAtlasFill.d.ts → graphics/texture/atlas/SpriteAtlasFill.d.ts} +4 -4
  18. package/src/engine/graphics/texture/atlas/SpriteAtlasFill.d.ts.map +1 -0
  19. package/src/engine/graphics/texture/atlas/SpriteAtlasFill.js +30 -0
  20. package/src/engine/graphics/texture/atlas/TextureAtlas.d.ts +7 -0
  21. package/src/engine/graphics/texture/atlas/TextureAtlas.d.ts.map +1 -1
  22. package/src/engine/graphics/texture/atlas/TextureAtlas.js +11 -1
  23. package/src/engine/{graphics3/decal/decal_atlas_border.d.ts → graphics/texture/atlas/sprite_atlas_border.d.ts} +12 -12
  24. package/src/engine/graphics/texture/atlas/sprite_atlas_border.d.ts.map +1 -0
  25. package/src/engine/{graphics3/decal/decal_atlas_border.js → graphics/texture/atlas/sprite_atlas_border.js} +69 -69
  26. package/src/engine/graphics3/DecalSystem.d.ts.map +1 -1
  27. package/src/engine/graphics3/DecalSystem.js +447 -450
  28. package/src/engine/graphics3/GPUParticleEmitterSystem.d.ts +9 -22
  29. package/src/engine/graphics3/GPUParticleEmitterSystem.d.ts.map +1 -1
  30. package/src/engine/graphics3/GPUParticleEmitterSystem.js +892 -951
  31. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  32. package/src/generation/foliage/FOLIAGE_DESIGN.md +2 -1
  33. package/src/generation/foliage/config/BarkMaterialConfig.d.ts +4 -3
  34. package/src/generation/foliage/config/BarkMaterialConfig.d.ts.map +1 -1
  35. package/src/generation/foliage/config/BarkMaterialConfig.js +6 -6
  36. package/src/generation/foliage/config/FoliageBarkType.d.ts +11 -0
  37. package/src/generation/foliage/config/FoliageBarkType.d.ts.map +1 -0
  38. package/src/generation/foliage/config/FoliageBarkType.js +16 -0
  39. package/src/generation/foliage/config/FoliageMaterialConfig.d.ts +58 -5
  40. package/src/generation/foliage/config/FoliageMaterialConfig.d.ts.map +1 -1
  41. package/src/generation/foliage/config/FoliageMaterialConfig.js +279 -181
  42. package/src/generation/foliage/index.d.ts +2 -1
  43. package/src/generation/foliage/index.js +44 -43
  44. package/src/generation/foliage/material/make_bark_material.d.ts.map +1 -1
  45. package/src/generation/foliage/material/make_bark_material.js +23 -95
  46. package/src/generation/foliage/material/make_foliage_material.d.ts +29 -3
  47. package/src/generation/foliage/material/make_foliage_material.d.ts.map +1 -1
  48. package/src/generation/foliage/material/make_foliage_material.js +605 -359
  49. package/src/generation/foliage/mesh/branch_collar_project.d.ts.map +1 -1
  50. package/src/generation/foliage/mesh/branch_collar_project.js +205 -203
  51. package/src/generation/foliage/mesh/foliage_collect_attachments.d.ts +15 -0
  52. package/src/generation/foliage/mesh/foliage_collect_attachments.d.ts.map +1 -1
  53. package/src/generation/foliage/mesh/foliage_collect_attachments.js +569 -502
  54. package/src/generation/foliage/mesh/tree_mesh_build_bark.d.ts.map +1 -1
  55. package/src/generation/foliage/mesh/tree_mesh_build_bark.js +1049 -1047
  56. package/src/generation/foliage/mesh/tree_mesh_build_foliage.d.ts +2 -1
  57. package/src/generation/foliage/mesh/tree_mesh_build_foliage.d.ts.map +1 -1
  58. package/src/generation/foliage/mesh/tree_mesh_build_foliage.js +454 -415
  59. package/src/generation/foliage/presets/make_tree_species_preset.d.ts.map +1 -1
  60. package/src/generation/foliage/presets/make_tree_species_preset.js +870 -837
  61. package/src/generation/foliage/skeleton/crown_envelope_evaluate.js +121 -121
  62. package/src/generation/foliage/skeleton/tree_skeleton_compute_pipe_radii.d.ts +10 -7
  63. package/src/generation/foliage/skeleton/tree_skeleton_compute_pipe_radii.d.ts.map +1 -1
  64. package/src/generation/foliage/skeleton/tree_skeleton_compute_pipe_radii.js +206 -179
  65. package/src/generation/foliage/skeleton/tree_skeleton_grow.d.ts.map +1 -1
  66. package/src/generation/foliage/skeleton/tree_skeleton_grow.js +1871 -1104
  67. package/src/shade/RENDERER_CONTRACT.md +5 -2
  68. package/src/shade/device/SHADE_DEVICE_FLOOR.d.ts.map +1 -1
  69. package/src/shade/device/SHADE_DEVICE_FLOOR.js +2 -0
  70. package/src/shade/playground/foliage_wind/foliage_world.d.ts +6 -0
  71. package/src/shade/playground/foliage_wind/foliage_world.d.ts.map +1 -1
  72. package/src/shade/playground/foliage_wind/foliage_world.js +602 -593
  73. package/src/shade/playground/foliage_wind/index.html +260 -254
  74. package/src/shade/playground/foliage_wind/main.js +275 -263
  75. package/src/shade/renderer/Renderer.d.ts.map +1 -1
  76. package/src/shade/renderer/Renderer.js +1 -1
  77. package/src/shade/renderer/fluid/GPUFluidCascade.d.ts +3 -3
  78. package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts +1 -1
  79. package/src/shade/renderer/fluid/forcing/GPUFluidForcing.d.ts +6 -6
  80. package/src/shade/renderer/fluid/pressure/GPUFluidPressureSolve.d.ts +1 -1
  81. package/src/shade/renderer/fluid/query/GPUFluidQueries.d.ts +1 -1
  82. package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.js +1 -1
  83. package/src/shade/renderer/hiz/HierarchicalZBuffer.d.ts +3 -3
  84. package/src/shade/renderer/hiz/HierarchicalZBuffer.d.ts.map +1 -1
  85. package/src/shade/renderer/hiz/HierarchicalZBuffer.js +350 -294
  86. package/src/shade/renderer/hiz/generate_downsampler_code.d.ts +0 -2
  87. package/src/shade/renderer/hiz/generate_downsampler_code.d.ts.map +1 -1
  88. package/src/shade/renderer/hiz/generate_downsampler_code.js +99 -100
  89. package/src/shade/renderer/hiz/hzb_pick_alignment.d.ts +15 -0
  90. package/src/shade/renderer/hiz/hzb_pick_alignment.d.ts.map +1 -0
  91. package/src/shade/renderer/hiz/hzb_pick_alignment.js +148 -0
  92. package/src/shade/renderer/hiz/hzb_plan_reduction_steps.d.ts +28 -0
  93. package/src/shade/renderer/hiz/hzb_plan_reduction_steps.d.ts.map +1 -0
  94. package/src/shade/renderer/hiz/hzb_plan_reduction_steps.js +58 -0
  95. package/src/shade/renderer/hiz/shader_hzb_reduce_any.d.ts +5 -5
  96. package/src/shade/renderer/hiz/shader_hzb_reduce_any.d.ts.map +1 -1
  97. package/src/shade/renderer/hiz/shader_hzb_reduce_any.js +57 -67
  98. package/src/shade/renderer/hiz/shader_hzb_reduce_mip0_clip.d.ts +3 -3
  99. package/src/shade/renderer/hiz/shader_hzb_reduce_mip0_clip.d.ts.map +1 -1
  100. package/src/shade/renderer/hiz/shader_hzb_reduce_mip0_clip.js +111 -112
  101. package/src/shade/renderer/hiz/shader_hzb_spd.d.ts +5 -0
  102. package/src/shade/renderer/hiz/shader_hzb_spd.d.ts.map +1 -0
  103. package/src/shade/renderer/hiz/shader_hzb_spd.js +160 -0
  104. package/src/shade/renderer/light/GPULightCollection.d.ts +8 -0
  105. package/src/shade/renderer/light/GPULightCollection.d.ts.map +1 -1
  106. package/src/shade/renderer/light/GPULightCollection.js +67 -0
  107. package/src/shade/renderer/light/environment/FAR_FIELD_IRRADIANCE_SH_RESOURCE.d.ts +7 -0
  108. package/src/shade/renderer/light/environment/FAR_FIELD_IRRADIANCE_SH_RESOURCE.d.ts.map +1 -0
  109. package/src/shade/renderer/light/environment/FAR_FIELD_IRRADIANCE_SH_RESOURCE.js +13 -0
  110. package/src/shade/renderer/light/environment/shader_project_far_field_irradiance_sh.d.ts +10 -0
  111. package/src/shade/renderer/light/environment/shader_project_far_field_irradiance_sh.d.ts.map +1 -0
  112. package/src/shade/renderer/light/environment/shader_project_far_field_irradiance_sh.js +72 -0
  113. package/src/shade/renderer/light/world_cluster/WORLD_LIGHT_CLUSTER.d.ts +39 -0
  114. package/src/shade/renderer/light/world_cluster/WORLD_LIGHT_CLUSTER.d.ts.map +1 -0
  115. package/src/shade/renderer/light/world_cluster/WORLD_LIGHT_CLUSTER.js +90 -0
  116. package/src/shade/renderer/light/world_cluster/chunk_world_light_cluster_lookup.d.ts +12 -0
  117. package/src/shade/renderer/light/world_cluster/chunk_world_light_cluster_lookup.d.ts.map +1 -0
  118. package/src/shade/renderer/light/world_cluster/chunk_world_light_cluster_lookup.js +56 -0
  119. package/src/shade/renderer/light/world_cluster/graph_build_world_light_clusters.d.ts +31 -0
  120. package/src/shade/renderer/light/world_cluster/graph_build_world_light_clusters.d.ts.map +1 -0
  121. package/src/shade/renderer/light/world_cluster/graph_build_world_light_clusters.js +196 -0
  122. package/src/shade/renderer/light/world_cluster/shader_world_cluster_assign_lights.d.ts +10 -0
  123. package/src/shade/renderer/light/world_cluster/shader_world_cluster_assign_lights.d.ts.map +1 -0
  124. package/src/shade/renderer/light/world_cluster/shader_world_cluster_assign_lights.js +163 -0
  125. package/src/shade/renderer/light/world_cluster/shader_world_cluster_cull_lights.d.ts +4 -0
  126. package/src/shade/renderer/light/world_cluster/shader_world_cluster_cull_lights.d.ts.map +1 -0
  127. package/src/shade/renderer/light/world_cluster/shader_world_cluster_cull_lights.js +137 -0
  128. package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
  129. package/src/shade/renderer/particles/GPUParticleSystem.d.ts.map +1 -1
  130. package/src/shade/renderer/particles/GPUParticleSystem.js +4 -3
  131. package/src/shade/renderer/particles/graph_particles_avboit.d.ts +4 -3
  132. package/src/shade/renderer/particles/graph_particles_avboit.d.ts.map +1 -1
  133. package/src/shade/renderer/particles/graph_particles_avboit.js +28 -11
  134. package/src/shade/renderer/particles/shaders/chunk_particle_lighting.d.ts +9 -13
  135. package/src/shade/renderer/particles/shaders/chunk_particle_lighting.d.ts.map +1 -1
  136. package/src/shade/renderer/particles/shaders/chunk_particle_lighting.js +25 -20
  137. package/src/shade/renderer/particles/shaders/shader_particle_avboit_draw.d.ts.map +1 -1
  138. package/src/shade/renderer/particles/shaders/shader_particle_avboit_draw.js +21 -38
  139. package/src/shade/renderer/postprocess/denoise/fragment_shader_denoise_ao.d.ts.map +1 -1
  140. package/src/shade/renderer/postprocess/denoise/fragment_shader_denoise_ao.js +154 -147
  141. package/src/shade/renderer/postprocess/gtao/GTAO.d.ts +2 -1
  142. package/src/shade/renderer/postprocess/gtao/GTAO.d.ts.map +1 -1
  143. package/src/shade/renderer/postprocess/gtao/GTAO.js +5 -1
  144. package/src/shade/renderer/postprocess/gtao/GTAO_CONSTANTS.d.ts +8 -0
  145. package/src/shade/renderer/postprocess/gtao/GTAO_CONSTANTS.d.ts.map +1 -1
  146. package/src/shade/renderer/postprocess/gtao/GTAO_CONSTANTS.js +10 -1
  147. package/src/shade/renderer/postprocess/gtao/ao_reproject_shader.d.ts.map +1 -1
  148. package/src/shade/renderer/postprocess/gtao/ao_reproject_shader.js +5 -0
  149. package/src/shade/renderer/postprocess/gtao/chunk_gtao_compute_mip_level.d.ts +22 -0
  150. package/src/shade/renderer/postprocess/gtao/chunk_gtao_compute_mip_level.d.ts.map +1 -0
  151. package/src/shade/renderer/postprocess/gtao/chunk_gtao_compute_mip_level.js +33 -0
  152. package/src/shade/renderer/postprocess/gtao/chunk_gtao_resolve_hzb_depth.d.ts +22 -0
  153. package/src/shade/renderer/postprocess/gtao/chunk_gtao_resolve_hzb_depth.d.ts.map +1 -0
  154. package/src/shade/renderer/postprocess/gtao/chunk_gtao_resolve_hzb_depth.js +56 -0
  155. package/src/shade/renderer/postprocess/gtao/chunk_gtao_sample_depth.d.ts +13 -0
  156. package/src/shade/renderer/postprocess/gtao/chunk_gtao_sample_depth.d.ts.map +1 -0
  157. package/src/shade/renderer/postprocess/gtao/chunk_gtao_sample_depth.js +42 -0
  158. package/src/shade/renderer/postprocess/gtao/fragment_shader_gtao.d.ts +2 -1
  159. package/src/shade/renderer/postprocess/gtao/fragment_shader_gtao.d.ts.map +1 -1
  160. package/src/shade/renderer/postprocess/gtao/fragment_shader_gtao.js +382 -357
  161. package/src/shade/renderer/postprocess/gtao/fragment_shader_gtao_with_irradiance.d.ts.map +1 -1
  162. package/src/shade/renderer/postprocess/gtao/fragment_shader_gtao_with_irradiance.js +414 -410
  163. package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
  164. package/src/shade/renderer/postprocess/ssr/prefilter/NOTES.md +0 -7
  165. package/src/shade/renderer/shader/chunk/depth/chunk_query_depth_from_screen_space_bb.d.ts.map +1 -1
  166. package/src/shade/renderer/shader/chunk/depth/chunk_query_depth_from_screen_space_bb.js +62 -62
  167. package/src/shade/renderer/shader/chunk/random/lowbias/chunk_hash_lowbias32_vec2u.d.ts +6 -0
  168. package/src/shade/renderer/shader/chunk/random/lowbias/chunk_hash_lowbias32_vec2u.d.ts.map +1 -0
  169. package/src/shade/renderer/shader/chunk/random/lowbias/chunk_hash_lowbias32_vec2u.js +19 -0
  170. package/src/shade/renderer/shader/chunk/screen_space/chunk_ffx_sssr_get_mip_resolution.d.ts.map +1 -1
  171. package/src/shade/renderer/shader/chunk/screen_space/chunk_ffx_sssr_get_mip_resolution.js +16 -10
  172. package/src/shade/renderer/shader/chunk/screen_space/chunk_ffx_sssr_hierarchical_raymarch.d.ts.map +1 -1
  173. package/src/shade/renderer/shader/chunk/screen_space/chunk_ffx_sssr_hierarchical_raymarch.js +118 -117
  174. package/src/shade/renderer/texture/atlas/GPUTileAtlas3D.d.ts +41 -7
  175. package/src/shade/renderer/texture/atlas/GPUTileAtlas3D.d.ts.map +1 -1
  176. package/src/shade/renderer/texture/atlas/GPUTileAtlas3D.js +162 -58
  177. package/src/shade/renderer/volumetrics/GPUSceneVolumetrics.js +1 -1
  178. package/src/shade/renderer/volumetrics/GPUViewVolumetrics.d.ts +10 -12
  179. package/src/shade/renderer/volumetrics/GPUViewVolumetrics.d.ts.map +1 -1
  180. package/src/shade/renderer/volumetrics/GPUViewVolumetrics.js +583 -606
  181. package/src/shade/renderer/volumetrics/graph_build_volumetrics.d.ts +1 -1
  182. package/src/shade/renderer/volumetrics/graph_build_volumetrics.js +640 -640
  183. package/src/shade/renderer/volumetrics/irradiance_clipmap/GPUIrradianceClipmap.d.ts +113 -0
  184. package/src/shade/renderer/volumetrics/irradiance_clipmap/GPUIrradianceClipmap.d.ts.map +1 -0
  185. package/src/shade/renderer/volumetrics/irradiance_clipmap/GPUIrradianceClipmap.js +484 -0
  186. package/src/shade/renderer/volumetrics/irradiance_clipmap/IRRADIANCE_CLIPMAP.d.ts +50 -0
  187. package/src/shade/renderer/volumetrics/irradiance_clipmap/IRRADIANCE_CLIPMAP.d.ts.map +1 -0
  188. package/src/shade/renderer/volumetrics/irradiance_clipmap/IRRADIANCE_CLIPMAP.js +60 -0
  189. package/src/shade/renderer/volumetrics/irradiance_clipmap/IRRADIANCE_CLIPMAP_STRUCT.d.ts +25 -0
  190. package/src/shade/renderer/volumetrics/irradiance_clipmap/IRRADIANCE_CLIPMAP_STRUCT.d.ts.map +1 -0
  191. package/src/shade/renderer/volumetrics/irradiance_clipmap/IRRADIANCE_CLIPMAP_STRUCT.js +47 -0
  192. package/src/shade/renderer/volumetrics/irradiance_clipmap/IrradianceCascadePlacement.d.ts +74 -0
  193. package/src/shade/renderer/volumetrics/irradiance_clipmap/IrradianceCascadePlacement.d.ts.map +1 -0
  194. package/src/shade/renderer/volumetrics/irradiance_clipmap/IrradianceCascadePlacement.js +173 -0
  195. package/src/shade/renderer/volumetrics/irradiance_clipmap/chunk_irradiance_clipmap_gi_sample.d.ts +26 -0
  196. package/src/shade/renderer/volumetrics/irradiance_clipmap/chunk_irradiance_clipmap_gi_sample.d.ts.map +1 -0
  197. package/src/shade/renderer/volumetrics/irradiance_clipmap/chunk_irradiance_clipmap_gi_sample.js +83 -0
  198. package/src/shade/renderer/volumetrics/irradiance_clipmap/chunk_irradiance_clipmap_local_light.d.ts +36 -0
  199. package/src/shade/renderer/volumetrics/irradiance_clipmap/chunk_irradiance_clipmap_local_light.d.ts.map +1 -0
  200. package/src/shade/renderer/volumetrics/irradiance_clipmap/chunk_irradiance_clipmap_local_light.js +129 -0
  201. package/src/shade/renderer/volumetrics/irradiance_clipmap/chunk_irradiance_clipmap_sample.d.ts +121 -0
  202. package/src/shade/renderer/volumetrics/irradiance_clipmap/chunk_irradiance_clipmap_sample.d.ts.map +1 -0
  203. package/src/shade/renderer/volumetrics/irradiance_clipmap/chunk_irradiance_clipmap_sample.js +370 -0
  204. package/src/shade/renderer/volumetrics/irradiance_clipmap/shader_irradiance_clipmap_build.d.ts +16 -0
  205. package/src/shade/renderer/volumetrics/irradiance_clipmap/shader_irradiance_clipmap_build.d.ts.map +1 -0
  206. package/src/shade/renderer/volumetrics/irradiance_clipmap/shader_irradiance_clipmap_build.js +191 -0
  207. package/src/shade/renderer/wind/GPUSceneWind.d.ts +1 -1
  208. package/src/shade/renderer/wind/GPUSceneWind.js +1 -1
  209. package/src/engine/graphics3/decal/DecalAtlas.d.ts +0 -43
  210. package/src/engine/graphics3/decal/DecalAtlas.d.ts.map +0 -1
  211. package/src/engine/graphics3/decal/DecalAtlasFill.d.ts.map +0 -1
  212. package/src/engine/graphics3/decal/DecalAtlasFill.js +0 -32
  213. package/src/engine/graphics3/decal/decal_atlas_border.d.ts.map +0 -1
  214. package/src/shade/renderer/postprocess/gtao/graph_build_depth_mipmap.d.ts +0 -26
  215. package/src/shade/renderer/postprocess/gtao/graph_build_depth_mipmap.d.ts.map +0 -1
  216. package/src/shade/renderer/postprocess/gtao/graph_build_depth_mipmap.js +0 -268
  217. package/src/shade/renderer/postprocess/ssr/copy_shader_f32.d.ts +0 -3
  218. package/src/shade/renderer/postprocess/ssr/copy_shader_f32.d.ts.map +0 -1
  219. package/src/shade/renderer/postprocess/ssr/copy_shader_f32.js +0 -32
  220. package/src/shade/renderer/postprocess/ssr/depth_max_shader.d.ts +0 -17
  221. package/src/shade/renderer/postprocess/ssr/depth_max_shader.d.ts.map +0 -1
  222. package/src/shade/renderer/postprocess/ssr/depth_max_shader.js +0 -98
  223. package/src/shade/renderer/postprocess/ssr/graph_build_depth_max_pyramid.d.ts +0 -23
  224. package/src/shade/renderer/postprocess/ssr/graph_build_depth_max_pyramid.d.ts.map +0 -1
  225. package/src/shade/renderer/postprocess/ssr/graph_build_depth_max_pyramid.js +0 -118
  226. package/src/shade/renderer/volumetrics/gi/chunk_volumetrics_froxel_centre_ws.d.ts +0 -15
  227. package/src/shade/renderer/volumetrics/gi/chunk_volumetrics_froxel_centre_ws.d.ts.map +0 -1
  228. package/src/shade/renderer/volumetrics/gi/chunk_volumetrics_froxel_centre_ws.js +0 -49
  229. package/src/shade/renderer/volumetrics/gi/chunk_volumetrics_gi.d.ts +0 -17
  230. package/src/shade/renderer/volumetrics/gi/chunk_volumetrics_gi.d.ts.map +0 -1
  231. package/src/shade/renderer/volumetrics/gi/chunk_volumetrics_gi.js +0 -50
  232. package/src/shade/renderer/volumetrics/gi/chunk_volumetrics_gi_sample.d.ts +0 -35
  233. package/src/shade/renderer/volumetrics/gi/chunk_volumetrics_gi_sample.d.ts.map +0 -1
  234. package/src/shade/renderer/volumetrics/gi/chunk_volumetrics_gi_sample.js +0 -105
  235. package/src/shade/renderer/volumetrics/gi/graph_build_froxel_gi.d.ts +0 -35
  236. package/src/shade/renderer/volumetrics/gi/graph_build_froxel_gi.d.ts.map +0 -1
  237. package/src/shade/renderer/volumetrics/gi/graph_build_froxel_gi.js +0 -80
  238. package/src/shade/renderer/volumetrics/gi/shader_volumetrics_gi.d.ts +0 -10
  239. package/src/shade/renderer/volumetrics/gi/shader_volumetrics_gi.d.ts.map +0 -1
  240. package/src/shade/renderer/volumetrics/gi/shader_volumetrics_gi.js +0 -51
  241. package/src/shade/renderer/volumetrics/gi/volumetrics_gi_resources.d.ts +0 -28
  242. package/src/shade/renderer/volumetrics/gi/volumetrics_gi_resources.d.ts.map +0 -1
  243. package/src/shade/renderer/volumetrics/gi/volumetrics_gi_resources.js +0 -39
  244. package/src/shade/renderer/volumetrics/graph_build_froxel_irradiance.d.ts +0 -48
  245. package/src/shade/renderer/volumetrics/graph_build_froxel_irradiance.d.ts.map +0 -1
  246. package/src/shade/renderer/volumetrics/graph_build_froxel_irradiance.js +0 -121
  247. package/src/shade/renderer/volumetrics/shader_volumetrics_build_irradiance.d.ts +0 -28
  248. package/src/shade/renderer/volumetrics/shader_volumetrics_build_irradiance.d.ts.map +0 -1
  249. package/src/shade/renderer/volumetrics/shader_volumetrics_build_irradiance.js +0 -237
@@ -1,98 +0,0 @@
1
- import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
2
- import { ImageShader } from "../../shader/ImageShader.js";
3
- import { ShaderResourceSetDescriptor } from "../../shader/resource/ShaderResourceSetDescriptor.js";
4
- import { ShaderDescriptor } from "../../shader/ShaderDescriptor.js";
5
-
6
- const resources = new ShaderResourceSetDescriptor();
7
-
8
- // per-pass, eight bytes, read-only: immediate data rather than a uniform buffer
9
- resources.setImmediate("output_resolution", "vec2<u32>");
10
-
11
- resources.createGroup()
12
- .addTexture("tInput");
13
-
14
-
15
- /**
16
- * Inclusive source-texel window one output texel of the reduction reads: `(min.xy, max.xy)`.
17
- *
18
- * The windows of one step tile the source exactly — every source texel belongs to one output texel,
19
- * none twice and none missed — which is what makes the result a max over the whole level rather than a
20
- * max over an arbitrary stencil. Pinned by `depth_max_source_bounds.spec`.
21
- *
22
- * The stride is `ceil(source / output)`, not a hardcoded 2, and the upper bound is
23
- * `min + stride - 1` because the loops that read it are inclusive. It used to be `target * 2` for the
24
- * origin and `min + stride` for the bound, which at a halving step is three texels per axis: nine
25
- * reads for a 2x2 footprint, overlapping its neighbours on both sides.
26
- */
27
- export const chunk_depth_max_source_bounds = CodeChunk.from(
28
- //language=WGSL
29
- `
30
- fn depth_max_source_bounds(
31
- target_coord: vec2<u32>,
32
- source_resolution: vec2<u32>,
33
- output_resolution: vec2<u32>
34
- ) -> vec4<u32> {
35
-
36
- let scale = vec2f(source_resolution) / vec2f(output_resolution);
37
-
38
- let stride = max(vec2u(ceil(scale)), vec2u(1u));
39
-
40
- let source_bounds_min = target_coord * stride;
41
-
42
- // inclusive, and clamped so an output resolution that does not divide the source cannot read past
43
- // the last texel
44
- let source_bounds_max = min(
45
- source_bounds_min + stride - vec2u(1u),
46
- source_resolution - vec2u(1u)
47
- );
48
-
49
- return vec4u(source_bounds_min, source_bounds_max);
50
- }
51
- `
52
- );
53
-
54
- const body = CodeChunk.from(
55
- //language=WGSL
56
- `
57
- @fragment
58
- fn main(
59
- @builtin(position) coord : vec4<f32>,
60
- @location(0) uv: vec2<f32>,
61
- ) -> @location(0) f32 {
62
-
63
- let target_coord_i = vec2<u32>(coord.xy);
64
-
65
- let source_resolution = textureDimensions(tInput);
66
-
67
- let bounds = depth_max_source_bounds(target_coord_i, source_resolution, output_resolution);
68
-
69
- var max_value = 0.0;
70
-
71
- for(var y = bounds.y ; y <= bounds.w ; y++){
72
- for(var x = bounds.x ; x <= bounds.z ; x++){
73
-
74
- let depth = textureLoad(tInput, vec2u(x,y), 0).r;
75
-
76
- max_value = max(depth, max_value);
77
- }
78
- }
79
-
80
- return max_value;
81
- }
82
- `,
83
- [chunk_depth_max_source_bounds]
84
- )
85
-
86
- export const depth_max_shader = new ImageShader({
87
- descriptor: ShaderDescriptor.from({
88
- label: "Depth Reduce / max",
89
- body,
90
- resources,
91
- }),
92
- targets: [
93
- {
94
- format: "r32float"
95
- }
96
- ]
97
- });
98
-
@@ -1,23 +0,0 @@
1
- /**
2
- * Build an `r32float` max-depth mip chain.
3
- *
4
- * **Nothing calls this.** `SSR.graph_pass` binds `view_ctx.hierarchical_z_buffer.texture` as
5
- * `tHZB` — see `Renderer.js` — and {@link HierarchicalZBuffer} is generally sufficient instead of
6
- * this. Kept because `@woosh/meep-engine` publishes raw `src`, so an unreferenced export is still
7
- * public surface.
8
- *
9
- * **The two are not interchangeable.** This pyramid is single-channel; the live HZB is two-channel and
10
- * `chunk_ffx_sssr_load_depth` reads its `.y`. Substituting this one gives a silently zero `.y`
11
- * rather than an error. See `prefilter/NOTES.md` for the rest of the dead surface in this directory.
12
- *
13
- * @param {Object} options
14
- * @param {FrameGraph} options.graph
15
- * @param {number[]} options.resolution
16
- * @param {number} options.input_depth
17
- */
18
- export function graph_build_depth_max_pyramid({ graph, resolution, input_depth }: {
19
- graph: FrameGraph;
20
- resolution: number[];
21
- input_depth: number;
22
- }): any;
23
- //# sourceMappingURL=graph_build_depth_max_pyramid.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"graph_build_depth_max_pyramid.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/postprocess/ssr/graph_build_depth_max_pyramid.js"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;GAgBG;AACH;IAJ+B,KAAK;IACP,UAAU,EAA5B,MAAM,EAAE;IACQ,WAAW,EAA3B,MAAM;QAiGhB"}
@@ -1,118 +0,0 @@
1
- import { TextureViewDescriptor } from "../../../descriptor/texture/TextureViewDescriptor.js";
2
- import { TextureResourceDescriptor } from "../../../device/graph/TextureResourceDescriptor.js";
3
- import { copy_shader_f32 } from "./copy_shader_f32.js";
4
- import { depth_max_shader } from "./depth_max_shader.js";
5
-
6
- /**
7
- * Build an `r32float` max-depth mip chain.
8
- *
9
- * **Nothing calls this.** `SSR.graph_pass` binds `view_ctx.hierarchical_z_buffer.texture` as
10
- * `tHZB` — see `Renderer.js` — and {@link HierarchicalZBuffer} is generally sufficient instead of
11
- * this. Kept because `@woosh/meep-engine` publishes raw `src`, so an unreferenced export is still
12
- * public surface.
13
- *
14
- * **The two are not interchangeable.** This pyramid is single-channel; the live HZB is two-channel and
15
- * `chunk_ffx_sssr_load_depth` reads its `.y`. Substituting this one gives a silently zero `.y`
16
- * rather than an error. See `prefilter/NOTES.md` for the rest of the dead surface in this directory.
17
- *
18
- * @param {Object} options
19
- * @param {FrameGraph} options.graph
20
- * @param {number[]} options.resolution
21
- * @param {number} options.input_depth
22
- */
23
- export function graph_build_depth_max_pyramid({
24
- graph,
25
- resolution,
26
- input_depth = -1
27
- }) {
28
- /**
29
- *
30
- * @param data
31
- * @param {FramePassResources} resources
32
- * @param {GraphicsExecutionContext} context
33
- */
34
- function execute(data, resources, context) {
35
- /**
36
- * @type {GPUTextureContext}
37
- */
38
- const input = resources.get(data.input);
39
- /**
40
- * @type {GPUTextureContext}
41
- */
42
- const output = resources.get(data.output);
43
-
44
- const encoder = context.encoder;
45
-
46
- let source_view = output.obtainView(TextureViewDescriptor.from({
47
- baseMipLevel: 0,
48
- mipLevelCount: 1
49
- }));
50
-
51
- copy_shader_f32.draw({
52
- encoder: encoder,
53
- bindings: {
54
- tInput: input.obtainView(),
55
- },
56
- colorAttachments: [
57
- {
58
- view: source_view,
59
-
60
- storeOp: "store",
61
- loadOp: "clear",
62
- }
63
- ]
64
- });
65
-
66
- const mips = output.descriptor.mipLevelCount;
67
-
68
- for (let i = 1; i < mips; i++) {
69
-
70
- const destination_resolution = new Uint32Array([resolution[0] >>> i, resolution[1] >>> i]);
71
-
72
- const output_resolution = encoder.allocateTransientBufferAndLoad(
73
- destination_resolution.buffer,
74
- );
75
-
76
- const destination_view = output.obtainView(TextureViewDescriptor.from({
77
- baseMipLevel: i,
78
- mipLevelCount: 1
79
- }));
80
-
81
- depth_max_shader.draw({
82
- encoder,
83
- bindings: {
84
- tInput: source_view,
85
- output_resolution: output_resolution,
86
- },
87
- colorAttachments: [
88
- {
89
- view: destination_view,
90
- storeOp: "store",
91
- loadOp: "clear",
92
- }
93
- ]
94
- })
95
-
96
- source_view = destination_view;
97
- }
98
-
99
- }
100
-
101
- const pass_data = {};
102
-
103
- const builder = graph.add("build depth max pyramid", pass_data, execute);
104
-
105
-
106
- pass_data.input = builder.read(input_depth);
107
-
108
- pass_data.output = builder.create("depth max", TextureResourceDescriptor.from({
109
- resolution,
110
- dimension: "2d",
111
- usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING,
112
- format: "r32float",
113
- enableMips: true
114
- }));
115
-
116
-
117
- return pass_data.output;
118
- }
@@ -1,15 +0,0 @@
1
- /**
2
- * `volumetrics_froxel_centre_ws(voxel, resolution)` — the world position a froxel's value stands for:
3
- * its column's centre, at the depth its slab's content sits at (`volumetrics_froxel_content_offset`),
4
- * which is where the lighting pass's jittered samples average to and where
5
- * `volumetrics_position_world_to_froxel_uvw` puts the froxel's texel centre. A froxel GI module
6
- * whose answer depends on position asks it there; GI is smooth enough across a froxel that one
7
- * sample is all of it.
8
- *
9
- * The enclosing shader binds `camera` and `volumetrics_metadata` under those names.
10
- *
11
- * @type {CodeChunk}
12
- */
13
- export const chunk_volumetrics_froxel_centre_ws: CodeChunk;
14
- import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
15
- //# sourceMappingURL=chunk_volumetrics_froxel_centre_ws.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"chunk_volumetrics_froxel_centre_ws.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/volumetrics/gi/chunk_volumetrics_froxel_centre_ws.js"],"names":[],"mappings":"AAUA;;;;;;;;;;;GAWG;AACH,iDAFU,SAAS,CAyBjB;0BAzCwB,oCAAoC"}
@@ -1,49 +0,0 @@
1
- import { chunk_cluster_depth_from_z_slice } from "../../light/cluster/chunk_cluster_depth_from_z_slice.js";
2
- import { chunk_camera_ray_from_uv } from "../../shader/chunk/geometry/ray/chunk_camera_ray_from_uv.js";
3
- import { RAY_STRUCT } from "../../shader/chunk/geometry/ray/RAY_STRUCT.js";
4
- import { chunk_texel_coordinate_to_uv } from "../../shader/chunk/texture/chunk_texel_coordinate_to_uv.js";
5
- import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
6
- import { chunk_camera_ray_planar_depth_scale } from "../chunk_camera_ray_planar_depth_scale.js";
7
- import { chunk_volumetrics_froxel_content_offset } from "../chunk_volumetrics_froxel_content_offset.js";
8
- import { CAMERA_RESOURCE } from "../../camera/CAMERA_RESOURCE.js";
9
- import { VOLUMETRICS_METADATA_RESOURCE } from "../VOLUMETRICS_RESOURCES.js";
10
-
11
- /**
12
- * `volumetrics_froxel_centre_ws(voxel, resolution)` — the world position a froxel's value stands for:
13
- * its column's centre, at the depth its slab's content sits at (`volumetrics_froxel_content_offset`),
14
- * which is where the lighting pass's jittered samples average to and where
15
- * `volumetrics_position_world_to_froxel_uvw` puts the froxel's texel centre. A froxel GI module
16
- * whose answer depends on position asks it there; GI is smooth enough across a froxel that one
17
- * sample is all of it.
18
- *
19
- * The enclosing shader binds `camera` and `volumetrics_metadata` under those names.
20
- *
21
- * @type {CodeChunk}
22
- */
23
- export const chunk_volumetrics_froxel_centre_ws = CodeChunk.from(
24
- //language=WGSL
25
- `
26
- fn volumetrics_froxel_centre_ws(voxel: vec3<u32>, resolution: vec3<u32>) -> vec3<f32> {
27
- let curve = volumetrics_metadata.froxel_cluster_parameters;
28
- let near_far = camera.clip_near_far;
29
-
30
- let slice = f32(voxel.z) + volumetrics_froxel_content_offset(curve.z);
31
- let view_depth = clamp(cluster_depth_from_z_slice(slice, curve, f32(resolution.z)), near_far.x, near_far.y);
32
-
33
- let ray = camera_ray_from_uv(texel_coordinate_to_uv(vec2<f32>(voxel.xy), resolution.xy), camera);
34
-
35
- // planar depth to a distance along the ray, as the lighting pass does
36
- return ray.origin + ray.direction * (view_depth * camera_ray_planar_depth_scale(ray.direction, camera));
37
- }
38
- `, [
39
- RAY_STRUCT.declaration_chunk,
40
- chunk_volumetrics_froxel_content_offset,
41
- chunk_cluster_depth_from_z_slice,
42
- chunk_camera_ray_from_uv,
43
- chunk_texel_coordinate_to_uv,
44
- chunk_camera_ray_planar_depth_scale,
45
- ]
46
- );
47
-
48
- chunk_volumetrics_froxel_centre_ws.requireResource(CAMERA_RESOURCE);
49
- chunk_volumetrics_froxel_centre_ws.requireResource(VOLUMETRICS_METADATA_RESOURCE);
@@ -1,17 +0,0 @@
1
- /**
2
- * How the froxel GI stage (`shader_volumetrics_gi`) stores its answer. One thread per froxel asks the
3
- * renderer's indirect lighting mode what radiance arrives at the froxel, as RGB SH2
4
- * (`chunk_volumetrics_gi_sample`), and hands the answer to `volumetrics_gi_store`. That starts the
5
- * froxel irradiance volume, and `shader_volumetrics_build_irradiance` adds the lights to it.
6
- *
7
- * `volumetrics_gi_store(voxel, radiance)` scales the field by `INDIRECT_LIGHT_INTENSITY`, as the
8
- * deferred and forward paths scale their indirect light, encodes it as the volume stores light
9
- * (`volumetrics_irradiance_sh_add_radiance`) and writes it to `tGIY` / `tGICoCg`.
10
- *
11
- * The enclosing shader binds `tGIY` and `tGICoCg` under those names.
12
- *
13
- * @type {CodeChunk}
14
- */
15
- export const chunk_volumetrics_gi: CodeChunk;
16
- import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
17
- //# sourceMappingURL=chunk_volumetrics_gi.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"chunk_volumetrics_gi.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/volumetrics/gi/chunk_volumetrics_gi.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;GAaG;AACH,mCAFU,SAAS,CA0BjB;0BA3CwB,oCAAoC"}
@@ -1,50 +0,0 @@
1
- import {
2
- METRO_L1_IRRADIANCE_STRUCT
3
- } from "../../shader/chunk/spherical_harmonics/l1i/chunk_convert_to_irradiance_sh.js";
4
- import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
5
- import { INDIRECT_LIGHT_INTENSITY } from "../../deferred/INDIRECT_LIGHT_INTENSITY.js";
6
- import { chunk_volumetrics_irradiance_sh } from "../chunk_volumetrics_irradiance_sh.js";
7
- import { VOLUMETRICS_GI_COCG_RESOURCE, VOLUMETRICS_GI_Y_RESOURCE } from "./volumetrics_gi_resources.js";
8
-
9
- /**
10
- * How the froxel GI stage (`shader_volumetrics_gi`) stores its answer. One thread per froxel asks the
11
- * renderer's indirect lighting mode what radiance arrives at the froxel, as RGB SH2
12
- * (`chunk_volumetrics_gi_sample`), and hands the answer to `volumetrics_gi_store`. That starts the
13
- * froxel irradiance volume, and `shader_volumetrics_build_irradiance` adds the lights to it.
14
- *
15
- * `volumetrics_gi_store(voxel, radiance)` scales the field by `INDIRECT_LIGHT_INTENSITY`, as the
16
- * deferred and forward paths scale their indirect light, encodes it as the volume stores light
17
- * (`volumetrics_irradiance_sh_add_radiance`) and writes it to `tGIY` / `tGICoCg`.
18
- *
19
- * The enclosing shader binds `tGIY` and `tGICoCg` under those names.
20
- *
21
- * @type {CodeChunk}
22
- */
23
- export const chunk_volumetrics_gi = CodeChunk.from(
24
- //language=WGSL
25
- `
26
- fn volumetrics_gi_store(voxel: vec3<u32>, radiance: array<vec3<f32>, 4>) {
27
- const INDIRECT_INTENSITY : f32 = ${INDIRECT_LIGHT_INTENSITY};
28
-
29
- let scaled = array<vec3<f32>, 4>(
30
- radiance[0] * INDIRECT_INTENSITY,
31
- radiance[1] * INDIRECT_INTENSITY,
32
- radiance[2] * INDIRECT_INTENSITY,
33
- radiance[3] * INDIRECT_INTENSITY,
34
- );
35
-
36
- var sh: ${METRO_L1_IRRADIANCE_STRUCT.wgsl_ref};
37
-
38
- let stored = volumetrics_irradiance_sh_storable(volumetrics_irradiance_sh_add_radiance(sh, scaled));
39
-
40
- textureStore(tGIY, voxel, stored.Y);
41
- textureStore(tGICoCg, voxel, vec4<f32>(stored.CoCg, 0.0, 0.0));
42
- }
43
- `, [
44
- METRO_L1_IRRADIANCE_STRUCT.declaration_chunk,
45
- chunk_volumetrics_irradiance_sh,
46
- ]
47
- );
48
-
49
- chunk_volumetrics_gi.requireResource(VOLUMETRICS_GI_COCG_RESOURCE);
50
- chunk_volumetrics_gi.requireResource(VOLUMETRICS_GI_Y_RESOURCE);
@@ -1,35 +0,0 @@
1
- /**
2
- * {@link chunk_volumetrics_gi_sample} under IBL: the environment, as `GPULightCollection.environment_sh`
3
- * holds it (`shader_project_environment_sh`). It is infinitely far, so every froxel receives the same
4
- * field.
5
- * @type {CodeChunk}
6
- */
7
- export const chunk_volumetrics_gi_sample_ibl: CodeChunk;
8
- /**
9
- * {@link chunk_volumetrics_gi_sample} under Brick4: the sparse volumetric light map's probes,
10
- * interpolated at the froxel's centre and truncated from SH3 to SH2. Reads `brick4`.
11
- * @type {CodeChunk}
12
- */
13
- export const chunk_volumetrics_gi_sample_brick4: CodeChunk;
14
- /**
15
- * {@link chunk_volumetrics_gi_sample} under LPV: the light probe volume's tetrahedral mesh, its probes
16
- * (radiance SH2) interpolated barycentrically at the froxel's centre. Reads the LPV's buffers.
17
- * @type {CodeChunk}
18
- */
19
- export const chunk_volumetrics_gi_sample_lpv: CodeChunk;
20
- /**
21
- * The radiance that arrives at a froxel, as RGB SH2, by the renderer's indirect lighting mode
22
- * ({@link INDIRECT_LIGHTING}):
23
- *
24
- * ```wgsl
25
- * fn volumetrics_gi_sample(voxel: vec3<u32>, resolution: vec3<u32>) -> array<vec3<f32>, 4>
26
- * ```
27
- *
28
- * A new mode is one more alternative: nothing downstream knows which mode wrote the volume.
29
- *
30
- * @type {CodeChunkChoice}
31
- */
32
- export const chunk_volumetrics_gi_sample: CodeChunkChoice;
33
- import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
34
- import { CodeChunkChoice } from "../../shader/compiler/CodeChunkChoice.js";
35
- //# sourceMappingURL=chunk_volumetrics_gi_sample.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"chunk_volumetrics_gi_sample.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/volumetrics/gi/chunk_volumetrics_gi_sample.js"],"names":[],"mappings":"AAWA;;;;;GAKG;AACH,8CAFU,SAAS,CAaZ;AAIP;;;;GAIG;AACH,iDAFU,SAAS,CAmBhB;AAEH;;;;GAIG;AACH,8CAFU,SAAS,CA2BhB;AAEH;;;;;;;;;;;GAWG;AACH,0CAFU,eAAe,CAE0D;0BA9FzD,oCAAoC;gCAC9B,0CAA0C"}
@@ -1,105 +0,0 @@
1
- import { chunk_brick4_sample_sh } from "../../global_illumination/brick4/gpu/draw/chunk_brick4_sample_sh.js";
2
- import { INDIRECT_LIGHTING } from "../../INDIRECT_LIGHTING.js";
3
- import { ShadeIndirectLightingMode } from "../../ShadeIndirectLightingMode.js";
4
- import { chunk_lpv_mesh_interpolation_probe_sh } from "../../shader/chunk/light/lpv/chunk_lpv_mesh_interpolation_probe_sh.js";
5
- import { chunk_lpv_mesh_lookup_nearest_cell } from "../../shader/chunk/light/lpv/chunk_lpv_mesh_lookup_nearest_cell.js";
6
- import { INVALID_TET_DECLARATION } from "../../shader/chunk/light/lpv/INVALID_TET_DECLARATION.js";
7
- import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
8
- import { CodeChunkChoice } from "../../shader/compiler/CodeChunkChoice.js";
9
- import { chunk_volumetrics_froxel_centre_ws } from "./chunk_volumetrics_froxel_centre_ws.js";
10
- import { ENVIRONMENT_SH_RESOURCE } from "../../light/environment/ENVIRONMENT_SH_RESOURCE.js";
11
-
12
- /**
13
- * {@link chunk_volumetrics_gi_sample} under IBL: the environment, as `GPULightCollection.environment_sh`
14
- * holds it (`shader_project_environment_sh`). It is infinitely far, so every froxel receives the same
15
- * field.
16
- * @type {CodeChunk}
17
- */
18
- export const chunk_volumetrics_gi_sample_ibl = CodeChunk.from(
19
- //language=WGSL
20
- `
21
- fn volumetrics_gi_sample(voxel: vec3<u32>, resolution: vec3<u32>) -> array<vec3<f32>, 4> {
22
- return array<vec3<f32>, 4>(
23
- environment_sh[0].xyz,
24
- environment_sh[1].xyz,
25
- environment_sh[2].xyz,
26
- environment_sh[3].xyz,
27
- );
28
- }
29
- `, []);
30
-
31
- chunk_volumetrics_gi_sample_ibl.requireResource(ENVIRONMENT_SH_RESOURCE);
32
-
33
- /**
34
- * {@link chunk_volumetrics_gi_sample} under Brick4: the sparse volumetric light map's probes,
35
- * interpolated at the froxel's centre and truncated from SH3 to SH2. Reads `brick4`.
36
- * @type {CodeChunk}
37
- */
38
- export const chunk_volumetrics_gi_sample_brick4 = CodeChunk.from(
39
- //language=WGSL
40
- `
41
- fn volumetrics_gi_sample(voxel: vec3<u32>, resolution: vec3<u32>) -> array<vec3<f32>, 4> {
42
- let position = volumetrics_froxel_centre_ws(voxel, resolution);
43
-
44
- // A froxel has no surface. The normal only masks probes behind one, and a zero normal weighs
45
- // every probe of the brick the same (brick4_probe_compute_weight_by_normal), which is the
46
- // interpolation a point in open space wants.
47
- let sh = brick4_sample_sh(position, vec3<f32>(0.0));
48
-
49
- // SH3 to SH2: the first four coefficients are the same two bands, in the same order
50
- return array<vec3<f32>, 4>(sh[0], sh[1], sh[2], sh[3]);
51
- }
52
- `, [
53
- chunk_volumetrics_froxel_centre_ws,
54
- chunk_brick4_sample_sh,
55
- ]);
56
-
57
- /**
58
- * {@link chunk_volumetrics_gi_sample} under LPV: the light probe volume's tetrahedral mesh, its probes
59
- * (radiance SH2) interpolated barycentrically at the froxel's centre. Reads the LPV's buffers.
60
- * @type {CodeChunk}
61
- */
62
- export const chunk_volumetrics_gi_sample_lpv = CodeChunk.from(
63
- //language=WGSL
64
- `
65
- fn volumetrics_gi_sample(voxel: vec3<u32>, resolution: vec3<u32>) -> array<vec3<f32>, 4> {
66
- let position = volumetrics_froxel_centre_ws(voxel, resolution);
67
-
68
- var weights: vec4<f32>;
69
- let tet = lpv_mesh_lookup_nearest_cell(position, &weights);
70
-
71
- // Outside the probe mesh there is nothing to interpolate, and the deferred LPV pass gives such a
72
- // point no indirect light either. No visibility mask: that needs a surface normal, and a froxel
73
- // has none.
74
- var radiance = array<vec3<f32>, 4>();
75
-
76
- if (tet != INVALID_TET) {
77
- radiance = lpv_mesh_interpolation_probe_sh(weights, tet);
78
- }
79
-
80
- return radiance;
81
- }
82
- `, [
83
- chunk_volumetrics_froxel_centre_ws,
84
- chunk_lpv_mesh_lookup_nearest_cell,
85
- chunk_lpv_mesh_interpolation_probe_sh,
86
- INVALID_TET_DECLARATION,
87
- ]);
88
-
89
- /**
90
- * The radiance that arrives at a froxel, as RGB SH2, by the renderer's indirect lighting mode
91
- * ({@link INDIRECT_LIGHTING}):
92
- *
93
- * ```wgsl
94
- * fn volumetrics_gi_sample(voxel: vec3<u32>, resolution: vec3<u32>) -> array<vec3<f32>, 4>
95
- * ```
96
- *
97
- * A new mode is one more alternative: nothing downstream knows which mode wrote the volume.
98
- *
99
- * @type {CodeChunkChoice}
100
- */
101
- export const chunk_volumetrics_gi_sample = CodeChunkChoice.from(INDIRECT_LIGHTING);
102
-
103
- chunk_volumetrics_gi_sample.add(ShadeIndirectLightingMode.IBL, chunk_volumetrics_gi_sample_ibl);
104
- chunk_volumetrics_gi_sample.add(ShadeIndirectLightingMode.Brick4, chunk_volumetrics_gi_sample_brick4);
105
- chunk_volumetrics_gi_sample.add(ShadeIndirectLightingMode.LPV, chunk_volumetrics_gi_sample_lpv);
@@ -1,35 +0,0 @@
1
- /**
2
- * The froxel GI stage: the renderer's indirect lighting at every froxel, as the froxel irradiance
3
- * volume encodes light, for `shader_volumetrics_build_irradiance` to add the lights to. The shader is
4
- * built for the renderer's switches, which pick the indirect lighting mode it samples
5
- * (`chunk_volumetrics_gi_sample`); this binds the environment and the running mode's source.
6
- *
7
- * @param {object} options
8
- * @param {import("../../../../engine/graphics/render/frame_graph/FrameGraph.js").FrameGraph} options.graph
9
- * @param {ShaderSwitchSet} [options.shader_switches] the renderer's
10
- * @param {import("../../scene/GPUSceneContext.js").GPUSceneContext} options.scene_ctx for its environment,
11
- * `lights.environment_sh`
12
- * @param {import("../../global_illumination/brick4/Brick4LightMap.js").Brick4LightMap} [options.brick4] the scene's,
13
- * while Brick4 runs
14
- * @param {import("../../global_illumination/lpv/GPULightProbeVolume.js").GPULightProbeVolume} [options.lpv] the
15
- * scene's, while LPV runs. A source not given is the shader's default, for a variant that does not read it
16
- * @param {import("../../camera/GPUCameraContext.js").GPUCameraContext} options.camera
17
- * @param {number} options.volumetrics_metadata graph handle
18
- * @param {number[]} options.resolution the froxel grid
19
- * @returns {{Y: number, CoCg: number}} handles of the GI volume, in the froxel irradiance encoding
20
- */
21
- export function graph_build_froxel_gi({ graph, shader_switches, scene_ctx, brick4, lpv, camera, volumetrics_metadata, resolution, }: {
22
- graph: import("../../../../engine/graphics/render/frame_graph/FrameGraph.js").FrameGraph;
23
- shader_switches?: ShaderSwitchSet;
24
- scene_ctx: import("../../scene/GPUSceneContext.js").GPUSceneContext;
25
- brick4?: import("../../global_illumination/brick4/Brick4LightMap.js").Brick4LightMap;
26
- lpv?: import("../../global_illumination/lpv/GPULightProbeVolume.js").GPULightProbeVolume;
27
- camera: import("../../camera/GPUCameraContext.js").GPUCameraContext;
28
- volumetrics_metadata: number;
29
- resolution: number[];
30
- }): {
31
- Y: number;
32
- CoCg: number;
33
- };
34
- import { ShaderSwitchSet } from "../../shader/compiler/ShaderSwitchSet.js";
35
- //# sourceMappingURL=graph_build_froxel_gi.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"graph_build_froxel_gi.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/volumetrics/gi/graph_build_froxel_gi.js"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;;GAmBG;AACH;IAbsG,KAAK,EAAhG,OAAO,8DAA8D,EAAE,UAAU;IACvD,eAAe,GAAzC,eAAe;IACmD,SAAS,EAA3E,OAAO,gCAAgC,EAAE,eAAe;IAE8B,MAAM,GAA5F,OAAO,oDAAoD,EAAE,cAAc;IAEkB,GAAG,GAAhG,OAAO,sDAAsD,EAAE,mBAAmB;IAEb,MAAM,EAA3E,OAAO,kCAAkC,EAAE,gBAAgB;IAC3C,oBAAoB,EAApC,MAAM;IACY,UAAU,EAA5B,MAAM,EAAE;IACN;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,CAsDrC;gCA5E+B,0CAA0C"}
@@ -1,80 +0,0 @@
1
- import { TextureResourceDescriptor } from "../../../device/graph/TextureResourceDescriptor.js";
2
- import { graph_compute_pass } from "../../shader/graph/compute/graph_compute_pass.js";
3
- import { graph_import_buffer } from "../../shader/graph/graph_import_buffer.js";
4
- import { ShaderSwitchSet } from "../../shader/compiler/ShaderSwitchSet.js";
5
- import { shader_volumetrics_gi } from "./shader_volumetrics_gi.js";
6
- import { VOLUMETRICS_GI_WORKGROUP_RESOLUTION } from "./volumetrics_gi_resources.js";
7
-
8
- /**
9
- * The froxel GI stage: the renderer's indirect lighting at every froxel, as the froxel irradiance
10
- * volume encodes light, for `shader_volumetrics_build_irradiance` to add the lights to. The shader is
11
- * built for the renderer's switches, which pick the indirect lighting mode it samples
12
- * (`chunk_volumetrics_gi_sample`); this binds the environment and the running mode's source.
13
- *
14
- * @param {object} options
15
- * @param {import("../../../../engine/graphics/render/frame_graph/FrameGraph.js").FrameGraph} options.graph
16
- * @param {ShaderSwitchSet} [options.shader_switches] the renderer's
17
- * @param {import("../../scene/GPUSceneContext.js").GPUSceneContext} options.scene_ctx for its environment,
18
- * `lights.environment_sh`
19
- * @param {import("../../global_illumination/brick4/Brick4LightMap.js").Brick4LightMap} [options.brick4] the scene's,
20
- * while Brick4 runs
21
- * @param {import("../../global_illumination/lpv/GPULightProbeVolume.js").GPULightProbeVolume} [options.lpv] the
22
- * scene's, while LPV runs. A source not given is the shader's default, for a variant that does not read it
23
- * @param {import("../../camera/GPUCameraContext.js").GPUCameraContext} options.camera
24
- * @param {number} options.volumetrics_metadata graph handle
25
- * @param {number[]} options.resolution the froxel grid
26
- * @returns {{Y: number, CoCg: number}} handles of the GI volume, in the froxel irradiance encoding
27
- */
28
- export function graph_build_froxel_gi({
29
- graph,
30
- shader_switches = ShaderSwitchSet.EMPTY,
31
- scene_ctx,
32
- brick4,
33
- lpv,
34
- camera,
35
- volumetrics_metadata,
36
- resolution,
37
- }) {
38
- const volume = () => TextureResourceDescriptor.from({
39
- resolution,
40
- dimension: "3d",
41
- format: "rgba16float",
42
- usage: GPUTextureUsage.STORAGE_BINDING | GPUTextureUsage.TEXTURE_BINDING
43
- });
44
-
45
- const bindings = {
46
- volumetrics_metadata,
47
- camera: graph_import_buffer(graph, camera.buffer.buffer, "froxel gi camera"),
48
- tGIY: volume(),
49
- tGICoCg: volume(),
50
- environment_sh: scene_ctx.lights.environment_sh,
51
- };
52
-
53
- // the running mode's source; the others are the shader's defaults, which its variant does not read
54
- if (brick4 !== undefined) {
55
- bindings.brick4 = brick4.buffer;
56
- }
57
-
58
- if (lpv !== undefined) {
59
- bindings.lpv_lookup = lpv.buffer_mesh_bvh;
60
- bindings.lpv_metadata = lpv.buffer_metadata;
61
- bindings.lpv_mesh = lpv.buffer_mesh;
62
- bindings.lpv_probes = lpv.buffer_probes;
63
- }
64
-
65
- const outputs = graph_compute_pass({
66
- graph,
67
- shader: shader_volumetrics_gi.variant(shader_switches),
68
- group_count: [
69
- Math.ceil(resolution[0] / VOLUMETRICS_GI_WORKGROUP_RESOLUTION[0]),
70
- Math.ceil(resolution[1] / VOLUMETRICS_GI_WORKGROUP_RESOLUTION[1]),
71
- Math.ceil(resolution[2] / VOLUMETRICS_GI_WORKGROUP_RESOLUTION[2]),
72
- ],
73
- bindings,
74
- });
75
-
76
- return {
77
- Y: outputs.tGIY,
78
- CoCg: outputs.tGICoCg,
79
- };
80
- }
@@ -1,10 +0,0 @@
1
- /**
2
- * The froxel GI stage: the renderer's indirect lighting at every froxel, one thread per froxel. Which
3
- * mode's light it asks for is a shader switch ({@link chunk_volumetrics_gi_sample}); the bindings are
4
- * the same for every mode. See `chunk_volumetrics_gi` for what it does with the answer.
5
- *
6
- * @type {ComputeShader}
7
- */
8
- export const shader_volumetrics_gi: ComputeShader;
9
- import { ComputeShader } from "../../shader/ComputeShader.js";
10
- //# sourceMappingURL=shader_volumetrics_gi.d.ts.map