@woosh/meep-engine 3.17.1 → 3.18.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 (265) hide show
  1. package/editor/actions/concrete/ComponentAddAction.d.ts +1 -0
  2. package/editor/actions/concrete/ComponentAddAction.d.ts.map +1 -1
  3. package/editor/actions/concrete/ComponentAddAction.js +4 -0
  4. package/editor/actions/concrete/ComponentRemoveAction.d.ts +1 -0
  5. package/editor/actions/concrete/ComponentRemoveAction.d.ts.map +1 -1
  6. package/editor/actions/concrete/ComponentRemoveAction.js +4 -0
  7. package/editor/actions/concrete/EntityCreateAction.d.ts +1 -0
  8. package/editor/actions/concrete/EntityCreateAction.d.ts.map +1 -1
  9. package/editor/actions/concrete/EntityCreateAction.js +7 -0
  10. package/editor/actions/concrete/EntityRemoveAction.d.ts +1 -0
  11. package/editor/actions/concrete/EntityRemoveAction.d.ts.map +1 -1
  12. package/editor/actions/concrete/EntityRemoveAction.js +4 -0
  13. package/editor/actions/concrete/PatchTerrainHeightAction.d.ts +10 -0
  14. package/editor/actions/concrete/PatchTerrainHeightAction.d.ts.map +1 -1
  15. package/editor/actions/concrete/PatchTerrainHeightAction.js +107 -85
  16. package/editor/actions/concrete/TransformModifyAction.d.ts +1 -0
  17. package/editor/actions/concrete/TransformModifyAction.d.ts.map +1 -1
  18. package/editor/actions/concrete/TransformModifyAction.js +4 -0
  19. package/editor/particles/effect/ParticleEffectDocument.d.ts.map +1 -1
  20. package/editor/particles/effect/ParticleEffectDocument.js +10 -6
  21. package/editor/particles/effect/ParticleReferenceSimulation.d.ts.map +1 -1
  22. package/editor/particles/effect/ParticleReferenceSimulation.js +98 -4
  23. package/editor/particles/effect/make_starter_particle_effect.d.ts.map +1 -1
  24. package/editor/particles/effect/make_starter_particle_effect.js +0 -2
  25. package/editor/tools/engine/ToolEngine.d.ts +30 -0
  26. package/editor/tools/engine/ToolEngine.d.ts.map +1 -1
  27. package/editor/tools/engine/ToolEngine.js +257 -188
  28. package/editor/view/ecs/EntityList.d.ts.map +1 -1
  29. package/editor/view/ecs/EntityList.js +6 -5
  30. package/editor/view/particles/effect/ParticleEmitterInspectorView.d.ts.map +1 -1
  31. package/editor/view/particles/effect/ParticleEmitterInspectorView.js +17 -9
  32. package/package.json +1 -1
  33. package/src/CODEC_LAYOUT_VERIFICATION.md +1 -2
  34. package/src/core/binary/meshopt/MESHOPT_VERTEX_BLOCK.d.ts +56 -0
  35. package/src/core/binary/meshopt/MESHOPT_VERTEX_BLOCK.d.ts.map +1 -0
  36. package/src/core/binary/meshopt/MESHOPT_VERTEX_BLOCK.js +73 -0
  37. package/src/core/binary/meshopt/meshopt_decode_vertex_buffer.d.ts.map +1 -1
  38. package/src/core/binary/meshopt/meshopt_decode_vertex_buffer.js +18 -63
  39. package/src/core/binary/meshopt/meshopt_encode_byte_group.d.ts +53 -0
  40. package/src/core/binary/meshopt/meshopt_encode_byte_group.d.ts.map +1 -0
  41. package/src/core/binary/meshopt/meshopt_encode_byte_group.js +140 -0
  42. package/src/core/binary/meshopt/meshopt_encode_data_block.d.ts +32 -0
  43. package/src/core/binary/meshopt/meshopt_encode_data_block.d.ts.map +1 -0
  44. package/src/core/binary/meshopt/meshopt_encode_data_block.js +77 -0
  45. package/src/core/binary/meshopt/meshopt_encode_index_sequence.d.ts +46 -0
  46. package/src/core/binary/meshopt/meshopt_encode_index_sequence.d.ts.map +1 -0
  47. package/src/core/binary/meshopt/meshopt_encode_index_sequence.js +146 -0
  48. package/src/core/binary/meshopt/meshopt_encode_vertex_buffer.d.ts +40 -0
  49. package/src/core/binary/meshopt/meshopt_encode_vertex_buffer.d.ts.map +1 -0
  50. package/src/core/binary/meshopt/meshopt_encode_vertex_buffer.js +700 -0
  51. package/src/core/binary/meshopt/meshopt_write_uint_var.d.ts +24 -0
  52. package/src/core/binary/meshopt/meshopt_write_uint_var.d.ts.map +1 -0
  53. package/src/core/binary/meshopt/meshopt_write_uint_var.js +39 -0
  54. package/src/core/math/random/seededRandom_Mulberry32.d.ts.map +1 -1
  55. package/src/core/math/random/seededRandom_Mulberry32.js +4 -2
  56. package/src/core/process/undo/Action.d.ts +19 -0
  57. package/src/core/process/undo/Action.d.ts.map +1 -1
  58. package/src/core/process/undo/Action.js +17 -0
  59. package/src/engine/graphics3/GPUParticleEmitterSystem.d.ts +78 -0
  60. package/src/engine/graphics3/GPUParticleEmitterSystem.d.ts.map +1 -0
  61. package/src/engine/graphics3/GPUParticleEmitterSystem.js +310 -0
  62. package/src/engine/graphics3/GraphicsEngine.d.ts +17 -0
  63. package/src/engine/graphics3/GraphicsEngine.d.ts.map +1 -1
  64. package/src/engine/graphics3/GraphicsEngine.js +30 -10
  65. package/src/engine/graphics3/particles/particle_gpu_records.d.ts.map +1 -1
  66. package/src/engine/graphics3/particles/particle_gpu_records.js +0 -2
  67. package/src/engine/interpolation/InterpolationSystem.d.ts +7 -0
  68. package/src/engine/interpolation/InterpolationSystem.d.ts.map +1 -1
  69. package/src/engine/interpolation/InterpolationSystem.js +10 -0
  70. package/src/engine/network/NetworkSession.d.ts.map +1 -1
  71. package/src/engine/network/NetworkSession.js +14 -34
  72. package/src/engine/network/time/RenderPlayout.d.ts +76 -0
  73. package/src/engine/network/time/RenderPlayout.d.ts.map +1 -0
  74. package/src/engine/network/time/RenderPlayout.js +163 -0
  75. package/src/engine/network/transport/adapters/WebSocketTransport.d.ts.map +1 -1
  76. package/src/engine/network/transport/adapters/WebSocketTransport.js +11 -4
  77. package/src/engine/physics/ecs/PhysicsSystem.d.ts +4 -12
  78. package/src/engine/physics/ecs/PhysicsSystem.d.ts.map +1 -1
  79. package/src/engine/physics/ecs/PhysicsSystem.js +39 -13
  80. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  81. package/src/engine/sound/simulation/core/VolumeField.d.ts.map +1 -1
  82. package/src/engine/sound/simulation/core/VolumeField.js +4 -1
  83. package/src/format/scene/gltf/MESHOPT_COMPRESSION_PLAN.md +23 -2
  84. package/src/shade/playground/particle_system/README.md +139 -139
  85. package/src/shade/playground/particle_system/particle_prototype.d.ts.map +1 -1
  86. package/src/shade/playground/particle_system/particle_prototype.js +0 -2
  87. package/src/shade/playground/particle_system/particle_scene.d.ts +6 -9
  88. package/src/shade/playground/particle_system/particle_scene.d.ts.map +1 -1
  89. package/src/shade/playground/particle_system/particle_scene.js +6 -13
  90. package/src/shade/playground/ssr_reprojection/README.md +103 -0
  91. package/src/shade/playground/ssr_reprojection/SpatialFilterProbe.d.ts +17 -0
  92. package/src/shade/playground/ssr_reprojection/SpatialFilterProbe.d.ts.map +1 -0
  93. package/src/shade/playground/ssr_reprojection/SpatialFilterProbe.js +68 -0
  94. package/src/shade/playground/ssr_reprojection/index.html +79 -0
  95. package/src/shade/playground/ssr_reprojection/main.d.ts +2 -0
  96. package/src/shade/playground/ssr_reprojection/main.d.ts.map +1 -0
  97. package/src/shade/playground/ssr_reprojection/main.js +245 -0
  98. package/src/shade/playground/ssr_reprojection/scene.d.ts +18 -0
  99. package/src/shade/playground/ssr_reprojection/scene.d.ts.map +1 -0
  100. package/src/shade/playground/ssr_reprojection/scene.js +51 -0
  101. package/src/shade/renderer/Renderer.d.ts +2 -23
  102. package/src/shade/renderer/Renderer.d.ts.map +1 -1
  103. package/src/shade/renderer/Renderer.js +185 -218
  104. package/src/shade/renderer/animation/GPUAnimationManager.d.ts +5 -8
  105. package/src/shade/renderer/animation/GPUAnimationManager.d.ts.map +1 -1
  106. package/src/shade/renderer/animation/GPUAnimationManager.js +12 -12
  107. package/src/shade/renderer/buffer/table/GPUTypedTable.d.ts.map +1 -1
  108. package/src/shade/renderer/buffer/table/GPUTypedTable.js +6 -0
  109. package/src/shade/renderer/buffer/table/single/GPUSingleTypeTable.d.ts.map +1 -1
  110. package/src/shade/renderer/buffer/table/single/GPUSingleTypeTable.js +7 -0
  111. package/src/shade/renderer/global_illumination/brick4/gpu/draw/chunk_brick4_sample_specular.d.ts +4 -0
  112. package/src/shade/renderer/global_illumination/brick4/gpu/draw/chunk_brick4_sample_specular.d.ts.map +1 -0
  113. package/src/shade/renderer/global_illumination/brick4/gpu/draw/chunk_brick4_sample_specular.js +51 -0
  114. package/src/shade/renderer/global_illumination/brick4/gpu/draw/shader_brick4_specular.d.ts.map +1 -1
  115. package/src/shade/renderer/global_illumination/brick4/gpu/draw/shader_brick4_specular.js +5 -35
  116. package/src/shade/renderer/particles/DESIGN.md +703 -514
  117. package/src/shade/renderer/particles/GPUParticleSystem.d.ts +16 -4
  118. package/src/shade/renderer/particles/GPUParticleSystem.d.ts.map +1 -1
  119. package/src/shade/renderer/particles/GPUParticleSystem.js +1189 -991
  120. package/src/shade/renderer/particles/ParticleConstants.d.ts +64 -0
  121. package/src/shade/renderer/particles/ParticleConstants.d.ts.map +1 -1
  122. package/src/shade/renderer/particles/ParticleConstants.js +71 -0
  123. package/src/shade/renderer/particles/bounds/chunk_particle_bounds.d.ts +57 -0
  124. package/src/shade/renderer/particles/bounds/chunk_particle_bounds.d.ts.map +1 -0
  125. package/src/shade/renderer/particles/bounds/chunk_particle_bounds.js +181 -0
  126. package/src/shade/renderer/particles/bounds/chunk_particle_bounds_unknown.d.ts +7 -0
  127. package/src/shade/renderer/particles/bounds/chunk_particle_bounds_unknown.d.ts.map +1 -0
  128. package/src/shade/renderer/particles/bounds/chunk_particle_bounds_unknown.js +12 -0
  129. package/src/shade/renderer/particles/bounds/graph_particle_bounds.d.ts +33 -0
  130. package/src/shade/renderer/particles/bounds/graph_particle_bounds.d.ts.map +1 -0
  131. package/src/shade/renderer/particles/bounds/graph_particle_bounds.js +67 -0
  132. package/src/shade/renderer/particles/bounds/shader_particle_bounds.d.ts +40 -0
  133. package/src/shade/renderer/particles/bounds/shader_particle_bounds.d.ts.map +1 -0
  134. package/src/shade/renderer/particles/bounds/shader_particle_bounds.js +187 -0
  135. package/src/shade/renderer/particles/coherence/graph_particle_bucket.d.ts +15 -2
  136. package/src/shade/renderer/particles/coherence/graph_particle_bucket.d.ts.map +1 -1
  137. package/src/shade/renderer/particles/coherence/graph_particle_bucket.js +14 -8
  138. package/src/shade/renderer/particles/data/PARTICLE_COUNTERS.d.ts +58 -4
  139. package/src/shade/renderer/particles/data/PARTICLE_COUNTERS.d.ts.map +1 -1
  140. package/src/shade/renderer/particles/data/PARTICLE_COUNTERS.js +79 -4
  141. package/src/shade/renderer/particles/data/PARTICLE_EMITTER_STATE.d.ts +23 -1
  142. package/src/shade/renderer/particles/data/PARTICLE_EMITTER_STATE.d.ts.map +1 -1
  143. package/src/shade/renderer/particles/data/PARTICLE_EMITTER_STATE.js +35 -2
  144. package/src/shade/renderer/particles/data/PARTICLE_EMITTER_STRUCT.d.ts +4 -2
  145. package/src/shade/renderer/particles/data/PARTICLE_EMITTER_STRUCT.d.ts.map +1 -1
  146. package/src/shade/renderer/particles/data/PARTICLE_EMITTER_STRUCT.js +5 -8
  147. package/src/shade/renderer/particles/data/particle_emitter_record.d.ts.map +1 -1
  148. package/src/shade/renderer/particles/data/particle_emitter_record.js +0 -6
  149. package/src/shade/renderer/particles/graph_particles.d.ts +25 -3
  150. package/src/shade/renderer/particles/graph_particles.d.ts.map +1 -1
  151. package/src/shade/renderer/particles/graph_particles.js +108 -31
  152. package/src/shade/renderer/particles/graph_particles_avboit.d.ts +6 -4
  153. package/src/shade/renderer/particles/graph_particles_avboit.d.ts.map +1 -1
  154. package/src/shade/renderer/particles/graph_particles_avboit.js +5 -5
  155. package/src/shade/renderer/particles/runtime/EmitterRegistry.d.ts +5 -0
  156. package/src/shade/renderer/particles/runtime/EmitterRegistry.d.ts.map +1 -1
  157. package/src/shade/renderer/particles/runtime/EmitterRegistry.js +27 -6
  158. package/src/shade/renderer/particles/runtime/GPUParticleEmitterContext.d.ts +4 -0
  159. package/src/shade/renderer/particles/runtime/GPUParticleEmitterContext.d.ts.map +1 -1
  160. package/src/shade/renderer/particles/runtime/GPUParticleEmitterContext.js +6 -1
  161. package/src/shade/renderer/particles/runtime/ParticleEmitter.d.ts +35 -27
  162. package/src/shade/renderer/particles/runtime/ParticleEmitter.d.ts.map +1 -1
  163. package/src/shade/renderer/particles/runtime/ParticleEmitter.js +424 -425
  164. package/src/shade/renderer/particles/shaders/chunk_particle_emitter_warmup.d.ts +20 -0
  165. package/src/shade/renderer/particles/shaders/chunk_particle_emitter_warmup.d.ts.map +1 -0
  166. package/src/shade/renderer/particles/shaders/chunk_particle_render_math.d.ts +4 -0
  167. package/src/shade/renderer/particles/shaders/chunk_particle_render_math.d.ts.map +1 -1
  168. package/src/shade/renderer/particles/shaders/chunk_particle_render_math.js +38 -2
  169. package/src/shade/renderer/particles/shaders/chunk_particle_spawn_budget.d.ts +22 -0
  170. package/src/shade/renderer/particles/shaders/chunk_particle_spawn_budget.d.ts.map +1 -0
  171. package/src/shade/renderer/particles/shaders/chunk_particle_spawn_budget.js +42 -0
  172. package/src/shade/renderer/particles/shaders/shader_particle_avboit_draw.js +1 -1
  173. package/src/shade/renderer/particles/shaders/shader_particle_avboit_occupancy.d.ts.map +1 -1
  174. package/src/shade/renderer/particles/shaders/shader_particle_avboit_occupancy.js +53 -22
  175. package/src/shade/renderer/particles/shaders/shader_particle_emitter_tick.d.ts.map +1 -1
  176. package/src/shade/renderer/particles/shaders/shader_particle_emitter_tick.js +213 -216
  177. package/src/shade/renderer/particles/shaders/shader_particle_reclaim.d.ts +50 -0
  178. package/src/shade/renderer/particles/shaders/shader_particle_reclaim.d.ts.map +1 -0
  179. package/src/shade/renderer/particles/shaders/shader_particle_render.js +1 -1
  180. package/src/shade/renderer/particles/warmup/chunk_particle_warmup_step.d.ts +36 -0
  181. package/src/shade/renderer/particles/warmup/chunk_particle_warmup_step.d.ts.map +1 -0
  182. package/src/shade/renderer/particles/warmup/chunk_particle_warmup_step.js +102 -0
  183. package/src/shade/renderer/particles/warmup/graph_particle_warmup.d.ts +102 -0
  184. package/src/shade/renderer/particles/warmup/graph_particle_warmup.d.ts.map +1 -0
  185. package/src/shade/renderer/particles/warmup/graph_particle_warmup.js +329 -0
  186. package/src/shade/renderer/particles/warmup/shader_particle_warmup.d.ts +112 -0
  187. package/src/shade/renderer/particles/warmup/shader_particle_warmup.d.ts.map +1 -0
  188. package/src/shade/renderer/particles/warmup/shader_particle_warmup.js +318 -0
  189. package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance.d.ts +35 -0
  190. package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance.d.ts.map +1 -0
  191. package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance.js +108 -0
  192. package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance_wide.d.ts +3 -0
  193. package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance_wide.d.ts.map +1 -0
  194. package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance_wide.js +70 -0
  195. package/src/shade/renderer/particles/warmup/warmup_schedule.d.ts +62 -0
  196. package/src/shade/renderer/particles/warmup/warmup_schedule.d.ts.map +1 -0
  197. package/src/shade/renderer/particles/warmup/warmup_schedule.js +55 -0
  198. package/src/shade/renderer/postprocess/PostProcess.d.ts.map +1 -1
  199. package/src/shade/renderer/postprocess/PostProcess.js +2 -1
  200. package/src/shade/renderer/postprocess/ssr/REPROJECTION_PROPOSAL.md +286 -0
  201. package/src/shade/renderer/postprocess/ssr/SSR.d.ts +57 -21
  202. package/src/shade/renderer/postprocess/ssr/SSR.d.ts.map +1 -1
  203. package/src/shade/renderer/postprocess/ssr/SSR.js +230 -129
  204. package/src/shade/renderer/postprocess/ssr/SSRReprojectionMode.d.ts +11 -0
  205. package/src/shade/renderer/postprocess/ssr/SSRReprojectionMode.d.ts.map +1 -0
  206. package/src/shade/renderer/postprocess/ssr/SSRReprojectionMode.js +6 -0
  207. package/src/shade/renderer/postprocess/ssr/chunk_ssr_metadata.d.ts +4 -0
  208. package/src/shade/renderer/postprocess/ssr/chunk_ssr_metadata.d.ts.map +1 -0
  209. package/src/shade/renderer/postprocess/ssr/chunk_ssr_metadata.js +32 -0
  210. package/src/shade/renderer/postprocess/ssr/chunk_ssr_spatial_variance.d.ts +4 -0
  211. package/src/shade/renderer/postprocess/ssr/chunk_ssr_spatial_variance.d.ts.map +1 -0
  212. package/src/shade/renderer/postprocess/ssr/chunk_ssr_spatial_variance.js +41 -0
  213. package/src/shade/renderer/postprocess/ssr/reproject/chunk_ssr_reprojection.d.ts +3 -0
  214. package/src/shade/renderer/postprocess/ssr/reproject/chunk_ssr_reprojection.d.ts.map +1 -0
  215. package/src/shade/renderer/postprocess/ssr/reproject/chunk_ssr_reprojection.js +30 -0
  216. package/src/shade/renderer/postprocess/ssr/reproject/chunk_ssr_sample_history.d.ts +4 -0
  217. package/src/shade/renderer/postprocess/ssr/reproject/chunk_ssr_sample_history.d.ts.map +1 -0
  218. package/src/shade/renderer/postprocess/ssr/reproject/chunk_ssr_sample_history.js +70 -0
  219. package/src/shade/renderer/postprocess/ssr/resolve/build_ssr_resolve_shader.d.ts +21 -0
  220. package/src/shade/renderer/postprocess/ssr/resolve/build_ssr_resolve_shader.d.ts.map +1 -0
  221. package/src/shade/renderer/postprocess/ssr/resolve/build_ssr_resolve_shader.js +363 -0
  222. package/src/shade/renderer/postprocess/ssr/resolve/chunk_get_neighbour_weight.js +1 -1
  223. package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader_Brick4.d.ts +2 -0
  224. package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader_Brick4.d.ts.map +1 -0
  225. package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader_Brick4.js +24 -0
  226. package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader_IBL.d.ts +1 -6
  227. package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader_IBL.d.ts.map +1 -1
  228. package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader_IBL.js +16 -332
  229. package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader_LPV.d.ts +1 -6
  230. package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader_LPV.d.ts.map +1 -1
  231. package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader_LPV.js +25 -358
  232. package/src/shade/renderer/postprocess/ssr/ssr_reproject_shader.d.ts +0 -5
  233. package/src/shade/renderer/postprocess/ssr/ssr_reproject_shader.d.ts.map +1 -1
  234. package/src/shade/renderer/postprocess/ssr/ssr_reproject_shader.js +201 -276
  235. package/src/shade/renderer/postprocess/ssr/ssr_spatial_denoise_shader.d.ts +1 -0
  236. package/src/shade/renderer/postprocess/ssr/ssr_spatial_denoise_shader.d.ts.map +1 -1
  237. package/src/shade/renderer/postprocess/ssr/ssr_spatial_denoise_shader.js +167 -143
  238. package/src/shade/renderer/shader/graph/graph_create_buffer.d.ts +15 -0
  239. package/src/shade/renderer/shader/graph/graph_create_buffer.d.ts.map +1 -0
  240. package/src/shade/renderer/shader/graph/graph_create_buffer.js +20 -0
  241. package/src/shade/renderer/view/GPUViewContext.d.ts +3 -4
  242. package/src/shade/renderer/view/GPUViewContext.d.ts.map +1 -1
  243. package/src/shade/renderer/view/GPUViewContext.js +5 -5
  244. package/src/core/binary/meshopt/__meshopt_test_streams.d.ts +0 -24
  245. package/src/core/binary/meshopt/__meshopt_test_streams.d.ts.map +0 -1
  246. package/src/core/binary/meshopt/__meshopt_test_streams.js +0 -237
  247. package/src/core/geom/3d/atlas/atlas_test_fixtures.d.ts +0 -84
  248. package/src/core/geom/3d/atlas/atlas_test_fixtures.d.ts.map +0 -1
  249. package/src/core/geom/3d/atlas/atlas_test_fixtures.js +0 -266
  250. package/src/engine/asset/loaders/gltf_test_fixtures.d.ts +0 -97
  251. package/src/engine/asset/loaders/gltf_test_fixtures.d.ts.map +0 -1
  252. package/src/engine/asset/loaders/gltf_test_fixtures.js +0 -359
  253. package/src/engine/sound/simulation/core/OcclusionSolver.d.ts +0 -29
  254. package/src/engine/sound/simulation/core/OcclusionSolver.d.ts.map +0 -1
  255. package/src/shade/renderer/animation/skin_test_fixtures.d.ts +0 -86
  256. package/src/shade/renderer/animation/skin_test_fixtures.d.ts.map +0 -1
  257. package/src/shade/renderer/animation/skin_test_fixtures.js +0 -250
  258. package/src/shade/renderer/geometry/virtual/format/attribute/vgeo_layers_test_fixtures.d.ts +0 -16
  259. package/src/shade/renderer/geometry/virtual/format/attribute/vgeo_layers_test_fixtures.d.ts.map +0 -1
  260. package/src/shade/renderer/geometry/virtual/format/attribute/vgeo_layers_test_fixtures.js +0 -27
  261. package/src/shade/renderer/particles/particle_test_fixtures.d.ts +0 -151
  262. package/src/shade/renderer/particles/particle_test_fixtures.d.ts.map +0 -1
  263. package/src/shade/renderer/particles/particle_test_fixtures.js +0 -229
  264. package/src/shade/renderer/particles/shaders/chunk_particle_emitter_world_sphere.js +0 -23
  265. package/src/shade/renderer/postprocess/ssr/reproject/shader_ffx_denoiser_reflections_reproject.js +0 -457
