@woosh/meep-engine 3.63.3 → 3.64.1

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 (190) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/package.json +1 -1
  3. package/src/core/color/xyz/m3_chromatic_adaptation_bradford.d.ts +14 -0
  4. package/src/core/color/xyz/m3_chromatic_adaptation_bradford.d.ts.map +1 -0
  5. package/src/core/color/xyz/m3_chromatic_adaptation_bradford.js +51 -0
  6. package/src/core/math/linalg/eigen/matrix_symmetric_3x3_eigen.d.ts +2 -1
  7. package/src/core/math/linalg/eigen/matrix_symmetric_3x3_eigen.d.ts.map +1 -1
  8. package/src/core/math/linalg/eigen/matrix_symmetric_3x3_eigen.js +51 -70
  9. package/src/core/math/linalg/eigen/matrix_symmetric_4x4_eigen.d.ts.map +1 -1
  10. package/src/core/math/linalg/eigen/matrix_symmetric_4x4_eigen.js +8 -64
  11. package/src/core/math/linalg/eigen/matrix_symmetric_jacobi_rotate_in_place.d.ts +17 -0
  12. package/src/core/math/linalg/eigen/matrix_symmetric_jacobi_rotate_in_place.d.ts.map +1 -0
  13. package/src/core/math/linalg/eigen/matrix_symmetric_jacobi_rotate_in_place.js +64 -0
  14. package/src/core/math/linalg/solve_box_constrained_qp.d.ts +30 -0
  15. package/src/core/math/linalg/solve_box_constrained_qp.d.ts.map +1 -0
  16. package/src/core/math/linalg/solve_box_constrained_qp.js +205 -0
  17. package/src/engine/graphics/texture/sampler/exr_to_sampler2d.d.ts +27 -0
  18. package/src/engine/graphics/texture/sampler/exr_to_sampler2d.d.ts.map +1 -0
  19. package/src/engine/graphics/texture/sampler/exr_to_sampler2d.js +91 -0
  20. package/src/engine/graphics/texture/sampler/sampler2d_to_exr.d.ts +23 -0
  21. package/src/engine/graphics/texture/sampler/sampler2d_to_exr.d.ts.map +1 -0
  22. package/src/engine/graphics/texture/sampler/sampler2d_to_exr.js +64 -0
  23. package/src/engine/physics/constraint/soft_spring_coefficients.d.ts +24 -0
  24. package/src/engine/physics/constraint/soft_spring_coefficients.d.ts.map +1 -0
  25. package/src/engine/physics/constraint/soft_spring_coefficients.js +38 -0
  26. package/src/engine/physics/constraint/solve_constraints.d.ts.map +1 -1
  27. package/src/engine/physics/constraint/solve_constraints.js +16 -8
  28. package/src/engine/physics/ecs/PhysicsSystem.d.ts +54 -0
  29. package/src/engine/physics/ecs/PhysicsSystem.d.ts.map +1 -1
  30. package/src/engine/physics/ecs/PhysicsSystem.js +192 -7
  31. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  32. package/src/engine/physics/inertia/world_inverse_inertia.d.ts +3 -5
  33. package/src/engine/physics/inertia/world_inverse_inertia.d.ts.map +1 -1
  34. package/src/engine/physics/inertia/world_inverse_inertia.js +3 -5
  35. package/src/engine/physics/vehicle/RaycastVehicle.d.ts +183 -12
  36. package/src/engine/physics/vehicle/RaycastVehicle.d.ts.map +1 -1
  37. package/src/engine/physics/vehicle/RaycastVehicle.js +1046 -121
  38. package/src/format/image/exr/ExrCompression.d.ts +22 -0
  39. package/src/format/image/exr/ExrCompression.d.ts.map +1 -0
  40. package/src/format/image/exr/ExrCompression.js +27 -0
  41. package/src/format/image/exr/ExrImage.d.ts +32 -0
  42. package/src/format/image/exr/ExrImage.d.ts.map +1 -0
  43. package/src/format/image/exr/ExrImage.js +32 -0
  44. package/src/format/image/exr/ExrPixelType.d.ts +13 -0
  45. package/src/format/image/exr/ExrPixelType.d.ts.map +1 -0
  46. package/src/format/image/exr/ExrPixelType.js +18 -0
  47. package/src/format/image/exr/exr_compare_names.d.ts +16 -0
  48. package/src/format/image/exr/exr_compare_names.d.ts.map +1 -0
  49. package/src/format/image/exr/exr_compare_names.js +25 -0
  50. package/src/format/image/exr/exr_constants.d.ts +49 -0
  51. package/src/format/image/exr/exr_constants.d.ts.map +1 -0
  52. package/src/format/image/exr/exr_constants.js +56 -0
  53. package/src/format/image/exr/exr_read.d.ts +32 -0
  54. package/src/format/image/exr/exr_read.d.ts.map +1 -0
  55. package/src/format/image/exr/exr_read.js +531 -0
  56. package/src/format/image/exr/exr_sample_bits.d.ts +16 -0
  57. package/src/format/image/exr/exr_sample_bits.d.ts.map +1 -0
  58. package/src/format/image/exr/exr_sample_bits.js +21 -0
  59. package/src/format/image/exr/exr_scanlines_per_chunk.d.ts +17 -0
  60. package/src/format/image/exr/exr_scanlines_per_chunk.d.ts.map +1 -0
  61. package/src/format/image/exr/exr_scanlines_per_chunk.js +31 -0
  62. package/src/format/image/exr/exr_write.d.ts +27 -0
  63. package/src/format/image/exr/exr_write.d.ts.map +1 -0
  64. package/src/format/image/exr/exr_write.js +378 -0
  65. package/src/shade/playground/probe_clipmap/index.html +5 -0
  66. package/src/shade/playground/probe_clipmap/main.d.ts.map +1 -1
  67. package/src/shade/playground/probe_clipmap/main.js +34 -1
  68. package/src/shade/playground/tonemap_sdr/README.md +11 -8
  69. package/src/shade/playground/tonemap_sdr/ToneMapCompare.js +2 -2
  70. package/src/shade/renderer/Renderer.d.ts +5 -6
  71. package/src/shade/renderer/Renderer.d.ts.map +1 -1
  72. package/src/shade/renderer/Renderer.js +15 -88
  73. package/src/shade/renderer/animation/chunk_animation_curve_evaluate_keys.d.ts +14 -0
  74. package/src/shade/renderer/animation/chunk_animation_curve_evaluate_keys.d.ts.map +1 -0
  75. package/src/shade/renderer/animation/chunk_animation_curve_evaluate_keys.js +62 -0
  76. package/src/shade/renderer/deferred/tonemap/ColorGrade.d.ts +158 -0
  77. package/src/shade/renderer/deferred/tonemap/ColorGrade.d.ts.map +1 -0
  78. package/src/shade/renderer/deferred/tonemap/ColorGrade.js +337 -0
  79. package/src/shade/renderer/deferred/tonemap/SAMPLER_TONEMAP_LUT.d.ts +9 -0
  80. package/src/shade/renderer/deferred/tonemap/SAMPLER_TONEMAP_LUT.d.ts.map +1 -0
  81. package/src/shade/renderer/deferred/tonemap/SAMPLER_TONEMAP_LUT.js +15 -0
  82. package/src/shade/renderer/deferred/tonemap/TONE_MAP_OPERATOR_ACES.d.ts +6 -0
  83. package/src/shade/renderer/deferred/tonemap/TONE_MAP_OPERATOR_ACES.d.ts.map +1 -0
  84. package/src/shade/renderer/deferred/tonemap/TONE_MAP_OPERATOR_ACES.js +84 -0
  85. package/src/shade/renderer/deferred/tonemap/TONE_MAP_OPERATOR_GT7.d.ts +10 -0
  86. package/src/shade/renderer/deferred/tonemap/TONE_MAP_OPERATOR_GT7.d.ts.map +1 -0
  87. package/src/shade/renderer/deferred/tonemap/TONE_MAP_OPERATOR_GT7.js +25 -0
  88. package/src/shade/renderer/deferred/tonemap/TONE_MAP_OPERATOR_NONE.d.ts +9 -0
  89. package/src/shade/renderer/deferred/tonemap/TONE_MAP_OPERATOR_NONE.d.ts.map +1 -0
  90. package/src/shade/renderer/deferred/tonemap/TONE_MAP_OPERATOR_NONE.js +20 -0
  91. package/src/shade/renderer/deferred/tonemap/TONE_MAP_OPERATOR_PBR_NEUTRAL.d.ts +14 -0
  92. package/src/shade/renderer/deferred/tonemap/TONE_MAP_OPERATOR_PBR_NEUTRAL.d.ts.map +1 -0
  93. package/src/shade/renderer/deferred/tonemap/TONE_MAP_OPERATOR_PBR_NEUTRAL.js +30 -0
  94. package/src/shade/renderer/deferred/tonemap/ToneMapOperator.d.ts +54 -0
  95. package/src/shade/renderer/deferred/tonemap/ToneMapOperator.d.ts.map +1 -0
  96. package/src/shade/renderer/deferred/tonemap/ToneMapOperator.js +63 -0
  97. package/src/shade/renderer/deferred/tonemap/ToneMapper.d.ts +106 -0
  98. package/src/shade/renderer/deferred/tonemap/ToneMapper.d.ts.map +1 -0
  99. package/src/shade/renderer/deferred/tonemap/ToneMapper.js +474 -0
  100. package/src/shade/renderer/deferred/tonemap/TonemapAces2Tables.d.ts +5 -13
  101. package/src/shade/renderer/deferred/tonemap/TonemapAces2Tables.d.ts.map +1 -1
  102. package/src/shade/renderer/deferred/tonemap/TonemapAces2Tables.js +5 -44
  103. package/src/shade/renderer/deferred/tonemap/TonemapDisplaySettings.d.ts +7 -25
  104. package/src/shade/renderer/deferred/tonemap/TonemapDisplaySettings.d.ts.map +1 -1
  105. package/src/shade/renderer/deferred/tonemap/TonemapDisplaySettings.js +11 -51
  106. package/src/shade/renderer/deferred/tonemap/m3_white_balance_rec709.d.ts +20 -0
  107. package/src/shade/renderer/deferred/tonemap/m3_white_balance_rec709.d.ts.map +1 -0
  108. package/src/shade/renderer/deferred/tonemap/m3_white_balance_rec709.js +103 -0
  109. package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR_lut.d.ts +9 -0
  110. package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR_lut.d.ts.map +1 -0
  111. package/src/shade/renderer/deferred/tonemap/{shader_tonemap_HDR_none.js → shader_tonemap_HDR_lut.js} +22 -18
  112. package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR_lut.d.ts +9 -0
  113. package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR_lut.d.ts.map +1 -0
  114. package/src/shade/renderer/deferred/tonemap/{shader_tonemap_LDR_aces.js → shader_tonemap_LDR_lut.js} +24 -24
  115. package/src/shade/renderer/deferred/tonemap/shader_tonemap_lut_bake.d.ts +23 -0
  116. package/src/shade/renderer/deferred/tonemap/shader_tonemap_lut_bake.d.ts.map +1 -0
  117. package/src/shade/renderer/deferred/tonemap/shader_tonemap_lut_bake.js +92 -0
  118. package/src/shade/renderer/deferred/tonemap/shader_tonemap_lut_sdr_from_hdr.d.ts +15 -0
  119. package/src/shade/renderer/deferred/tonemap/shader_tonemap_lut_sdr_from_hdr.d.ts.map +1 -0
  120. package/src/shade/renderer/deferred/tonemap/shader_tonemap_lut_sdr_from_hdr.js +73 -0
  121. package/src/shade/renderer/fluid/GPUFluidCascade.d.ts +3 -3
  122. package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts +1 -1
  123. package/src/shade/renderer/fluid/forcing/GPUFluidForcing.d.ts +6 -6
  124. package/src/shade/renderer/fluid/pressure/GPUFluidPressureSolve.d.ts +1 -1
  125. package/src/shade/renderer/fluid/query/GPUFluidQueries.d.ts +1 -1
  126. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts +1 -1
  127. package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP.d.ts +3 -15
  128. package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP.d.ts.map +1 -1
  129. package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP.js +4 -17
  130. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap.d.ts +3 -3
  131. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap.d.ts.map +1 -1
  132. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap.js +15 -13
  133. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_accumulate.d.ts +7 -3
  134. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_accumulate.d.ts.map +1 -1
  135. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_accumulate.js +28 -17
  136. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_project.d.ts +18 -18
  137. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_project.d.ts.map +1 -1
  138. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_project.js +44 -48
  139. package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
  140. package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
  141. package/src/shade/renderer/shader/chunk/color/conversion/chunk_CRM_REC709_AP1.d.ts +22 -0
  142. package/src/shade/renderer/shader/chunk/color/conversion/chunk_CRM_REC709_AP1.d.ts.map +1 -0
  143. package/src/shade/renderer/shader/chunk/color/conversion/chunk_CRM_REC709_AP1.js +62 -0
  144. package/src/shade/renderer/shader/chunk/color/grade/chunk_color_grade.d.ts +13 -0
  145. package/src/shade/renderer/shader/chunk/color/grade/chunk_color_grade.d.ts.map +1 -0
  146. package/src/shade/renderer/shader/chunk/color/grade/chunk_color_grade.js +140 -0
  147. package/src/shade/renderer/shader/chunk/color/oklab/chunk_oklab_compute_max_saturation.d.ts +11 -0
  148. package/src/shade/renderer/shader/chunk/color/oklab/chunk_oklab_compute_max_saturation.d.ts.map +1 -0
  149. package/src/shade/renderer/shader/chunk/color/oklab/chunk_oklab_compute_max_saturation.js +65 -0
  150. package/src/shade/renderer/shader/chunk/color/tonemap/chunk_bt2390_eetf.d.ts +14 -0
  151. package/src/shade/renderer/shader/chunk/color/tonemap/chunk_bt2390_eetf.d.ts.map +1 -0
  152. package/src/shade/renderer/shader/chunk/color/tonemap/chunk_bt2390_eetf.js +38 -0
  153. package/src/shade/renderer/shader/chunk/color/tonemap/chunk_tonemap_lut.d.ts +16 -0
  154. package/src/shade/renderer/shader/chunk/color/tonemap/chunk_tonemap_lut.d.ts.map +1 -0
  155. package/src/shade/renderer/shader/chunk/color/tonemap/chunk_tonemap_lut.js +41 -0
  156. package/src/shade/renderer/shader/chunk/filter/chunk_multiscale_mean.d.ts +8 -0
  157. package/src/shade/renderer/shader/chunk/filter/chunk_multiscale_mean.d.ts.map +1 -1
  158. package/src/shade/renderer/shader/chunk/filter/chunk_multiscale_mean.js +21 -3
  159. package/src/shade/renderer/water/query/GPUWaterQueries.d.ts +1 -1
  160. package/src/shade/wgsl/emulator/WGSLJavaScriptCompiler.js +8 -8
  161. package/src/shade/wgsl/emulator/WGSLLanguageCore.d.ts.map +1 -1
  162. package/src/shade/wgsl/emulator/WGSLLanguageCore.js +2 -0
  163. package/src/shade/renderer/ShadeToneMappingMode.d.ts +0 -15
  164. package/src/shade/renderer/ShadeToneMappingMode.d.ts.map +0 -1
  165. package/src/shade/renderer/ShadeToneMappingMode.js +0 -41
  166. package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR.d.ts +0 -9
  167. package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR.d.ts.map +0 -1
  168. package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR.js +0 -79
  169. package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR_aces.d.ts +0 -17
  170. package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR_aces.d.ts.map +0 -1
  171. package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR_aces.js +0 -101
  172. package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR_none.d.ts +0 -9
  173. package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR_none.d.ts.map +0 -1
  174. package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR_pbr_neutral.d.ts +0 -10
  175. package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR_pbr_neutral.d.ts.map +0 -1
  176. package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR_pbr_neutral.js +0 -80
  177. package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR.d.ts +0 -9
  178. package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR.d.ts.map +0 -1
  179. package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR.js +0 -80
  180. package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR_aces.d.ts +0 -10
  181. package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR_aces.d.ts.map +0 -1
  182. package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR_none.d.ts +0 -9
  183. package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR_none.d.ts.map +0 -1
  184. package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR_none.js +0 -71
  185. package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR_pbr_neutral.d.ts +0 -10
  186. package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR_pbr_neutral.d.ts.map +0 -1
  187. package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR_pbr_neutral.js +0 -76
  188. package/src/shade/renderer/shader/chunk/color/tonemap/chunk_tonemap_hdr_bt2390.d.ts +0 -3
  189. package/src/shade/renderer/shader/chunk/color/tonemap/chunk_tonemap_hdr_bt2390.d.ts.map +0 -1
  190. package/src/shade/renderer/shader/chunk/color/tonemap/chunk_tonemap_hdr_bt2390.js +0 -44
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The encoding of a tone-mapping LUT, on both of its sides.
3
+ *
4
+ * - `tonemap_lut_pq_encode`: linear light with 1 at the paper white to its ST 2084 (PQ) signal, per channel. A
5
+ * negative component reads as zero. 10000 cd/m², 49.3 × the paper white, encodes to 1.
6
+ * - `tonemap_lut_pq_decode`: the inverse, clamping the signal to [0, 1].
7
+ * - `tonemap_lut_coordinate`: where a LUT of `resolution`³ texels holds exposed scene colour `scene`, as a texture
8
+ * coordinate. Texel i holds the signal i / (resolution - 1); a colour past 10000 cd/m² lands on the last texel.
9
+ *
10
+ * A LUT maps the PQ signal of exposed scene-linear Rec.709 to the PQ signal of linear Rec.2020 display light.
11
+ *
12
+ * @type {CodeChunk}
13
+ */
14
+ export const chunk_tonemap_lut: CodeChunk;
15
+ import { CodeChunk } from "../../../compiler/CodeChunk.js";
16
+ //# sourceMappingURL=chunk_tonemap_lut.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk_tonemap_lut.d.ts","sourceRoot":"","sources":["../../../../../../../../src/shade/renderer/shader/chunk/color/tonemap/chunk_tonemap_lut.js"],"names":[],"mappings":"AAKA;;;;;;;;;;;;GAYG;AACH,gCAFU,SAAS,CAwBjB;0BAxCwB,gCAAgC"}
@@ -0,0 +1,41 @@
1
+ import { CodeChunk } from "../../../compiler/CodeChunk.js";
2
+ import { chunk_eotfSt2084 } from "../iCtCp/chunk_eotf_st2084.js";
3
+ import { chunk_inverseEotfSt2084 } from "../iCtCp/chunk_inverse_eotf_st2084.js";
4
+ import { chunk_PAPER_WHITE_NITS } from "./chunk_PAPER_WHITE_NITS.js";
5
+
6
+ /**
7
+ * The encoding of a tone-mapping LUT, on both of its sides.
8
+ *
9
+ * - `tonemap_lut_pq_encode`: linear light with 1 at the paper white to its ST 2084 (PQ) signal, per channel. A
10
+ * negative component reads as zero. 10000 cd/m², 49.3 × the paper white, encodes to 1.
11
+ * - `tonemap_lut_pq_decode`: the inverse, clamping the signal to [0, 1].
12
+ * - `tonemap_lut_coordinate`: where a LUT of `resolution`³ texels holds exposed scene colour `scene`, as a texture
13
+ * coordinate. Texel i holds the signal i / (resolution - 1); a colour past 10000 cd/m² lands on the last texel.
14
+ *
15
+ * A LUT maps the PQ signal of exposed scene-linear Rec.709 to the PQ signal of linear Rec.2020 display light.
16
+ *
17
+ * @type {CodeChunk}
18
+ */
19
+ export const chunk_tonemap_lut = CodeChunk.from(
20
+ //language=WGSL
21
+ `
22
+ fn tonemap_lut_pq_encode(v: vec3<f32>) -> vec3<f32> {
23
+ // the ST 2084 chunks count in units of 100 cd/m²
24
+ let n = max(v, vec3<f32>(0.0)) * (PAPER_WHITE_NITS / 100.0);
25
+ return vec3<f32>(inverseEotfSt2084(n.x), inverseEotfSt2084(n.y), inverseEotfSt2084(n.z));
26
+ }
27
+
28
+ fn tonemap_lut_pq_decode(e: vec3<f32>) -> vec3<f32> {
29
+ return vec3<f32>(eotfSt2084(e.x), eotfSt2084(e.y), eotfSt2084(e.z)) * (100.0 / PAPER_WHITE_NITS);
30
+ }
31
+
32
+ fn tonemap_lut_coordinate(scene: vec3<f32>, resolution: f32) -> vec3<f32> {
33
+ let e = min(tonemap_lut_pq_encode(scene), vec3<f32>(1.0));
34
+ return e * ((resolution - 1.0) / resolution) + 0.5 / resolution;
35
+ }
36
+ `, [
37
+ chunk_eotfSt2084,
38
+ chunk_inverseEotfSt2084,
39
+ chunk_PAPER_WHITE_NITS,
40
+ ]
41
+ );
@@ -8,8 +8,16 @@
8
8
  * fn multiscale_mean_seed(sample: vec3f) -> MultiscaleMean
