@woosh/meep-engine 3.67.0 → 3.68.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 (311) hide show
  1. package/package.json +1 -1
  2. package/src/engine/graphics3/GraphicsEngine.d.ts.map +1 -1
  3. package/src/engine/graphics3/GraphicsEngine.js +4 -9
  4. package/src/engine/graphics3/load_cube_environment.js +3 -3
  5. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  6. package/src/shade/playground/probe_clipmap/index.html +43 -0
  7. package/src/shade/playground/probe_clipmap/main.d.ts.map +1 -1
  8. package/src/shade/playground/probe_clipmap/main.js +29 -0
  9. package/src/shade/renderer/Renderer.d.ts +7 -0
  10. package/src/shade/renderer/Renderer.d.ts.map +1 -1
  11. package/src/shade/renderer/Renderer.js +213 -15
  12. package/src/shade/renderer/ShadeIndirectLightingMode.d.ts +1 -0
  13. package/src/shade/renderer/ShadeIndirectLightingMode.js +9 -0
  14. package/src/shade/renderer/atmosphere/ATMOSPHERE_PARAMETERS_STRUCT.d.ts +22 -0
  15. package/src/shade/renderer/atmosphere/ATMOSPHERE_PARAMETERS_STRUCT.d.ts.map +1 -0
  16. package/src/shade/renderer/atmosphere/ATMOSPHERE_PARAMETERS_STRUCT.js +160 -0
  17. package/src/shade/renderer/atmosphere/ATMOSPHERE_UNIT_SCALE.d.ts +45 -0
  18. package/src/shade/renderer/atmosphere/ATMOSPHERE_UNIT_SCALE.d.ts.map +1 -0
  19. package/src/shade/renderer/atmosphere/ATMOSPHERE_UNIT_SCALE.js +57 -0
  20. package/src/shade/renderer/atmosphere/GPUSky.d.ts +23 -8
  21. package/src/shade/renderer/atmosphere/GPUSky.d.ts.map +1 -1
  22. package/src/shade/renderer/atmosphere/GPUSky.js +91 -34
  23. package/src/shade/renderer/atmosphere/SAMPLER_SKY_LUT.d.ts +17 -0
  24. package/src/shade/renderer/atmosphere/SAMPLER_SKY_LUT.d.ts.map +1 -1
  25. package/src/shade/renderer/atmosphere/SAMPLER_SKY_LUT.js +55 -25
  26. package/src/shade/renderer/atmosphere/SceneAtmosphere.d.ts +164 -0
  27. package/src/shade/renderer/atmosphere/SceneAtmosphere.d.ts.map +1 -0
  28. package/src/shade/renderer/atmosphere/SceneAtmosphere.js +308 -0
  29. package/src/shade/renderer/atmosphere/chunk_get_multiscatter_values.d.ts +3 -12
  30. package/src/shade/renderer/atmosphere/chunk_get_multiscatter_values.d.ts.map +1 -1
  31. package/src/shade/renderer/atmosphere/chunk_get_multiscatter_values.js +52 -89
  32. package/src/shade/renderer/atmosphere/chunk_raymarch_sky_scattering.d.ts +14 -0
  33. package/src/shade/renderer/atmosphere/chunk_raymarch_sky_scattering.d.ts.map +1 -0
  34. package/src/shade/renderer/atmosphere/chunk_raymarch_sky_scattering.js +103 -0
  35. package/src/shade/renderer/atmosphere/chunk_sample_multiscatter_lut.d.ts +10 -4
  36. package/src/shade/renderer/atmosphere/chunk_sample_multiscatter_lut.d.ts.map +1 -1
  37. package/src/shade/renderer/atmosphere/chunk_sample_multiscatter_lut.js +95 -57
  38. package/src/shade/renderer/atmosphere/chunk_sample_transmittance_lut.d.ts +10 -14
  39. package/src/shade/renderer/atmosphere/chunk_sample_transmittance_lut.d.ts.map +1 -1
  40. package/src/shade/renderer/atmosphere/chunk_sample_transmittance_lut.js +97 -69
  41. package/src/shade/renderer/atmosphere/chunk_sky_irradiance_lut_encode_uv.d.ts +17 -0
  42. package/src/shade/renderer/atmosphere/chunk_sky_irradiance_lut_encode_uv.d.ts.map +1 -1
  43. package/src/shade/renderer/atmosphere/chunk_sky_irradiance_lut_encode_uv.js +117 -48
  44. package/src/shade/renderer/atmosphere/chunk_sky_lut_compute_uv.d.ts +8 -0
  45. package/src/shade/renderer/atmosphere/chunk_sky_lut_compute_uv.d.ts.map +1 -1
  46. package/src/shade/renderer/atmosphere/chunk_sky_lut_compute_uv.js +65 -35
  47. package/src/shade/renderer/atmosphere/compute_mie_absorption.d.ts +2 -1
  48. package/src/shade/renderer/atmosphere/compute_mie_absorption.d.ts.map +1 -1
  49. package/src/shade/renderer/atmosphere/compute_mie_absorption.js +6 -6
  50. package/src/shade/renderer/atmosphere/resolve_atmosphere_sun.d.ts +41 -0
  51. package/src/shade/renderer/atmosphere/resolve_atmosphere_sun.d.ts.map +1 -0
  52. package/src/shade/renderer/atmosphere/resolve_atmosphere_sun.js +123 -0
  53. package/src/shade/renderer/atmosphere/shader_multiscatter_lut.d.ts.map +1 -1
  54. package/src/shade/renderer/atmosphere/shader_multiscatter_lut.js +21 -64
  55. package/src/shade/renderer/atmosphere/shader_sky_irradiance_lut.d.ts +6 -2
  56. package/src/shade/renderer/atmosphere/shader_sky_irradiance_lut.d.ts.map +1 -1
  57. package/src/shade/renderer/atmosphere/shader_sky_irradiance_lut.js +55 -179
  58. package/src/shade/renderer/atmosphere/shader_sky_view_lut.d.ts +7 -0
  59. package/src/shade/renderer/atmosphere/shader_sky_view_lut.d.ts.map +1 -0
  60. package/src/shade/renderer/atmosphere/shader_sky_view_lut.js +111 -0
  61. package/src/shade/renderer/atmosphere/shader_transmittance_lut.d.ts +0 -1
  62. package/src/shade/renderer/atmosphere/shader_transmittance_lut.d.ts.map +1 -1
  63. package/src/shade/renderer/atmosphere/shader_transmittance_lut.js +68 -79
  64. package/src/shade/renderer/deferred/shader_background.js +1 -1
  65. package/src/shade/renderer/deferred/shader_background_sky.d.ts +5 -0
  66. package/src/shade/renderer/deferred/shader_background_sky.d.ts.map +1 -0
  67. package/src/shade/renderer/deferred/shader_background_sky.js +130 -0
  68. package/src/shade/renderer/deferred/tonemap/chunk_tonemap_purkinje.d.ts +2 -1
  69. package/src/shade/renderer/deferred/tonemap/chunk_tonemap_purkinje.d.ts.map +1 -1
  70. package/src/shade/renderer/deferred/tonemap/chunk_tonemap_purkinje.js +6 -2
  71. package/src/shade/renderer/extension/ViewTextures.d.ts +3 -2
  72. package/src/shade/renderer/extension/ViewTextures.d.ts.map +1 -1
  73. package/src/shade/renderer/extension/ViewTextures.js +3 -2
  74. package/src/shade/renderer/fluid/GPUFluidCascade.d.ts +3 -3
  75. package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts +1 -1
  76. package/src/shade/renderer/fluid/forcing/GPUFluidForcing.d.ts +6 -6
  77. package/src/shade/renderer/fluid/pressure/GPUFluidPressureSolve.d.ts +1 -1
  78. package/src/shade/renderer/fluid/query/GPUFluidQueries.d.ts +1 -1
  79. package/src/shade/renderer/global_illumination/probe/octahedral/shader_lpv_build_gbuffer.js +1 -1
  80. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts +20 -1
  81. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts.map +1 -1
  82. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.js +29 -0
  83. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_hit_light.d.ts +47 -0
  84. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_hit_light.d.ts.map +1 -0
  85. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_hit_light.js +246 -0
  86. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.d.ts +4 -15
  87. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.d.ts.map +1 -1
  88. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.js +8 -148
  89. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.d.ts +4 -9
  90. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.d.ts.map +1 -1
  91. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.js +9 -58
  92. package/src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.d.ts +142 -0
  93. package/src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.d.ts.map +1 -0
  94. package/src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.js +938 -0
  95. package/src/shade/renderer/global_illumination/screen_probe/SCREEN_PROBE.d.ts +192 -0
  96. package/src/shade/renderer/global_illumination/screen_probe/SCREEN_PROBE.d.ts.map +1 -0
  97. package/src/shade/renderer/global_illumination/screen_probe/SCREEN_PROBE.js +231 -0
  98. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeDebugView.d.ts +11 -0
  99. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeDebugView.d.ts.map +1 -0
  100. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeDebugView.js +25 -0
  101. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.d.ts +110 -0
  102. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.d.ts.map +1 -0
  103. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.js +197 -0
  104. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe.d.ts +150 -0
  105. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe.d.ts.map +1 -0
  106. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe.js +408 -0
  107. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_brdf_density.d.ts +23 -0
  108. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_brdf_density.d.ts.map +1 -0
  109. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_brdf_density.js +63 -0
  110. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_brick_origin.d.ts +24 -0
  111. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_brick_origin.d.ts.map +1 -0
  112. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_brick_origin.js +61 -0
  113. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_interpolate.d.ts +39 -0
  114. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_interpolate.d.ts.map +1 -0
  115. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_interpolate.js +126 -0
  116. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_lighting_history.d.ts +21 -0
  117. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_lighting_history.d.ts.map +1 -0
  118. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_lighting_history.js +74 -0
  119. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_march_distance.d.ts +20 -0
  120. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_march_distance.d.ts.map +1 -0
  121. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_march_distance.js +26 -0
  122. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_ray_sort.d.ts +24 -0
  123. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_ray_sort.d.ts.map +1 -0
  124. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_ray_sort.js +57 -0
  125. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_screen_march.d.ts +22 -0
  126. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_screen_march.d.ts.map +1 -0
  127. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_screen_march.js +53 -0
  128. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_surface.d.ts +62 -0
  129. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_surface.d.ts.map +1 -0
  130. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_surface.js +156 -0
  131. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_workgroup_sum.d.ts +18 -0
  132. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_workgroup_sum.d.ts.map +1 -0
  133. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_workgroup_sum.js +50 -0
  134. package/src/shade/renderer/global_illumination/screen_probe/graph_screen_probe_debug_view.d.ts +21 -0
  135. package/src/shade/renderer/global_illumination/screen_probe/graph_screen_probe_debug_view.d.ts.map +1 -0
  136. package/src/shade/renderer/global_illumination/screen_probe/graph_screen_probe_debug_view.js +54 -0
  137. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_brick.d.ts +67 -0
  138. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_brick.d.ts.map +1 -0
  139. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_brick.js +509 -0
  140. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_debug.d.ts +20 -0
  141. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_debug.d.ts.map +1 -0
  142. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_debug.js +128 -0
  143. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_gather.d.ts +62 -0
  144. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_gather.d.ts.map +1 -0
  145. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_gather.js +478 -0
  146. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_importance.d.ts +69 -0
  147. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_importance.d.ts.map +1 -0
  148. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_importance.js +457 -0
  149. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_indirect_lighting.d.ts +27 -0
  150. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_indirect_lighting.d.ts.map +1 -0
  151. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_indirect_lighting.js +219 -0
  152. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_pick.d.ts +22 -0
  153. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_pick.d.ts.map +1 -0
  154. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_pick.js +151 -0
  155. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_place.d.ts +66 -0
  156. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_place.d.ts.map +1 -0
  157. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_place.js +301 -0
  158. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_resolve.d.ts +59 -0
  159. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_resolve.d.ts.map +1 -0
  160. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_resolve.js +364 -0
  161. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_trace_screen.d.ts +40 -0
  162. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_trace_screen.d.ts.map +1 -0
  163. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_trace_screen.js +275 -0
  164. package/src/shade/renderer/grass/blade/GPUGrassBlades.d.ts.map +1 -1
  165. package/src/shade/renderer/grass/blade/GPUGrassBlades.js +17 -2
  166. package/src/shade/renderer/grass/blade/grass_blade_resolve.d.ts +18 -8
  167. package/src/shade/renderer/grass/blade/grass_blade_resolve.d.ts.map +1 -1
  168. package/src/shade/renderer/grass/blade/grass_blade_resolve.js +114 -32
  169. package/src/shade/renderer/light/GPULightCollection.d.ts +1 -1
  170. package/src/shade/renderer/light/GPULightCollection.d.ts.map +1 -1
  171. package/src/shade/renderer/light/GPULightCollection.js +213 -80
  172. package/src/shade/renderer/{atmosphere → light/environment}/chunk_sample_environment_color.d.ts +1 -2
  173. package/src/shade/renderer/light/environment/chunk_sample_environment_color.d.ts.map +1 -0
  174. package/src/shade/renderer/{atmosphere → light/environment}/chunk_sample_environment_color.js +3 -4
  175. package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
  176. package/src/shade/renderer/path_tracer/shader/chunk_render_trace_path.js +1 -1
  177. package/src/shade/renderer/postprocess/denoise/debug/graph_pass_debug_reprojection.js +1 -1
  178. package/src/shade/renderer/postprocess/motion_blur/MotionBlur.d.ts +1 -1
  179. package/src/shade/renderer/postprocess/motion_blur/MotionBlur.js +1 -1
  180. package/src/shade/renderer/postprocess/motion_blur/graph_postprocess_motion_blur.d.ts +1 -1
  181. package/src/shade/renderer/postprocess/motion_blur/graph_postprocess_motion_blur.js +1 -1
  182. package/src/shade/renderer/postprocess/motion_blur/shader_motion_blur_reconstruct.js +1 -1
  183. package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
  184. package/src/shade/renderer/postprocess/ssr/resolve/chunk_ssr_add_hit_irradiance.js +2 -0
  185. package/src/shade/renderer/postprocess/ssr/resolve/chunk_ssr_sample_radiance.js +2 -0
  186. package/src/shade/renderer/postprocess/taa/chunk_fsr2_compute_depth_clip.d.ts +6 -0
  187. package/src/shade/renderer/postprocess/taa/chunk_fsr2_compute_depth_clip.d.ts.map +1 -1
  188. package/src/shade/renderer/postprocess/taa/chunk_fsr2_compute_depth_clip.js +9 -1
  189. package/src/shade/renderer/postprocess/taa/shader_depth_occlusion_clip.d.ts.map +1 -1
  190. package/src/shade/renderer/postprocess/taa/shader_depth_occlusion_clip.js +4 -3
  191. package/src/shade/renderer/postprocess/velocity/VELOCITY_BUFFER.d.ts +17 -0
  192. package/src/shade/renderer/postprocess/velocity/VELOCITY_BUFFER.d.ts.map +1 -0
  193. package/src/shade/renderer/postprocess/velocity/VELOCITY_BUFFER.js +16 -0
  194. package/src/shade/renderer/postprocess/velocity/chunk_velocity_texel.d.ts +21 -0
  195. package/src/shade/renderer/postprocess/velocity/chunk_velocity_texel.d.ts.map +1 -0
  196. package/src/shade/renderer/postprocess/velocity/chunk_velocity_texel.js +30 -0
  197. package/src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.d.ts +7 -5
  198. package/src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.d.ts.map +1 -1
  199. package/src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.js +19 -17
  200. package/src/shade/renderer/rasterize/forward/chunk_forward_sample_indirect.js +2 -0
  201. package/src/shade/renderer/scene/GPUSceneContext.d.ts.map +1 -1
  202. package/src/shade/renderer/scene/GPUSceneContext.js +2 -1
  203. package/src/shade/renderer/scene/Scene.d.ts +9 -2
  204. package/src/shade/renderer/scene/Scene.d.ts.map +1 -1
  205. package/src/shade/renderer/scene/Scene.js +10 -2
  206. package/src/shade/renderer/shader/ImageShader.d.ts +24 -12
  207. package/src/shade/renderer/shader/ImageShader.d.ts.map +1 -1
  208. package/src/shade/renderer/shader/ImageShader.js +11 -8
  209. package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_HEIGHT_DECLARATION.d.ts +3 -1
  210. package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_HEIGHT_DECLARATION.d.ts.map +1 -1
  211. package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_HEIGHT_DECLARATION.js +11 -3
  212. package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_RADII_DECLARATION.d.ts +2 -11
  213. package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_RADII_DECLARATION.d.ts.map +1 -1
  214. package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_RADII_DECLARATION.js +23 -32
  215. package/src/shade/renderer/shader/chunk/atmosphere/PLANET_RADIUS_DECLARATION.d.ts +6 -0
  216. package/src/shade/renderer/shader/chunk/atmosphere/PLANET_RADIUS_DECLARATION.d.ts.map +1 -1
  217. package/src/shade/renderer/shader/chunk/atmosphere/PLANET_RADIUS_DECLARATION.js +14 -2
  218. package/src/shade/renderer/shader/chunk/atmosphere/chunk_atmosphere_height.d.ts.map +1 -1
  219. package/src/shade/renderer/shader/chunk/atmosphere/chunk_atmosphere_height.js +4 -2
  220. package/src/shade/renderer/shader/chunk/atmosphere/chunk_atmosphere_intersection.d.ts.map +1 -1
  221. package/src/shade/renderer/shader/chunk/atmosphere/chunk_atmosphere_intersection.js +11 -3
  222. package/src/shade/renderer/shader/chunk/atmosphere/chunk_atmosphere_ray_bounds.d.ts.map +1 -1
  223. package/src/shade/renderer/shader/chunk/atmosphere/chunk_atmosphere_ray_bounds.js +68 -69
  224. package/src/shade/renderer/shader/chunk/atmosphere/chunk_get_sun_transmittance.d.ts +4 -1
  225. package/src/shade/renderer/shader/chunk/atmosphere/chunk_get_sun_transmittance.d.ts.map +1 -1
  226. package/src/shade/renderer/shader/chunk/atmosphere/chunk_get_sun_transmittance.js +46 -39
  227. package/src/shade/renderer/shader/chunk/atmosphere/chunk_position_relative_to_planet_center.d.ts.map +1 -1
  228. package/src/shade/renderer/shader/chunk/atmosphere/chunk_position_relative_to_planet_center.js +5 -3
  229. package/src/shade/renderer/shader/chunk/color/tonemap/purkinje/chunk_apply_purkinje_shift.d.ts +18 -10
  230. package/src/shade/renderer/shader/chunk/color/tonemap/purkinje/chunk_apply_purkinje_shift.d.ts.map +1 -1
  231. package/src/shade/renderer/shader/chunk/color/tonemap/purkinje/chunk_apply_purkinje_shift.js +30 -27
  232. package/src/shade/renderer/shader/chunk/depth/chunk_get_device_depth.d.ts +14 -0
  233. package/src/shade/renderer/shader/chunk/depth/chunk_get_device_depth.d.ts.map +1 -0
  234. package/src/shade/renderer/shader/chunk/depth/chunk_get_device_depth.js +30 -0
  235. package/src/shade/renderer/shader/chunk/geometry/octahedron/chunk_uv_equal_area_sphere.d.ts +21 -0
  236. package/src/shade/renderer/shader/chunk/geometry/octahedron/chunk_uv_equal_area_sphere.d.ts.map +1 -0
  237. package/src/shade/renderer/shader/chunk/geometry/octahedron/chunk_uv_equal_area_sphere.js +60 -0
  238. package/src/shade/renderer/shader/chunk/light/{sky/chunk_sample_sky_color.d.ts → io/chunk_light_get_sun.d.ts} +3 -6
  239. package/src/shade/renderer/shader/chunk/light/io/chunk_light_get_sun.d.ts.map +1 -0
  240. package/src/shade/renderer/shader/chunk/light/{sky/chunk_sample_sky_color.js → io/chunk_light_get_sun.js} +6 -26
  241. package/src/shade/renderer/shadow/sdf/cascade/shader_scene_sdf_soft_shadows.js +1 -1
  242. package/src/shade/renderer/volumetrics/GPUViewVolumetrics.d.ts +3 -1
  243. package/src/shade/renderer/volumetrics/GPUViewVolumetrics.d.ts.map +1 -1
  244. package/src/shade/renderer/volumetrics/GPUViewVolumetrics.js +4 -2
  245. package/src/shade/renderer/volumetrics/graph_build_volumetrics.d.ts.map +1 -1
  246. package/src/shade/renderer/volumetrics/graph_build_volumetrics.js +743 -739
  247. package/src/shade/renderer/volumetrics/irradiance_clipmap/chunk_irradiance_clipmap_gi_sample.js +2 -0
  248. package/src/shade/renderer/volumetrics/shader_volumetrics_build_lighting.d.ts.map +1 -1
  249. package/src/shade/renderer/volumetrics/shader_volumetrics_build_lighting.js +19 -17
  250. package/src/shade/renderer/volumetrics/shader_volumetrics_build_scattering_lut.d.ts.map +1 -1
  251. package/src/shade/renderer/volumetrics/shader_volumetrics_build_scattering_lut.js +5 -3
  252. package/src/shade/renderer/water/chunk_water_gi.js +2 -0
  253. package/src/shade/renderer/water/query/GPUWaterQueries.d.ts +1 -1
  254. package/src/shade/renderer/wind/GPUSceneWind.d.ts +1 -1
  255. package/src/engine/graphics/sh3/path_tracer/make_sky_hosek.d.ts +0 -2
  256. package/src/engine/graphics/sh3/path_tracer/make_sky_hosek.d.ts.map +0 -1
  257. package/src/engine/graphics/sh3/path_tracer/make_sky_hosek.js +0 -45
  258. package/src/engine/graphics/sh3/path_tracer/make_sky_rtiw.d.ts +0 -2
  259. package/src/engine/graphics/sh3/path_tracer/make_sky_rtiw.d.ts.map +0 -1
  260. package/src/engine/graphics/sh3/path_tracer/make_sky_rtiw.js +0 -17
  261. package/src/engine/graphics/sh3/sky/hosek/README.md +0 -4
  262. package/src/engine/graphics/sh3/sky/hosek/data.d.ts +0 -17
  263. package/src/engine/graphics/sh3/sky/hosek/data.d.ts.map +0 -1
  264. package/src/engine/graphics/sh3/sky/hosek/data.js +0 -3744
  265. package/src/engine/graphics/sh3/sky/hosek/prototype_hosek.d.ts +0 -2
  266. package/src/engine/graphics/sh3/sky/hosek/prototype_hosek.d.ts.map +0 -1
  267. package/src/engine/graphics/sh3/sky/hosek/prototype_hosek.js +0 -71
  268. package/src/engine/graphics/sh3/sky/hosek/render_hosek_sky_to_equirectangular.d.ts +0 -26
  269. package/src/engine/graphics/sh3/sky/hosek/render_hosek_sky_to_equirectangular.d.ts.map +0 -1
  270. package/src/engine/graphics/sh3/sky/hosek/render_hosek_sky_to_equirectangular.js +0 -70
  271. package/src/engine/graphics/sh3/sky/hosek/sky_hosek_compute_irradiance_by_direction.d.ts +0 -22
  272. package/src/engine/graphics/sh3/sky/hosek/sky_hosek_compute_irradiance_by_direction.d.ts.map +0 -1
  273. package/src/engine/graphics/sh3/sky/hosek/sky_hosek_compute_irradiance_by_direction.js +0 -388
  274. package/src/engine/graphics3/make_default_environment.d.ts +0 -15
  275. package/src/engine/graphics3/make_default_environment.d.ts.map +0 -1
  276. package/src/engine/graphics3/make_default_environment.js +0 -111
  277. package/src/shade/renderer/atmosphere/MIE_G.d.ts +0 -6
  278. package/src/shade/renderer/atmosphere/MIE_G.d.ts.map +0 -1
  279. package/src/shade/renderer/atmosphere/MIE_G.js +0 -5
  280. package/src/shade/renderer/atmosphere/chunk_sample_environment_color.d.ts.map +0 -1
  281. package/src/shade/renderer/atmosphere/hillaire/ATMOSPHERE_EARTH.d.ts +0 -4
  282. package/src/shade/renderer/atmosphere/hillaire/ATMOSPHERE_EARTH.d.ts.map +0 -1
  283. package/src/shade/renderer/atmosphere/hillaire/ATMOSPHERE_EARTH.js +0 -44
  284. package/src/shade/renderer/atmosphere/hillaire/ATMOSPHERE_PARAMETERS_STRUCT.d.ts +0 -2
  285. package/src/shade/renderer/atmosphere/hillaire/ATMOSPHERE_PARAMETERS_STRUCT.d.ts.map +0 -1
  286. package/src/shade/renderer/atmosphere/hillaire/ATMOSPHERE_PARAMETERS_STRUCT.js +0 -43
  287. package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_DENSITY_DECLARATION.d.ts +0 -3
  288. package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_DENSITY_DECLARATION.d.ts.map +0 -1
  289. package/src/shade/renderer/shader/chunk/atmosphere/ATMOSPHERE_DENSITY_DECLARATION.js +0 -6
  290. package/src/shade/renderer/shader/chunk/atmosphere/chunk_absorb.d.ts +0 -3
  291. package/src/shade/renderer/shader/chunk/atmosphere/chunk_absorb.d.ts.map +0 -1
  292. package/src/shade/renderer/shader/chunk/atmosphere/chunk_absorb.js +0 -18
  293. package/src/shade/renderer/shader/chunk/atmosphere/chunk_integrate_optical_depth.d.ts +0 -14
  294. package/src/shade/renderer/shader/chunk/atmosphere/chunk_integrate_optical_depth.d.ts.map +0 -1
  295. package/src/shade/renderer/shader/chunk/atmosphere/chunk_integrate_optical_depth.js +0 -86
  296. package/src/shade/renderer/shader/chunk/atmosphere/chunk_integrate_scattering.d.ts +0 -8
  297. package/src/shade/renderer/shader/chunk/atmosphere/chunk_integrate_scattering.d.ts.map +0 -1
  298. package/src/shade/renderer/shader/chunk/atmosphere/chunk_integrate_scattering.js +0 -125
  299. package/src/shade/renderer/shader/chunk/atmosphere/chunk_planet_intersection.d.ts +0 -3
  300. package/src/shade/renderer/shader/chunk/atmosphere/chunk_planet_intersection.d.ts.map +0 -1
  301. package/src/shade/renderer/shader/chunk/atmosphere/chunk_planet_intersection.js +0 -17
  302. package/src/shade/renderer/shader/chunk/atmosphere/chunk_sphere_intersection_nearest.d.ts +0 -3
  303. package/src/shade/renderer/shader/chunk/atmosphere/chunk_sphere_intersection_nearest.d.ts.map +0 -1
  304. package/src/shade/renderer/shader/chunk/atmosphere/chunk_sphere_intersection_nearest.js +0 -38
  305. package/src/shade/renderer/shader/chunk/atmosphere/hillaire/DENSITY_PROFILE_LAYER_STRUCT.d.ts +0 -16
  306. package/src/shade/renderer/shader/chunk/atmosphere/hillaire/DENSITY_PROFILE_LAYER_STRUCT.d.ts.map +0 -1
  307. package/src/shade/renderer/shader/chunk/atmosphere/hillaire/DENSITY_PROFILE_LAYER_STRUCT.js +0 -28
  308. package/src/shade/renderer/shader/chunk/light/sky/chunk_sample_sky_color.d.ts.map +0 -1
  309. package/src/shade/renderer/view/GPUViewSkyContext.d.ts +0 -26
  310. package/src/shade/renderer/view/GPUViewSkyContext.d.ts.map +0 -1
  311. package/src/shade/renderer/view/GPUViewSkyContext.js +0 -170
