@woosh/meep-engine 3.54.0 → 3.55.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/package.json +1 -1
  2. package/src/shade/RENDERER_CONTRACT.md +5 -2
  3. package/src/shade/device/SHADE_DEVICE_FLOOR.d.ts.map +1 -1
  4. package/src/shade/device/SHADE_DEVICE_FLOOR.js +2 -0
  5. package/src/shade/renderer/Renderer.d.ts.map +1 -1
  6. package/src/shade/renderer/Renderer.js +1 -1
  7. package/src/shade/renderer/hiz/generate_downsampler_code.js +1 -1
  8. package/src/shade/renderer/hiz/shader_hzb_reduce_mip0_clip.js +1 -1
  9. package/src/shade/renderer/postprocess/denoise/fragment_shader_denoise_ao.d.ts.map +1 -1
  10. package/src/shade/renderer/postprocess/denoise/fragment_shader_denoise_ao.js +154 -147
  11. package/src/shade/renderer/postprocess/gtao/GTAO.d.ts +2 -1
  12. package/src/shade/renderer/postprocess/gtao/GTAO.d.ts.map +1 -1
  13. package/src/shade/renderer/postprocess/gtao/GTAO.js +5 -1
  14. package/src/shade/renderer/postprocess/gtao/GTAO_CONSTANTS.d.ts +8 -0
  15. package/src/shade/renderer/postprocess/gtao/GTAO_CONSTANTS.d.ts.map +1 -1
  16. package/src/shade/renderer/postprocess/gtao/GTAO_CONSTANTS.js +10 -1
  17. package/src/shade/renderer/postprocess/gtao/ao_reproject_shader.d.ts.map +1 -1
  18. package/src/shade/renderer/postprocess/gtao/ao_reproject_shader.js +5 -0
  19. package/src/shade/renderer/postprocess/gtao/chunk_gtao_compute_mip_level.d.ts +22 -0
  20. package/src/shade/renderer/postprocess/gtao/chunk_gtao_compute_mip_level.d.ts.map +1 -0
  21. package/src/shade/renderer/postprocess/gtao/chunk_gtao_compute_mip_level.js +33 -0
  22. package/src/shade/renderer/postprocess/gtao/chunk_gtao_resolve_hzb_depth.d.ts +22 -0
  23. package/src/shade/renderer/postprocess/gtao/chunk_gtao_resolve_hzb_depth.d.ts.map +1 -0
  24. package/src/shade/renderer/postprocess/gtao/chunk_gtao_resolve_hzb_depth.js +56 -0
  25. package/src/shade/renderer/postprocess/gtao/chunk_gtao_sample_depth.d.ts +13 -0
  26. package/src/shade/renderer/postprocess/gtao/chunk_gtao_sample_depth.d.ts.map +1 -0
  27. package/src/shade/renderer/postprocess/gtao/chunk_gtao_sample_depth.js +42 -0
  28. package/src/shade/renderer/postprocess/gtao/fragment_shader_gtao.d.ts +2 -1
  29. package/src/shade/renderer/postprocess/gtao/fragment_shader_gtao.d.ts.map +1 -1
  30. package/src/shade/renderer/postprocess/gtao/fragment_shader_gtao.js +382 -357
  31. package/src/shade/renderer/postprocess/gtao/fragment_shader_gtao_with_irradiance.d.ts.map +1 -1
  32. package/src/shade/renderer/postprocess/gtao/fragment_shader_gtao_with_irradiance.js +414 -410
  33. package/src/shade/renderer/postprocess/ssr/prefilter/NOTES.md +0 -7
  34. package/src/shade/renderer/volumetrics/irradiance_clipmap/chunk_irradiance_clipmap_local_light.d.ts +10 -5
  35. package/src/shade/renderer/volumetrics/irradiance_clipmap/chunk_irradiance_clipmap_local_light.d.ts.map +1 -1
  36. package/src/shade/renderer/volumetrics/irradiance_clipmap/chunk_irradiance_clipmap_local_light.js +30 -14
  37. package/src/shade/renderer/volumetrics/irradiance_clipmap/chunk_irradiance_clipmap_sample.d.ts.map +1 -1
  38. package/src/shade/renderer/volumetrics/irradiance_clipmap/chunk_irradiance_clipmap_sample.js +17 -3
  39. package/src/engine/graphics3/decal/DecalAtlas.d.ts +0 -43
  40. package/src/engine/graphics3/decal/DecalAtlas.d.ts.map +0 -1
  41. package/src/engine/graphics3/decal/DecalAtlasFill.d.ts +0 -12
  42. package/src/engine/graphics3/decal/DecalAtlasFill.d.ts.map +0 -1
  43. package/src/engine/graphics3/decal/decal_atlas_border.d.ts +0 -52
  44. package/src/engine/graphics3/decal/decal_atlas_border.d.ts.map +0 -1
  45. package/src/shade/renderer/postprocess/gtao/graph_build_depth_mipmap.d.ts +0 -26
  46. package/src/shade/renderer/postprocess/gtao/graph_build_depth_mipmap.d.ts.map +0 -1
  47. package/src/shade/renderer/postprocess/gtao/graph_build_depth_mipmap.js +0 -268
  48. package/src/shade/renderer/postprocess/ssr/copy_shader_f32.d.ts +0 -3
  49. package/src/shade/renderer/postprocess/ssr/copy_shader_f32.d.ts.map +0 -1
  50. package/src/shade/renderer/postprocess/ssr/copy_shader_f32.js +0 -32
  51. package/src/shade/renderer/postprocess/ssr/depth_max_shader.d.ts +0 -17
  52. package/src/shade/renderer/postprocess/ssr/depth_max_shader.d.ts.map +0 -1
  53. package/src/shade/renderer/postprocess/ssr/depth_max_shader.js +0 -98
  54. package/src/shade/renderer/postprocess/ssr/graph_build_depth_max_pyramid.d.ts +0 -23
  55. package/src/shade/renderer/postprocess/ssr/graph_build_depth_max_pyramid.d.ts.map +0 -1
  56. package/src/shade/renderer/postprocess/ssr/graph_build_depth_max_pyramid.js +0 -118
  57. package/src/shade/renderer/volumetrics/chunk_volumetrics_froxel_sample.d.ts +0 -24
  58. package/src/shade/renderer/volumetrics/chunk_volumetrics_froxel_sample.d.ts.map +0 -1
  59. package/src/shade/renderer/volumetrics/gi/chunk_volumetrics_froxel_centre_ws.d.ts +0 -15
  60. package/src/shade/renderer/volumetrics/gi/chunk_volumetrics_froxel_centre_ws.d.ts.map +0 -1
  61. package/src/shade/renderer/volumetrics/gi/chunk_volumetrics_gi.d.ts +0 -17
  62. package/src/shade/renderer/volumetrics/gi/chunk_volumetrics_gi.d.ts.map +0 -1
  63. package/src/shade/renderer/volumetrics/gi/chunk_volumetrics_gi_sample.d.ts +0 -35
  64. package/src/shade/renderer/volumetrics/gi/chunk_volumetrics_gi_sample.d.ts.map +0 -1
  65. package/src/shade/renderer/volumetrics/gi/graph_build_froxel_gi.d.ts +0 -35
  66. package/src/shade/renderer/volumetrics/gi/graph_build_froxel_gi.d.ts.map +0 -1
  67. package/src/shade/renderer/volumetrics/gi/shader_volumetrics_gi.d.ts +0 -10
  68. package/src/shade/renderer/volumetrics/gi/shader_volumetrics_gi.d.ts.map +0 -1
  69. package/src/shade/renderer/volumetrics/gi/volumetrics_gi_resources.d.ts +0 -28
  70. package/src/shade/renderer/volumetrics/gi/volumetrics_gi_resources.d.ts.map +0 -1
  71. package/src/shade/renderer/volumetrics/graph_build_froxel_irradiance.d.ts +0 -48
  72. package/src/shade/renderer/volumetrics/graph_build_froxel_irradiance.d.ts.map +0 -1
  73. package/src/shade/renderer/volumetrics/shader_volumetrics_build_irradiance.d.ts +0 -28
  74. package/src/shade/renderer/volumetrics/shader_volumetrics_build_irradiance.d.ts.map +0 -1
  75. package/src/shade/renderer/volumetrics/shader_volumetrics_classify_froxels.d.ts +0 -16
  76. package/src/shade/renderer/volumetrics/shader_volumetrics_classify_froxels.d.ts.map +0 -1
  77. package/src/shade/renderer/volumetrics/shader_volumetrics_lighting_regimes.d.ts +0 -23
  78. package/src/shade/renderer/volumetrics/shader_volumetrics_lighting_regimes.d.ts.map +0 -1
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "description": "Advanced 3D game engine",
7
7
  "type": "module",