9
9
  * fn multiscale_mean_add(e: MultiscaleMean, sample: vec3f, short_blend: f32, variance_blend: f32, mean_blend_min: f32, clip: bool, exposure: f32) -> MultiscaleMean
10
10
  * fn multiscale_mean_deviation_floor(short_mean: vec3f, exposure: f32) -> vec3f
11
+ * fn multiscale_mean_catch_up(relative: f32, inconsistency: f32, reduction: f32) -> f32
12
+ * fn multiscale_mean_blend_reduction(level: f32) -> f32
13
+ * const MULTISCALE_MEAN_REDUCTION_BLEND: f32
11
14
  * ```
12
15
  *
16
+ * `multiscale_mean_catch_up` and `multiscale_mean_blend_reduction` are the long mean's decision alone, for an
17
+ * estimator over a quantity the caller keeps the means of itself: `relative` the means' gap over the deviation,
18
+ * `inconsistency` its smoothed history, `reduction` the blend reduction as it stood before this sample, and `level`
19
+ * the short mean over the deviation. The reduction follows `level`'s by `MULTISCALE_MEAN_REDUCTION_BLEND` a sample.
20
+ *
13
21
  * `MultiscaleMean` is {@link MULTISCALE_MEAN_STRUCT}.
14
22
  *
15
23
  * - **Exposure**: the factor the display multiplies the samples by ahead of its tone curve, Unreal Engine's
@@ -1 +1 @@
1
- {"version":3,"file":"chunk_multiscale_mean.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/shader/chunk/filter/chunk_multiscale_mean.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,oCAFU,SAAS,CAuDZ;0BAhHmB,6BAA6B"}
1
+ {"version":3,"file":"chunk_multiscale_mean.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/shader/chunk/filter/chunk_multiscale_mean.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH,oCAFU,SAAS,CAiEZ;0BAlImB,6BAA6B"}
@@ -16,8 +16,16 @@ const EXPOSURE_MAX = '1.70141183e38';
16
16
  * fn multiscale_mean_seed(sample: vec3f) -> MultiscaleMean
17
17
  * fn multiscale_mean_add(e: MultiscaleMean, sample: vec3f, short_blend: f32, variance_blend: f32, mean_blend_min: f32, clip: bool, exposure: f32) -> MultiscaleMean
18
18
  * fn multiscale_mean_deviation_floor(short_mean: vec3f, exposure: f32) -> vec3f
19
+ * fn multiscale_mean_catch_up(relative: f32, inconsistency: f32, reduction: f32) -> f32
20
+ * fn multiscale_mean_blend_reduction(level: f32) -> f32
21
+ * const MULTISCALE_MEAN_REDUCTION_BLEND: f32
19
22
  * ```