@@ -0,0 +1,275 @@
1
+ import { chunk_project_position_from_depth } from "../../shader/chunk/camera/chunk_project_position_from_depth.js";
2
+ import { chunk_get_view_space_depth } from "../../shader/chunk/depth/chunk_get_view_space_depth.js";
3
+ import { chunk_is_background } from "../../shader/chunk/depth/chunk_is_background.js";
4
+ import {
5
+ chunk_decode_g_buffer_face_normal
6
+ } from "../../shader/chunk/geometry/normal/chunk_decode_g_buffer_face_normal.js";
7
+ import { chunk_uv_equal_area_sphere } from "../../shader/chunk/geometry/octahedron/chunk_uv_equal_area_sphere.js";
8
+ import {
9
+ chunk_uv_octahedral_unit_decode
10
+ } from "../../shader/chunk/geometry/octahedron/chunk_uv_octahedral_unit_decode.js";
11
+ import { chunk_folded_workgroup_index } from "../../shader/chunk/grid/chunk_folded_workgroup_index.js";
12
+ import { chunk_stbn_sample_vec2 } from "../../shader/chunk/noise/chunk_stbn_sample_vec2.js";
13
+ import { SCREEN_HZB_RESOURCE } from "../../shader/chunk/screen_space/SCREEN_SPACE_RESOURCES.js";
14
+ import {
15
+ chunk_subgroup_append_slot,
16
+ SUBGROUP_APPEND_NONE
17
+ } from "../../shader/chunk/subgroup/chunk_subgroup_append_slot.js";
18
+ import { chunk_ndc_to_uv } from "../../shader/chunk/texture/chunk_ndc_to_uv.js";
19
+ import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
20
+ import { ComputeShader } from "../../shader/ComputeShader.js";
21
+ import { ShaderResourceDescriptor } from "../../shader/resource/ShaderResourceDescriptor.js";
22
+ import { ShaderResourceSetDescriptor } from "../../shader/resource/ShaderResourceSetDescriptor.js";
23
+ import { u32 } from "../../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
24
+ import { WebGPUStruct } from "../../shader/type/WebGPUStruct.js";
25
+ import { STBN_VEC2_RESOURCE } from "../../STATIC_GRAPHICS_ENGINE_ASSET_RESOURCES.js";
26
+ import {
27
+ chunk_screen_probe,
28
+ chunk_screen_probe_counts,
29
+ chunk_screen_probe_ray_jitter,
30
+ SCREEN_PROBE_COUNTERS_RESOURCE,
31
+ SCREEN_PROBE_DISPATCH_READ_RESOURCE,
32
+ SCREEN_PROBE_EXPOSURE_RESOURCE,
33
+ SCREEN_PROBE_FRAME_RESOURCE,
34
+ SCREEN_PROBE_PICKS_READ_RESOURCE,
35
+ SCREEN_PROBE_RAY_INFO_READ_RESOURCE,
36
+ SCREEN_PROBE_RAYS_WRITE_RESOURCE,
37
+ SCREEN_PROBE_TRACE_HIT_WRITE_RESOURCE,
38
+ SCREEN_PROBE_TRACE_RADIANCE_WRITE_RESOURCE,
39
+ SCREEN_PROBES_READ_RESOURCE
40
+ } from "./chunk_screen_probe.js";
41
+ import {
42
+ chunk_screen_probe_object_speed,
43
+ SCREEN_PROBE_CAMERA_PREVIOUS_RESOURCE,
44
+ SCREEN_PROBE_CAMERA_RESOURCE,
45
+ SCREEN_PROBE_DEPTH_RESOURCE,
46
+ SCREEN_PROBE_PBR_RESOURCE,
47
+ SCREEN_PROBE_VELOCITY_RESOURCE
48
+ } from "./chunk_screen_probe_surface.js";
49
+ import { chunk_screen_probe_march_distance } from "./chunk_screen_probe_march_distance.js";
50
+ import { chunk_screen_probe_screen_march } from "./chunk_screen_probe_screen_march.js";
51
+ import {
52
+ SCREEN_PROBE_COUNTER_BRICK_RAYS,
53
+ SCREEN_PROBE_MOVING_SPEED,
54
+ SCREEN_PROBE_SCREEN_EDGE,
55
+ SCREEN_PROBE_SCREEN_THICKNESS,
56
+ SCREEN_PROBE_THREAD_WORKGROUP_SIZE
57
+ } from "./SCREEN_PROBE.js";
58
+
59
+ /** Last frame's lit colour of the opaque surfaces, the view's size, before transparencies and fog. @type {ShaderResourceDescriptor} */
60
+ export const SCREEN_PROBE_COLOR_HISTORY_RESOURCE = ShaderResourceDescriptor.texture("screen_probe_color_history", "unfilterable-float");
61
+
62
+ /** The TAA's history confidence a pixel, in `r` (`shader_depth_occlusion_clip`). @type {ShaderResourceDescriptor} */
63
+ export const SCREEN_PROBE_OCCLUSION_RESOURCE = ShaderResourceDescriptor.texture("tOcclusion", "unfilterable-float");
64
+
65
+ /**
66
+ * Settings of the screen trace.
67
+ * @type {WebGPUStruct}
68
+ */
69
+ export const SCREEN_PROBE_TRACE_SCREEN_SETTINGS = WebGPUStruct.from({
70
+ /** slots of the list of rays left to the bricks */
71
+ capacity: u32,
72
+ }, "ScreenProbeTraceScreenSettings");
73
+
74
+ const resources = new ShaderResourceSetDescriptor();
75
+
76
+ resources.setImmediate("settings", SCREEN_PROBE_TRACE_SCREEN_SETTINGS);
77
+
78
+ resources.createGroup()
79
+ .add(SCREEN_PROBE_FRAME_RESOURCE)
80
+ .add(SCREEN_PROBE_EXPOSURE_RESOURCE)
81
+ .add(SCREEN_PROBE_CAMERA_RESOURCE)
82
+ .add(SCREEN_PROBE_CAMERA_PREVIOUS_RESOURCE)
83
+ .add(SCREEN_PROBES_READ_RESOURCE)
84
+ .add(SCREEN_PROBE_PICKS_READ_RESOURCE)
85
+ .add(SCREEN_PROBE_DISPATCH_READ_RESOURCE)
86
+ .add(SCREEN_PROBE_COUNTERS_RESOURCE)
87
+ .add(SCREEN_PROBE_RAYS_WRITE_RESOURCE)
88
+ .add(STBN_VEC2_RESOURCE);
89
+
90
+ resources.createGroup()
91
+ .add(SCREEN_PROBE_RAY_INFO_READ_RESOURCE)
92
+ .add(SCREEN_PROBE_DEPTH_RESOURCE)
93
+ .add(SCREEN_HZB_RESOURCE)
94
+ .add(SCREEN_PROBE_PBR_RESOURCE)
95
+ .add(SCREEN_PROBE_VELOCITY_RESOURCE)
96
+ .add(SCREEN_PROBE_COLOR_HISTORY_RESOURCE)
97
+ .add(SCREEN_PROBE_OCCLUSION_RESOURCE)
98
+ .add(SCREEN_PROBE_TRACE_RADIANCE_WRITE_RESOURCE)
99
+ .add(SCREEN_PROBE_TRACE_HIT_WRITE_RESOURCE);
100
+
101
+ /**
102
+ * The screen trace (Lumen's `ScreenProbeTraceScreenTexturesCS`): a thread a ray of the frame's probes, through the
103
+ * thread-a-ray command; a ray finds its probe and slot from its index, and its direction from its info and its probe's
104
+ * jitter (`screen_probe_ray_direction`).
105
+ *
106
+ * - **Origin**: the probe's surface point, lifted along its face normal by twice the depth half a pixel's offset makes
107
+ * along it (Lumen's normal bias): the depth buffer's texels stand proud of the plane they sample. An origin the lift
108
+ * moves off the screen traces nothing in it.
109
+ * - **Reach**: the march covers the probe's reach (`screen_probe_picks`), cut short of the camera's plane, 0.99 of the
110
+ * way, for a ray heading toward it, as Lumen's `TraceScreen` cuts it.
111
+ * - **March**: the depth buffer's hierarchy from the full-resolution level, `ffx_sssr_hierarchical_raymarch`, the
112
+ * engine's HZB traversal (SSR's), `SCREEN_PROBE_SCREEN_TRACE_STEPS` steps at most; past the reach's end it is a miss.
113
+ * - **A hit** stands at most `SCREEN_PROBE_SCREEN_THICKNESS` of the surface's depth behind it, on a surface the ray
114
+ * meets from its front (its face normal against the ray), and holds when two dithered tests pass, as Lumen's: the
115
+ * screen-edge fade at the hit (`SCREEN_PROBE_SCREEN_EDGE`) and the TAA's confidence in the hit pixel's history, so
116
+ * last frame's colour is that surface's. Its radiance is last frame's lit colour of the opaque surfaces at the hit
117
+ * pixel's place last frame (its velocity), a bounce more each frame, pre-exposed (`screen_probe_exposure`). It is moving when its speed and the probe's
118
+ * differ by `SCREEN_PROBE_MOVING_SPEED` of the probe's depth, held to a metre from below.
119
+ * - **Anything else** is left to the bricks, appended to their list (one atomic a subgroup) with how far the screen
120
+ * showed it clear: to the end of the march, or to a hit the tests refused, so the bricks resume in front of that
121
+ * surface. A ray of a probe on no surface ends here, NONE.
122
+ *
123
+ * Every lane appends, wanting or not, from uniform control flow.
124
+ *
125
+ * @type {ComputeShader}
126
+ */
127
+ export const shader_screen_probe_trace_screen = ComputeShader.from({
128
+ label: "Screen Probe Trace Screen",
129
+ resources,
130
+ body: CodeChunk.from(
131
+ //language=WGSL
132
+ `
133
+ // the dithered fade toward the screen's edges at a screen position in [-1, 1], Lumen's ComputeHitVignetteFromScreenPos
134
+ fn screen_probe_edge_fade(ndc: vec2<f32>) -> f32 {
135
+ let v = saturate((abs(ndc) - ${1 - SCREEN_PROBE_SCREEN_EDGE}) / ${SCREEN_PROBE_SCREEN_EDGE});
136
+
137
+ return saturate(1.0 - dot(v, v));
138
+ }
139
+
140
+ @compute @workgroup_size(${SCREEN_PROBE_THREAD_WORKGROUP_SIZE})
141
+ fn main(
142
+ @builtin(workgroup_id) workgroup_id: vec3<u32>,
143
+ @builtin(local_invocation_index) lane: u32,
144
+ ) {
145
+ let frame = screen_probe_frame;
146
+ let ray = folded_workgroup_index(workgroup_id) * ${SCREEN_PROBE_THREAD_WORKGROUP_SIZE}u + lane;
147
+ let ray_shift = 2u * frame.octahedron_shift;
148
+ let probe = ray >> ray_shift;
149
+ let slot = ray & ((1u << ray_shift) - 1u);
150
+ let size = vec2<f32>(frame.view_size);
151
+
152
+ var pending = false;
153
+ var clear = 0.0;
154
+ var packed = 0u;
155
+ var texel = vec2<u32>(0u);
156
+
157
+ if (probe < screen_probe_count()) {
158
+ texel = screen_probe_texel(probe, slot);
159
+
160
+ let record = screen_probes[probe];
161
+
162
+ if (record.depth <= 0.0) {
163
+ textureStore(screen_probe_trace_hit, texel, vec4<u32>(screen_probe_trace_hit_pack(SCREEN_PROBE_TRACE_NONE, 0.0, false), 0u, 0u, 0u));
164
+ } else {
165
+ let pixel = screen_probe_pixel_decode(record.pixel);
166
+ let tile = screen_probe_noise_tile(probe, pixel);
167
+ let direction = screen_probe_ray_direction(textureLoad(screen_probe_ray_info, texel, 0).r, screen_probe_ray_jitter(tile));
168
+ let normal = uv_octahedral_unit_decode(unpack2x16unorm(record.normal));
169
+ let reach = screen_probe_picks[probe].reach;
170
+ let noise = stbn_sample_vec2(vec3<u32>(texel, frame.frame_index));
171
+
172
+ packed = pack2x16unorm(uv_equal_area_sphere_encode(direction));
173
+ pending = true;
174
+
175
+ if (frame.screen_traces != 0u) {
176
+ // the lift: twice how far half a pixel's offset at the probe's depth moves along the normal
177
+ let uv = (vec2<f32>(pixel) + 0.5) / size;
178
+ let device_depth = textureLoad(tDepth, pixel, 0).r;
179
+ let corner = project_position_from_depth(uv + 0.5 / size, device_depth, camera.view_projection_matrix_inverse);
180
+ let origin = record.position + normal * (2.0 * abs(dot(corner - record.position, normal)));
181
+ let origin_clip = camera.view_projection_matrix * vec4<f32>(origin, 1.0);
182
+
183
+ if (origin_clip.w > 0.0 && all(abs(origin_clip.xy) <= vec2<f32>(origin_clip.w))) {
184
+ // a ray heading toward the camera's plane stops short of it
185
+ let forward = -camera.transform[2].xyz;
186
+ let toward = dot(direction, forward);
187
+ let plane_distance = dot(origin - camera.transform[3].xyz, forward);
188
+ let segment = select(reach, min(reach, 0.99 * plane_distance / -toward), toward < 0.0);
189
+
190
+ let origin_ndc = origin_clip.xyz / origin_clip.w;
191
+ let end_clip = camera.view_projection_matrix * vec4<f32>(origin + direction * segment, 1.0);
192
+ let end_ndc = end_clip.xyz / end_clip.w;
193
+
194
+ let start = vec3<f32>(ndc_to_uv(origin_ndc.xy), origin_ndc.z);
195
+ let span = vec3<f32>(ndc_to_uv(end_ndc.xy), end_ndc.z) - start;
196
+
197
+ let march = screen_probe_screen_march(start, span, size);
198
+
199
+ clear = screen_probe_march_distance(march.t, segment, origin_clip.w, end_clip.w);
200
+
201
+ if (march.hit) {
202
+ let hit_pixel = vec2<u32>(clamp(march.reached.xy * size, vec2<f32>(0.0), size - 1.0));
203
+ let surface_device = textureLoad(tDepth, hit_pixel, 0).r;
204
+
205
+ if (!is_background(surface_device)) {
206
+ let surface_depth = get_view_space_depth(surface_device, camera);
207
+ let ray_depth = get_view_space_depth(march.reached.z, camera);
208
+ let hit_uv = (vec2<f32>(hit_pixel) + 0.5) / size;
209
+ let hit_position = project_position_from_depth(hit_uv, surface_device, camera.view_projection_matrix_inverse);
210
+ let face = decode_g_buffer_face_normal(textureLoad(tPBR, hit_pixel, 0));
211
+
212
+ // how far the ray is clear of the surface it reached, whether the hit holds or not
213
+ clear = min(clear, length(hit_position - origin));
214
+
215
+ let thick_enough = ray_depth - surface_depth < ${SCREEN_PROBE_SCREEN_THICKNESS} * surface_depth;
216
+ let facing = dot(face, direction) < 0.0;
217
+ let in_frame = screen_probe_edge_fade(march.reached.xy * vec2<f32>(2.0, -2.0) + vec2<f32>(-1.0, 1.0)) >= noise.x;
218
+ let history = textureLoad(tOcclusion, hit_pixel, 0).r >= noise.y;
219
+
220
+ let previous = vec2<f32>(hit_pixel) + 0.5 - textureLoad(tVelocity, hit_pixel, 0).rg;
221
+ let on_screen = all(previous >= vec2<f32>(0.0)) && all(previous < size);
222
+
223
+ if (thick_enough && facing && in_frame && history && on_screen && frame.history != 0u) {
224
+ let radiance = textureLoad(screen_probe_color_history, vec2<u32>(previous), 0).rgb;
225
+ let speed = screen_probe_object_speed(hit_pixel, hit_position, surface_depth);
226
+ let moving = abs(record.speed - speed) > ${SCREEN_PROBE_MOVING_SPEED} * max(record.depth, 1.0);
227
+
228
+ textureStore(screen_probe_trace_radiance, texel, vec4<f32>(radiance * screen_probe_exposure.value, 0.0));
229
+ textureStore(screen_probe_trace_hit, texel, vec4<u32>(screen_probe_trace_hit_pack(SCREEN_PROBE_TRACE_SCREEN, length(hit_position - record.position), moving), 0u, 0u, 0u));
230
+
231
+ pending = false;
232
+ }
233
+ }
234
+ }
235
+ }
236
+ }
237
+
238
+ if (pending) {
239
+ textureStore(screen_probe_trace_hit, texel, vec4<u32>(screen_probe_trace_hit_pack(SCREEN_PROBE_TRACE_PENDING, clear, false), 0u, 0u, 0u));
240
+ }
241
+ }
242
+ }
243
+
244
+ // every lane, pending or not, for the subgroup's one atomic
245
+ let at = subgroup_append_slot(&screen_probe_counters[${SCREEN_PROBE_COUNTER_BRICK_RAYS}u], pending, settings.capacity);
246
+
247
+ if (at != ${SUBGROUP_APPEND_NONE}u) {
248
+ var entry: ScreenProbeRay;
249
+
250
+ entry.ray = (probe << SCREEN_PROBE_RAY_SLOT_BITS) | slot;
251
+ entry.t = clear;
252
+ entry.direction = packed;
253
+
254
+ screen_probe_rays[at] = entry;
255
+ }
256
+ }
257
+ `, [
258
+ chunk_screen_probe,
259
+ chunk_screen_probe_counts,
260
+ chunk_screen_probe_ray_jitter,
261
+ chunk_screen_probe_object_speed,
262
+ chunk_screen_probe_march_distance,
263
+ chunk_screen_probe_screen_march,
264
+ chunk_folded_workgroup_index,
265
+ chunk_uv_octahedral_unit_decode,
266
+ chunk_uv_equal_area_sphere,
267
+ chunk_stbn_sample_vec2,
268
+ chunk_project_position_from_depth,
269
+ chunk_get_view_space_depth,
270
+ chunk_is_background,
271
+ chunk_decode_g_buffer_face_normal,
272
+ chunk_ndc_to_uv,
273
+ chunk_subgroup_append_slot,
274
+ ]),
275
+ });
@@ -1 +1 @@
1
- {"version":3,"file":"GPUGrassBlades.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/grass/blade/GPUGrassBlades.js"],"names":[],"mappings":"AAsFA;;;;;;;;;;;;;GAaG;AACH;IAEI;;;;OAIG;IACH,iCAFW,eAAe,QAWzB;IAmED;;;OAGG;IACH,sBAHW,eAAe,YACf,gBAAgB,EAW1B;IA9ED;;;;;OAKG;IACH,gBAFU,aAAa,CAEjB;IA0EN;;OAEG;IACH,6BAEC;IAED;;OAEG;IACH,2BAEC;IAED;;;;OAIG;IACH,0BAEC;IAED;;;;OAIG;IACH,wBAEC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,mBAjBW,MAAM;QAEU,YAAY,EAA5B,MAAM;QACU,WAAW,EAA3B,MAAM;QACU,OAAO,EAAvB,MAAM;QACU,SAAS,EAAzB,MAAM;QACY,UAAU,EAA5B,MAAM,EAAE;QACU,SAAS,EAA3B,MAAM,EAAE;QACQ,gBAAgB,EAAhC,MAAM;QACU,IAAI,EAApB,MAAM;QACU,IAAI,EAApB,MAAM;QACU,IAAI,EAApB,MAAM;QACU,SAAS,EAAzB,MAAM;QACU,eAAe,EAA/B,MAAM;QACU,WAAW,EAA3B,MAAM;QACU,UAAU,EAA1B,MAAM;aA0ChB;IAED;;;;;;OAMG;IACH,2BAFW,MAAM,QAyDhB;IAED;;;;;;;;;OASG;IACH;QAL+B,KAAK,EAAzB,UAAU;QACc,IAAI,EAA5B,cAAc;QACiB,OAAO,GAAtC,eAAe,GAAC,IAAI;aA8J9B;IAED;;;;;;OAMG;IACH,kBAFW,YAAY,QAqItB;IAED;;OAEG;IACH,gBAQC;;CACJ;yBA/nBY,OAAO,8DAA8D,EAAE,UAAU;8BACjF,OAAO,6CAA6C,EAAE,eAAe;2BACrE,OAAO,iCAAiC,EAAE,YAAY;8BACtD,OAAO,wCAAwC,EAAE,eAAe;8BAChE,OAAO,0BAA0B,EAAE,eAAe;6BAClD,OAAO,8BAA8B,EAAE,cAAc;+BACrD,OAAO,gCAAgC,EAAE,gBAAgB;8BA1BxC,2BAA2B"}
1
+ {"version":3,"file":"GPUGrassBlades.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/grass/blade/GPUGrassBlades.js"],"names":[],"mappings":"AA0FA;;;;;;;;;;;;;GAaG;AACH;IAEI;;;;OAIG;IACH,iCAFW,eAAe,QAYzB;IAmED;;;OAGG;IACH,sBAHW,eAAe,YACf,gBAAgB,EAW1B;IA9ED;;;;;OAKG;IACH,gBAFU,aAAa,CAEjB;IA0EN;;OAEG;IACH,6BAEC;IAED;;OAEG;IACH,2BAEC;IAED;;;;OAIG;IACH,0BAEC;IAED;;;;OAIG;IACH,wBAEC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,mBAjBW,MAAM;QAEU,YAAY,EAA5B,MAAM;QACU,WAAW,EAA3B,MAAM;QACU,OAAO,EAAvB,MAAM;QACU,SAAS,EAAzB,MAAM;QACY,UAAU,EAA5B,MAAM,EAAE;QACU,SAAS,EAA3B,MAAM,EAAE;QACQ,gBAAgB,EAAhC,MAAM;QACU,IAAI,EAApB,MAAM;QACU,IAAI,EAApB,MAAM;QACU,IAAI,EAApB,MAAM;QACU,SAAS,EAAzB,MAAM;QACU,eAAe,EAA/B,MAAM;QACU,WAAW,EAA3B,MAAM;QACU,UAAU,EAA1B,MAAM;aA0ChB;IAED;;;;;;OAMG;IACH,2BAFW,MAAM,QAyDhB;IAED;;;;;;;;;OASG;IACH;QAL+B,KAAK,EAAzB,UAAU;QACc,IAAI,EAA5B,cAAc;QACiB,OAAO,GAAtC,eAAe,GAAC,IAAI;aA8J9B;IAED;;;;;;OAMG;IACH,kBAFW,YAAY,QA+ItB;IAED;;OAEG;IACH,gBAQC;;CACJ;yBA1oBY,OAAO,8DAA8D,EAAE,UAAU;8BACjF,OAAO,6CAA6C,EAAE,eAAe;2BACrE,OAAO,iCAAiC,EAAE,YAAY;8BACtD,OAAO,wCAAwC,EAAE,eAAe;8BAChE,OAAO,0BAA0B,EAAE,eAAe;6BAClD,OAAO,8BAA8B,EAAE,cAAc;+BACrD,OAAO,gCAAgC,EAAE,gBAAgB;8BA9BxC,2BAA2B"}
@@ -28,7 +28,11 @@ import {
28
28
  GRASS_SPECIES_WORDS
29
29
  } from "./GRASS_BLADE.js";