@@ -1,23 +0,0 @@
1
- import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
2
- import { chunk_particle_emitter } from "../data/chunk_particle_emitter.js";
3
-
4
- /**
5
- * An emitter's bounds sphere in world space: the centre through the node's matrix, the radius
6
- * scaled by the largest axis scale the matrix carries.
7
- *
8
- * The axes are read as transformed unit vectors rather than as matrix columns — the same numbers,
9
- * in a form the WGSL emulator also evaluates. Shared by the tick pass (frustum culling of spawning)
10
- * and the AVBOIT occupancy pass (which depth slices the emitter's particles can reach), so both
11
- * test the same sphere.
12
- *
13
- * @type {CodeChunk}
14
- */
15
- export const chunk_particle_emitter_world_sphere = CodeChunk.from(/* language=wgsl */ `
16
- fn particle_emitter_world_sphere(em : ParticleEmitter, transform : mat4x4<f32>) -> vec4<f32> {
17
- let center = (transform * vec4<f32>(em.bounds_center, 1.0)).xyz;
18
- let sx = length((transform * vec4<f32>(1.0, 0.0, 0.0, 0.0)).xyz);
19
- let sy = length((transform * vec4<f32>(0.0, 1.0, 0.0, 0.0)).xyz);
20
- let sz = length((transform * vec4<f32>(0.0, 0.0, 1.0, 0.0)).xyz);
21
- return vec4<f32>(center, em.bounds_radius * max(sx, max(sy, sz)));
22
- }
23
- `, [chunk_particle_emitter]);
@@ -1,457 +0,0 @@
1
- import { chunk_unpack_float16_4 } from "../../../shader/chunk/binary/chunk_unpack_float16_4.js";
2
- import { chunk_rgb_to_luminance } from "../../../shader/chunk/color/chunk_rgb_to_luminance.js";
3
- import { chunk_dot2 } from "../../../shader/chunk/math/chunk_dot2.js";
4
- import { CodeChunk } from "../../../shader/compiler/CodeChunk.js";
5
-
6
- /**
7
- * An unfinished translation of the FidelityFX reflection denoiser's reprojection pass.
8
- *
9
- * Not yet a shader, and not yet valid WGSL: the body still carries HLSL spellings the port has not
10
- * reached (`FfxFloat16x4`, `FfxInt32x2`, `FFX_GROUP_MEMORY_BARRIER`), and `main` is an empty stub
11
- * with no `@compute` and no `@workgroup_size`. It was a `ComputeShader` here until the workgroup
12
- * size started being read out of the WGSL, which is a question this source cannot answer; it stays
13
- * a chunk until someone finishes the port and writes the entry point.
14
- *
15
- * The bindings it will want are one texture, `tRadiance`.
16
- *
17
- * @see https://github.com/GPUOpen-LibrariesAndSDKs/FidelityFX-SDK/blob/1bbe66e7ea0d358e84af4471a90aa9c35b583de0/sdk/include/FidelityFX/gpu/denoiser/ffx_denoiser_reflections_reproject.h
18
- * @type {CodeChunk}
19
- */
20
- export const chunk_ffx_denoiser_reflections_reproject = CodeChunk.from(
21
- //language=WGSL
22
- `
23
-
24
- var<workgroup> g_ffx_dnsr_shared_0:array< array< u32, 16>, 16 >;
25
- var<workgroup> g_ffx_dnsr_shared_1:array< array< u32, 16>, 16 >;
26
-
27
- struct FFX_DNSR_Reflections_NeighborhoodSample {
28
- radiance:vec3<f32>
29
- };
30
-
31
- fn FFX_DNSR_Reflections_LoadFromGroupSharedMemory( idx:vec2<i32> ) -> FFX_DNSR_Reflections_NeighborhoodSample{
32
- let packed_radiance = vec2(g_ffx_dnsr_shared_0[idx.y][idx.x], g_ffx_dnsr_shared_1[idx.y][idx.x]);
33
- let unpacked_radiance = unpack_float16_4(packed_radiance);
34
-
35
- var neighborSample:FFX_DNSR_Reflections_NeighborhoodSample;
36
-
37
- neighborSample.radiance = unpacked_radiance.xyz;
38
-
39
- return neighborSample;
40
- }
41
-
42
- fn FFX_DNSR_Reflections_StoreInGroupSharedMemory(
43
- group_thread_id:vec2<i32>,
44
- radiance:vec3<f32>
45
- ) {
46
- g_ffx_dnsr_shared_0[group_thread_id.y][group_thread_id.x] = pack2x16float(radiance.xy);
47
- g_ffx_dnsr_shared_1[group_thread_id.y][group_thread_id.x] = pack2x16float(radiance.zz);
48
- }
49
-
50
- fn FFX_DNSR_Reflections_StoreInGroupSharedMemory(
51
- group_thread_id:vec2<i32>,
52
- radiance_variance:vec4<f32>
53
- ) {
54
- g_ffx_dnsr_shared_0[group_thread_id.y][group_thread_id.x] = pack2x16float(radiance_variance.xy);
55
- g_ffx_dnsr_shared_1[group_thread_id.y][group_thread_id.x] = pack2x16float(radiance_variance.zw);
56
- }
57
-
58
- fn FFX_DNSR_Reflections_InitializeGroupSharedMemory(
59
- dispatch_thread_id:vec2<i32>,
60
- group_thread_id:vec2<i32>,
61
- screen_size:vec2<i32>
62
- ) {
63
- // Load 16x16 region into shared memory using 4 8x8 blocks.
64
- const offset = array<vec2<i32>, 4>(
65
- vec2(0, 0),
66
- vec2(8, 0),
67
- vec2(0, 8),
68
- vec2(8, 8)
69
- );
70
-
71
- // Intermediate storage registers to cache the result of all loads
72
- var radiance: array<vec3<f32>, 4>;
73
-
74
- // Start in the upper left corner of the 16x16 region.
75
- dispatch_thread_id -= 4;
76
-
77
- // First store all loads in registers
78
- for (var i = 0; i < 4; i++) {
79
- radiance[i] = textureLoad(tRadiance, dispatch_thread_id + offset[i], 0).rgb;
80
- }
81
-
82
- // Then move all registers to FFX_GROUPSHARED memory
83
- for (var j = 0; j < 4; j++) {
84
- FFX_DNSR_Reflections_StoreInGroupSharedMemory(group_thread_id + offset[j], radiance[j]); // X
85
- }
86
- }
87
-
88
- fn FFX_DNSR_Reflections_LoadFromGroupSharedMemoryRaw( idx: vec2<i32>) -> vec4<f32> {
89
- let packed_radiance = vec2(g_ffx_dnsr_shared_0[idx.y][idx.x], g_ffx_dnsr_shared_1[idx.y][idx.x]);
90
- return unpack_float16_4(packed_radiance);
91
- }
92
-
93
- fn FFX_DNSR_Reflections_GetLuminanceWeight( val : vec3<f32> ) -> f32{
94
- let luma = rgb_to_luminance(val.xyz);
95
- let weight = max(exp(-luma * FFX_DNSR_REFLECTIONS_AVG_RADIANCE_LUMINANCE_WEIGHT), 1.0e-2);
96
- return weight;
97
- }
98
-
99
- // TODO unnecessary, shouldbe removed
100
- fn FFX_DNSR_Reflections_GetSurfaceReprojection(
101
- dispatch_thread_id:vec2<i32>,
102
- uv:vec2<f32>,
103
- motion_vector:vec2<f32>,
104
- ) {
105
- // Reflector position reprojection
106
- let history_uv = uv + motion_vector;
107
- return history_uv;
108
- }
109
-
110
- fn FFX_DNSR_Reflections_GetHitPositionReprojection(
111
- dispatch_thread_id:vec2<i32>,
112
- uv:vec2<f32>,
113
- reflected_ray_length:f32
114
- ) -> vec2<f32>{
115
-
116
- }
117
- let z = FFX_DNSR_Reflections_LoadDepth(dispatch_thread_id);
118
- var view_space_ray = FFX_DNSR_Reflections_ScreenSpaceToViewSpace(FfxFloat32x3(uv, z));
119
-
120
- // We start out with reconstructing the ray length in view space.
121
- // This includes the portion from the camera to the reflecting surface as well as the portion from the surface to the hit position.
122
- let surface_depth = length(view_space_ray);
123
- let ray_length = surface_depth + reflected_ray_length;
124
-
125
- // We then perform a parallax correction by shooting a ray
126
- // of the same length "straight through" the reflecting surface
127
- // and reprojecting the tip of that ray to the previous frame.
128
- view_space_ray /= surface_depth; // == normalize(view_space_ray)
129
- view_space_ray *= ray_length;
130
-
131
- // This is the "fake" hit position if we would follow the ray straight through the surface.
132
- let world_hit_position =
133
- FFX_DNSR_Reflections_ViewSpaceToWorldSpace(vec4(view_space_ray, 1.0));
134
-
135
- let prev_hit_position = FFX_DNSR_Reflections_WorldSpaceToScreenSpacePrevious(world_hit_position);
136
- let history_uv = prev_hit_position.xy;
137
-
138
- return history_uv;
139
- }
140
-
141
- fn FFX_DNSR_Reflections_GetDisocclusionFactor(
142
- normal:vec3<f32>,
143
- history_normal:vec3<f32>,
144
- linear_depth:f32,
145
- history_linear_depth:f32
146
- ) -> f32{
147
- let factor = exp(-abs(1.0f - max(0.0f, dot(normal, history_normal))) * FFX_DNSR_REFLECTIONS_DISOCCLUSION_NORMAL_WEIGHT)
148
- * exp(-abs(history_linear_depth - linear_depth) / linear_depth * FFX_DNSR_REFLECTIONS_DISOCCLUSION_DEPTH_WEIGHT);
149
- return factor;
150
- }
151
-
152
- struct FFX_DNSR_Reflections_Moments {
153
- mean:vec3<f32>;
154
- variance: vec3<f32>;
155
- };
156
-
157
- fn FFX_DNSR_Reflections_EstimateLocalNeighborhoodInGroup( group_thread_id: vec2<i32> ) -> FFX_DNSR_Reflections_Moments{
158
- var estimate: FFX_DNSR_Reflections_Moments;
159
-
160
- estimate.mean = vec3(0.0f, 0.0f, 0.0f);
161
- estimate.variance = vec3(0.0f, 0.0f, 0.0f);
162
-
163
- var accumulated_weight = 0.0f;
164
-
165
- for (var j = -FFX_DNSR_REFLECTIONS_LOCAL_NEIGHBORHOOD_RADIUS; j <= FFX_DNSR_REFLECTIONS_LOCAL_NEIGHBORHOOD_RADIUS; j++) {
166
- for (var i = -FFX_DNSR_REFLECTIONS_LOCAL_NEIGHBORHOOD_RADIUS; i <= FFX_DNSR_REFLECTIONS_LOCAL_NEIGHBORHOOD_RADIUS; i++) {
167
-
168
- let new_idx = group_thread_id + vec2(i, j);
169
- let radiance = FFX_DNSR_Reflections_LoadFromGroupSharedMemory(new_idx).radiance;
170
- let weight = FFX_DNSR_Reflections_LocalNeighborhoodKernelWeight(f32(i)) * FFX_DNSR_Reflections_LocalNeighborhoodKernelWeight(f32(j));
171
-
172
- accumulated_weight += weight;
173
- estimate.mean += radiance * weight;
174
- estimate.variance += radiance * radiance * weight;
175
-
176
- }
177
- }
178
- estimate.mean /= accumulated_weight;
179
- estimate.variance /= accumulated_weight;
180
-
181
- estimate.variance = abs(estimate.variance - estimate.mean * estimate.mean);
182
- return estimate;
183
- }
184
-
185
- fn FFX_DNSR_Reflections_PickReprojection(
186
- dispatch_thread_id:vec2<i32>,
187
- group_thread_id:vec2<i32>,
188
- screen_size:vec2<u32>,
189
- roughness:f32,
190
- ray_length:f32,
191
- disocclusion_factor:ptr<function, f32>,
192
- reprojection_uv: ptr<function, vec2<f32>>,
193
- reprojection: ptr<function, vec3<f32>>
194
- ) {
195
-
196
- let local_neighborhood = FFX_DNSR_Reflections_EstimateLocalNeighborhoodInGroup(group_thread_id);
197
-
198
- let uv = vec2(dispatch_thread_id.x + 0.5, dispatch_thread_id.y + 0.5) / screen_size;
199
- let normal = FFX_DNSR_Reflections_LoadWorldSpaceNormal(dispatch_thread_id);
200
- var history_normal:vec3<f32>;
201
- var history_linear_depth:f32;
202
-
203
- {
204
- let motion_vector = FFX_DNSR_Reflections_LoadMotionVector(dispatch_thread_id);
205
- let surface_reprojection_uv = FFX_DNSR_Reflections_GetSurfaceReprojection(dispatch_thread_id, uv, motion_vector);
206
- let hit_reprojection_uv = FFX_DNSR_Reflections_GetHitPositionReprojection(dispatch_thread_id, uv, ray_length);
207
- let surface_normal = FFX_DNSR_Reflections_SampleWorldSpaceNormalHistory(surface_reprojection_uv);
208
- let hit_normal = FFX_DNSR_Reflections_SampleWorldSpaceNormalHistory(hit_reprojection_uv);
209
- let surface_history = FFX_DNSR_Reflections_SampleRadianceHistory(surface_reprojection_uv);
210
- let hit_history = FFX_DNSR_Reflections_SampleRadianceHistory(hit_reprojection_uv);
211
- let hit_normal_similarity = dot(normalize(hit_normal), normalize(normal));
212
- let surface_normal_similarity = dot(normalize(surface_normal), normalize(normal));
213
- let hit_roughness = FFX_DNSR_Reflections_SampleRoughnessHistory(hit_reprojection_uv);
214
- let surface_roughness = FFX_DNSR_Reflections_SampleRoughnessHistory(surface_reprojection_uv);
215
-
216
- // Choose reprojection uv based on similarity to the local neighborhood.
217
- if (hit_normal_similarity > FFX_DNSR_REFLECTIONS_REPROJECTION_NORMAL_SIMILARITY_THRESHOLD // Candidate for mirror reflection parallax
218
- && hit_normal_similarity + 1.0e-3 > surface_normal_similarity //
219
- && abs(hit_roughness - roughness) < abs(surface_roughness - roughness) + 1.0e-3 //
220
- ) {
221
- history_normal = hit_normal;
222
-
223
- let hit_history_depth = FFX_DNSR_Reflections_SampleDepthHistory(hit_reprojection_uv);
224
- let hit_history_linear_depth = FFX_DNSR_Reflections_GetLinearDepth(hit_reprojection_uv, hit_history_depth);
225
-
226
- history_linear_depth = hit_history_linear_depth;
227
- reprojection_uv = hit_reprojection_uv;
228
- reprojection = hit_history;
229
- } else {
230
- // Reject surface reprojection based on simple distance
231
- if (dot2(surface_history - local_neighborhood.mean) <
232
- FFX_DNSR_REFLECTIONS_REPROJECT_SURFACE_DISCARD_VARIANCE_WEIGHT * length(local_neighborhood.variance)
233
- ) {
234
-
235
- history_normal = surface_normal;
236
-
237
- let surface_history_depth = FFX_DNSR_Reflections_SampleDepthHistory(surface_reprojection_uv);
238
- let surface_history_linear_depth = FFX_DNSR_Reflections_GetLinearDepth(surface_reprojection_uv, surface_history_depth);
239
-
240
- history_linear_depth = surface_history_linear_depth;
241
- reprojection_uv = surface_reprojection_uv;
242
- reprojection = surface_history;
243
-
244
- } else {
245
- disocclusion_factor = FfxFloat16(0.0f);
246
- return;
247
- }
248
- }
249
- }
250
-
251
- let depth = FFX_DNSR_Reflections_LoadDepth(dispatch_thread_id);
252
- let linear_depth = FFX_DNSR_Reflections_GetLinearDepth(uv, depth);
253
-
254
- // Determine disocclusion factor based on history
255
- disocclusion_factor = FFX_DNSR_Reflections_GetDisocclusionFactor(normal, history_normal, linear_depth, history_linear_depth);
256
-
257
- if (disocclusion_factor > FFX_DNSR_REFLECTIONS_DISOCCLUSION_THRESHOLD){
258
- // Early out, good enough
259
- return;
260
- }
261
-
262
- // Try to find the closest sample in the vicinity if we are not convinced of a disocclusion
263
- if (disocclusion_factor < FFX_DNSR_REFLECTIONS_DISOCCLUSION_THRESHOLD) {
264
-
265
- var closest_uv = reprojection_uv;
266
- var dudv = 1.0 / vec2<f32>(screen_size);
267
-
268
- const search_radius = 1;
269
-
270
- for (FfxInt32 y = -search_radius; y <= search_radius; y++) {
271
- for (FfxInt32 x = -search_radius; x <= search_radius; x++) {
272
-
273
- let uv = reprojection_uv + vec2(f32(x), f32(y)) * dudv;
274
- let history_normal = FFX_DNSR_Reflections_SampleWorldSpaceNormalHistory(uv);
275
- let history_depth = FFX_DNSR_Reflections_SampleDepthHistory(uv);
276
- let history_linear_depth = FFX_DNSR_Reflections_GetLinearDepth(uv, history_depth);
277
- let weight = FFX_DNSR_Reflections_GetDisocclusionFactor(normal, history_normal, linear_depth, history_linear_depth);
278
-
279
- if (weight > disocclusion_factor) {
280
- disocclusion_factor = weight;
281
- closest_uv = uv;
282
- reprojection_uv = closest_uv;
283
- }
284
-
285
- }
286
- }
287
-
288
- reprojection = FFX_DNSR_Reflections_SampleRadianceHistory(reprojection_uv);
289
-
290
- }
291
-
292
- // Rare slow path - triggered only on the edges.
293
- // Try to get rid of potential leaks at bilinear interpolation level.
294
- if (disocclusion_factor < FFX_DNSR_REFLECTIONS_DISOCCLUSION_THRESHOLD) {
295
- // If we've got a discarded history, try to construct a better sample out of 2x2 interpolation neighborhood
296
- // Helps quite a bit on the edges in movement
297
- let uvx = fract(vec2<f32>(screen_size.x) * reprojection_uv.x + 0.5);
298
- let uvy = fract(vec2<f32>(screen_size.y) * reprojection_uv.y + 0.5);
299
-
300
- let reproject_texel_coords = vec2(screen_size * reprojection_uv - 0.5);
301
-
302
- FfxFloat16x3 reprojection00 = FFX_DNSR_Reflections_LoadRadianceHistory(reproject_texel_coords + vec2(0, 0));
303
- FfxFloat16x3 reprojection10 = FFX_DNSR_Reflections_LoadRadianceHistory(reproject_texel_coords + vec2(1, 0));
304
- FfxFloat16x3 reprojection01 = FFX_DNSR_Reflections_LoadRadianceHistory(reproject_texel_coords + vec2(0, 1));
305
- FfxFloat16x3 reprojection11 = FFX_DNSR_Reflections_LoadRadianceHistory(reproject_texel_coords + vec2(1, 1));
306
-
307
- FfxFloat16x3 normal00 = FFX_DNSR_Reflections_LoadWorldSpaceNormalHistory(reproject_texel_coords + FfxInt32x2(0, 0));
308
- FfxFloat16x3 normal10 = FFX_DNSR_Reflections_LoadWorldSpaceNormalHistory(reproject_texel_coords + FfxInt32x2(1, 0));
309
- FfxFloat16x3 normal01 = FFX_DNSR_Reflections_LoadWorldSpaceNormalHistory(reproject_texel_coords + FfxInt32x2(0, 1));
310
- FfxFloat16x3 normal11 = FFX_DNSR_Reflections_LoadWorldSpaceNormalHistory(reproject_texel_coords + FfxInt32x2(1, 1));
311
-
312
- FfxFloat32 depth00 = FFX_DNSR_Reflections_GetLinearDepth(reprojection_uv, FFX_DNSR_Reflections_LoadDepthHistory(reproject_texel_coords + FfxInt32x2(0, 0)));
313
- FfxFloat32 depth10 = FFX_DNSR_Reflections_GetLinearDepth(reprojection_uv, FFX_DNSR_Reflections_LoadDepthHistory(reproject_texel_coords + FfxInt32x2(1, 0)));
314
- FfxFloat32 depth01 = FFX_DNSR_Reflections_GetLinearDepth(reprojection_uv, FFX_DNSR_Reflections_LoadDepthHistory(reproject_texel_coords + FfxInt32x2(0, 1)));
315
- FfxFloat32 depth11 = FFX_DNSR_Reflections_GetLinearDepth(reprojection_uv, FFX_DNSR_Reflections_LoadDepthHistory(reproject_texel_coords + FfxInt32x2(1, 1)));
316
-
317
- var w:vec4<f32>;
318
-
319
- // Initialize with occlusion weights
320
- w.x = FFX_DNSR_Reflections_GetDisocclusionFactor(normal, normal00, linear_depth, depth00) > FFX_DNSR_REFLECTIONS_DISOCCLUSION_THRESHOLD / 2.0f ? FfxFloat16(1.0f) : FfxFloat16(0.0f);
321
- w.y = FFX_DNSR_Reflections_GetDisocclusionFactor(normal, normal10, linear_depth, depth10) > FFX_DNSR_REFLECTIONS_DISOCCLUSION_THRESHOLD / 2.0f ? FfxFloat16(1.0f) : FfxFloat16(0.0f);
322
- w.z = FFX_DNSR_Reflections_GetDisocclusionFactor(normal, normal01, linear_depth, depth01) > FFX_DNSR_REFLECTIONS_DISOCCLUSION_THRESHOLD / 2.0f ? FfxFloat16(1.0f) : FfxFloat16(0.0f);
323
- w.w = FFX_DNSR_Reflections_GetDisocclusionFactor(normal, normal11, linear_depth, depth11) > FFX_DNSR_REFLECTIONS_DISOCCLUSION_THRESHOLD / 2.0f ? FfxFloat16(1.0f) : FfxFloat16(0.0f);
324
-
325
- // And then mix in bilinear weights
326
- w.x = w.x * (1.0 - uvx) * (1.0 - uvy);
327
- w.y = w.y * (uvx) * (1.0 - uvy);
328
- w.z = w.z * (1.0 - uvx) * (uvy);
329
- w.w = w.w * (uvx) * (uvy);
330
-
331
- let ws = max(w.x + w.y + w.z + w.w, 1.0e-3);
332
-
333
- // normalize
334
- w /= ws;
335
-
336
- var history_normal:vec3<f32>;
337
- var history_linear_depth:f32;
338
-
339
- reprojection = reprojection00 * w.x + reprojection10 * w.y + reprojection01 * w.z + reprojection11 * w.w;
340
- history_linear_depth = depth00 * w.x + depth10 * w.y + depth01 * w.z + depth11 * w.w;
341
- history_normal = normal00 * w.x + normal10 * w.y + normal01 * w.z + normal11 * w.w;
342
- disocclusion_factor = FFX_DNSR_Reflections_GetDisocclusionFactor(normal, history_normal, linear_depth, history_linear_depth);
343
- }
344
-
345
- disocclusion_factor = disocclusion_factor < FFX_DNSR_REFLECTIONS_DISOCCLUSION_THRESHOLD ? 0.0f : disocclusion_factor;
346
- }
347
-
348
- fn FFX_DNSR_Reflections_Reproject(
349
-
350
- FfxInt32x2 dispatch_thread_id,
351
- FfxInt32x2 group_thread_id,
352
- FfxUInt32x2 screen_size,
353
- FfxFloat32 temporal_stability_factor,
354
- FfxInt32 max_samples
355
-
356
- ) {
357
- FFX_DNSR_Reflections_InitializeGroupSharedMemory(dispatch_thread_id, group_thread_id, FfxInt32x2(screen_size));
358
- FFX_GROUP_MEMORY_BARRIER;
359
-
360
- group_thread_id += 4; // Center threads in FFX_GROUPSHARED memory
361
-
362
- FfxFloat16 variance = FfxFloat16(1.0f);
363
- FfxFloat16 num_samples = FfxFloat16(0.0f);
364
- FfxFloat16 roughness = FFX_DNSR_Reflections_LoadRoughness(dispatch_thread_id);
365
- FfxFloat32x3 normal = FFX_DNSR_Reflections_LoadWorldSpaceNormal(dispatch_thread_id);
366
- FfxFloat16x3 radiance = FFX_DNSR_Reflections_LoadRadiance(dispatch_thread_id);
367
- const FfxFloat16 ray_length = FFX_DNSR_Reflections_LoadRayLength(dispatch_thread_id);
368
-
369
- if (FFX_DNSR_Reflections_IsGlossyReflection(roughness)) {
370
- FfxFloat16 disocclusion_factor;
371
- FfxFloat32x2 reprojection_uv;
372
- FfxFloat16x3 reprojection;
373
- FFX_DNSR_Reflections_PickReprojection(/*in*/ dispatch_thread_id,
374
- /* in */ group_thread_id,
375
- /* in */ screen_size,
376
- /* in */ roughness,
377
- /* in */ ray_length,
378
- /* out */ disocclusion_factor,
379
- /* out */ reprojection_uv,
380
- /* out */ reprojection);
381
- if ( (reprojection_uv.x > 0.0f) && (reprojection_uv.y > 0.0f) && (reprojection_uv.x < 1.0f) && (reprojection_uv.y< 1.0f)) {
382
- FfxFloat16 prev_variance = FFX_DNSR_Reflections_SampleVarianceHistory(reprojection_uv);
383
- num_samples = FFX_DNSR_Reflections_SampleNumSamplesHistory(reprojection_uv) * disocclusion_factor;
384
- FfxFloat16 s_max_samples = FfxFloat16(max(8.0f, FfxFloat16(max_samples) * FFX_DNSR_REFLECTIONS_SAMPLES_FOR_ROUGHNESS(roughness)));
385
- num_samples = min(s_max_samples, num_samples + FfxFloat16(1.0f));
386
- FfxFloat16 new_variance = FFX_DNSR_Reflections_ComputeTemporalVariance(radiance.xyz, reprojection.xyz);
387
- if (disocclusion_factor < FFX_DNSR_REFLECTIONS_DISOCCLUSION_THRESHOLD) {
388
- FFX_DNSR_Reflections_StoreRadianceReprojected(dispatch_thread_id, FfxFloat16x3(0.0f, 0.0f, 0.0f));
389
- FFX_DNSR_Reflections_StoreVariance(dispatch_thread_id, FfxFloat16(1.0f));
390
- FFX_DNSR_Reflections_StoreNumSamples(dispatch_thread_id, FfxFloat16(1.0f));
391
- } else {
392
- FfxFloat16 variance_mix = ffxLerp(new_variance, prev_variance, FfxFloat16(1.0f / num_samples));
393
- FFX_DNSR_Reflections_StoreRadianceReprojected(dispatch_thread_id, reprojection);
394
- FFX_DNSR_Reflections_StoreVariance(dispatch_thread_id, variance_mix);
395
- FFX_DNSR_Reflections_StoreNumSamples(dispatch_thread_id, num_samples);
396
- // Mix in reprojection for radiance mip computation
397
- radiance = ffxLerp(radiance, reprojection, FfxFloat16(0.3f));
398
- }
399
- } else {
400
- FFX_DNSR_Reflections_StoreRadianceReprojected(dispatch_thread_id, FfxFloat16x3(0.0f, 0.0f, 0.0f));
401
- FFX_DNSR_Reflections_StoreVariance(dispatch_thread_id, FfxFloat16(1.0f));
402
- FFX_DNSR_Reflections_StoreNumSamples(dispatch_thread_id, FfxFloat16(1.0f));
403
- }
404
- }
405
-
406
- // Downsample 8x8 -> 1 radiance using FFX_GROUPSHARED memory
407
- // Initialize FFX_GROUPSHARED array for downsampling
408
- FfxFloat16 weight = FFX_DNSR_Reflections_GetLuminanceWeight(radiance.xyz);
409
- radiance.xyz *= weight;
410
- if ( (dispatch_thread_id.x >= screen_size.x) || (dispatch_thread_id.y >= screen_size.y) || any(isinf(radiance)) || any(isnan(radiance)) || (weight > FfxFloat16(1.0e3))) {
411
- radiance = vec3(0.0f, 0.0f, 0.0f);
412
- weight = 0.0f;
413
- }
414
-
415
- group_thread_id -= 4; // Center threads in FFX_GROUPSHARED memory
416
-
417
- FFX_DNSR_Reflections_StoreInGroupSharedMemory(group_thread_id, FfxFloat16x4(radiance.xyz, weight));
418
- FFX_GROUP_MEMORY_BARRIER;
419
-
420
- for (FfxInt32 i = 2; i <= 8; i = i * 2) {
421
-
422
- }
423
- FfxInt32 ox = group_thread_id.x * i;
424
- FfxInt32 oy = group_thread_id.y * i;
425
- FfxInt32 ix = group_thread_id.x * i + i / 2;
426
- FfxInt32 iy = group_thread_id.y * i + i / 2;
427
-
428
- if (ix < 8 && iy < 8) {
429
- FfxFloat16x4 rad_weight00 = FFX_DNSR_Reflections_LoadFromGroupSharedMemoryRaw(FfxInt32x2(ox, oy));
430
- FfxFloat16x4 rad_weight10 = FFX_DNSR_Reflections_LoadFromGroupSharedMemoryRaw(FfxInt32x2(ox, iy));
431
- FfxFloat16x4 rad_weight01 = FFX_DNSR_Reflections_LoadFromGroupSharedMemoryRaw(FfxInt32x2(ix, oy));
432
- FfxFloat16x4 rad_weight11 = FFX_DNSR_Reflections_LoadFromGroupSharedMemoryRaw(FfxInt32x2(ix, iy));
433
- FfxFloat16x4 sum = rad_weight00 + rad_weight01 + rad_weight10 + rad_weight11;
434
- FFX_DNSR_Reflections_StoreInGroupSharedMemory(FfxInt32x2(ox, oy), sum);
435
- }
436
-
437
- FFX_GROUP_MEMORY_BARRIER;
438
- }
439
-
440
- if ((group_thread_id.x == 0) && (group_thread_id.y == 0)) {
441
- FfxFloat16x4 sum = FFX_DNSR_Reflections_LoadFromGroupSharedMemoryRaw(FfxInt32x2(0, 0));
442
- FfxFloat16 weight_acc = max(sum.w, FfxFloat16(1.0e-3));
443
- FfxFloat32x3 radiance_avg = sum.xyz / weight_acc;
444
- FFX_DNSR_Reflections_StoreAverageRadiance(dispatch_thread_id.xy / 8, FfxFloat16x3(radiance_avg));
445
- }
446
-
447
- }
448
-
449
- fn main(){
450
-
451
- }
452
- `, [
453
- chunk_unpack_float16_4,
454
- chunk_rgb_to_luminance,
455
- chunk_dot2,
456
- ]
457
- );