@woosh/meep-engine 3.51.0 → 3.52.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 (70) hide show
  1. package/package.json +1 -1
  2. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  3. package/src/shade/playground/tonemap_sdr/README.md +5 -3
  4. package/src/shade/renderer/Renderer.d.ts +1 -1
  5. package/src/shade/renderer/Renderer.d.ts.map +1 -1
  6. package/src/shade/renderer/Renderer.js +43 -15
  7. package/src/shade/renderer/ShadeToneMappingMode.d.ts +3 -2
  8. package/src/shade/renderer/ShadeToneMappingMode.js +15 -4
  9. package/src/shade/renderer/deferred/tonemap/TonemapAces2Tables.d.ts +38 -0
  10. package/src/shade/renderer/deferred/tonemap/TonemapAces2Tables.d.ts.map +1 -0
  11. package/src/shade/renderer/deferred/tonemap/TonemapAces2Tables.js +97 -0
  12. package/src/shade/renderer/deferred/{TonemapDisplaySettings.d.ts → tonemap/TonemapDisplaySettings.d.ts} +1 -1
  13. package/src/shade/renderer/deferred/tonemap/TonemapDisplaySettings.d.ts.map +1 -0
  14. package/src/shade/renderer/deferred/{TonemapDisplaySettings.js → tonemap/TonemapDisplaySettings.js} +5 -5
  15. package/src/shade/renderer/deferred/{shader_tonemap_HDR.d.ts → tonemap/shader_tonemap_HDR.d.ts} +1 -1
  16. package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR.d.ts.map +1 -0
  17. package/src/shade/renderer/deferred/{shader_tonemap_HDR.js → tonemap/shader_tonemap_HDR.js} +9 -9
  18. package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR_aces.d.ts +17 -0
  19. package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR_aces.d.ts.map +1 -0
  20. package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR_aces.js +101 -0
  21. package/src/shade/renderer/deferred/{shader_tonemap_HDR_none.d.ts → tonemap/shader_tonemap_HDR_none.d.ts} +1 -1
  22. package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR_none.d.ts.map +1 -0
  23. package/src/shade/renderer/deferred/{shader_tonemap_HDR_none.js → tonemap/shader_tonemap_HDR_none.js} +6 -6
  24. package/src/shade/renderer/deferred/{shader_tonemap_HDR_pbr_neutral.d.ts → tonemap/shader_tonemap_HDR_pbr_neutral.d.ts} +1 -1
  25. package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR_pbr_neutral.d.ts.map +1 -0
  26. package/src/shade/renderer/deferred/{shader_tonemap_HDR_pbr_neutral.js → tonemap/shader_tonemap_HDR_pbr_neutral.js} +8 -8
  27. package/src/shade/renderer/deferred/{shader_tonemap_LDR.d.ts → tonemap/shader_tonemap_LDR.d.ts} +1 -1
  28. package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR.d.ts.map +1 -0
  29. package/src/shade/renderer/deferred/{shader_tonemap_LDR.js → tonemap/shader_tonemap_LDR.js} +10 -10
  30. package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR_aces.d.ts +10 -0
  31. package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR_aces.d.ts.map +1 -0
  32. package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR_aces.js +77 -0
  33. package/src/shade/renderer/deferred/{shader_tonemap_LDR_none.d.ts → tonemap/shader_tonemap_LDR_none.d.ts} +1 -1
  34. package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR_none.d.ts.map +1 -0
  35. package/src/shade/renderer/deferred/{shader_tonemap_LDR_none.js → tonemap/shader_tonemap_LDR_none.js} +7 -7
  36. package/src/shade/renderer/deferred/{shader_tonemap_LDR_pbr_neutral.d.ts → tonemap/shader_tonemap_LDR_pbr_neutral.d.ts} +1 -1
  37. package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR_pbr_neutral.d.ts.map +1 -0
  38. package/src/shade/renderer/deferred/{shader_tonemap_LDR_pbr_neutral.js → tonemap/shader_tonemap_LDR_pbr_neutral.js} +8 -8
  39. package/src/shade/renderer/fluid/GPUFluidCascade.d.ts +3 -3
  40. package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts +1 -1
  41. package/src/shade/renderer/fluid/forcing/GPUFluidForcing.d.ts +6 -6
  42. package/src/shade/renderer/fluid/pressure/GPUFluidPressureSolve.d.ts +1 -1
  43. package/src/shade/renderer/fluid/query/GPUFluidQueries.d.ts +1 -1
  44. package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
  45. package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
  46. package/src/shade/renderer/shader/chunk/color/tonemap/ACES_TONE_MAPPING_BRIEF_2026_10_17.md +160 -0
  47. package/src/shade/renderer/shader/chunk/color/tonemap/HDR_TONE_MAPPING_FORMS_BRIEF_2026_10_16.md +5 -1
  48. package/src/shade/renderer/shader/chunk/color/tonemap/SDR_TONE_MAPPING_BRIEF_2026_10_16.md +15 -5
  49. package/src/shade/renderer/shader/chunk/color/tonemap/aces/aces2_transform_block.d.ts +41 -0
  50. package/src/shade/renderer/shader/chunk/color/tonemap/aces/aces2_transform_block.d.ts.map +1 -0
  51. package/src/shade/renderer/shader/chunk/color/tonemap/aces/aces2_transform_block.js +692 -0
  52. package/src/shade/renderer/shader/chunk/color/tonemap/aces/chunk_aces2_output_transform.d.ts +25 -0
  53. package/src/shade/renderer/shader/chunk/color/tonemap/aces/chunk_aces2_output_transform.d.ts.map +1 -0
  54. package/src/shade/renderer/shader/chunk/color/tonemap/aces/chunk_aces2_output_transform.js +446 -0
  55. package/src/shade/renderer/shader/chunk/color/tonemap/aces/chunk_aces_ue_matrices.d.ts +22 -0
  56. package/src/shade/renderer/shader/chunk/color/tonemap/aces/chunk_aces_ue_matrices.d.ts.map +1 -0
  57. package/src/shade/renderer/shader/chunk/color/tonemap/aces/chunk_aces_ue_matrices.js +68 -0
  58. package/src/shade/renderer/shader/chunk/color/tonemap/aces/chunk_tonemap_ue_filmic.d.ts +32 -0
  59. package/src/shade/renderer/shader/chunk/color/tonemap/aces/chunk_tonemap_ue_filmic.d.ts.map +1 -0
  60. package/src/shade/renderer/shader/chunk/color/tonemap/aces/chunk_tonemap_ue_filmic.js +163 -0
  61. package/src/shade/renderer/shader/chunk/color/tonemap/chunk_PAPER_WHITE_NITS.d.ts +10 -3
  62. package/src/shade/renderer/shader/chunk/color/tonemap/chunk_PAPER_WHITE_NITS.d.ts.map +1 -1
  63. package/src/shade/renderer/shader/chunk/color/tonemap/chunk_PAPER_WHITE_NITS.js +12 -4
  64. package/src/shade/renderer/deferred/TonemapDisplaySettings.d.ts.map +0 -1
  65. package/src/shade/renderer/deferred/shader_tonemap_HDR.d.ts.map +0 -1
  66. package/src/shade/renderer/deferred/shader_tonemap_HDR_none.d.ts.map +0 -1
  67. package/src/shade/renderer/deferred/shader_tonemap_HDR_pbr_neutral.d.ts.map +0 -1
  68. package/src/shade/renderer/deferred/shader_tonemap_LDR.d.ts.map +0 -1
  69. package/src/shade/renderer/deferred/shader_tonemap_LDR_none.d.ts.map +0 -1
  70. package/src/shade/renderer/deferred/shader_tonemap_LDR_pbr_neutral.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.51.0",