30
30
  import { GRASS_BLADE_ID_PIPELINE, GRASS_BLADE_ID_RESOURCES } from "./grass_blade_id_draw.js";
31
- import { GRASS_BLADE_RESOLVE_PIPELINE, GRASS_BLADE_RESOLVE_RESOURCES } from "./grass_blade_resolve.js";
31
+ import {
32
+ GRASS_BLADE_MOTION_PIPELINE,
33
+ GRASS_BLADE_RESOLVE_PIPELINE,
34
+ GRASS_BLADE_RESOLVE_RESOURCES
35
+ } from "./grass_blade_resolve.js";
32
36
  import { shader_grass_blade_draw_args } from "./shader_grass_blade_draw_args.js";
33
37
  import { shader_grass_blade_expand } from "./shader_grass_blade_expand.js";
34
38
  import { GRASS_CELL_COUNT_WORKGROUP_SIZE, shader_grass_cell_count } from "./shader_grass_cell_count.js";
@@ -112,6 +116,7 @@ export class GPUGrassBlades {
112
116
  enquiry.compute.push(shader_prefix_sum_to_command.pipeline);
113
117
  enquiry.render.push(GRASS_BLADE_ID_PIPELINE);
114
118
  enquiry.render.push(GRASS_BLADE_RESOLVE_PIPELINE);
119
+ enquiry.render.push(GRASS_BLADE_MOTION_PIPELINE);
115
120
 
116
121
  GPUGrassPress.enquirePipelines(enquiry);
117
122
  }
