@woosh/meep-engine 3.60.5 → 3.60.6

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 (55) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/package.json +1 -1
  3. package/src/shade/renderer/Renderer.d.ts +11 -0
  4. package/src/shade/renderer/Renderer.d.ts.map +1 -1
  5. package/src/shade/renderer/Renderer.js +43 -1
  6. package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.d.ts +26 -43
  7. package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.d.ts.map +1 -1
  8. package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.js +109 -117
  9. package/src/shade/renderer/geometry/sdf/cards/GPUMeshCardSets.d.ts +20 -2
  10. package/src/shade/renderer/geometry/sdf/cards/GPUMeshCardSets.d.ts.map +1 -1
  11. package/src/shade/renderer/geometry/sdf/cards/GPUMeshCardSets.js +66 -2
  12. package/src/shade/renderer/geometry/virtual/proxy/vgeo_proxy_triangle_limit.d.ts +19 -0
  13. package/src/shade/renderer/geometry/virtual/proxy/vgeo_proxy_triangle_limit.d.ts.map +1 -0
  14. package/src/shade/renderer/geometry/virtual/proxy/vgeo_proxy_triangle_limit.js +25 -0
  15. package/src/shade/renderer/geometry/virtual/runtime/VirtualGeometry.d.ts +15 -0
  16. package/src/shade/renderer/geometry/virtual/runtime/VirtualGeometry.d.ts.map +1 -1
  17. package/src/shade/renderer/geometry/virtual/runtime/VirtualGeometry.js +38 -0
  18. package/src/shade/renderer/geometry/virtual/sdf/VGeoSDFProxies.d.ts +28 -59
  19. package/src/shade/renderer/geometry/virtual/sdf/VGeoSDFProxies.d.ts.map +1 -1
  20. package/src/shade/renderer/geometry/virtual/sdf/VGeoSDFProxies.js +84 -789
  21. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSceneHolds.d.ts +2 -1
  22. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSceneHolds.d.ts.map +1 -1
  23. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSceneHolds.js +2 -1
  24. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_instance.d.ts +2 -2
  25. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_instance.js +2 -2
  26. package/src/shade/renderer/material/GPUMaterialManager.d.ts +4 -1
  27. package/src/shade/renderer/material/GPUMaterialManager.d.ts.map +1 -1
  28. package/src/shade/renderer/material/GPUMaterialManager.js +5 -8
  29. package/src/shade/renderer/postprocess/gtao/GTAO.d.ts +7 -3
  30. package/src/shade/renderer/postprocess/gtao/GTAO.d.ts.map +1 -1
  31. package/src/shade/renderer/postprocess/gtao/GTAO.js +26 -13
  32. package/src/shade/renderer/postprocess/gtao/ao_reproject_shader.d.ts +14 -0
  33. package/src/shade/renderer/postprocess/gtao/ao_reproject_shader.d.ts.map +1 -1
  34. package/src/shade/renderer/postprocess/gtao/ao_reproject_shader.js +196 -68
  35. package/src/shade/renderer/postprocess/gtao/fragment_shader_gtao.d.ts.map +1 -1
  36. package/src/shade/renderer/postprocess/gtao/fragment_shader_gtao.js +42 -28
  37. package/src/shade/renderer/postprocess/gtao/fragment_shader_gtao_with_irradiance.d.ts.map +1 -1
  38. package/src/shade/renderer/postprocess/gtao/fragment_shader_gtao_with_irradiance.js +429 -414
  39. package/src/shade/renderer/postprocess/gtao/shader_gtao_spatial_denoise.d.ts +16 -0
  40. package/src/shade/renderer/postprocess/gtao/shader_gtao_spatial_denoise.d.ts.map +1 -0
  41. package/src/shade/renderer/postprocess/gtao/shader_gtao_spatial_denoise.js +156 -0
  42. package/src/shade/renderer/scene/GPUSceneContext.d.ts +2 -2
  43. package/src/shade/renderer/scene/GPUSceneContext.js +5 -5
  44. package/src/shade/renderer/geometry/virtual/sdf/VGEO_SDF.d.ts +0 -47
  45. package/src/shade/renderer/geometry/virtual/sdf/VGEO_SDF.d.ts.map +0 -1
  46. package/src/shade/renderer/geometry/virtual/sdf/VGEO_SDF.js +0 -80
  47. package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_collect.d.ts +0 -16
  48. package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_collect.d.ts.map +0 -1
  49. package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_collect.js +0 -67
  50. package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_decode.d.ts +0 -17
  51. package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_decode.d.ts.map +0 -1
  52. package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_decode.js +0 -145
  53. package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_traverse.d.ts +0 -12
  54. package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_traverse.d.ts.map +0 -1
  55. package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_traverse.js +0 -105