9
+ "version": "3.52.0",
10
10
  "exports": {
11
11
  "./build/*": "./build/*",
12
12
  "./src/*": "./src/*",
@@ -66,11 +66,11 @@ export class FluidObstacleSystem extends System<any> {
66
66
  /**
67
67
  * @param {FluidComponent} fluid
68
68
  */
69
- static "__#461@#refresh_masks"(fluid: FluidComponent): void;
69
+ static "__#462@#refresh_masks"(fluid: FluidComponent): void;
70
70
  /**
71
71
  * @param {FluidComponent} fluid
72
72
  */
73
- static "__#461@#clear_field"(fluid: FluidComponent): void;
73
+ static "__#462@#clear_field"(fluid: FluidComponent): void;
74
74
  /**
75
75
  * Mark every cell of `fluid` whose centre lies within `inflation` of the
76
76
  * posed shape as solid. Iteration is clipped to the shape's world AABB
@@ -82,7 +82,7 @@ export class FluidObstacleSystem extends System<any> {
82
82
  * @param {number} inflation world-units SDF threshold
83
83
  * @param {Float64Array} point length-3 scratch
84
84
  */
85
- static "__#461@#voxelize"(fluid: FluidComponent, posed: PosedShape3D, aabb: Float64Array, inflation: number, point: Float64Array): void;
85
+ static "__#462@#voxelize"(fluid: FluidComponent, posed: PosedShape3D, aabb: Float64Array, inflation: number, point: Float64Array): void;
86
86
  /**
87
87
  * Write the obstacle's translation velocity onto every face of every cell
88
88
  * it voxelized — the moving-wall boundary condition. Runs AFTER the mask
@@ -102,7 +102,7 @@ export class FluidObstacleSystem extends System<any> {
102
102
  * @param {number} wvy
103
103
  * @param {number} wvz
104
104
  */
105
- static "__#461@#stamp_wall_velocity"(fluid: FluidComponent, posed: PosedShape3D, aabb: Float64Array, inflation: number, point: Float64Array, wvx: number, wvy: number, wvz: number): void;
105
+ static "__#462@#stamp_wall_velocity"(fluid: FluidComponent, posed: PosedShape3D, aabb: Float64Array, inflation: number, point: Float64Array, wvx: number, wvy: number, wvz: number): void;
106
106
  constructor();
107
107
  dependencies: (typeof FluidObstacle)[];
108
108
  components_used: (ResourceAccessSpecification<typeof Transform64> | ResourceAccessSpecification<typeof FluidObstacle> | ResourceAccessSpecification<typeof Collider> | ResourceAccessSpecification<typeof RigidBody> | ResourceAccessSpecification<typeof FluidComponent>)[];
@@ -1,12 +1,14 @@
1
1
  # Tone mapping: GT7 and PBR Neutral, SDR and HDR
2
2
 
3
- The renderer has three tone mapping modes, each one operator on every output (`ShadeToneMappingMode`):
3
+ The renderer has four tone mapping modes, each one choice for every output (`ShadeToneMappingMode`):
4
4
 
5
- - `GT7`, the default;
5
+ - `ACES`, the default: Unreal Engine's look;
6
+ - `GT7`;
6
7
  - `PBR_NEUTRAL`;
7
8
  - `NONE`.
8
9
 
9
- This page compares the two operators, and shows each one's HDR form beside its SDR form.
10
+ This page compares GT7 and PBR Neutral, and shows each one's HDR form beside its SDR form. ACES is not one of its
11
+ views; the engine's own canvas shows it, and `shader_tonemap_aces.spec.js` holds it to Unreal's and OpenColorIO's numbers.
10
12
 
11
13
  The engine renders and tonemaps each frame as usual. Two extensions then redraw the canvas from the HDR colour the
12
14
  tonemapper was given:
@@ -40,7 +40,7 @@ export class Renderer {
40
40
  transparency_mode: ShadeTransparencyMode;
41
41
  /**
42
42
  * How the exposed scene colour becomes display colour, on every output. An SDR and an HDR display run the same
43
- * mode, so a scene looks alike on both; see {@link ShadeToneMappingMode}. Read every frame, so it can be flipped
43
+ * mode, so a scene looks alike on both; see {@link ShadeToneMappingMode}. ACES, Unreal's default look, unless set. Read every frame, so it can be flipped
44
44
  * at runtime. A mode not in use at {@link initialize} compiles its pass on the first frame that draws with it.
45
45
  * @type {ShadeToneMappingMode}
46
46
  */
@@ -1 +1 @@
1
- {"version":3,"file":"Renderer.d.ts","sourceRoot":"","sources":["../../../../src/shade/renderer/Renderer.js"],"names":[],"mappings":"AA0IA;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,CAEe;IAE7C;;;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,yB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CAA4C;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"}
@@ -22,13 +22,16 @@ import { shader_composite_volumetrics } from "./deferred/shader_composite_volume
22
22
  import { shader_deferred_main } from "./deferred/shader_deferred_main.js";
23
23
  import { LOCAL_LIGHT_SHADING } from "./deferred/LOCAL_LIGHT_SHADING.js";
24
24
  import { LocalLightShading } from "./deferred/LocalLightShading.js";
25
- import { shader_tonemap_HDR } from "./deferred/shader_tonemap_HDR.js";
26
- import { shader_tonemap_HDR_none } from "./deferred/shader_tonemap_HDR_none.js";
27
- import { shader_tonemap_HDR_pbr_neutral } from "./deferred/shader_tonemap_HDR_pbr_neutral.js";
28
- import { shader_tonemap_LDR } from "./deferred/shader_tonemap_LDR.js";
29
- import { shader_tonemap_LDR_none } from "./deferred/shader_tonemap_LDR_none.js";
30
- import { shader_tonemap_LDR_pbr_neutral } from "./deferred/shader_tonemap_LDR_pbr_neutral.js";
31
- import { TonemapDisplaySettings } from "./deferred/TonemapDisplaySettings.js";
25
+ import { shader_tonemap_HDR } from "./deferred/tonemap/shader_tonemap_HDR.js";
26
+ import { shader_tonemap_HDR_aces } from "./deferred/tonemap/shader_tonemap_HDR_aces.js";
27
+ import { shader_tonemap_HDR_none } from "./deferred/tonemap/shader_tonemap_HDR_none.js";
28
+ import { shader_tonemap_HDR_pbr_neutral } from "./deferred/tonemap/shader_tonemap_HDR_pbr_neutral.js";
29
+ import { shader_tonemap_LDR } from "./deferred/tonemap/shader_tonemap_LDR.js";
30
+ import { shader_tonemap_LDR_aces } from "./deferred/tonemap/shader_tonemap_LDR_aces.js";
31
+ import { shader_tonemap_LDR_none } from "./deferred/tonemap/shader_tonemap_LDR_none.js";
32
+ import { shader_tonemap_LDR_pbr_neutral } from "./deferred/tonemap/shader_tonemap_LDR_pbr_neutral.js";
33
+ import { TonemapAces2Tables } from "./deferred/tonemap/TonemapAces2Tables.js";
34
+ import { TonemapDisplaySettings } from "./deferred/tonemap/TonemapDisplaySettings.js";
32
35
  import { FrameContext } from "./extension/FrameContext.js";
33
36
  import { FramePhase } from "./extension/FramePhase.js";
34
37
  import { GBufferTextures } from "./extension/GBufferTextures.js";
@@ -225,11 +228,11 @@ export class Renderer {
225
228
 
226
229
  /**
227
230
  * How the exposed scene colour becomes display colour, on every output. An SDR and an HDR display run the same
228
- * mode, so a scene looks alike on both; see {@link ShadeToneMappingMode}. Read every frame, so it can be flipped
231
+ * mode, so a scene looks alike on both; see {@link ShadeToneMappingMode}. ACES, Unreal's default look, unless set. Read every frame, so it can be flipped
229
232
  * at runtime. A mode not in use at {@link initialize} compiles its pass on the first frame that draws with it.
230
233
  * @type {ShadeToneMappingMode}
231
234
  */
232
- tone_mapping_mode = ShadeToneMappingMode.GT7;
235
+ tone_mapping_mode = ShadeToneMappingMode.ACES;
233
236
 
234
237
  /**
235
238
  * Switches of the AVBOIT mode, read every frame while {@link transparency_mode} selects it.
@@ -1399,6 +1402,13 @@ export class Renderer {
1399
1402
  */
1400
1403
  #tonemap_settings = new TonemapDisplaySettings();
1401
1404
 
1405
+ /**
1406
+ * The ACES HDR pass's two output transforms, built for the display in {@link #tonemap_settings}.
1407
+ *
1408
+ * @type {TonemapAces2Tables}
1409
+ */
1410
+ #tonemap_aces2_tables = new TonemapAces2Tables();
1411
+
1402
1412
  #update_presentation_format() {
1403
1413
 
1404
1414
  const format8bit = navigator.gpu.getPreferredCanvasFormat();
@@ -1741,6 +1751,10 @@ export class Renderer {
1741
1751
  return this.#hdr_supported ? shader_tonemap_HDR_none : shader_tonemap_LDR_none;
1742
1752
  }
1743
1753
 
1754
+ if (this.tone_mapping_mode === ShadeToneMappingMode.ACES) {
1755
+ return this.#hdr_supported ? shader_tonemap_HDR_aces : shader_tonemap_LDR_aces;
1756
+ }
1757
+
1744
1758
  if (this.tone_mapping_mode === ShadeToneMappingMode.PBR_NEUTRAL) {
1745
1759
  return this.#hdr_supported ? shader_tonemap_HDR_pbr_neutral : shader_tonemap_LDR_pbr_neutral;
1746
1760
  }
@@ -1822,6 +1836,7 @@ export class Renderer {
1822
1836
  this.#scene_sdfs.clear();
1823
1837
 
1824
1838
  this.#autoexposure?.destroy();
1839
+ this.#tonemap_aces2_tables.destroy();
1825
1840
  this.#depth_of_field?.destroy();
1826
1841
  this.#depth_of_field_unreal?.destroy();
1827
1842
  this.#restir_di?.destroy();
@@ -3177,16 +3192,29 @@ export class Renderer {
3177
3192
 
3178
3193
  current_color_out = record_scene_color.color;
3179
3194
 
3195
+ const tonemap_shader = this.#tonemap_shader();
3196
+
3180
3197
  // every pass reads from the settings only the members its immediate struct names: the canvas's primaries
3181
3198
  // from its working space, and, on an HDR display, the peak
3199
+ const tonemap_inputs = {
3200
+ input_color: current_color_out,
3201
+ settings: this.#tonemap_settings,
3202
+ exposure,
3203
+ };
3204
+
3205
+ if (tonemap_shader === shader_tonemap_HDR_aces) {
3206
+ // the two ACES 2.0 transforms for this display, rebuilt only when the display changed
3207
+ const display = this.#tonemap_settings;
3208
+ const tables = this.#tonemap_aces2_tables;
3209
+
3210
+ tables.update(display.peak_nits);
3211
+ tonemap_inputs.aces2_tables = graph_import_buffer(graph, tables.gpu_buffer(this.device), "tonemap/aces2 tables");
3212
+ }
3213
+
3182
3214
  [current_color_out] = graph_image_pass({
3183
3215
  graph,
3184
- shader: this.#tonemap_shader(),
3185
- inputs: {
3186
- input_color: current_color_out,
3187
- settings: this.#tonemap_settings,
3188
- exposure
3189
- },
3216
+ shader: tonemap_shader,
3217
+ inputs: tonemap_inputs,
3190
3218
  output: [gr_texture_canvas]
3191
3219
  });
3192
3220
 
@@ -2,13 +2,14 @@
2
2
  * How the exposed scene colour becomes display colour.
3
3
  *
4
4
  * One choice for every display. The same mode runs on an SDR and an HDR output, so a scene looks the same on both up
5
- * to the SDR display's limits. That is the reason Polyphony give for GT7's operator, and there is no per-output
6
- * setting on purpose.
5
+ * to the SDR display's limits. That is the reason Polyphony give for GT7's operator, and Epic's for how Unreal 5.8
6
+ * takes its Filmic picture to HDR, and there is no per-output setting on purpose.
7
7
  */
8
8
  export type ShadeToneMappingMode = number;
9
9
  export namespace ShadeToneMappingMode {
10
10
  let GT7: number;
11
11
  let NONE: number;
12
12
  let PBR_NEUTRAL: number;
13
+ let ACES: number;
13
14
  }
14
15
  //# sourceMappingURL=ShadeToneMappingMode.d.ts.map
@@ -2,15 +2,15 @@
2
2
  * How the exposed scene colour becomes display colour.
3
3
  *
4
4
  * One choice for every display. The same mode runs on an SDR and an HDR output, so a scene looks the same on both up
5
- * to the SDR display's limits. That is the reason Polyphony give for GT7's operator, and there is no per-output
6
- * setting on purpose.
5
+ * to the SDR display's limits. That is the reason Polyphony give for GT7's operator, and Epic's for how Unreal 5.8
6
+ * takes its Filmic picture to HDR, and there is no per-output setting on purpose.
7
7
  *
8
8
  * @enum {number}
9
9
  */
10
10
  export const ShadeToneMappingMode = {
11
11
  /**
12
- * GT7 tone mapping (Polyphony Digital, SIGGRAPH 2025). An exposed 1.0 shows at a 250 cd/m² paper white on both
13
- * outputs. SDR clips at that paper white, the curve's SDR mode, and HDR rolls off to the display's peak.
12
+ * GT7 tone mapping (Polyphony Digital, SIGGRAPH 2025). An exposed 1.0 shows at the paper white on both outputs.
13
+ * SDR clips at that paper white, the curve's SDR mode, and HDR rolls off to the display's peak.
14
14
  */
15
15
  GT7: 0,
16
16
  /**
@@ -27,4 +27,15 @@ export const ShadeToneMappingMode = {
27
27
  * An exposed 0.18 shows at 0.14 of SDR white, where {@link GT7} shows it at 0.179.
28
28
  */
29
29
  PBR_NEUTRAL: 2,
30
+ /**
31
+ * Unreal Engine's default look, the default here too. SDR is UE's "Filmic" tone mapper at its default settings,
32
+ * the ACES-derived curve every Unreal title ships with unless it chose otherwise. HDR is what Unreal 5.8 does with
33
+ * the same method: the SDR picture, taken back to the scene through the inverse ACES 2.0 output transform for an
34
+ * SDR display, and rendered again with the ACES 2.0 output transform for the display's headroom.
35
+ *
36
+ * An exposed 0.18 shows at 0.18 of SDR white, as with {@link GT7}, with a mid-tone contrast of 1.36 against GT7's
37
+ * 1.05. On HDR the picture expands into the headroom and mid-grey rises with it, by ACES 2.0's design: 0.26 of SDR
38
+ * white at a 1000 cd/m² display.
39
+ */
40
+ ACES: 3,
30
41
  };
@@ -0,0 +1,38 @@
1
+ /**
2
+ * What {@link shader_tonemap_HDR_aces} binds as `aces2_tables`: two ACES 2.0 output transforms, each its parameters and
3
+ * gamut tables, both limited to Rec.709, the gamut of the SDR picture they expand.
4
+ *
5
+ * 1. An SDR display, 100 cd/m². The pass runs it backwards, from the SDR picture to the scene.
6
+ * 2. This display: the peak over the paper white, times 100 cd/m². A display at or under the paper white gets
7
+ * 100 cd/m², which the pass does not read.
8
+ *
9
+ * Both take SDR white for 100 cd/m², ACES 2.0's reference, so an SDR picture expanded for a display keeps SDR white
10
+ * where the paper white puts it.
11
+ *
12
+ * Building one transform takes 7 to 13 ms, so the tables are built on the first {@link update} rather than with the
13
+ * renderer, and again only when the display's peak changes.
14
+ */
15
+ export class TonemapAces2Tables {
16
+ /**
17
+ * Both blocks, the SDR one first. Zero until the first {@link update}.
18
+ * @type {Float32Array}
19
+ */
20
+ data: Float32Array;
21
+ /**
22
+ * Build the tables for a display, if they are not built for it already.
23
+ *
24
+ * @param {number} peak_nits the display's peak, cd/m²
25
+ * @returns {boolean} whether {@link data} changed
26
+ */
27
+ update(peak_nits: number): boolean;
28
+ /**
29
+ * The tables on the device, written if they changed since the last call.
30
+ *
31
+ * @param {GPUDevice} device
32
+ * @returns {GPUBuffer}
33
+ */
34
+ gpu_buffer(device: GPUDevice): GPUBuffer;
35
+ destroy(): void;
36
+ #private;
37
+ }
38
+ //# sourceMappingURL=TonemapAces2Tables.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TonemapAces2Tables.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/deferred/tonemap/TonemapAces2Tables.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;GAaG;AACH;IACI;;;OAGG;IACH,MAFU,YAAY,CAE0B;IAWhD;;;;;OAKG;IACH,kBAHW,MAAM,GACJ,OAAO,CAsBnB;IAED;;;;;OAKG;IACH,yCAgBC;IAED,gBAKC;;CACJ"}
@@ -0,0 +1,97 @@
1
+ import { assert } from "../../../../core/assert.js";
2
+ import {
3
+ ACES2_BLOCK_FLOATS,
4
+ ACES2_LIMITING_REC709,
5
+ aces2_transform_block_write
6
+ } from "../../shader/chunk/color/tonemap/aces/aces2_transform_block.js";
7
+ import { PAPER_WHITE_NITS } from "../../shader/chunk/color/tonemap/chunk_PAPER_WHITE_NITS.js";
8
+
9
+ /**
10
+ * What {@link shader_tonemap_HDR_aces} binds as `aces2_tables`: two ACES 2.0 output transforms, each its parameters and
11
+ * gamut tables, both limited to Rec.709, the gamut of the SDR picture they expand.
12
+ *
13
+ * 1. An SDR display, 100 cd/m². The pass runs it backwards, from the SDR picture to the scene.
14
+ * 2. This display: the peak over the paper white, times 100 cd/m². A display at or under the paper white gets
15
+ * 100 cd/m², which the pass does not read.
16
+ *
17
+ * Both take SDR white for 100 cd/m², ACES 2.0's reference, so an SDR picture expanded for a display keeps SDR white
18
+ * where the paper white puts it.
19
+ *
20
+ * Building one transform takes 7 to 13 ms, so the tables are built on the first {@link update} rather than with the
21
+ * renderer, and again only when the display's peak changes.
22
+ */
23
+ export class TonemapAces2Tables {
24
+ /**
25
+ * Both blocks, the SDR one first. Zero until the first {@link update}.
26
+ * @type {Float32Array}
27
+ */
28
+ data = new Float32Array(2 * ACES2_BLOCK_FLOATS);
29
+
30
+ #peak_nits = NaN;
31
+
32
+ /**
33
+ * @type {GPUBuffer|null}
34
+ */
35
+ #buffer = null;
36
+
37
+ #uploaded = false;
38
+
39
+ /**
40
+ * Build the tables for a display, if they are not built for it already.
41
+ *
42
+ * @param {number} peak_nits the display's peak, cd/m²
43
+ * @returns {boolean} whether {@link data} changed
44
+ */
45
+ update(peak_nits) {
46
+ assert.isNumber(peak_nits, 'peak_nits');
47
+ assert.greaterThan(peak_nits, 0, 'peak_nits');
48
+
49
+ if (peak_nits === this.#peak_nits) {
50
+ return false;
51
+ }
52
+
53
+ if (Number.isNaN(this.#peak_nits)) {
54
+ aces2_transform_block_write(this.data, 0, 100, ACES2_LIMITING_REC709);
55
+ }
56
+
57
+ const headroom = Math.max(peak_nits / PAPER_WHITE_NITS, 1);
58
+
59
+ aces2_transform_block_write(this.data, ACES2_BLOCK_FLOATS, 100 * headroom, ACES2_LIMITING_REC709);
60
+
61
+ this.#peak_nits = peak_nits;
62
+ this.#uploaded = false;
63
+
64
+ return true;
65
+ }
66
+
67
+ /**
68
+ * The tables on the device, written if they changed since the last call.
69
+ *
70
+ * @param {GPUDevice} device
71
+ * @returns {GPUBuffer}
72
+ */
73
+ gpu_buffer(device) {
74
+ if (this.#buffer === null) {
75
+ this.#buffer = device.createBuffer({
76
+ label: "tonemap/aces2 tables",
77
+ size: this.data.byteLength,
78
+ usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST,
79
+ });
80
+ this.#uploaded = false;
81
+ }
82
+
83
+ if (!this.#uploaded) {
84
+ device.queue.writeBuffer(this.#buffer, 0, this.data);
85
+ this.#uploaded = true;
86
+ }
87
+
88
+ return this.#buffer;
89
+ }
90
+
91
+ destroy() {
92
+ if (this.#buffer !== null) {
93
+ this.#buffer.destroy();
94
+ this.#buffer = null;
95
+ }
96
+ }
97
+ }
@@ -46,5 +46,5 @@ export const TONEMAP_SETTINGS_REC2020: WebGPUStruct;
46
46
  * TonemapDisplaySettings}.
47
47
  */
48
48
  export const TONEMAP_SETTINGS_REC2020_PEAK: WebGPUStruct;
49
- import { WebGPUStruct } from "../shader/type/WebGPUStruct.js";
49
+ import { WebGPUStruct } from "../../shader/type/WebGPUStruct.js";
50
50
  //# sourceMappingURL=TonemapDisplaySettings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TonemapDisplaySettings.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/deferred/tonemap/TonemapDisplaySettings.js"],"names":[],"mappings":"AAiDA;;;;;;;;;GASG;AACH;IACI,qCAAqD;IACrD,qCAAqD;IACrD,qCAAqD;IAErD,sCAA8C;IAC9C,sCAA8C;IAC9C,sCAA8C;IAE9C;;;OAGG;IACH,WAFU,MAAM,CAEC;IAMjB;;;;;OAKG;IACH,oCAHW,oBAAoB,GAAC,MAAM,QAkBrC;CACJ;AAqBD;;GAEG;AACH,mDAAqF;AAErF;;;GAGG;AACH,wDAAmG;AAEnG;;GAEG;AACH,oDAAuF;AAEvF;;;GAGG;AACH,yDAAqG;6BAzIxE,mCAAmC"}
@@ -1,8 +1,8 @@
1
- import { m3_rgb_to_xyz_from_primaries } from "../../../core/color/xyz/m3_rgb_to_xyz_from_primaries.js";
2
- import { m3_invert } from "../../../core/geom/mat3/m3_invert.js";
3
- import { m3_multiply } from "../../../core/geom/mat3/m3_multiply.js";
4
- import { f32, vec3f } from "../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
5
- import { WebGPUStruct } from "../shader/type/WebGPUStruct.js";
1
+ import { m3_rgb_to_xyz_from_primaries } from "../../../../core/color/xyz/m3_rgb_to_xyz_from_primaries.js";
2
+ import { m3_invert } from "../../../../core/geom/mat3/m3_invert.js";
3
+ import { m3_multiply } from "../../../../core/geom/mat3/m3_multiply.js";
4
+ import { f32, vec3f } from "../../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
5
+ import { WebGPUStruct } from "../../shader/type/WebGPUStruct.js";
6
6
 
7
7
  // chromaticities of red, green and blue; every space here has a D65 white, so none needs chromatic adaptation
8
8
  const PRIMARIES_REC709 = [0.640, 0.330, 0.300, 0.600, 0.150, 0.060];
@@ -5,5 +5,5 @@
5
5
  * @type {ImageShader}
6
6
  */
7
7
  export const shader_tonemap_HDR: ImageShader;
8
- import { ImageShader } from "../shader/ImageShader.js";
8
+ import { ImageShader } from "../../shader/ImageShader.js";
9
9
  //# sourceMappingURL=shader_tonemap_HDR.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shader_tonemap_HDR.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/deferred/tonemap/shader_tonemap_HDR.js"],"names":[],"mappings":"AA4DA;;;;;GAKG;AACH,iCAFU,WAAW,CAclB;4BAvEyB,6BAA6B"}
@@ -1,13 +1,13 @@
1
- import { F32_CONTAINER_STRUCT } from "../shader/type/F32_CONTAINER_STRUCT.js";
1
+ import { F32_CONTAINER_STRUCT } from "../../shader/type/F32_CONTAINER_STRUCT.js";
2
2
  import { TONEMAP_SETTINGS_REC2020_PEAK } from "./TonemapDisplaySettings.js";
3
- import { chunk_CRM_FROM_REC709_TO_REC2020 } from "../shader/chunk/color/conversion/chunk_CRM_FROM_REC709_TO_REC2020.js";
4
- import { chunk_sRGBTransferOETF } from "../shader/chunk/color/sRGB/chunk_sRGBTransferOETF.js";
5
- import { chunk_PAPER_WHITE_NITS } from "../shader/chunk/color/tonemap/chunk_PAPER_WHITE_NITS.js";
6
- import { chunk_tonemap_gt7 } from "../shader/chunk/color/tonemap/gt7/chunk_tonemap_gt7.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";
3
+ import { chunk_CRM_FROM_REC709_TO_REC2020 } from "../../shader/chunk/color/conversion/chunk_CRM_FROM_REC709_TO_REC2020.js";
4
+ import { chunk_sRGBTransferOETF } from "../../shader/chunk/color/sRGB/chunk_sRGBTransferOETF.js";
5
+ import { chunk_PAPER_WHITE_NITS } from "../../shader/chunk/color/tonemap/chunk_PAPER_WHITE_NITS.js";
6
+ import { chunk_tonemap_gt7 } from "../../shader/chunk/color/tonemap/gt7/chunk_tonemap_gt7.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
11
 
12
12
  const resources = new ShaderResourceSetDescriptor();
13
13
 
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The HDR output with {@link ShadeToneMappingMode.ACES}, as Unreal Engine 5.8 does it with its default "Filmic" method
3
+ * on a display past 100 cd/m²: the SDR picture of {@link shader_tonemap_LDR_aces}, taken back to the scene through the
4
+ * inverse ACES 2.0 output transform for an SDR display, and rendered again with the ACES 2.0 output transform for this
5
+ * display, limited to Rec.709 as the SDR picture is. Written in the canvas's primaries, extended, where 1.0 is SDR
6
+ * white.
7
+ *
8
+ * A display at or under the paper white shows the SDR picture.
9
+ *
10
+ * Binds `aces2_tables`, the two transforms' parameters and gamut tables, which {@link TonemapAces2Tables} builds for
11
+ * the display.
12
+ *
13
+ * @type {ImageShader}
14
+ */
15
+ export const shader_tonemap_HDR_aces: ImageShader;
16
+ import { ImageShader } from "../../shader/ImageShader.js";
17
+ //# sourceMappingURL=shader_tonemap_HDR_aces.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shader_tonemap_HDR_aces.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/deferred/tonemap/shader_tonemap_HDR_aces.js"],"names":[],"mappings":"AA0EA;;;;;;;;;;;;;GAaG;AACH,sCAFU,WAAW,CAclB;4BA1FyB,6BAA6B"}
@@ -0,0 +1,101 @@
1
+ import { F32_CONTAINER_STRUCT } from "../../shader/type/F32_CONTAINER_STRUCT.js";
2
+ import { f32 } from "../../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
3
+ import { WebGPUArray } from "../../shader/type/WebGPUArray.js";
4
+ import { TONEMAP_SETTINGS_REC709_PEAK } from "./TonemapDisplaySettings.js";
5
+ import { chunk_sRGBTransferOETF } from "../../shader/chunk/color/sRGB/chunk_sRGBTransferOETF.js";
6
+ import { ACES2_BLOCK_FLOATS } from "../../shader/chunk/color/tonemap/aces/aces2_transform_block.js";
7
+ import { chunk_aces2_output_transform } from "../../shader/chunk/color/tonemap/aces/chunk_aces2_output_transform.js";
8
+ import { chunk_tonemap_ue_filmic } from "../../shader/chunk/color/tonemap/aces/chunk_tonemap_ue_filmic.js";
9
+ import { chunk_PAPER_WHITE_NITS } from "../../shader/chunk/color/tonemap/chunk_PAPER_WHITE_NITS.js";
10
+ import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
11
+ import { ImageShader } from "../../shader/ImageShader.js";
12
+ import { ShaderResourceSetDescriptor } from "../../shader/resource/ShaderResourceSetDescriptor.js";
13
+ import { ShaderDescriptor } from "../../shader/ShaderDescriptor.js";
14
+
15
+ const resources = new ShaderResourceSetDescriptor();
16
+
17
+ resources.setImmediate("settings", TONEMAP_SETTINGS_REC709_PEAK);
18
+ resources.createGroup()
19
+ .addTexture("input_color", "float")
20
+ .addUniform("exposure", F32_CONTAINER_STRUCT)
21
+ // two ACES 2.0 output transforms, TonemapAces2Tables: 100 cd/m² first, then the display's headroom
22
+ .addStorageBuffer("aces2_tables", WebGPUArray.from(f32))
23
+
24
+ const body = CodeChunk.from(
25
+ //language=WGSL
26
+ `
27
+ const ACES2_SDR_BLOCK: u32 = 0u;
28
+ const ACES2_DISPLAY_BLOCK: u32 = ${ACES2_BLOCK_FLOATS}u;
29
+
30
+ @fragment
31
+ fn main(
32
+ @builtin(position) coord : vec4<f32>,
33
+ ) -> @location(0) vec4<f32> {
34
+
35
+ // scene color in linear Rec. 709
36
+ var color = textureLoad(input_color, vec2i(coord.xy), 0).rgb;
37
+
38
+ // Apply exposure
39
+ color *= exposure.value;
40
+
41
+ // the SDR picture first, which is what Unreal 5.8 does with Filmic on any display
42
+ let film = tonemap_ue_filmic(color);
43
+
44
+ var picture = film;
45
+
46
+ if (settings.peak_nits > PAPER_WHITE_NITS) {
47
+ // back to the scene through ACES 2.0 at SDR white, then out again through ACES 2.0 at the display's peak over
48
+ // the paper white. Both transforms take SDR white for 100 cd/m² and both are limited to Rec.709, the SDR
49
+ // picture's own gamut, so as the headroom shrinks to none the picture becomes the SDR one.
50
+ let aces = aces2_inverse(ACES2_SDR_BLOCK, film);
51
+ picture = aces2_forward(ACES2_DISPLAY_BLOCK, aces);
52
+ }
53
+
54
+ // into the primaries the canvas reports it was configured with (Renderer#configure_context): Display P3, or
55
+ // sRGB where the browser would not configure P3
56
+ let color_display = mat3x3<f32>(
57
+ settings.display_from_rec709_c0,
58
+ settings.display_from_rec709_c1,
59
+ settings.display_from_rec709_c2
60
+ ) * picture;
61
+
62
+ // NOTE: no dithering, colorspace is wide
63
+
64
+ // apply gamma. Note that gamma is the same for "Display P3" and "sRGB"
65
+ return vec4(sRGBTransferOETF(color_display), 1.0);
66
+ }
67
+ `, [
68
+ chunk_tonemap_ue_filmic,
69
+ chunk_aces2_output_transform,
70
+ chunk_PAPER_WHITE_NITS,
71
+ chunk_sRGBTransferOETF,
72
+ ]
73
+ );
74
+
75
+ /**
76
+ * The HDR output with {@link ShadeToneMappingMode.ACES}, as Unreal Engine 5.8 does it with its default "Filmic" method
77
+ * on a display past 100 cd/m²: the SDR picture of {@link shader_tonemap_LDR_aces}, taken back to the scene through the
78
+ * inverse ACES 2.0 output transform for an SDR display, and rendered again with the ACES 2.0 output transform for this
79
+ * display, limited to Rec.709 as the SDR picture is. Written in the canvas's primaries, extended, where 1.0 is SDR
80
+ * white.
81
+ *
82
+ * A display at or under the paper white shows the SDR picture.
83
+ *
84
+ * Binds `aces2_tables`, the two transforms' parameters and gamut tables, which {@link TonemapAces2Tables} builds for
85
+ * the display.
86
+ *
87
+ * @type {ImageShader}
88
+ */
89
+ export const shader_tonemap_HDR_aces = new ImageShader({
90
+ descriptor: ShaderDescriptor.from({
91
+ label: "Tonemap/HDR/aces",
92
+ resources,
93
+ body
94
+ }),
95
+ targets: [
96
+ {
97
+ label: "tone-mapped",
98
+ format: "rgba16float"
99
+ }
100
+ ]
101
+ });
@@ -5,5 +5,5 @@
5
5
  * @type {ImageShader}
6
6
  */
7
7
  export const shader_tonemap_HDR_none: ImageShader;
8
- import { ImageShader } from "../shader/ImageShader.js";
8
+ import { ImageShader } from "../../shader/ImageShader.js";
9
9
  //# sourceMappingURL=shader_tonemap_HDR_none.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shader_tonemap_HDR_none.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/deferred/tonemap/shader_tonemap_HDR_none.js"],"names":[],"mappings":"AA+CA;;;;;GAKG;AACH,sCAFU,WAAW,CAclB;4BA7DyB,6BAA6B"}
@@ -1,10 +1,10 @@
1
- import { F32_CONTAINER_STRUCT } from "../shader/type/F32_CONTAINER_STRUCT.js";
1
+ import { F32_CONTAINER_STRUCT } from "../../shader/type/F32_CONTAINER_STRUCT.js";
2
2
  import { TONEMAP_SETTINGS_REC709 } from "./TonemapDisplaySettings.js";
3
- import { chunk_sRGBTransferOETF } from "../shader/chunk/color/sRGB/chunk_sRGBTransferOETF.js";
4
- import { CodeChunk } from "../shader/compiler/CodeChunk.js";
5
- import { ImageShader } from "../shader/ImageShader.js";
6
- import { ShaderResourceSetDescriptor } from "../shader/resource/ShaderResourceSetDescriptor.js";
7
- import { ShaderDescriptor } from "../shader/ShaderDescriptor.js";
3
+ import { chunk_sRGBTransferOETF } from "../../shader/chunk/color/sRGB/chunk_sRGBTransferOETF.js";
4
+ import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
5
+ import { ImageShader } from "../../shader/ImageShader.js";
6
+ import { ShaderResourceSetDescriptor } from "../../shader/resource/ShaderResourceSetDescriptor.js";
7
+ import { ShaderDescriptor } from "../../shader/ShaderDescriptor.js";
8
8
 
9
9
  const resources = new ShaderResourceSetDescriptor();
10
10
  resources.setImmediate("settings", TONEMAP_SETTINGS_REC709);
@@ -6,5 +6,5 @@
6
6
  * @type {ImageShader}
7
7
  */
8
8
  export const shader_tonemap_HDR_pbr_neutral: ImageShader;
9
- import { ImageShader } from "../shader/ImageShader.js";
9
+ import { ImageShader } from "../../shader/ImageShader.js";
10
10
  //# sourceMappingURL=shader_tonemap_HDR_pbr_neutral.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shader_tonemap_HDR_pbr_neutral.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/deferred/tonemap/shader_tonemap_HDR_pbr_neutral.js"],"names":[],"mappings":"AA4DA;;;;;;GAMG;AACH,6CAFU,WAAW,CAclB;4BAzEyB,6BAA6B"}