8
8
  "author": "Alexander Goldring",
9
- "version": "3.54.0",
9
+ "version": "3.55.0",
10
10
  "exports": {
11
11
  "./build/*": "./build/*",
12
12
  "./src/*": "./src/*",
@@ -47,12 +47,15 @@ Three consequences that shape everything below:
47
47
  The renderer requires a WebGPU device that meets a fixed floor. There is no feature detection
48
48
  beyond it and no branch that produces a lesser frame.
49
49
 
50
- **Required features** — the adapter must have both, or startup fails:
50
+ **Required features** — the adapter must have all three, or startup fails:
51
51
 
52
52
  - `indirect-first-instance` — indirect draw is used throughout
53
53
  - `float32-blendable` — the MBOIT transparency mode blends into 32-bit float targets. The default mode,
54
54
  AVBOIT, blends `rgba16float` only and does not need it. The feature stays on the floor while MBOIT is
55
55
  selectable at all; retiring it from the floor means retiring MBOIT.
56
+ - `texture-formats-tier1` — the hierarchical Z buffer is reduced in compute into `rg16float` storage
57
+ textures, which core WebGPU cannot write. Without it the HZB texture and every HZB pipeline fail
58
+ validation, and occlusion culling, SSR, screen-space shadows and light culling all read the HZB.
56
59
 
57
60
  **Required limits:**
58
61
 
@@ -65,7 +68,7 @@ The required features and the two fixed limits are one definition, `device/SHADE
65
68
  All of it is checked against the adapter before a device is requested, so a refusal names every
66
69
  feature and limit the adapter lacks, with the value it offers, rather than the first one found.
67
70
 
68
- **Taken when offered, never required:** `timestamp-query`, `subgroups`, `texture-formats-tier1`.
71
+ **Taken when offered, never required:** `timestamp-query`, `subgroups`.
69
72
  `timestamp-query` drives GPU timers and nothing else, and some browsers withhold it on hardware that
70
73
  is otherwise fine — so the timers go quiet when it is absent rather than the renderer refusing to
71
74
  start.
@@ -1 +1 @@
1
- {"version":3,"file":"SHADE_DEVICE_FLOOR.d.ts","sourceRoot":"","sources":["../../../../src/shade/device/SHADE_DEVICE_FLOOR.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH;IACI;;OAEG;cADO,cAAc,mBAAmB,CAAC;IAS5C;;OAEG;YADO,SAAS,OAAO,MAAM,EAAE,MAAM,CAAC,CAAC;GAO3C;oCAjCiC,sCAAsC"}
1
+ {"version":3,"file":"SHADE_DEVICE_FLOOR.d.ts","sourceRoot":"","sources":["../../../../src/shade/device/SHADE_DEVICE_FLOOR.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH;IACI;;OAEG;cADO,cAAc,mBAAmB,CAAC;IAW5C;;OAEG;YADO,SAAS,OAAO,MAAM,EAAE,MAAM,CAAC,CAAC;GAO3C;oCAnCiC,sCAAsC"}
@@ -21,6 +21,8 @@ export const SHADE_DEVICE_FLOOR = Object.freeze({
21
21
  WebGPUExtensionType.IndirectFirstInstance,
22
22
  // the MBOIT transparency mode blends into 32-bit float targets; stays while MBOIT is selectable
23
23
  WebGPUExtensionType.Float32Blendable,
24
+ // the HZB is reduced in compute into rg16float storage textures; core WebGPU has no rg16float storage
25
+ WebGPUExtensionType.TextureFormatsTier1,
24
26
  ]),
25
27
 
26
28
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Renderer.d.ts","sourceRoot":"","sources":["../../../../src/shade/renderer/Renderer.js"],"names":[],"mappings":"AA6IA;IAOI,0BAEC;IAED;;OAEG;IACH,0BAAQ;IAER;;;;;;OAMG;IACH,kDAEC;IAED;;OAEG;IACH,kBAAO;IAYP;;;OAGG;IACH,2BAEC;IAaD,wCAGC;IAED,uCAEC;IAED;;;;OAIG;IACH,wBAFU,yBAAyB,CAEoB;IAEvD;;;;;;;OAOG;IACH,mBAFU,qBAAqB,CAEkB;IAEjD;;;;;OAKG;IACH,mBAFU,oBAAoB,CAEgB;IAE9C;;;OAGG;IACH,QAFU,cAAc,CAEM;IAE9B;;;;;;;;;OASG;IACH,2BAFU,OAAO,CAEiB;IAElC,6BAA4B;IAC5B,8BAA4B;IAC5B;;;;OAIG;IACH,mCAAkC;IAClC;;;;;;;OAOG;IACH,mCAFU,OAAO,CAEyB;IAW1C,oCAIC;IAED,mCAEC;IAYD,oCAIC;IAED,mCAEC;IAED;;;;;;OAMG;IACH,6BAFU,OAAO,CAEmB;IAcpC;;OAEG;IACH,uCAEC;IAyBD,0CAIC;IAED,yCAEC;IAED;;;;;OAKG;IACH,yBAFU,MAAM,CAEY;IAS5B,+CAKC;IAED,8CAEC;IAED,+BAA6B;IAC7B,4CAA0C;IAkB1C,qCAKC;IArBD;;;;;;;;;;OAUG;IACH,oCAGC;IASD;;;;;;;OAOG;IACH,0BAFU,OAAO,CAEe;IAQhC;;;;;OAKG;IACH,oCAOC;IAjBD,mCAEC;IAiBD;;;;;;;;;OASG;IACH,6BAFU,OAAO,CAEmB;IAWpC;;;;;OAKG;IACH,8BAA+C;IAE/C;;;;;;;;OAQG;IACH,6BAFU,OAAO,CAEmB;IAEpC;;;;;;;;;;;;;;OAcG;IACH,8BAFU,OAAO,CAEoB;IAErC;;;;;;;;;;OAUG;IACH,qBAFU,OAAO,CAEW;IAU5B;;;;;OAKG;IACH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;;;;;;;;;OAcG;IACH,0BAFW,eAAe,QA8DzB;IAyDD;;;;;;;;;;;;;;;;;OAiBG;IACH,WAFa,IAAI,CAwChB;IAgCD,4BAwBC;IAkJD;;;;;OAKG;IACH,UAHW,MAAM,KACN,MAAM,QAgBhB;IAoFD,0CAMC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,eAZW,iBAAiB,SACjB,KAAK,uBACL,MAAM,GAIJ,OAAO,CAuCnB;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,yBARW,iBAAiB,SACjB,KAAK,sBACL,MAAM,UACN,iBAAiB,GACf,OAAO,CAiBnB;;CAyiCJ;+BAvpGY,OAAO,8CAA8C,EAAE,gBAAgB;gCACvE,OAAO,+CAA+C,EAAE,iBAAiB;gCACzE,OAAO,+BAA+B,EAAE,iBAAiB;8BACzD,OAAO,gCAAgC,EAAE,eAAe;gCACxD,OAAO,gDAAgD,EAAE,iBAAiB;8BAC1E,OAAO,4BAA4B,EAAE,eAAe;oBACpD,OAAO,kBAAkB,EAAE,KAAK;6BA/BhB,yBAAyB;0CACZ,gCAAgC;sCAEpC,4BAA4B;qCAD7B,2BAA2B;+BAEjC,6CAA6C;gCAC5C,sCAAsC;2BAhC3C,yCAAyC;6BAFvC,4CAA4C;8BAD3C,2CAA2C;4BAoD7C,uBAAuB;gCA/DnB,sBAAsB;oBAjDlC,4BAA4B;kCA6Gd,gCAAgC;2BA7EvC,2BAA2B;iCA2ErB,0CAA0C;4CA7D/B,+DAA+D;yBA0ClF,yBAAyB;kCAChB,kCAAkC;kCAUlC,wBAAwB;oBAnCtC,0BAA0B;gCAnDd,uCAAuC;uCAyChC,sDAAsD"}
@@ -1562,7 +1562,6 @@ export class Renderer {
1562
1562
  // for the sake of a feature the renderer does not need to run.
1563
1563
  WebGPUExtensionType.TimestampQuery,
1564
1564
  WebGPUExtensionType.Subgroups,
1565
- WebGPUExtensionType.TextureFormatsTier1,
1566
1565
  /*
1567
1566
  Compressed textures. Taken when offered and never required: a device with none of
1568
1567
  them still loads every scene, because the asset layer asks what is supported before
@@ -2845,6 +2844,7 @@ export class Renderer {
2845
2844
  input_velocity: gr_velocity,
2846
2845
  input_normal: gr_texture_normal,
2847
2846
  input_occlusion: gr_occlusion_clip,
2847
+ input_hzb: gr_texture_hzb,
2848
2848
  // NOTE: AO is blended into the G-buffer
2849
2849
  output: gr_texture_material_albedo_ao,
2850
2850
  camera: gr_buffer_camera_current,
@@ -43,7 +43,7 @@ export function generate_downsampler_code({
43
43
  return CodeChunk.from(
44
44
  //language=WGSL
45
45
  `
46
- @compute @workgroup_size(8, 8, 1)
46
+ @compute @workgroup_size(16, 16)
47
47
  fn main(
48
48
  @builtin(global_invocation_id) global_id: vec3<u32>,
49
49
  ) {
@@ -31,7 +31,7 @@ resources.createGroup()
31
31
  const body = CodeChunk.from(
32
32
  //language=WGSL
33
33
  `
34
- @compute @workgroup_size(8, 8, 1)
34
+ @compute @workgroup_size(16, 16)
35
35
  fn main(
36
36
  @builtin(global_invocation_id) global_id: vec3<u32>,
37
37
  ) {
@@ -1 +1 @@
1
- {"version":3,"file":"fragment_shader_denoise_ao.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/postprocess/denoise/fragment_shader_denoise_ao.js"],"names":[],"mappings":"AAYA,kDAEG;AAsHH;;;GAGG;AACH,yCAFU,gBAAgB,CAMvB;AAEH,2DAKE;6BAlJ2B,mCAAmC;iCAQ/B,kCAAkC;4BAFvC,6BAA6B"}
1
+ {"version":3,"file":"fragment_shader_denoise_ao.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/postprocess/denoise/fragment_shader_denoise_ao.js"],"names":[],"mappings":"AAaA,kDAEG;AAsHH;;;GAGG;AACH,yCAFU,gBAAgB,CAMvB;AAEH,2DAWE;6BAxJ2B,mCAAmC;iCAQ/B,kCAAkC;4BAFvC,6BAA6B"}
@@ -1,148 +1,155 @@
1
- import { i32 } from "../../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
2
- import { WebGPUStruct } from "../../shader/type/WebGPUStruct.js";
3
- import { chunk_decode_g_buffer_normal } from "../../shader/chunk/geometry/normal/chunk_decode_g_buffer_normal.js";
4
- import {
5
- chunk_texture_channel_compute_variance_center
6
- } from "../../shader/chunk/texture/chunk_texture_channel_compute_variance_center.js";
7
- import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
8
- import { ImageShader } from "../../shader/ImageShader.js";
9
- import { ShaderResourceSetDescriptor } from "../../shader/resource/ShaderResourceSetDescriptor.js";
10
- import { ShaderDescriptor } from "../../shader/ShaderDescriptor.js";
11
- import { chunk_compute_edge_stopping_weight } from "../../shader/chunk/filter/chunk_compute_edge_stopping_weight.js";
12
-
13
- export const ATORUS_UNIFORMS_STRUCT = WebGPUStruct.from({
14
- step_size: i32
15
- });
16
-
17
- const resources = new ShaderResourceSetDescriptor();
18
-
19
- // per-pass, four bytes, read-only: immediate data rather than a uniform buffer
20
- resources.setImmediate("settings", ATORUS_UNIFORMS_STRUCT);
21
-
22
- resources.createGroup()
23
- .addTexture("tInput")
24
- .addTexture("tDepth")
25
- .addTexture("tNormal", "uint");
26
-
27
- const body = CodeChunk.from(
28
- //language=WGSL
29
- `
30
- const phi_visibility = 4.0;
31
- const phi_normal = 128.0;
32
- const sigma_depth = 1.0;
33
-
34
- @fragment
35
- fn main(
36
- @builtin(position) coord: vec4<f32>,
37
- ) -> @location(0) vec2<f32>{
38
- let ipos = vec2<i32>(coord.xy);
39
- let screen_size = vec2<i32>(textureDimensions(tInput));
40
-
41
- const eps_variance = 1e-10;
42
- const kernel_weights = array<f32,3>( 1.0, 2.0 / 3.0, 1.0 / 6.0 );
43
-
44
- // constant samplers to prevent the compiler from generating code which
45
- // fetches the sampler descriptor from memory for each texture access
46
- let center_visibility = textureLoad(tInput, ipos, 0).rg;
47
-
48
- // variance estimate from per-pixel moments, filtered using 3x3 gaussian blur
49
- let variance = texture_channel_compute_variance_center( ipos, tInput);
50
-
51
- let std_dev = sqrt(max(0.0, eps_variance + variance));
52
-
53
- let phi_visibility = phi_visibility * std_dev;
54
-
55
- // explicitly store/accumulate center pixel with weight 1 to prevent issues
56
- // with the edge-stopping functions
57
- var sum_w_visibility = 1.0;
58
- var sum_visibility = center_visibility;
59
-
60
-
61
- let current_normal = decode_g_buffer_normal(textureLoad(tNormal, ipos, 0).xy);
62
- let center_depth = textureLoad(tDepth, ipos, 0).r;
63
-
64
- const offsets = array< vec2<i32>,8>(
65
- vec2( -1, -1 ),
66
- vec2( 0, -1 ) ,
67
- vec2( 1, -1 ),
68
- vec2( -1, 0 ),
69
- vec2( 1, 0 ),
70
- vec2( -1, 1 ),
71
- vec2( 0, 1 ),
72
- vec2( 1, 1 ),
73
- );
74
-
75
- const num_samples = 8;
76
-
77
- for(var i=0; i< num_samples; i++){
78
- let offset = offsets[i];
79
-
80
- let xx = offset.x;
81
- let yy = offset.y;
82
-
83
- let p = ipos + offset * settings.step_size;
84
- let inside = all(p >= vec2(0, 0)) && all(p < screen_size);
85
-
86
- if(!inside){
87
- continue;
88
- }
89
-
90
- let kernel = kernel_weights[ abs(xx) ] * kernel_weights[ abs(yy) ];
91
-
92
- let sample_visibility = textureLoad(tInput, p, 0).rg;
93
-
94
- let sample_normal = decode_g_buffer_normal(textureLoad(tNormal, p, 0).xy);
95
- let sample_depth = textureLoad(tDepth, p, 0).r;
96
-
97
- // compute the edge-stopping functions
98
- let w = compute_edge_stopping_weight(
99
- center_depth,
100
- sample_depth,
101
- sigma_depth,
102
-
103
- current_normal,
104
- sample_normal,
105
- phi_normal,
106
-
107
- center_visibility.r,
108
- sample_visibility.r,
109
- phi_visibility
110
- );
111
-
112
- let w_visibility = w * kernel;
113
-
114
- // both channels carry moments (E[X], E[X²]) - average linearly so the
115
- // pair remains a valid moment estimate that downstream get_std_dev can interpret.
116
- sum_w_visibility += w_visibility;
117
- sum_visibility += w_visibility * sample_visibility;
118
- }
119
-
120
- // output first two moments
121
- let out_visibility = sum_visibility / sum_w_visibility;
122
-
123
- return out_visibility;
124
- }
125
- `,
126
- [
127
- ATORUS_UNIFORMS_STRUCT.declaration_chunk,
128
- chunk_texture_channel_compute_variance_center,
129
- chunk_decode_g_buffer_normal,
130
- chunk_compute_edge_stopping_weight,
131
- ]);
132
-
133
- /**
134
- * Based on REBLUR paper, a type of Gaussian blur with edge-stopping
135
- * @type {ShaderDescriptor}
136
- */
137
- export const fragment_shader_denoise_ao = ShaderDescriptor.from({
138
- label: "A-torus Denoise",
139
- resources,
140
- body
141
- });
142
-
143
- export const shader_denoise_luminance_spatial = ImageShader.from({
144
- descriptor: fragment_shader_denoise_ao,
145
- targets: [
146
- { format: "rg16float" }
147
- ]
1
+ import { DEPTH_STENCIL_FOREGROUND_ONLY } from "../../depth/DEPTH_STENCIL_FOREGROUND_ONLY.js";
2
+ import { i32 } from "../../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
3
+ import { WebGPUStruct } from "../../shader/type/WebGPUStruct.js";
4
+ import { chunk_decode_g_buffer_normal } from "../../shader/chunk/geometry/normal/chunk_decode_g_buffer_normal.js";
5
+ import {
6
+ chunk_texture_channel_compute_variance_center
7
+ } from "../../shader/chunk/texture/chunk_texture_channel_compute_variance_center.js";
8
+ import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
9
+ import { ImageShader } from "../../shader/ImageShader.js";
10
+ import { ShaderResourceSetDescriptor } from "../../shader/resource/ShaderResourceSetDescriptor.js";
11
+ import { ShaderDescriptor } from "../../shader/ShaderDescriptor.js";
12
+ import { chunk_compute_edge_stopping_weight } from "../../shader/chunk/filter/chunk_compute_edge_stopping_weight.js";
13
+
14
+ export const ATORUS_UNIFORMS_STRUCT = WebGPUStruct.from({
15
+ step_size: i32
16
+ });
17
+
18
+ const resources = new ShaderResourceSetDescriptor();
19
+
20
+ // per-pass, four bytes, read-only: immediate data rather than a uniform buffer
21
+ resources.setImmediate("settings", ATORUS_UNIFORMS_STRUCT);
22
+
23
+ resources.createGroup()
24
+ .addTexture("tInput")
25
+ .addTexture("tDepth")
26
+ .addTexture("tNormal", "uint");
27
+
28
+ const body = CodeChunk.from(
29
+ //language=WGSL
30
+ `
31
+ const phi_visibility = 4.0;
32
+ const phi_normal = 128.0;
33
+ const sigma_depth = 1.0;
34
+
35
+ @fragment
36
+ fn main(
37
+ @builtin(position) coord: vec4<f32>,
38
+ ) -> @location(0) vec2<f32>{
39
+ let ipos = vec2<i32>(coord.xy);
40
+ let screen_size = vec2<i32>(textureDimensions(tInput));
41
+
42
+ const eps_variance = 1e-10;
43
+ const kernel_weights = array<f32,3>( 1.0, 2.0 / 3.0, 1.0 / 6.0 );
44
+
45
+ // constant samplers to prevent the compiler from generating code which
46
+ // fetches the sampler descriptor from memory for each texture access
47
+ let center_visibility = textureLoad(tInput, ipos, 0).rg;
48
+
49
+ // variance estimate from per-pixel moments, filtered using 3x3 gaussian blur
50
+ let variance = texture_channel_compute_variance_center( ipos, tInput);
51
+
52
+ let std_dev = sqrt(max(0.0, eps_variance + variance));
53
+
54
+ let phi_visibility = phi_visibility * std_dev;
55
+
56
+ // explicitly store/accumulate center pixel with weight 1 to prevent issues
57
+ // with the edge-stopping functions
58
+ var sum_w_visibility = 1.0;
59
+ var sum_visibility = center_visibility;
60
+
61
+
62
+ let current_normal = decode_g_buffer_normal(textureLoad(tNormal, ipos, 0).xy);
63
+ let center_depth = textureLoad(tDepth, ipos, 0).r;
64
+
65
+ const offsets = array< vec2<i32>,8>(
66
+ vec2( -1, -1 ),
67
+ vec2( 0, -1 ) ,
68
+ vec2( 1, -1 ),
69
+ vec2( -1, 0 ),
70
+ vec2( 1, 0 ),
71
+ vec2( -1, 1 ),
72
+ vec2( 0, 1 ),
73
+ vec2( 1, 1 ),
74
+ );
75
+
76
+ const num_samples = 8;
77
+
78
+ for(var i=0; i< num_samples; i++){
79
+ let offset = offsets[i];
80
+
81
+ let xx = offset.x;
82
+ let yy = offset.y;
83
+
84
+ let p = ipos + offset * settings.step_size;
85
+ let inside = all(p >= vec2(0, 0)) && all(p < screen_size);
86
+
87
+ if(!inside){
88
+ continue;
89
+ }
90
+
91
+ let kernel = kernel_weights[ abs(xx) ] * kernel_weights[ abs(yy) ];
92
+
93
+ let sample_visibility = textureLoad(tInput, p, 0).rg;
94
+
95
+ let sample_normal = decode_g_buffer_normal(textureLoad(tNormal, p, 0).xy);
96
+ let sample_depth = textureLoad(tDepth, p, 0).r;
97
+
98
+ // compute the edge-stopping functions
99
+ let w = compute_edge_stopping_weight(
100
+ center_depth,
101
+ sample_depth,
102
+ sigma_depth,
103
+
104
+ current_normal,
105
+ sample_normal,
106
+ phi_normal,
107
+
108
+ center_visibility.r,
109
+ sample_visibility.r,
110
+ phi_visibility
111
+ );
112
+
113
+ let w_visibility = w * kernel;
114
+
115
+ // both channels carry moments (E[X], E[X²]) - average linearly so the
116
+ // pair remains a valid moment estimate that downstream get_std_dev can interpret.
117
+ sum_w_visibility += w_visibility;
118
+ sum_visibility += w_visibility * sample_visibility;
119
+ }
120
+
121
+ // output first two moments
122
+ let out_visibility = sum_visibility / sum_w_visibility;
123
+
124
+ return out_visibility;
125
+ }
126
+ `,
127
+ [
128
+ ATORUS_UNIFORMS_STRUCT.declaration_chunk,
129
+ chunk_texture_channel_compute_variance_center,
130
+ chunk_decode_g_buffer_normal,
131
+ chunk_compute_edge_stopping_weight,
132
+ ]);
133
+
134
+ /**
135
+ * Based on REBLUR paper, a type of Gaussian blur with edge-stopping
136
+ * @type {ShaderDescriptor}
137
+ */
138
+ export const fragment_shader_denoise_ao = ShaderDescriptor.from({
139
+ label: "A-torus Denoise",
140
+ resources,
141
+ body
142
+ });
143
+
144
+ export const shader_denoise_luminance_spatial = ImageShader.from({
145
+ descriptor: fragment_shader_denoise_ao,
146
+ depthStencil: DEPTH_STENCIL_FOREGROUND_ONLY,
147
+ targets: [
148
+ {
149
+ format: "rg16float",
150
+ // Background is skipped, so it keeps the clear: moments of visibility 1 (not occluded), zero variance.
151
+ // Downstream neighbourhoods read across silhouettes and must see background as unoccluded.
152
+ clearValue: [1, 1],
153
+ }
154
+ ]
148
155
  })
@@ -24,6 +24,7 @@ export class GTAO {
24
24
  * @param {FrameGraph} graph
25
25
  * @param {number} camera
26
26
  * @param {number} input_depth
27
+ * @param {number} input_hzb
27
28
  * @param {number} input_color
28
29
  * @param {number} input_depth_previous
29
30
  * @param {number} input_normal
@@ -34,7 +35,7 @@ export class GTAO {
34
35
  * @param {number[]} resolution
35
36
  * @returns {{occlusion:number, bent_normals:number, diffuse_indirect:number}}
36
37
  */
37
- graph_pass({ graph, camera, input_depth, input_depth_previous, input_normal, input_velocity, input_occlusion, frame_index, output, resolution }: FrameGraph): {
38
+ graph_pass({ graph, camera, input_depth, input_hzb, input_depth_previous, input_normal, input_velocity, input_occlusion, frame_index, output, resolution }: FrameGraph): {
38
39
  occlusion: number;
39
40
  bent_normals: number;
40
41
  diffuse_indirect: number;
@@ -1 +1 @@
1
- {"version":3,"file":"GTAO.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/postprocess/gtao/GTAO.js"],"names":[],"mappings":"AAQA;;GAEG;AAEH;IAQI;;;OAGG;IACH,uCAUC;IAED;;;;OAIG;IACH,UAHW,MAAM,KACN,MAAM,QAKhB;IAED;;;;OAIG;IACH,0BAFW,eAAe,QAOzB;IAED;;;;;;;;;;;;;;OAcG;IACH,8JAFa;QAAC,SAAS,EAAC,MAAM,CAAC;QAAC,YAAY,EAAC,MAAM,CAAC;QAAC,gBAAgB,EAAC,MAAM,CAAA;KAAC,CA6F5E;;CACJ;8BA5JY,OAAO,6CAA6C,EAAE,eAAe"}
1
+ {"version":3,"file":"GTAO.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/postprocess/gtao/GTAO.js"],"names":[],"mappings":"AAQA;;GAEG;AAEH;IAQI;;;OAGG;IACH,uCAUC;IAED;;;;OAIG;IACH,UAHW,MAAM,KACN,MAAM,QAKhB;IAED;;;;OAIG;IACH,0BAFW,eAAe,QAOzB;IAED;;;;;;;;;;;;;;;OAeG;IACH,yKAFa;QAAC,SAAS,EAAC,MAAM,CAAC;QAAC,YAAY,EAAC,MAAM,CAAC;QAAC,gBAAgB,EAAC,MAAM,CAAA;KAAC,CAiG5E;;CACJ;8BAjKY,OAAO,6CAA6C,EAAE,eAAe"}
@@ -61,6 +61,7 @@ export class GTAO {
61
61
  * @param {FrameGraph} graph
62
62
  * @param {number} camera
63
63
  * @param {number} input_depth
64
+ * @param {number} input_hzb
64
65
  * @param {number} input_color
65
66
  * @param {number} input_depth_previous
66
67
  * @param {number} input_normal
@@ -75,6 +76,7 @@ export class GTAO {
75
76
  graph,
76
77
  camera,
77
78
  input_depth,
79
+ input_hzb,
78
80
  input_depth_previous,
79
81
  input_normal,
80
82
  input_velocity,
@@ -102,6 +104,7 @@ export class GTAO {
102
104
  input_depth,
103
105
  inputs: {
104
106
  tDepth: input_depth,
107
+ tHZB: input_hzb,
105
108
  tNormal: input_normal,
106
109
  camera,
107
110
  settings: {
@@ -119,6 +122,7 @@ export class GTAO {
119
122
  graph,
120
123
  shader: shader_denoise_luminance_spatial,
121
124
  output_resolution: resolution,
125
+ input_depth,
122
126
  inputs: {
123
127
  tInput: moments,
124
128
  tDepth: input_depth,
@@ -134,6 +138,7 @@ export class GTAO {
134
138
  graph,
135
139
  shader: ao_reproject_shader,
136
140
  output: [moments_output],
141
+ input_depth,
137
142
  inputs: {
138
143
  tInput: moments,
139
144
  tHistory: moments_history,
@@ -164,4 +169,3 @@ export class GTAO {
164
169
  };
165
170
  }
166
171
  }
167
-
@@ -15,6 +15,14 @@ export const GTAO_QUALITY_PROFILES: any;
15
15
  * @type {number}
16
16
  */
17
17
  export const GTAO_DEPTH_MIP_LEVELS: number;
18
+ /**
19
+ * Log2 offset applied to the screen-space step distance (in pixels) when selecting a depth pyramid mip level.
20
+ * Higher values stay on finer mips further out; lower values drop to coarser mips sooner.
21
+ *
22
+ * @see https://github.com/GameTechDev/XeGTAO/blob/a5b1686c7ea37788eeb3576b5be47f7c03db532c/Source/Rendering/Shaders/XeGTAO.h#L71
23
+ * @type {number}
24
+ */
25
+ export const GTAO_DEPTH_MIP_SAMPLING_OFFSET: number;
18
26
  /**
19
27
  * distant samples contribute less
20
28
  * must be in [0, 1] range
@@ -1 +1 @@
1
- {"version":3,"file":"GTAO_CONSTANTS.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/postprocess/gtao/GTAO_CONSTANTS.js"],"names":[],"mappings":"gCAmBU,MAAM;;;;;;;AAShB;;;GAGG;AACH,wCAiBE;AAEF;;;GAGG;AACH,oCAFU,MAAM,CAEuB;AAEvC;;;GAGG;AACH,8CAA+C;AAE/C;;;;GAIG;AACH,iCAFU,MAAM,CAEoB"}
1
+ {"version":3,"file":"GTAO_CONSTANTS.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/postprocess/gtao/GTAO_CONSTANTS.js"],"names":[],"mappings":"gCAmBU,MAAM;;;;;;;AAShB;;;GAGG;AACH,wCAiBE;AAEF;;;GAGG;AACH,oCAFU,MAAM,CAEuB;AAEvC;;;;;;GAMG;AACH,6CAFU,MAAM,CAEmC;AAEnD;;;GAGG;AACH,8CAA+C;AAE/C;;;;GAIG;AACH,iCAFU,MAAM,CAEoB"}
@@ -53,7 +53,16 @@ export const GTAO_QUALITY_PROFILES = {
53
53
  * see https://github.com/GameTechDev/XeGTAO/blob/a5b1686c7ea37788eeb3576b5be47f7c03db532c/Source/Rendering/Shaders/XeGTAO.h#L55
54
54
  * @type {number}
55
55
  */
56
- export const GTAO_DEPTH_MIP_LEVELS = 0;
56
+ export const GTAO_DEPTH_MIP_LEVELS = 5;
57
+
58
+ /**
59
+ * Log2 offset applied to the screen-space step distance (in pixels) when selecting a depth pyramid mip level.
60
+ * Higher values stay on finer mips further out; lower values drop to coarser mips sooner.
61
+ *
62
+ * @see https://github.com/GameTechDev/XeGTAO/blob/a5b1686c7ea37788eeb3576b5be47f7c03db532c/Source/Rendering/Shaders/XeGTAO.h#L71
63
+ * @type {number}
64
+ */
65
+ export const GTAO_DEPTH_MIP_SAMPLING_OFFSET = 3.30;
57
66
 
58
67
  /**
59
68
  * distant samples contribute less
@@ -1 +1 @@
1
- {"version":3,"file":"ao_reproject_shader.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/postprocess/gtao/ao_reproject_shader.js"],"names":[],"mappings":"AA+JA,8CASE;4BAnK0B,6BAA6B"}
1
+ {"version":3,"file":"ao_reproject_shader.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/postprocess/gtao/ao_reproject_shader.js"],"names":[],"mappings":"AAgKA,8CAaE;4BAvK0B,6BAA6B"}
@@ -1,3 +1,4 @@
1
+ import { DEPTH_STENCIL_FOREGROUND_ONLY } from "../../depth/DEPTH_STENCIL_FOREGROUND_ONLY.js";
1
2
  import { chunk_get_std_dev } from "../../shader/chunk/math/statistics/chunk_get_std_dev.js";
2
3
  import {
3
4
  chunk_texture_sample_catmullrom_hardware_5tap_uv
@@ -163,7 +164,11 @@ export const ao_reproject_shader = new ImageShader({
163
164
  body,
164
165
  resources,
165
166
  }),
167
+ depthStencil: DEPTH_STENCIL_FOREGROUND_ONLY,
166
168
  targets: [{
167
169
  format: "rg16float",
170
+ // Background is skipped, so it keeps the clear: moments of visibility 1 (not occluded), zero variance.
171
+ // This is also next frame's history, whose filtered fetch reaches across silhouettes.
172
+ clearValue: [1, 1],
168
173
  }]
169
174
  })
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Selects the depth pyramid mip level for a GTAO horizon step at `sample_offset_length` screen pixels
3
+ * from the center pixel.
4
+ *
5
+ * Follows Intel XeGTAO's `clamp(log2(sampleOffsetLength) - DepthMIPSamplingOffset, 0, GTAO_DEPTH_MIP_LEVELS - 1)`
6
+ * paired with a `MIP_POINT` sampler (`round` to nearest integer mip). Because Mip 0 lives in `tDepth`
7
+ * while Mips 1..4 live in `tHZB`, rounding here keeps the Mip 0 -> Mip 1 handoff at `lod = 0.5`
8
+ * (`~13.9 px`) rather than `lod > 0.0` (`~9.8 px`). With `GTAO_DEPTH_MIP_SAMPLING_OFFSET = 3.30`:
9
+ * - Mip 0 (`< ~13.9 px`): full-resolution `tDepth`
10
+ * - Mip 1 (`~13.9 .. 27.9 px`): HZB mip 0 (half-res)
11
+ * - Mip 2 (`~27.9 .. 55.7 px`): HZB mip 1 (quarter-res)
12
+ * - Mip 3 (`~55.7 .. 111.4 px`): HZB mip 2 (1/8-res)
13
+ * - Mip 4 (`>= ~111.4 px`): HZB mip 3 (1/16-res)
14
+ *
15
+ * Every mip transition occurs when the tap is at least ~7 texels away at the target mip resolution.
16
+ *
17
+ * @see https://github.com/GameTechDev/XeGTAO/blob/a5b1686c7ea37788eeb3576b5be47f7c03db532c/Source/Rendering/Shaders/XeGTAO.hlsli#L244
18
+ * @type {CodeChunk}
19
+ */
20
+ export const chunk_gtao_compute_mip_level: CodeChunk;
21
+ import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
22
+ //# sourceMappingURL=chunk_gtao_compute_mip_level.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk_gtao_compute_mip_level.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/postprocess/gtao/chunk_gtao_compute_mip_level.js"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;GAkBG;AACH,2CAFU,SAAS,CAUjB;0BAhCwB,oCAAoC"}
@@ -0,0 +1,33 @@
1
+ import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
2
+ import { GTAO_DEPTH_MIP_LEVELS, GTAO_DEPTH_MIP_SAMPLING_OFFSET } from "./GTAO_CONSTANTS.js";
3
+
4
+ const MAX_MIP_LEVEL = Math.max(0, GTAO_DEPTH_MIP_LEVELS - 1);
5
+
6
+ /**
7
+ * Selects the depth pyramid mip level for a GTAO horizon step at `sample_offset_length` screen pixels
8
+ * from the center pixel.
9
+ *
10
+ * Follows Intel XeGTAO's `clamp(log2(sampleOffsetLength) - DepthMIPSamplingOffset, 0, GTAO_DEPTH_MIP_LEVELS - 1)`
11
+ * paired with a `MIP_POINT` sampler (`round` to nearest integer mip). Because Mip 0 lives in `tDepth`
12
+ * while Mips 1..4 live in `tHZB`, rounding here keeps the Mip 0 -> Mip 1 handoff at `lod = 0.5`
13
+ * (`~13.9 px`) rather than `lod > 0.0` (`~9.8 px`). With `GTAO_DEPTH_MIP_SAMPLING_OFFSET = 3.30`:
14
+ * - Mip 0 (`< ~13.9 px`): full-resolution `tDepth`
15
+ * - Mip 1 (`~13.9 .. 27.9 px`): HZB mip 0 (half-res)
16
+ * - Mip 2 (`~27.9 .. 55.7 px`): HZB mip 1 (quarter-res)
17
+ * - Mip 3 (`~55.7 .. 111.4 px`): HZB mip 2 (1/8-res)
18
+ * - Mip 4 (`>= ~111.4 px`): HZB mip 3 (1/16-res)
19
+ *
20
+ * Every mip transition occurs when the tap is at least ~7 texels away at the target mip resolution.
21
+ *
22
+ * @see https://github.com/GameTechDev/XeGTAO/blob/a5b1686c7ea37788eeb3576b5be47f7c03db532c/Source/Rendering/Shaders/XeGTAO.hlsli#L244
23
+ * @type {CodeChunk}
24
+ */
25
+ export const chunk_gtao_compute_mip_level = CodeChunk.from(
26
+ //language=WGSL
27
+ `
28
+ fn gtao_compute_mip_level(sample_offset_length: f32) -> f32 {
29
+ let mip_f = round(log2(max(1.0, sample_offset_length)) - ${GTAO_DEPTH_MIP_SAMPLING_OFFSET});
30
+ return clamp(mip_f, 0.0, f32(${MAX_MIP_LEVEL}));
31
+ }
32
+ `
33
+ );
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Resolves a single reverse-Z device depth from an HZB `(d_min, d_max)` pair (`hzb.x` = farthest,
3
+ * `hzb.y` = closest in the $2^m \times 2^m$ footprint) using a discontinuity-aware slope filter.
4
+ *
5
+ * Why neither pure `hzb.y` (closest) nor pure `0.5 * (hzb.x + hzb.y)` (average) suffices alone
6
+ * (cf. Intel XeGTAO `DepthMIPFilter` and Tomasz Stachowiak / h3r2tic's Tiny Glade linear + point
7
+ * depth-sampling analysis):
8
+ * - On a continuous sloped surface, reverse-Z device depth $1 / (-z_{\text{view}})$ is affine in
9
+ * screen space. Taking only `hzb.y` treats each coarse $2^m \times 2^m$ texel as a flat "Duplo
10
+ * brick" protruding toward the camera, causing false self-occlusion on slopes; averaging
11
+ * `0.5 * (hzb.x + hzb.y)` reconstructs the smooth plane across the footprint.
12
+ * - Across a silhouette edge (depth discontinuity), averaging `hzb.x` and `hzb.y` creates a
13
+ * mid-air "shrink-wrap" phantom surface between foreground and background (or erodes silhouettes
14
+ * against the sky). Weighting `hzb.x` down to zero when `depth_far - depth_near` exceeds the
15
+ * effect falloff collapses the filter to `hzb.y` (the foreground surface).
16
+ *
17
+ * @see https://github.com/GameTechDev/XeGTAO/blob/a5b1686c7ea37788eeb3576b5be47f7c03db532c/Source/Rendering/Shaders/XeGTAO.hlsli#L622
18
+ * @type {CodeChunk}
19
+ */
20
+ export const chunk_gtao_resolve_hzb_depth: CodeChunk;
21
+ import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
22
+ //# sourceMappingURL=chunk_gtao_resolve_hzb_depth.d.ts.map