@@ -629,12 +634,22 @@ export class GPUGrassBlades {
629
634
  attachment(data.albedo),
630
635
  attachment(data.emissive),
631
636
  attachment(data.visibility),
632
- attachment(data.velocity),
633
637
  ],
634
638
  });
635
639
 
636
640
  pass.draw(3);
637
641
  pass.end();
642
+
643
+ // the velocity on its own: with the surface's targets it would pass the device floor's attachment bytes
644
+ const motion = encoder.constructRenderPass({
645
+ label: "Grass Blade Motion",
646
+ pipeline: GRASS_BLADE_MOTION_PIPELINE,
647
+ bindings,
648
+ colorAttachments: [attachment(data.velocity)],
649
+ });
650
+
651
+ motion.draw(3);
652
+ motion.end();
638
653
  });
639
654
 
640
655
  resolve_data.blades = resolve_pass.read(product.blades);
@@ -1,15 +1,18 @@
1
1
  /**
2
- * The bindings of {@link GRASS_BLADE_RESOLVE_PIPELINE}: `camera`, `scene_database`, `grass_blades` (the
3
- * list the ids were drawn from), `grass_species`, `grass_ids` (the blade id target), `scene_depth` (the
4
- * depth the blades were drawn into), and the two matrices of `view_velocity_matrices`.
2
+ * The bindings of {@link GRASS_BLADE_RESOLVE_PIPELINE} and {@link GRASS_BLADE_MOTION_PIPELINE}, one layout for both:
3
+ * `camera`, `scene_database`, `grass_blades` (the list the ids were drawn from), `grass_species`, `grass_ids` (the
4
+ * blade id target), `scene_depth` (the depth the blades were drawn into), and the two matrices of
5
+ * `view_velocity_matrices`.
5
6
  *
6
7
  * @type {ShaderResourceSetDescriptor}
7
8
  */