@@ -9,7 +9,8 @@
9
9
  * `GPU_DATABASE_NULL` until then and for a row out of the SDF world.
10
10
  *
11
11
  * A row is in the SDF world when its `flags` carry `MESH_FLAG_SDF_WORLD`, whatever its geometry: a
12
- * virtual geometry's cache is held as a mesh's is, and comes from its own source (`VGeoSDFProxies`).
12
+ * virtual geometry's cache is held as a mesh's is, and is its proxy's once `VGeoSDFProxies` aliases it: the
13
+ * hold and its side move to the proxy, and the pair's card set captures the proxy's layout.
13
14
  * A skinned row draws a clone: the hold and the pair are its source's,
14
15
  * whose unskinned field and cards the clone's header is aliased to (§6.3). A row written again moves
15
16
  * its hold and its pair, the new ones taken before the old ones go, so a cache or card set a row keeps
@@ -1 +1 @@
1
- {"version":3,"file":"ProbeClipmapSceneHolds.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSceneHolds.js"],"names":[],"mappings":"AAwDA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH;IAwEI;;;OAGG;IACH,mBAHW,eAAe,YACf,eAAe,EASzB;IAED;;OAEG;IACH,sEAEC;IAED;;;OAGG;IACH,yBAEC;IAED;;;OAGG;IACH,yBAEC;IAED;;;OAGG;IACH,mCAEC;IAED;;;OAGG;IACH,qCAEC;IAED,0BAEC;IAED;;;;;;OAMG;IACH,oBAJW,mBAAmB,YACnB,aAAa,GACX,MAAM,GAAC,SAAS,CAI5B;IAED;;;;OAIG;IACH,6BAIC;IAED,eAiBC;IAED,eAuCC;IAED;;OAEG;IACH,cAiBC;;CA4TJ;8BA1mBY,OAAO,gCAAgC,EAAE,eAAe;8BACxD,OAAO,mCAAmC,EAAE,eAAe;kCAC3D,OAAO,uCAAuC,EAAE,mBAAmB;4BACnE,OAAO,iCAAiC,EAAE,aAAa;iCACvD,OAAO,sCAAsC,EAAE,kBAAkB;8BACjE,OAAO,0BAA0B,EAAE,eAAe"}
1
+ {"version":3,"file":"ProbeClipmapSceneHolds.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSceneHolds.js"],"names":[],"mappings":"AAwDA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH;IAwEI;;;OAGG;IACH,mBAHW,eAAe,YACf,eAAe,EASzB;IAED;;OAEG;IACH,sEAEC;IAED;;;OAGG;IACH,yBAEC;IAED;;;OAGG;IACH,yBAEC;IAED;;;OAGG;IACH,mCAEC;IAED;;;OAGG;IACH,qCAEC;IAED,0BAEC;IAED;;;;;;OAMG;IACH,oBAJW,mBAAmB,YACnB,aAAa,GACX,MAAM,GAAC,SAAS,CAI5B;IAED;;;;OAIG;IACH,6BAIC;IAED,eAiBC;IAED,eAuCC;IAED;;OAEG;IACH,cAiBC;;CA4TJ;8BA3mBY,OAAO,gCAAgC,EAAE,eAAe;8BACxD,OAAO,mCAAmC,EAAE,eAAe;kCAC3D,OAAO,uCAAuC,EAAE,mBAAmB;4BACnE,OAAO,iCAAiC,EAAE,aAAa;iCACvD,OAAO,sCAAsC,EAAE,kBAAkB;8BACjE,OAAO,0BAA0B,EAAE,eAAe"}
@@ -65,7 +65,8 @@ class Pair {
65
65
  * `GPU_DATABASE_NULL` until then and for a row out of the SDF world.
66
66
  *
67
67
  * A row is in the SDF world when its `flags` carry `MESH_FLAG_SDF_WORLD`, whatever its geometry: a
68
- * virtual geometry's cache is held as a mesh's is, and comes from its own source (`VGeoSDFProxies`).
68
+ * virtual geometry's cache is held as a mesh's is, and is its proxy's once `VGeoSDFProxies` aliases it: the
69
+ * hold and its side move to the proxy, and the pair's card set captures the proxy's layout.
69
70
  * A skinned row draws a clone: the hold and the pair are its source's,
70
71
  * whose unskinned field and cards the clone's header is aliased to (§6.3). A row written again moves
71
72
  * its hold and its pair, the new ones taken before the old ones go, so a cache or card set a row keeps
@@ -10,8 +10,8 @@
10
10
  * `mesh_brick_accept` is the gather's leaf filter, with `bounds` the row's world box and `voxel` the
11
11
  * cascade's: the row is in the SDF world, its geometry's field is resident (a skinned clone's through
12
12
  * its source's, the hook), and its box resolves in the cascade (`brick_provider_resolves`). A virtual
13
- * geometry's field is the one baked for its proxy and adopted into it (§7.8), so its rows are taken as
14
- * a mesh's are, once it is resident.
13
+ * geometry's header is an alias of its proxy's (§7.8), so its rows are taken as a mesh's are, once the
14
+ * proxy's field is resident.
15
15
  *
16
16
  * `mesh_brick_instance` makes the instance the texels sample: the inverse of its transform, its box,
17
17
  * its smallest axis scale, and the coarsest level of its field no coarser than the cascade,
@@ -19,8 +19,8 @@ import { MESH_BRICK_INSTANCE_STRUCT } from "./MESH_BRICK_INSTANCE_STRUCT.js";
19
19
  * `mesh_brick_accept` is the gather's leaf filter, with `bounds` the row's world box and `voxel` the
20
20
  * cascade's: the row is in the SDF world, its geometry's field is resident (a skinned clone's through
21
21
  * its source's, the hook), and its box resolves in the cascade (`brick_provider_resolves`). A virtual
22
- * geometry's field is the one baked for its proxy and adopted into it (§7.8), so its rows are taken as
23
- * a mesh's are, once it is resident.
22
+ * geometry's header is an alias of its proxy's (§7.8), so its rows are taken as a mesh's are, once the
23
+ * proxy's field is resident.
24
24
  *
25
25
  * `mesh_brick_instance` makes the instance the texels sample: the inverse of its transform, its box,
26
26
  * its smallest axis scale, and the coarsest level of its field no coarser than the cascade,
@@ -38,13 +38,16 @@ export class GPUMaterialManager {
38
38
  * @param {GPUViewContext} options.view
39
39
  * @param {number} options.texture_viz_mesh
40
40
  * @param {number} options.texture_viz_triangle
41
+ * @param {number} options.texture_normal the normal target to write, `rgba16uint` at the view's
42
+ * resolution. The caller owns it so that it outlives the frame: reprojection reads last frame's.
41
43
  * @returns {{g_pbr: number, g_normal: number, g_albedo: number, g_emissive: number}} updated g-buffer
42
44
  */
43
- graph_viz_render({ graph, view, texture_viz_mesh, texture_viz_triangle, }: {
45
+ graph_viz_render({ graph, view, texture_viz_mesh, texture_viz_triangle, texture_normal, }: {
44
46
  graph: FrameGraph;
45
47
  view: GPUViewContext;
46
48
  texture_viz_mesh: number;
47
49
  texture_viz_triangle: number;
50
+ texture_normal: number;
48
51
  }): {
49
52
  g_pbr: number;
50
53
  g_normal: number;
@@ -1 +1 @@
1
- {"version":3,"file":"GPUMaterialManager.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/material/GPUMaterialManager.js"],"names":[],"mappings":"AA4NA;IA4FI;;;;;;;;OAQG;IACH,yCANW,cAAc,oBACd,qBAAqB,YACrB,gBAAgB,qBAChB,qBAAqB,aACrB,iBAAiB,EAiD3B;IAlJD;;;;;OAKG;IACH,wBAAkC;IAOlC;;;OAGG;IACH,UAFU,IAAI,aAAa,EAAE,kBAAkB,CAAC,CAE3B;IAyBrB;;;OAGG;IACH,yCAEC;IAID;;;OAGG;IACH,sBAEC;IAsLD;;;;;;;;OAQG;IACH;QAN+B,KAAK,EAAzB,UAAU;QACc,IAAI,EAA5B,cAAc;QACE,gBAAgB,EAAhC,MAAM;QACU,oBAAoB,EAApC,MAAM;QACJ;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAC,CAiMnF;IAED;;;;OAIG;IACH,iBAHW,aAAa,GACX,kBAAkB,CAqB9B;IAED;;;;;;;;;;;;OAYG;IACH,kBAHW,aAAa,GACX,OAAO,CAyBnB;IAED;;;;OAIG;IACH,gBAaC;IAED;;;;;;;OAOG;IACH,0BAFW,eAAe,QAazB;IAED;;;;;;;;;;;OAWG;IACH,kBAHW,qBAAqB,GACnB,QAAQ,IAAI,CAAC,CAMzB;IAsBD;;;;;;OAMG;IACH,0BAHW,aAAa,EAAE,GACb,aAAa,EAAE,CAI3B;IAED;;;;;;OAMG;IACH,wBAHW,aAAa,EAAE,GACb,aAAa,EAAE,CAI3B;IAuED;;;OAGG;IACH,YAFW,sBAAsB,QAmChC;;CAEJ;8BAr4BY,OAAO,0CAA0C,EAAE,eAAe;6BAClE,OAAO,2BAA2B,EAAE,cAAc;yBAIlD,OAAO,2DAA2D,EAAE,UAAU;qCAC9E,OAAO,wCAAwC,EAAE,sBAAsB;oCACvE,OAAO,gDAAgD,EAAE,qBAAqB;+BAC9E,OAAO,gCAAgC,EAAE,gBAAgB;gCACzD,OAAO,yBAAyB,EAAE,iBAAiB;6BACnD,OAAO,8BAA8B,EAAE,cAAc;oCACrD,OAAO,6CAA6C,EAAE,qBAAqB;4BAC3E,OAAO,oBAAoB,EAAE,aAAa;oCAC1C,OAAO,qCAAqC,EAAE,qBAAqB;mCAtBzE,yBAAyB;mCAjBG,8CAA8C"}
1
+ {"version":3,"file":"GPUMaterialManager.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/material/GPUMaterialManager.js"],"names":[],"mappings":"AA4NA;IA4FI;;;;;;;;OAQG;IACH,yCANW,cAAc,oBACd,qBAAqB,YACrB,gBAAgB,qBAChB,qBAAqB,aACrB,iBAAiB,EAiD3B;IAlJD;;;;;OAKG;IACH,wBAAkC;IAOlC;;;OAGG;IACH,UAFU,IAAI,aAAa,EAAE,kBAAkB,CAAC,CAE3B;IAyBrB;;;OAGG;IACH,yCAEC;IAID;;;OAGG;IACH,sBAEC;IAsLD;;;;;;;;;;OAUG;IACH;QAR+B,KAAK,EAAzB,UAAU;QACc,IAAI,EAA5B,cAAc;QACE,gBAAgB,EAAhC,MAAM;QACU,oBAAoB,EAApC,MAAM;QACU,cAAc,EAA9B,MAAM;QAEJ;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAC,CA4LnF;IAED;;;;OAIG;IACH,iBAHW,aAAa,GACX,kBAAkB,CAqB9B;IAED;;;;;;;;;;;;OAYG;IACH,kBAHW,aAAa,GACX,OAAO,CAyBnB;IAED;;;;OAIG;IACH,gBAaC;IAED;;;;;;;OAOG;IACH,0BAFW,eAAe,QAazB;IAED;;;;;;;;;;;OAWG;IACH,kBAHW,qBAAqB,GACnB,QAAQ,IAAI,CAAC,CAMzB;IAsBD;;;;;;OAMG;IACH,0BAHW,aAAa,EAAE,GACb,aAAa,EAAE,CAI3B;IAED;;;;;;OAMG;IACH,wBAHW,aAAa,EAAE,GACb,aAAa,EAAE,CAI3B;IAuED;;;OAGG;IACH,YAFW,sBAAsB,QAmChC;;CAEJ;8BAl4BY,OAAO,0CAA0C,EAAE,eAAe;6BAClE,OAAO,2BAA2B,EAAE,cAAc;yBAIlD,OAAO,2DAA2D,EAAE,UAAU;qCAC9E,OAAO,wCAAwC,EAAE,sBAAsB;oCACvE,OAAO,gDAAgD,EAAE,qBAAqB;+BAC9E,OAAO,gCAAgC,EAAE,gBAAgB;gCACzD,OAAO,yBAAyB,EAAE,iBAAiB;6BACnD,OAAO,8BAA8B,EAAE,cAAc;oCACrD,OAAO,6CAA6C,EAAE,qBAAqB;4BAC3E,OAAO,oBAAoB,EAAE,aAAa;oCAC1C,OAAO,qCAAqC,EAAE,qBAAqB;mCAtBzE,yBAAyB;mCAjBG,8CAA8C"}
@@ -467,6 +467,8 @@ export class GPUMaterialManager {
467
467
  * @param {GPUViewContext} options.view
468
468
  * @param {number} options.texture_viz_mesh
469
469
  * @param {number} options.texture_viz_triangle
470
+ * @param {number} options.texture_normal the normal target to write, `rgba16uint` at the view's
471
+ * resolution. The caller owns it so that it outlives the frame: reprojection reads last frame's.
470
472
  * @returns {{g_pbr: number, g_normal: number, g_albedo: number, g_emissive: number}} updated g-buffer
471
473
  */
472
474
  graph_viz_render({
@@ -474,9 +476,11 @@ export class GPUMaterialManager {
474
476
  view,
475
477
  texture_viz_mesh,
476
478
  texture_viz_triangle,
479
+ texture_normal,
477
480
  }) {
478
481
 
479
482
  assert.defined(graph, 'graph');
483
+ assert.isNonNegativeInteger(texture_normal, 'texture_normal');
480
484
  assert.defined(view, 'view');
481
485
 
482
486
  /**
@@ -620,14 +624,7 @@ export class GPUMaterialManager {
620
624
  usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING,
621
625
  })
622
626
  );
623
- pass_data.g_normal = pass.create(
624
- "g-buffer / Normal",
625
- TextureResourceDescriptor.from({
626
- format: 'rgba16uint',
627
- resolution: view.resolution,
628
- usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING,
629
- })
630
- );
627
+ pass_data.g_normal = pass.write(texture_normal);
631
628
  pass_data.g_albedo = pass.create(
632
629
  "g-buffer / Albedo",
633
630
  TextureResourceDescriptor.from({
@@ -27,21 +27,25 @@ export class GTAO {
27
27
  * @param {number} options.input_depth this frame's depth
28
28
  * @param {number} options.input_hzb hierarchical depth built from it
29
29
  * @param {number} options.input_normal G-buffer normals
30
+ * @param {number} options.input_normal_previous last frame's G-buffer normals, at the size last frame was
31
+ * drawn at: which surface each history texel was written on
30
32
  * @param {number} options.input_velocity per-pixel velocity, in this frame's pixels
31
33
  * @param {number} options.input_occlusion depth-clip pass output: history confidence in r
32
34
  * @param {number} options.frame_index the renderer's frame counter: drives the noise, the history
33
35
  * ping-pong, and whether the history follows on from the last frame drawn
34
36
  * @param {number} options.output G-buffer albedo; AO is blended into its alpha
35
37
  * @param {number[]} options.resolution this frame's render size
36
- * @returns {{visibility:number, occlusion:number, bent_normals:number}} the accumulated visibility
37
- * moments, `output` after the composite, and the raw bent normals
38
+ * @returns {{visibility:number, occlusion:number, bent_normals:number}} the accumulated visibility and
39
+ * bend (`rgba16float`), `output` after the composite, and the accumulated bent normals, octahedral in
40
+ * `rg16uint` as `input_normal` is
38
41
  */
39
- graph_pass({ graph, camera, input_depth, input_hzb, input_normal, input_velocity, input_occlusion, frame_index, output, resolution }: {
42
+ graph_pass({ graph, camera, input_depth, input_hzb, input_normal, input_normal_previous, input_velocity, input_occlusion, frame_index, output, resolution }: {
40
43
  graph: FrameGraph;
41
44
  camera: number;
42
45
  input_depth: number;
43
46
  input_hzb: number;
44
47
  input_normal: number;
48
+ input_normal_previous: number;
45
49
  input_velocity: number;
46
50
  input_occlusion: number;
47
51
  frame_index: number;
@@ -1 +1 @@
1
- {"version":3,"file":"GTAO.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/postprocess/gtao/GTAO.js"],"names":[],"mappings":"AAQA;;GAEG;AAEH;IAqBI;;;OAGG;IACH,uCAUC;IA5BD;;;;OAIG;IACH,eAFU,OAAO,CAEI;IAyBrB;;;;OAIG;IACH,0BAFW,eAAe,QAOzB;IAED;;;;;;;;;;;;;;;;OAgBG;IACH;QAd+B,KAAK;QACT,MAAM,EAAtB,MAAM;QACU,WAAW,EAA3B,MAAM;QACU,SAAS,EAAzB,MAAM;QACU,YAAY,EAA5B,MAAM;QACU,cAAc,EAA9B,MAAM;QACU,eAAe,EAA/B,MAAM;QACU,WAAW,EAA3B,MAAM;QAEU,MAAM,EAAtB,MAAM;QACY,UAAU,EAA5B,MAAM,EAAE;QACN;QAAC,UAAU,EAAC,MAAM,CAAC;QAAC,SAAS,EAAC,MAAM,CAAC;QAAC,YAAY,EAAC,MAAM,CAAA;KAAC,CA4GtE;;CACJ;8BA/KY,OAAO,6CAA6C,EAAE,eAAe"}
1
+ {"version":3,"file":"GTAO.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/postprocess/gtao/GTAO.js"],"names":[],"mappings":"AASA;;GAEG;AAEH;IAqBI;;;OAGG;IACH,uCAWC;IA7BD;;;;OAIG;IACH,eAFU,OAAO,CAEI;IA0BrB;;;;OAIG;IACH,0BAFW,eAAe,QAOzB;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH;QAjB+B,KAAK;QACT,MAAM,EAAtB,MAAM;QACU,WAAW,EAA3B,MAAM;QACU,SAAS,EAAzB,MAAM;QACU,YAAY,EAA5B,MAAM;QACU,qBAAqB,EAArC,MAAM;QAEU,cAAc,EAA9B,MAAM;QACU,eAAe,EAA/B,MAAM;QACU,WAAW,EAA3B,MAAM;QAEU,MAAM,EAAtB,MAAM;QACY,UAAU,EAA5B,MAAM,EAAE;QACN;QAAC,UAAU,EAAC,MAAM,CAAC;QAAC,SAAS,EAAC,MAAM,CAAC;QAAC,YAAY,EAAC,MAAM,CAAA;KAAC,CAqHtE;;CACJ;8BA3LY,OAAO,6CAA6C,EAAE,eAAe"}
@@ -1,10 +1,11 @@
1
+ import { TextureResourceDescriptor } from "../../../device/graph/TextureResourceDescriptor.js";
1
2
  import { graph_image_pass } from "../../shader/graph/graph_image_pass.js";
2
3
  import { graph_import_texture } from "../../shader/graph/graph_import_texture.js";
3
4
  import { GPUTextureContext } from "../../texture/GPUTextureContext.js";
4
- import { shader_denoise_luminance_spatial } from "../denoise/fragment_shader_denoise_ao.js";
5
5
  import { ao_reproject_shader } from "./ao_reproject_shader.js";
6
6
  import { fragment_shader_gtao } from "./fragment_shader_gtao.js";
7
7
  import { shader_ao_composit } from "./graph_composit_ao_to_gBuffer.js";
8
+ import { shader_gtao_spatial_denoise } from "./shader_gtao_spatial_denoise.js";
8
9
 
9
10
  /**
10
11
  * @typedef {import("../../../device/pipeline/PipelineEnquiry.js").PipelineEnquiry} PipelineEnquiry
@@ -40,7 +41,8 @@ export class GTAO {
40
41
  for (let i = 0; i < 2; i++) {
41
42
  const texture = new GPUTextureContext(graphics.device);
42
43
 
43
- texture.descriptor.format = "rg16float";
44
+ // visibility, and the bend: the bent normal minus the shading normal
45
+ texture.descriptor.format = "rgba16float";
44
46
  texture.descriptor.usage = GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.RENDER_ATTACHMENT;
45
47
 
46
48
  this.#history[i] = texture;
@@ -54,7 +56,7 @@ export class GTAO {
54
56
  */
55
57
  enquirePipelines(enquiry) {
56
58
  enquiry.render.push(fragment_shader_gtao.pipeline);
57
- enquiry.render.push(shader_denoise_luminance_spatial.pipeline);
59
+ enquiry.render.push(shader_gtao_spatial_denoise.pipeline);
58
60
  enquiry.render.push(ao_reproject_shader.pipeline);
59
61
  enquiry.render.push(shader_ao_composit.pipeline);
60
62
  }
@@ -67,14 +69,17 @@ export class GTAO {
67
69
  * @param {number} options.input_depth this frame's depth
68
70
  * @param {number} options.input_hzb hierarchical depth built from it
69
71
  * @param {number} options.input_normal G-buffer normals
72
+ * @param {number} options.input_normal_previous last frame's G-buffer normals, at the size last frame was
73
+ * drawn at: which surface each history texel was written on
70
74
  * @param {number} options.input_velocity per-pixel velocity, in this frame's pixels
71
75
  * @param {number} options.input_occlusion depth-clip pass output: history confidence in r
72
76
  * @param {number} options.frame_index the renderer's frame counter: drives the noise, the history
73
77
  * ping-pong, and whether the history follows on from the last frame drawn
74
78
  * @param {number} options.output G-buffer albedo; AO is blended into its alpha
75
79
  * @param {number[]} options.resolution this frame's render size
76
- * @returns {{visibility:number, occlusion:number, bent_normals:number}} the accumulated visibility
77
- * moments, `output` after the composite, and the raw bent normals
80
+ * @returns {{visibility:number, occlusion:number, bent_normals:number}} the accumulated visibility and
81
+ * bend (`rgba16float`), `output` after the composite, and the accumulated bent normals, octahedral in
82
+ * `rg16uint` as `input_normal` is
78
83
  */
79
84
  graph_pass({
80
85
  graph,
@@ -82,6 +87,7 @@ export class GTAO {
82
87
  input_depth,
83
88
  input_hzb,
84
89
  input_normal,
90
+ input_normal_previous,
85
91
  input_velocity,
86
92
  input_occlusion,
87
93
  frame_index,
@@ -102,8 +108,15 @@ export class GTAO {
102
108
  const moments_history = graph_import_texture(graph, h0, "ao_history");
103
109
  const moments_output = graph_import_texture(graph, h1, "ao_output");
104
110
 
111
+ // written by the reprojection beside the history, so it is asked of the graph rather than of a pass
112
+ let bent_normals = graph.create_resource("bent normals", TextureResourceDescriptor.from({
113
+ resolution,
114
+ dimension: "2d",
115
+ format: "rg16uint",
116
+ usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.RENDER_ATTACHMENT
117
+ }));
105
118
 
106
- const [raw_occlusion, raw_bent_normals] = graph_image_pass({
119
+ const [raw_occlusion] = graph_image_pass({
107
120
  graph,
108
121
  shader: fragment_shader_gtao,
109
122
  output_resolution: resolution,
@@ -126,16 +139,13 @@ export class GTAO {
126
139
  // apply small spatial denoise
127
140
  [moments] = graph_image_pass({
128
141
  graph,
129
- shader: shader_denoise_luminance_spatial,
142
+ shader: shader_gtao_spatial_denoise,
130
143
  output_resolution: resolution,
131
144
  input_depth,
132
145
  inputs: {
133
146
  tInput: moments,
134
147
  tDepth: input_depth,
135
148
  tNormal: input_normal,
136
- settings: {
137
- step_size: 1,
138
- }
139
149
  }
140
150
  });
141
151
 
@@ -145,18 +155,21 @@ export class GTAO {
145
155
  this.reset_history = false;
146
156
  this.#history_frame_index = frame_index;
147
157
 
148
- [moments] = graph_image_pass({
158
+ [moments, bent_normals] = graph_image_pass({
149
159
  graph,
150
160
  shader: ao_reproject_shader,
151
- output: [moments_output],
161
+ output: [moments_output, bent_normals],
152
162
  input_depth,
153
163
  inputs: {
154
164
  tInput: moments,
155
165
  tHistory: moments_history,
156
166
  tVelocity: input_velocity,
157
167
  tOcclusion: input_occlusion,
168
+ tNormal: input_normal,
169
+ tNormalPrevious: input_normal_previous,
158
170
  settings: {
159
171
  history_validity: history_valid ? 1 : 0,
172
+ frame_index,
160
173
  },
161
174
  }
162
175
  });
@@ -179,7 +192,7 @@ export class GTAO {
179
192
  return {
180
193
  visibility: moments,
181
194
  occlusion: filtered_occlusion,
182
- bent_normals: raw_bent_normals,
195
+ bent_normals: bent_normals,
183
196
  };
184
197
  }
185
198
  }
@@ -1,3 +1,17 @@
1
+ /**
2
+ * Accumulates GTAO over time: visibility, and the bend that makes the bent normal.
3
+ *
4
+ * The bend takes the history only where the history was written on this texel's surface, by the face normals of
5
+ * `tNormalPrevious` — last frame's G-buffer normal — against this frame's.
6
+ *
7
+ * `tInput`, `tHistory` and the first target are `rgba16float`: visibility in `x`, and in `yzw` the world-space
8
+ * bend — the bent normal minus the shading normal. Each is clamped to this frame's 3x3 neighbourhood before it
9
+ * blends, visibility to a box and the bend to a ball. The second target is the bent normal itself,
10
+ * `normalize(shading normal + bend)`, octahedral in `rg16uint` as the G-buffer normal is, which is what lighting
11
+ * reads.
12
+ *
13
+ * @type {ImageShader}
14
+ */
1
15
  export const ao_reproject_shader: ImageShader;
2
16
  import { ImageShader } from "../../shader/ImageShader.js";
3
17
  //# sourceMappingURL=ao_reproject_shader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ao_reproject_shader.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/postprocess/gtao/ao_reproject_shader.js"],"names":[],"mappings":"AA4KA,8CAaE;4BAnL0B,6BAA6B"}
1
+ {"version":3,"file":"ao_reproject_shader.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/postprocess/gtao/ao_reproject_shader.js"],"names":[],"mappings":"AAwRA;;;;;;;;;;;;;GAaG;AACH,kCAFU,WAAW,CAqBnB;4BA9S0B,6BAA6B"}