20
23
  *
24
+ * `multiscale_mean_catch_up` and `multiscale_mean_blend_reduction` are the long mean's decision alone, for an
25
+ * estimator over a quantity the caller keeps the means of itself: `relative` the means' gap over the deviation,
26
+ * `inconsistency` its smoothed history, `reduction` the blend reduction as it stood before this sample, and `level`
27
+ * the short mean over the deviation. The reduction follows `level`'s by `MULTISCALE_MEAN_REDUCTION_BLEND` a sample.
28
+ *
21
29
  * `MultiscaleMean` is {@link MULTISCALE_MEAN_STRUCT}.
22
30
  *
23
31
  * - **Exposure**: the factor the display multiplies the samples by ahead of its tone curve, Unreal Engine's
@@ -79,6 +87,16 @@ fn multiscale_mean_deviation_floor(short_mean: vec3f, exposure: f32) -> vec3f {
79
87
  return max(vec3f(sqrt(1e-5) / multiscale_mean_exposure(exposure)), max(abs(short_mean) * exp2(-10.0), vec3f(exp2(-24.0))));
80
88
  }
81
89
 
90
+ const MULTISCALE_MEAN_REDUCTION_BLEND: f32 = 0.1;
91
+
92
+ fn multiscale_mean_catch_up(relative: f32, inconsistency: f32, reduction: f32) -> f32 {
93
+ return clamp(smoothstep(0.0, 1.0, relative * max(0.02, inconsistency - 0.2)), 1.0 / 256.0, 1.0) * reduction;
94
+ }
95
+
96
+ fn multiscale_mean_blend_reduction(level: f32) -> f32 {
97
+ return clamp(0.5 * level, 1.0 / 32.0, 1.0);
98
+ }
99
+
82
100
  fn multiscale_mean_add(e: ${MULTISCALE_MEAN_STRUCT.wgsl_ref}, sample: vec3f, short_blend: f32, variance_blend: f32, mean_blend_min: f32, clip: bool, exposure: f32) -> ${MULTISCALE_MEAN_STRUCT.wgsl_ref} {
83
101
  var y = sample;
84
102
 
@@ -95,15 +113,15 @@ fn multiscale_mean_add(e: ${MULTISCALE_MEAN_STRUCT.wgsl_ref}, sample: vec3f, sho
95
113
 
96
114
  let relative = rgb_to_luminance(abs(e.mean - short_mean) / deviation);
97
115
  let inconsistency = mix(e.inconsistency, relative, short_blend);
98
- let reduction = clamp(rgb_to_luminance(0.5 * short_mean / deviation), 1.0 / 32.0, 1.0);
116
+ let reduction = multiscale_mean_blend_reduction(rgb_to_luminance(short_mean / deviation));
99
117
 
100
- let catch_up = clamp(smoothstep(0.0, 1.0, relative * max(0.02, inconsistency - 0.2)), 1.0 / 256.0, 1.0) * e.reduction;
118
+ let catch_up = multiscale_mean_catch_up(relative, inconsistency, e.reduction);
101
119
 
102
120
  return ${MULTISCALE_MEAN_STRUCT.make({
103
121
  mean: 'mix(e.mean, y, max(saturate(catch_up), mean_blend_min))',
104
122
  short_mean: 'short_mean',
105
123
  variance: 'variance',
106
- reduction: 'mix(e.reduction, reduction, 0.1)',
124
+ reduction: 'mix(e.reduction, reduction, MULTISCALE_MEAN_REDUCTION_BLEND)',
107
125
  inconsistency: 'inconsistency',
108
126
  })};
109
127
  }
@@ -24,7 +24,7 @@ export class GPUWaterQueries {
24
24
  * @param {PipelineEnquiry} enquiry
25
25
  */
26
26
  static enquirePipelines(enquiry: PipelineEnquiry): void;
27
- static "__#282@#execute"(pass: any, resources: any, context: any): void;
27
+ static "__#285@#execute"(pass: any, resources: any, context: any): void;
28
28
  /**
29
29
  * @param {object} options
30
30
  * @param {GPUDevice} options.device
@@ -3141,7 +3141,7 @@ const INTEGER_TYPED_BUILTIN = new Set(['abs', 'firstLeadingBit', 'firstTrailingB
3141
3141
  */
3142
3142
  const ELEMENT_WISE_BUILTIN = new Set([
3143
3143
  'abs', 'sign', 'floor', 'ceil', 'round', 'trunc', 'fract', 'sqrt', 'inverseSqrt',
3144
- 'exp', 'exp2', 'log', 'log2', 'sin', 'cos', 'tan', 'asin', 'acos', 'atan',
3144
+ 'exp', 'exp2', 'log', 'log2', 'sin', 'cos', 'tan', 'asin', 'acos', 'atan', 'degrees', 'radians',
3145
3145
  'pow', 'atan2', 'min', 'max', 'step', 'clamp', 'saturate', 'mix', 'smoothstep',
3146
3146
  'normalize', 'reflect', 'fma', 'quantizeToF16',
3147
3147
  'subgroupBroadcastFirst', 'subgroupAdd', 'subgroupMul', 'subgroupMin', 'subgroupMax',
@@ -3232,13 +3232,13 @@ function inferBuiltinReturnType(name, args) {
3232
3232
  // Both gathers return the four texels of a 2x2 footprint. Saying so here matters more than
3233
3233
  // for most builtins: the shadow chunks immediately swizzle the result (`samples.wzxy`), and
3234
3234
  // an unknown type degrades swizzle codegen downstream.
3235
- if (name === 'textureGather') {
3236
- const first = args[0] !== undefined ? args[0].type : null;
3237
- const texture = first !== null && first.kind === 'texture' ? first : (args[1] !== undefined ? args[1].type : null);
3238
- const scalar = texture !== null && texture.kind === 'texture' ? texture.scalar : 'f32';
3239
- return { kind: 'vec', size: 4, scalar: scalar === 'u32' || /uint$/.test(scalar) ? 'u32'
3240
- : scalar === 'i32' || /sint$/.test(scalar) ? 'i32' : 'f32' };
3241
- }
3235
+ if (name === 'textureGather') {
3236
+ const first = args[0] !== undefined ? args[0].type : null;
3237
+ const texture = first !== null && first.kind === 'texture' ? first : (args[1] !== undefined ? args[1].type : null);
3238
+ const scalar = texture !== null && texture.kind === 'texture' ? texture.scalar : 'f32';
3239
+ return { kind: 'vec', size: 4, scalar: scalar === 'u32' || /uint$/.test(scalar) ? 'u32'
3240
+ : scalar === 'i32' || /sint$/.test(scalar) ? 'i32' : 'f32' };
3241
+ }
3242
3242
  if (name === 'textureGatherCompare') {
3243
3243
  return { kind: 'vec', size: 4, scalar: 'f32' };
3244
3244
  }
@@ -1 +1 @@
1
- {"version":3,"file":"WGSLLanguageCore.d.ts","sourceRoot":"","sources":["../../../../../src/shade/wgsl/emulator/WGSLLanguageCore.js"],"names":[],"mappings":";IAk6DA;;;;;;;;;;;;;OAaG;IACH,+DAyFC"}
1
+ {"version":3,"file":"WGSLLanguageCore.d.ts","sourceRoot":"","sources":["../../../../../src/shade/wgsl/emulator/WGSLLanguageCore.js"],"names":[],"mappings":";IAo6DA;;;;;;;;;;;;;OAaG;IACH,+DAyFC"}
@@ -883,6 +883,8 @@ export const WGSLLanguageCore = {
883
883
  asin: (a) => unop(a, Math.asin),
884
884
  acos: (a) => unop(a, Math.acos),
885
885
  atan: (a) => unop(a, Math.atan),
886
+ degrees: (a) => unop(a, x => x * (180 / Math.PI)),
887
+ radians: (a) => unop(a, x => x * (Math.PI / 180)),
886
888
 
887
889
  pow: (a, b) => binop(a, b, Math.pow),
888
890
  atan2: (a, b) => binop(a, b, Math.atan2),
@@ -1,15 +0,0 @@
1
- /**
2
- * How the exposed scene colour becomes display colour.
3
- *
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 Epic's for how Unreal 5.8
6
- * takes its Filmic picture to HDR, and there is no per-output setting on purpose.
7
- */
8
- export type ShadeToneMappingMode = number;
9
- export namespace ShadeToneMappingMode {
10
- let GT7: number;
11
- let NONE: number;
12
- let PBR_NEUTRAL: number;
13
- let ACES: number;
14
- }
15
- //# sourceMappingURL=ShadeToneMappingMode.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ShadeToneMappingMode.d.ts","sourceRoot":"","sources":["../../../../src/shade/renderer/ShadeToneMappingMode.js"],"names":[],"mappings":";;;;;;;mCAOU,MAAM"}
@@ -1,41 +0,0 @@
1
- /**
2
- * How the exposed scene colour becomes display colour.
3
- *
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 Epic's for how Unreal 5.8
6
- * takes its Filmic picture to HDR, and there is no per-output setting on purpose.
7
- *
8
- * @enum {number}
9
- */
10
- export const ShadeToneMappingMode = {
11
- /**
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
- */
15
- GT7: 0,
16
- /**
17
- * No tone mapping: the exposed colour as it is, with 1.0 at SDR white. An SDR output clips everything above 1.0,
18
- * and an HDR output shows it as far as the display reaches.
19
- */
20
- NONE: 1,
21
- /**
22
- * Khronos PBR Neutral (Lalish, 2024). Base colours under 0.8 come out as they are, less a 0.04 Fresnel offset, and
23
- * hues never shift: made for showing products. SDR is the specification, which rolls highlights off to SDR white
24
- * and toward white. HDR puts the display's peak in place of the specification's 1, so everything below the
25
- * compression start looks the same on both outputs, and a highlight rolls off to the display's peak instead.
26
- *
27
- * An exposed 0.18 shows at 0.14 of SDR white, where {@link GT7} shows it at 0.179.
28
- */
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,
41
- };
@@ -1,9 +0,0 @@
1
- /**
2
- * The HDR output with {@link ShadeToneMappingMode.GT7}: GT7 at the display's peak, with the same paper white as
3
- * {@link shader_tonemap_LDR}, written in the canvas's primaries, extended, where 1.0 is SDR white.
4
- *
5
- * @type {ImageShader}
6
- */
7
- export const shader_tonemap_HDR: ImageShader;
8
- import { ImageShader } from "../../shader/ImageShader.js";
9
- //# sourceMappingURL=shader_tonemap_HDR.d.ts.map
@@ -1 +0,0 @@
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,79 +0,0 @@
1
- import { F32_CONTAINER_STRUCT } from "../../shader/type/F32_CONTAINER_STRUCT.js";
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";
11
-
12
- const resources = new ShaderResourceSetDescriptor();
13
-
14
- // per-pass, four bytes, read-only: immediate data rather than a uniform buffer. exposure stays
15
- // bound - it is computed on the GPU, so there is no CPU value to write.
16
- resources.setImmediate("settings", TONEMAP_SETTINGS_REC2020_PEAK);
17
- resources.createGroup()
18
- .addTexture("input_color", "float")
19
- .addUniform("exposure", F32_CONTAINER_STRUCT)
20
-
21
- const body = CodeChunk.from(
22
- //language=WGSL
23
- `
24
- @fragment
25
- fn main(
26
- @builtin(position) coord : vec4<f32>,
27
- ) -> @location(0) vec4<f32> {
28
-
29
- // scene color in linear Rec. 709
30
- var color = textureLoad(input_color, vec2i(coord.xy), 0).rgb;
31
-
32
- // Apply exposure
33
- color *= exposure.value;
34
-
35
- // Finally tonemap, in the operator's own Rec.2020
36
- let color_2020 = tonemap_gt7_rec2020(CRM_FROM_REC709_TO_REC2020 * color, settings.peak_nits, PAPER_WHITE_NITS);
37
-
38
- // NOTE: no dithering, colorspace is wide
39
-
40
- // into the primaries the canvas reports it was configured with (Renderer#configure_context): Display P3, or
41
- // sRGB where the browser would not configure P3
42
- let color_display = mat3x3<f32>(
43
- settings.display_from_rec2020_c0,
44
- settings.display_from_rec2020_c1,
45
- settings.display_from_rec2020_c2
46
- ) * color_2020;
47
-
48
- // apply gamma. Note that gamma is the same for "Display P3" and "sRGB"
49
- let color_gamma = sRGBTransferOETF(color_display);
50
-
51
- return vec4(color_gamma, 1.0);
52
- }
53
- `, [
54
- chunk_tonemap_gt7,
55
- chunk_PAPER_WHITE_NITS,
56
- chunk_CRM_FROM_REC709_TO_REC2020,
57
- chunk_sRGBTransferOETF,
58
- ]
59
- );
60
-
61
- /**
62
- * The HDR output with {@link ShadeToneMappingMode.GT7}: GT7 at the display's peak, with the same paper white as
63
- * {@link shader_tonemap_LDR}, written in the canvas's primaries, extended, where 1.0 is SDR white.
64
- *
65
- * @type {ImageShader}
66
- */
67
- export const shader_tonemap_HDR = new ImageShader({
68
- descriptor: ShaderDescriptor.from({
69
- label: "Tonemap/HDR",
70
- resources,
71
- body
72
- }),
73
- targets: [
74
- {
75
- label: "tone-mapped",
76
- format: "rgba16float"
77
- }
78
- ]
79
- });
@@ -1,17 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,101 +0,0 @@
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
- });
@@ -1,9 +0,0 @@
1
- /**
2
- * The HDR output with {@link ShadeToneMappingMode.NONE}: exposure and the canvas's primaries, extended, where 1.0 is
3
- * SDR white, and nothing in between.
4
- *
5
- * @type {ImageShader}
6
- */
7
- export const shader_tonemap_HDR_none: ImageShader;
8
- import { ImageShader } from "../../shader/ImageShader.js";
9
- //# sourceMappingURL=shader_tonemap_HDR_none.d.ts.map
@@ -1 +0,0 @@
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 +0,0 @@
1
- /**
2
- * The HDR output with {@link ShadeToneMappingMode.PBR_NEUTRAL}: Khronos PBR Neutral with the display's peak over the
3
- * paper white in place of the specification's 1, written in the canvas's primaries, extended, where 1.0 is SDR white.
4
- * Below the compression start it writes what {@link shader_tonemap_LDR_pbr_neutral} writes.
5
- *
6
- * @type {ImageShader}
7
- */
8
- export const shader_tonemap_HDR_pbr_neutral: ImageShader;
9
- import { ImageShader } from "../../shader/ImageShader.js";
10
- //# sourceMappingURL=shader_tonemap_HDR_pbr_neutral.d.ts.map
@@ -1 +0,0 @@
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"}
@@ -1,80 +0,0 @@
1
- import { F32_CONTAINER_STRUCT } from "../../shader/type/F32_CONTAINER_STRUCT.js";
2
- import { TONEMAP_SETTINGS_REC709_PEAK } from "./TonemapDisplaySettings.js";
3
- import { chunk_sRGBTransferOETF } from "../../shader/chunk/color/sRGB/chunk_sRGBTransferOETF.js";
4
- import { chunk_PAPER_WHITE_NITS } from "../../shader/chunk/color/tonemap/chunk_PAPER_WHITE_NITS.js";
5
- import { chunk_tonemap_khronos_pbr } from "../../shader/chunk/color/tonemap/chunk_tonemap_khronos_pbr.js";
6
- import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
7
- import { ImageShader } from "../../shader/ImageShader.js";
8
- import { ShaderResourceSetDescriptor } from "../../shader/resource/ShaderResourceSetDescriptor.js";
9
- import { ShaderDescriptor } from "../../shader/ShaderDescriptor.js";
10
-
11
- const resources = new ShaderResourceSetDescriptor();
12
-
13
- // per-pass, four bytes, read-only: immediate data rather than a uniform buffer. exposure stays
14
- // bound - it is computed on the GPU, so there is no CPU value to write.
15
- resources.setImmediate("settings", TONEMAP_SETTINGS_REC709_PEAK);
16
- resources.createGroup()
17
- .addTexture("input_color", "float")
18
- .addUniform("exposure", F32_CONTAINER_STRUCT)
19
-
20
- const body = CodeChunk.from(
21
- //language=WGSL
22
- `
23
- @fragment
24
- fn main(
25
- @builtin(position) coord : vec4<f32>,
26
- ) -> @location(0) vec4<f32> {
27
-
28
- // scene color in linear Rec. 709
29
- var color = textureLoad(input_color, vec2i(coord.xy), 0).rgb;
30
-
31
- // Apply exposure
32
- color *= exposure.value;
33
-
34
- // the display's peak in units of SDR white. A display under the paper white gets the SDR form, which is where
35
- // the operator is defined.
36
- let peak = max(settings.peak_nits / PAPER_WHITE_NITS, 1.0);
37
-
38
- // It takes non-negative input.
39
- color = tonemap_khronos_pbr(max(color, vec3<f32>(0.0)), peak);
40
-
41
- // NOTE: no dithering, colorspace is wide
42
-
43
- // into the primaries the canvas reports it was configured with (Renderer#configure_context): Display P3, or
44
- // sRGB where the browser would not configure P3
45
- let color_display = mat3x3<f32>(
46
- settings.display_from_rec709_c0,
47
- settings.display_from_rec709_c1,
48
- settings.display_from_rec709_c2
49
- ) * color;
50
-
51
- // apply gamma. Note that gamma is the same for "Display P3" and "sRGB"
52
- return vec4(sRGBTransferOETF(color_display), 1.0);
53
- }
54
- `, [
55
- chunk_tonemap_khronos_pbr,
56
- chunk_PAPER_WHITE_NITS,
57
- chunk_sRGBTransferOETF,
58
- ]
59
- );
60
-
61
- /**
62
- * The HDR output with {@link ShadeToneMappingMode.PBR_NEUTRAL}: Khronos PBR Neutral with the display's peak over the
63
- * paper white in place of the specification's 1, written in the canvas's primaries, extended, where 1.0 is SDR white.
64
- * Below the compression start it writes what {@link shader_tonemap_LDR_pbr_neutral} writes.
65
- *
66
- * @type {ImageShader}
67
- */
68
- export const shader_tonemap_HDR_pbr_neutral = new ImageShader({
69
- descriptor: ShaderDescriptor.from({
70
- label: "Tonemap/HDR/pbr_neutral",
71
- resources,
72
- body
73
- }),
74
- targets: [
75
- {
76
- label: "tone-mapped",
77
- format: "rgba16float"
78
- }
79
- ]
80
- });
@@ -1,9 +0,0 @@
1
- /**
2
- * The SDR output with {@link ShadeToneMappingMode.GT7}: exposure, GT7 in its SDR mode, the canvas's primaries, the sRGB
3
- * transfer curve and an 8-bit dither. {@link shader_tonemap_HDR} is the same operator for an HDR display.
4
- *
5
- * @type {ImageShader}
6
- */
7
- export const shader_tonemap_LDR: ImageShader;
8
- import { ImageShader } from "../../shader/ImageShader.js";
9
- //# sourceMappingURL=shader_tonemap_LDR.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"shader_tonemap_LDR.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/deferred/tonemap/shader_tonemap_LDR.js"],"names":[],"mappings":"AA6DA;;;;;GAKG;AACH,iCAFU,WAAW,CAclB;4BArEyB,6BAA6B"}