8
9
  export const GRASS_BLADE_RESOLVE_RESOURCES: ShaderResourceSetDescriptor;
9
10
  /**
10
11
  * Turns the blade id target into the G-buffer's surface under every pixel a blade covers, and leaves every
11
- * other pixel as it was: a full-screen triangle (three vertices) over six targets, loaded: the four
12
- * G-buffer targets in `G_BUFFER_COLOR_TARGETS`' order, then the visibility buffer and the velocity buffer.
12
+ * other pixel as it was: a full-screen triangle (three vertices) over five targets, loaded: the four
13
+ * G-buffer targets in `G_BUFFER_COLOR_TARGETS`' order, then the visibility buffer. Its velocity is
14
+ * {@link GRASS_BLADE_MOTION_PIPELINE}'s: the six targets together do not fit the colour attachment bytes a
15
+ * sample that the device floor asks for.
13
16
  *
14
17
  * A blade's pixel takes its species' colour from root to tip, tinted by the blade's own seed; the normal
15
18
  * of the blade's face on the view's side, turned towards the edge the pixel is nearer; no metalness, no
@@ -17,13 +20,20 @@ export const GRASS_BLADE_RESOLVE_RESOURCES: ShaderResourceSetDescriptor;
17
20
  * normal towards the ground's and its roughness towards one by as much.
18
21
  *
19
22
  * The pixel's visibility word becomes `VISIBILITY_NONE`: no meshlet is the surface there, and a reader that
20
- * decoded the word would find the ground under the blade. Its velocity is the blade point's own, in the
21
- * velocity buffer's units: where the point was a frame ago, on the blade as it was bent then
22
- * (`grass_blade_previous`) and on its surface where that was.
23
+ * decoded the word would find the ground under the blade.
23
24
  *
24
25
  * @type {RenderPipelineDescriptor}
25
26
  */
26
27
  export const GRASS_BLADE_RESOLVE_PIPELINE: RenderPipelineDescriptor;
28
+ /**
29
+ * The velocity under every pixel a blade covers, every other pixel left as it was: a full-screen triangle over the
30
+ * velocity buffer, loaded. A blade's pixel takes the blade point's own motion as the velocity buffer's texel
31
+ * (`chunk_velocity_texel`): where the point was a frame ago, on the blade as it was bent then
32
+ * (`grass_blade_previous`) and on its surface where that was.
33
+ *
34
+ * @type {RenderPipelineDescriptor}
35
+ */
36
+ export const GRASS_BLADE_MOTION_PIPELINE: RenderPipelineDescriptor;
27
37
  import { ShaderResourceSetDescriptor } from "../../shader/resource/ShaderResourceSetDescriptor.js";
28
38
  import { RenderPipelineDescriptor } from "../../../descriptor/pipeline/render/RenderPipelineDescriptor.js";
29
39
  //# sourceMappingURL=grass_blade_resolve.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"grass_blade_resolve.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/grass/blade/grass_blade_resolve.js"],"names":[],"mappings":"AAsIA;;;;;;GAMG;AACH,4CAFU,2BAA2B,CAEkB;AAEvD;;;;;;;;;;;;;;;;GAgBG;AACH,2CAFU,wBAAwB,CAgB/B;4CAjKyC,sDAAsD;yCAZzD,iEAAiE"}
1
+ {"version":3,"file":"grass_blade_resolve.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/grass/blade/grass_blade_resolve.js"],"names":[],"mappings":"AAgMA;;;;;;;GAOG;AACH,4CAFU,2BAA2B,CAEkB;AAIvD;;;;;;;;;;;;;;;;GAgBG;AACH,2CAFU,wBAAwB,CAe/B;AAEH;;;;;;;GAOG;AACH,0CAFU,wBAAwB,CAc/B;4CAjPyC,sDAAsD;yCAdzD,iEAAiE"}
@@ -2,6 +2,8 @@ import { ColorTargetState } from "../../../descriptor/pipeline/render/ColorTarge
2
2
  import { RenderPipelineDescriptor } from "../../../descriptor/pipeline/render/RenderPipelineDescriptor.js";
3
3
  import { CAMERA_RESOURCE } from "../../camera/CAMERA_RESOURCE.js";
4
4
  import { G_BUFFER_COLOR_TARGETS } from "../../gbuffer/G_BUFFER_COLOR_TARGETS.js";
5
+ import { chunk_velocity_texel } from "../../postprocess/velocity/chunk_velocity_texel.js";
6
+ import { VELOCITY_FORMAT } from "../../postprocess/velocity/VELOCITY_BUFFER.js";
5
7
  import { VISIBILITY_FORMAT, VISIBILITY_NONE } from "../../rasterize/visibility/VISIBILITY_BUFFER.js";
6
8
  import { TRANSFORMS_TABLE } from "../../scene/chunk_scene_database_access.js";
7
9
  import { SCENE_DATABASE_RESOURCE } from "../../scene/SCENE_DATABASE_RESOURCE.js";
@@ -34,7 +36,45 @@ resources.createGroup()
34
36
  const ALONG_STEPS = 2 ** GRASS_BLADE_ID_ALONG_BITS - 1;
35
37
  const ACROSS_STEPS = 2 ** GRASS_BLADE_ID_ACROSS_BITS - 1;
36
38
 
37
- const body = CodeChunk.from(
39
+ /**
40
+ * The blade a pixel of the blade id target names, and where on it:
41
+ *
42
+ * ```wgsl
43
+ * fn grass_blade_at(id: u32) -> GrassBladePlace // the id is never GRASS_BLADE_ID_NONE
44
+ * ```
45
+ *
46
+ * `along` from root (0) to tip (1), `across` from one edge (-1) to the other (1), and the frame of the surface the
47
+ * blade stands on.
48
+ *
49
+ * @type {CodeChunk}
50
+ */
51
+ const chunk_grass_blade_at = CodeChunk.from(
52
+ //language=WGSL
53
+ `
54
+ struct GrassBladePlace {
55
+ blade: GrassBlade,
56
+ along: f32,
57
+ across: f32,
58
+ frame: mat4x4<f32>,
59
+ }
60
+
61
+ fn grass_blade_at(id: u32) -> GrassBladePlace {
62
+ var place: GrassBladePlace;
63
+
64
+ place.blade = grass_blade_unpack(grass_blades.records[(id >> ${GRASS_BLADE_ID_ALONG_BITS + GRASS_BLADE_ID_ACROSS_BITS}u) - 1u]);
65
+ place.along = f32((id >> ${GRASS_BLADE_ID_ACROSS_BITS}u) & ${ALONG_STEPS}u) / ${ALONG_STEPS}.0;
66
+ place.across = f32(id & ${ACROSS_STEPS}u) / ${ACROSS_STEPS}.0 * 2.0 - 1.0;
67
+ place.frame = grass_surface_frame(${TRANSFORMS_TABLE.marshalling_method_read_field('global')}(&scene_database, place.blade.surface));
68
+
69
+ return place;
70
+ }
71
+ `, [
72
+ chunk_grass_surface_frame,
73
+ chunk_grass_blade,
74
+ TRANSFORMS_TABLE.chunk_read_field('global'),
75
+ ]);
76
+
77
+ const surface_body = CodeChunk.from(
38
78
  //language=WGSL
39
79
  `
40
80
  struct GrassResolveOutput {
@@ -43,7 +83,6 @@ struct GrassResolveOutput {
43
83
  @location(2) albedo: vec4<f32>,
44
84
  @location(3) emissive: u32,
45
85
  @location(4) visibility: u32,
46
- @location(5) velocity: vec2<f32>,
47
86
  }
48
87
 
49
88
  @fragment
@@ -54,15 +93,14 @@ fn fs_main(@builtin(position) position: vec4<f32>) -> GrassResolveOutput {
54
93
  discard;
55
94
  }
56
95
 
57
- let blade = grass_blade_unpack(grass_blades.records[(id >> ${GRASS_BLADE_ID_ALONG_BITS + GRASS_BLADE_ID_ACROSS_BITS}u) - 1u]);
58
-
59
- let along = f32((id >> ${GRASS_BLADE_ID_ACROSS_BITS}u) & ${ALONG_STEPS}u) / ${ALONG_STEPS}.0;
60
- let across = f32(id & ${ACROSS_STEPS}u) / ${ACROSS_STEPS}.0 * 2.0 - 1.0;
96
+ let place = grass_blade_at(id);
97
+ let blade = place.blade;
98
+ let along = place.along;
99
+ let across = place.across;
100
+ let frame = place.frame;
61
101
 
62
102
  let species = grass_species[blade.species];
63
103
 
64
- let frame = grass_surface_frame(${TRANSFORMS_TABLE.marshalling_method_read_field('global')}(&scene_database, blade.surface));
65
-
66
104
  // the face the view sees, rounded across the blade's width
67
105
  let side = grass_blade_across(blade);
68
106
 
@@ -92,6 +130,31 @@ fn fs_main(@builtin(position) position: vec4<f32>) -> GrassResolveOutput {
92
130
  // no meshlet is under a blade
93
131
  out.visibility = ${VISIBILITY_NONE}u;
94
132
 
133
+ return out;
134
+ }
135
+ `, [
136
+ chunk_grass_blade_at,
137
+ chunk_encode_g_buffer_normal,
138
+ chunk_encode_g_buffer_face_normal,
139
+ chunk_rgbe9995_encode,
140
+ ]);
141
+
142
+ const motion_body = CodeChunk.from(
143
+ //language=WGSL
144
+ `
145
+ @fragment
146
+ fn fs_main(@builtin(position) position: vec4<f32>) -> @location(0) vec4<f32> {
147
+ let id = textureLoad(grass_ids, vec2<i32>(position.xy), 0).x;
148
+
149
+ if (id == ${GRASS_BLADE_ID_NONE}u) {
150
+ discard;
151
+ }
152
+
153
+ let place = grass_blade_at(id);
154
+ let blade = place.blade;
155
+ let along = place.along;
156
+ let across = place.across;
157
+
95
158
  // where this point of the blade was a frame ago: on the blade as it was bent then, carried by its surface
96
159
  let pixel = position.xy;
97
160
  let size = vec2<f32>(textureDimensions(scene_depth));
@@ -107,44 +170,44 @@ fn fs_main(@builtin(position) position: vec4<f32>) -> GrassResolveOutput {
107
170
  let half = 0.5 * blade.width * grass_blade_taper(along) * across;
108
171
 
109
172
  // how far the point has moved on its surface over the frame, in the frame and then in the world
110
- let moved = grass_blade_point(blade, along) + side * half
173
+ let moved = grass_blade_point(blade, along) + grass_blade_across(blade) * half
111
174
  - grass_blade_point(blade_before, along) - grass_blade_across(blade_before) * half;
112
175
 
113
- let there = here.xyz / here.w - (frame * vec4<f32>(moved, 0.0)).xyz;
176
+ let there = here.xyz / here.w - (place.frame * vec4<f32>(moved, 0.0)).xyz;
114
177
 
115
178
  let before = view_projection_previous * (global_previous * (mat4_inverse(global) * vec4<f32>(there, 1.0)));
116
- let before_ndc = before.xy / before.w;
117
-
118
- out.velocity = pixel - vec2<f32>((before_ndc.x + 1.0) * 0.5 * size.x, (1.0 - before_ndc.y) * 0.5 * size.y);
119
179
 
120
- return out;
180
+ // this frame's clip w, the point's view depth, is the reciprocal of the w its unprojection came out with
181
+ return velocity_texel(pixel, 1.0 / here.w, before, size);
121
182
  }
122
183
  `, [
123
- chunk_grass_surface_frame,
124
- chunk_grass_blade,
125
- chunk_encode_g_buffer_normal,
126
- chunk_encode_g_buffer_face_normal,
127
- chunk_rgbe9995_encode,
184
+ chunk_grass_blade_at,
185
+ chunk_velocity_texel,
128
186
  chunk_mat4_inverse,
129
- TRANSFORMS_TABLE.chunk_read_field('global'),
130
187
  TRANSFORMS_TABLE.chunk_read_field('prev_global'),
131
188
  ]);
132
189
 
133
- const descriptor = ShaderDescriptor.from({ label: "Grass Blade Resolve", body, resources });
190
+ const surface_descriptor = ShaderDescriptor.from({ label: "Grass Blade Resolve", body: surface_body, resources });
191
+ const motion_descriptor = ShaderDescriptor.from({ label: "Grass Blade Motion", body: motion_body, resources });
134
192
 
135
193
  /**
136
- * The bindings of {@link GRASS_BLADE_RESOLVE_PIPELINE}: `camera`, `scene_database`, `grass_blades` (the
137
- * list the ids were drawn from), `grass_species`, `grass_ids` (the blade id target), `scene_depth` (the
138
- * depth the blades were drawn into), and the two matrices of `view_velocity_matrices`.
194
+ * The bindings of {@link GRASS_BLADE_RESOLVE_PIPELINE} and {@link GRASS_BLADE_MOTION_PIPELINE}, one layout for both:
195
+ * `camera`, `scene_database`, `grass_blades` (the list the ids were drawn from), `grass_species`, `grass_ids` (the
196
+ * blade id target), `scene_depth` (the depth the blades were drawn into), and the two matrices of
197
+ * `view_velocity_matrices`.
139
198
  *
140
199
  * @type {ShaderResourceSetDescriptor}
141
200
  */
142
201
  export const GRASS_BLADE_RESOLVE_RESOURCES = resources;
143
202
 
203
+ const layout = resources.generatePipelineLayout(GPUShaderStage.VERTEX | GPUShaderStage.FRAGMENT);
204
+
144
205
  /**
145
206
  * Turns the blade id target into the G-buffer's surface under every pixel a blade covers, and leaves every
146
- * other pixel as it was: a full-screen triangle (three vertices) over six targets, loaded: the four
147
- * G-buffer targets in `G_BUFFER_COLOR_TARGETS`' order, then the visibility buffer and the velocity buffer.
207
+ * other pixel as it was: a full-screen triangle (three vertices) over five targets, loaded: the four
208
+ * G-buffer targets in `G_BUFFER_COLOR_TARGETS`' order, then the visibility buffer. Its velocity is
209
+ * {@link GRASS_BLADE_MOTION_PIPELINE}'s: the six targets together do not fit the colour attachment bytes a
210
+ * sample that the device floor asks for.
148
211
  *
149
212
  * A blade's pixel takes its species' colour from root to tip, tinted by the blade's own seed; the normal
150
213
  * of the blade's face on the view's side, turned towards the edge the pixel is nearer; no metalness, no
@@ -152,23 +215,42 @@ export const GRASS_BLADE_RESOLVE_RESOURCES = resources;
152
215
  * normal towards the ground's and its roughness towards one by as much.
153
216
  *
154
217
  * The pixel's visibility word becomes `VISIBILITY_NONE`: no meshlet is the surface there, and a reader that
155
- * decoded the word would find the ground under the blade. Its velocity is the blade point's own, in the
156
- * velocity buffer's units: where the point was a frame ago, on the blade as it was bent then
157
- * (`grass_blade_previous`) and on its surface where that was.
218
+ * decoded the word would find the ground under the blade.
158
219
  *
159
220
  * @type {RenderPipelineDescriptor}
160
221
  */
161
222
  export const GRASS_BLADE_RESOLVE_PIPELINE = RenderPipelineDescriptor.from({
162
223
  label: "Grass Blade Resolve",
163
- layout: resources.generatePipelineLayout(GPUShaderStage.VERTEX | GPUShaderStage.FRAGMENT),
224
+ layout,
164
225
  vertex: { module: { code: vertex_full_viewport_quad }, entryPoint: "main" },
165
226
  fragment: {
166
- module: { code: descriptor.source },
227
+ module: { code: surface_descriptor.source },
167
228
  entryPoint: "fs_main",
168
229
  targets: [
169
230
  ...G_BUFFER_COLOR_TARGETS.map(target => ColorTargetState.from({ format: target.format })),
170
231
  ColorTargetState.from({ format: VISIBILITY_FORMAT }),
171
- ColorTargetState.from({ format: "rg16float" }),
232
+ ],
233
+ },
234
+ primitive: { topology: "triangle-list", cullMode: "none" },
235
+ });
236
+
237
+ /**
238
+ * The velocity under every pixel a blade covers, every other pixel left as it was: a full-screen triangle over the
239
+ * velocity buffer, loaded. A blade's pixel takes the blade point's own motion as the velocity buffer's texel
240
+ * (`chunk_velocity_texel`): where the point was a frame ago, on the blade as it was bent then
241
+ * (`grass_blade_previous`) and on its surface where that was.
242
+ *
243
+ * @type {RenderPipelineDescriptor}
244
+ */
245
+ export const GRASS_BLADE_MOTION_PIPELINE = RenderPipelineDescriptor.from({
246
+ label: "Grass Blade Motion",
247
+ layout,
248
+ vertex: { module: { code: vertex_full_viewport_quad }, entryPoint: "main" },
249
+ fragment: {
250
+ module: { code: motion_descriptor.source },
251
+ entryPoint: "fs_main",
252
+ targets: [
253
+ ColorTargetState.from({ format: VELOCITY_FORMAT }),
172
254
  ],
173
255
  },
174
256
  primitive: { topology: "triangle-list", cullMode: "none" },
@@ -1,7 +1,7 @@
1
1
  export class GPULightCollection {
2
2
  /**
3
3
  * Offer the pipelines a scene's lights are updated with — the environment map's filtering and
4
- * projection, and the pose refresh — see {@link PipelineEnquiry}.
4
+ * projection, procedural sky mip-0 synthesis, and the pose refresh — see {@link PipelineEnquiry}.
5
5
  *
6
6
  * @param {PipelineEnquiry} enquiry
7
7
  */
@@ -1 +1 @@
1
- {"version":3,"file":"GPULightCollection.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/light/GPULightCollection.js"],"names":[],"mappings":"AAoDA;IAEI;;;;;OAKG;IACH,iCAFW,eAAe,QAOzB;IAmLD;;;;;;OAMG;IACH,sBALW,eAAe,aACf,eAAe,EA6CzB;IA3ND;;;OAGG;IACH,6DAEC;IAeD;;OAEG;IACH,4BAEC;IAED;;;;;;OAMG;IACH,6BAEC;IAED;;;;;;;OAOG;IACH,qFAEC;IAWD;;OAEG;IACH,+CAEC;IAmED;;;OAGG;IACH,qCAEC;IAED;;;;;;OAMG;IACH,gCAEC;IAED;;;;;;OAMG;IACH,yCAEC;IAGD,4BAMC;IAsMD;;;OAGG;IACH,YAFW,eAAe,QAoCzB;IAED;;;;;;;;;;;OAWG;IACH,gBAFW,OAAO,+BAA+B,EAAE,YAAY,QA2B9D;IAqBD;;;;;;OAMG;IACH,uBAHW,sBAAsB,mCA6BhC;IAwED,gBAaC;;CACJ;8BAnnBY,OAAO,0CAA0C,EAAE,eAAe;8BAClE,OAAO,uBAAuB,EAAE,eAAe;8BAC/C,OAAO,6BAA6B,EAAE,eAAe;8BACrD,OAAO,sBAAsB,EAAE,eAAe;4BA7B/B,gCAAgC;yCACnB,2CAA2C;kCAClD,iCAAiC;uCAH5B,wCAAwC"}
1
+ {"version":3,"file":"GPULightCollection.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/light/GPULightCollection.js"],"names":[],"mappings":"AA8DA;IAEI;;;;;OAKG;IACH,iCAFW,eAAe,QAQzB;IAqND;;;;;;OAMG;IACH,sBALW,eAAe,aACf,eAAe,EA+CzB;IA1PD;;;OAGG;IACH,6DAEC;IAeD;;OAEG;IACH,4BAEC;IAED;;;;;;OAMG;IACH,6BAEC;IAED;;;;;;;OAOG;IACH,qFAEC;IAWD;;OAEG;IACH,+CAEC;IAgGD;;;OAGG;IACH,qCAEC;IAED;;;;;;OAMG;IACH,gCAEC;IAED;;;;;;OAMG;IACH,yCAEC;IAGD,4BAMC;IA8RD;;;OAGG;IACH,YAFW,eAAe,QAoCzB;IAED;;;;;;;;;;;OAWG;IACH,gBAFW,OAAO,+BAA+B,EAAE,YAAY,QA2B9D;IAqBD;;;;;;OAMG;IACH,uBAHW,sBAAsB,mCA6BhC;IAwED,gBAaC;;CACJ;8BArvBY,OAAO,0CAA0C,EAAE,eAAe;8BAClE,OAAO,uBAAuB,EAAE,eAAe;8BAC/C,OAAO,6BAA6B,EAAE,eAAe;8BACrD,OAAO,sBAAsB,EAAE,eAAe;4BA7B/B,gCAAgC;yCACnB,2CAA2C;kCAClD,iCAAiC;uCAL5B,wCAAwC"}