@woosh/meep-engine 3.63.2 → 3.64.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.
- package/CHANGELOG.md +51 -0
- package/package.json +1 -1
- package/src/core/color/xyz/m3_chromatic_adaptation_bradford.d.ts +14 -0
- package/src/core/color/xyz/m3_chromatic_adaptation_bradford.d.ts.map +1 -0
- package/src/core/color/xyz/m3_chromatic_adaptation_bradford.js +51 -0
- package/src/core/math/linalg/eigen/matrix_symmetric_3x3_eigen.d.ts +2 -1
- package/src/core/math/linalg/eigen/matrix_symmetric_3x3_eigen.d.ts.map +1 -1
- package/src/core/math/linalg/eigen/matrix_symmetric_3x3_eigen.js +51 -70
- package/src/core/math/linalg/eigen/matrix_symmetric_4x4_eigen.d.ts.map +1 -1
- package/src/core/math/linalg/eigen/matrix_symmetric_4x4_eigen.js +8 -64
- package/src/core/math/linalg/eigen/matrix_symmetric_jacobi_rotate_in_place.d.ts +17 -0
- package/src/core/math/linalg/eigen/matrix_symmetric_jacobi_rotate_in_place.d.ts.map +1 -0
- package/src/core/math/linalg/eigen/matrix_symmetric_jacobi_rotate_in_place.js +64 -0
- package/src/core/math/linalg/solve_box_constrained_qp.d.ts +30 -0
- package/src/core/math/linalg/solve_box_constrained_qp.d.ts.map +1 -0
- package/src/core/math/linalg/solve_box_constrained_qp.js +205 -0
- package/src/engine/physics/constraint/soft_spring_coefficients.d.ts +24 -0
- package/src/engine/physics/constraint/soft_spring_coefficients.d.ts.map +1 -0
- package/src/engine/physics/constraint/soft_spring_coefficients.js +38 -0
- package/src/engine/physics/constraint/solve_constraints.d.ts.map +1 -1
- package/src/engine/physics/constraint/solve_constraints.js +16 -8
- package/src/engine/physics/ecs/PhysicsSystem.d.ts +54 -0
- package/src/engine/physics/ecs/PhysicsSystem.d.ts.map +1 -1
- package/src/engine/physics/ecs/PhysicsSystem.js +192 -7
- package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
- package/src/engine/physics/inertia/world_inverse_inertia.d.ts +3 -5
- package/src/engine/physics/inertia/world_inverse_inertia.d.ts.map +1 -1
- package/src/engine/physics/inertia/world_inverse_inertia.js +3 -5
- package/src/engine/physics/vehicle/RaycastVehicle.d.ts +183 -12
- package/src/engine/physics/vehicle/RaycastVehicle.d.ts.map +1 -1
- package/src/engine/physics/vehicle/RaycastVehicle.js +1046 -121
- package/src/shade/device/mock/SoftwareGPUCommandEncoder.d.ts +17 -0
- package/src/shade/device/mock/SoftwareGPUCommandEncoder.d.ts.map +1 -1
- package/src/shade/device/mock/SoftwareGPUCommandEncoder.js +46 -0
- package/src/shade/playground/tonemap_sdr/README.md +11 -8
- package/src/shade/playground/tonemap_sdr/ToneMapCompare.js +2 -2
- package/src/shade/renderer/Renderer.d.ts +5 -6
- package/src/shade/renderer/Renderer.d.ts.map +1 -1
- package/src/shade/renderer/Renderer.js +15 -88
- package/src/shade/renderer/animation/chunk_animation_curve_evaluate_keys.d.ts +14 -0
- package/src/shade/renderer/animation/chunk_animation_curve_evaluate_keys.d.ts.map +1 -0
- package/src/shade/renderer/animation/chunk_animation_curve_evaluate_keys.js +62 -0
- package/src/shade/renderer/buffer/table/GPUDatabase.d.ts +12 -0
- package/src/shade/renderer/buffer/table/GPUDatabase.d.ts.map +1 -1
- package/src/shade/renderer/buffer/table/GPUDatabase.js +85 -0
- package/src/shade/renderer/buffer/table/GPUDatabaseDefinition.d.ts +2 -1
- package/src/shade/renderer/buffer/table/GPUDatabaseDefinition.d.ts.map +1 -1
- package/src/shade/renderer/buffer/table/GPUDatabaseDefinition.js +2 -1
- package/src/shade/renderer/deferred/tonemap/ColorGrade.d.ts +158 -0
- package/src/shade/renderer/deferred/tonemap/ColorGrade.d.ts.map +1 -0
- package/src/shade/renderer/deferred/tonemap/ColorGrade.js +337 -0
- package/src/shade/renderer/deferred/tonemap/SAMPLER_TONEMAP_LUT.d.ts +9 -0
- package/src/shade/renderer/deferred/tonemap/SAMPLER_TONEMAP_LUT.d.ts.map +1 -0
- package/src/shade/renderer/deferred/tonemap/SAMPLER_TONEMAP_LUT.js +15 -0
- package/src/shade/renderer/deferred/tonemap/TONE_MAP_OPERATOR_ACES.d.ts +6 -0
- package/src/shade/renderer/deferred/tonemap/TONE_MAP_OPERATOR_ACES.d.ts.map +1 -0
- package/src/shade/renderer/deferred/tonemap/TONE_MAP_OPERATOR_ACES.js +84 -0
- package/src/shade/renderer/deferred/tonemap/TONE_MAP_OPERATOR_GT7.d.ts +10 -0
- package/src/shade/renderer/deferred/tonemap/TONE_MAP_OPERATOR_GT7.d.ts.map +1 -0
- package/src/shade/renderer/deferred/tonemap/TONE_MAP_OPERATOR_GT7.js +25 -0
- package/src/shade/renderer/deferred/tonemap/TONE_MAP_OPERATOR_NONE.d.ts +9 -0
- package/src/shade/renderer/deferred/tonemap/TONE_MAP_OPERATOR_NONE.d.ts.map +1 -0
- package/src/shade/renderer/deferred/tonemap/TONE_MAP_OPERATOR_NONE.js +20 -0
- package/src/shade/renderer/deferred/tonemap/TONE_MAP_OPERATOR_PBR_NEUTRAL.d.ts +14 -0
- package/src/shade/renderer/deferred/tonemap/TONE_MAP_OPERATOR_PBR_NEUTRAL.d.ts.map +1 -0
- package/src/shade/renderer/deferred/tonemap/TONE_MAP_OPERATOR_PBR_NEUTRAL.js +30 -0
- package/src/shade/renderer/deferred/tonemap/ToneMapOperator.d.ts +54 -0
- package/src/shade/renderer/deferred/tonemap/ToneMapOperator.d.ts.map +1 -0
- package/src/shade/renderer/deferred/tonemap/ToneMapOperator.js +63 -0
- package/src/shade/renderer/deferred/tonemap/ToneMapper.d.ts +106 -0
- package/src/shade/renderer/deferred/tonemap/ToneMapper.d.ts.map +1 -0
- package/src/shade/renderer/deferred/tonemap/ToneMapper.js +474 -0
- package/src/shade/renderer/deferred/tonemap/TonemapAces2Tables.d.ts +5 -13
- package/src/shade/renderer/deferred/tonemap/TonemapAces2Tables.d.ts.map +1 -1
- package/src/shade/renderer/deferred/tonemap/TonemapAces2Tables.js +5 -44
- package/src/shade/renderer/deferred/tonemap/TonemapDisplaySettings.d.ts +7 -25
- package/src/shade/renderer/deferred/tonemap/TonemapDisplaySettings.d.ts.map +1 -1
- package/src/shade/renderer/deferred/tonemap/TonemapDisplaySettings.js +11 -51
- package/src/shade/renderer/deferred/tonemap/m3_white_balance_rec709.d.ts +20 -0
- package/src/shade/renderer/deferred/tonemap/m3_white_balance_rec709.d.ts.map +1 -0
- package/src/shade/renderer/deferred/tonemap/m3_white_balance_rec709.js +103 -0
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR_lut.d.ts +9 -0
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR_lut.d.ts.map +1 -0
- package/src/shade/renderer/deferred/tonemap/{shader_tonemap_HDR_none.js → shader_tonemap_HDR_lut.js} +22 -18
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR_lut.d.ts +9 -0
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR_lut.d.ts.map +1 -0
- package/src/shade/renderer/deferred/tonemap/{shader_tonemap_LDR_aces.js → shader_tonemap_LDR_lut.js} +24 -24
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_lut_bake.d.ts +23 -0
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_lut_bake.d.ts.map +1 -0
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_lut_bake.js +92 -0
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_lut_sdr_from_hdr.d.ts +15 -0
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_lut_sdr_from_hdr.d.ts.map +1 -0
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_lut_sdr_from_hdr.js +73 -0
- package/src/shade/renderer/fluid/GPUFluidCascade.d.ts +3 -3
- package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts +1 -1
- package/src/shade/renderer/fluid/forcing/GPUFluidForcing.d.ts +6 -6
- package/src/shade/renderer/fluid/pressure/GPUFluidPressureSolve.d.ts +1 -1
- package/src/shade/renderer/fluid/query/GPUFluidQueries.d.ts +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts +1 -1
- package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
- package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
- package/src/shade/renderer/shader/chunk/color/conversion/chunk_CRM_REC709_AP1.d.ts +22 -0
- package/src/shade/renderer/shader/chunk/color/conversion/chunk_CRM_REC709_AP1.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/color/conversion/chunk_CRM_REC709_AP1.js +62 -0
- package/src/shade/renderer/shader/chunk/color/grade/chunk_color_grade.d.ts +13 -0
- package/src/shade/renderer/shader/chunk/color/grade/chunk_color_grade.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/color/grade/chunk_color_grade.js +140 -0
- package/src/shade/renderer/shader/chunk/color/oklab/chunk_oklab_compute_max_saturation.d.ts +11 -0
- package/src/shade/renderer/shader/chunk/color/oklab/chunk_oklab_compute_max_saturation.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/color/oklab/chunk_oklab_compute_max_saturation.js +65 -0
- package/src/shade/renderer/shader/chunk/color/tonemap/chunk_bt2390_eetf.d.ts +14 -0
- package/src/shade/renderer/shader/chunk/color/tonemap/chunk_bt2390_eetf.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/color/tonemap/chunk_bt2390_eetf.js +38 -0
- package/src/shade/renderer/shader/chunk/color/tonemap/chunk_tonemap_lut.d.ts +16 -0
- package/src/shade/renderer/shader/chunk/color/tonemap/chunk_tonemap_lut.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/color/tonemap/chunk_tonemap_lut.js +41 -0
- package/src/shade/renderer/water/query/GPUWaterQueries.d.ts +1 -1
- package/src/shade/wgsl/emulator/WGSLJavaScriptCompiler.js +8 -8
- package/src/shade/wgsl/emulator/WGSLLanguageCore.d.ts.map +1 -1
- package/src/shade/wgsl/emulator/WGSLLanguageCore.js +2 -0
- package/src/shade/renderer/ShadeToneMappingMode.d.ts +0 -15
- package/src/shade/renderer/ShadeToneMappingMode.d.ts.map +0 -1
- package/src/shade/renderer/ShadeToneMappingMode.js +0 -41
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR.d.ts +0 -9
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR.d.ts.map +0 -1
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR.js +0 -79
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR_aces.d.ts +0 -17
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR_aces.d.ts.map +0 -1
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR_aces.js +0 -101
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR_none.d.ts +0 -9
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR_none.d.ts.map +0 -1
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR_pbr_neutral.d.ts +0 -10
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR_pbr_neutral.d.ts.map +0 -1
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR_pbr_neutral.js +0 -80
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR.d.ts +0 -9
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR.d.ts.map +0 -1
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR.js +0 -80
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR_aces.d.ts +0 -10
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR_aces.d.ts.map +0 -1
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR_none.d.ts +0 -9
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR_none.d.ts.map +0 -1
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR_none.js +0 -71
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR_pbr_neutral.d.ts +0 -10
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR_pbr_neutral.d.ts.map +0 -1
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR_pbr_neutral.js +0 -76
- package/src/shade/renderer/shader/chunk/color/tonemap/chunk_tonemap_hdr_bt2390.d.ts +0 -3
- package/src/shade/renderer/shader/chunk/color/tonemap/chunk_tonemap_hdr_bt2390.d.ts.map +0 -1
- package/src/shade/renderer/shader/chunk/color/tonemap/chunk_tonemap_hdr_bt2390.js +0 -44
|
@@ -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"}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { F32_CONTAINER_STRUCT } from "../../shader/type/F32_CONTAINER_STRUCT.js";
|
|
2
|
-
import { TONEMAP_SETTINGS_REC2020 } 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 {
|
|
8
|
-
chunk_dither_color_8bit_triangle_noise
|
|
9
|
-
} from "../../shader/chunk/texture/dither/chunk_dither_color_8bit_triangle_noise.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
|
-
resources.setImmediate("settings", TONEMAP_SETTINGS_REC2020);
|
|
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
|
-
var color = textureLoad(input_color, vec2i(coord.xy), 0).rgb;
|
|
30
|
-
|
|
31
|
-
color *= exposure.value;
|
|
32
|
-
|
|
33
|
-
// GT7's SDR mode: the peak is the paper white, so the result tops out at 1.0. The HDR pass keeps the same paper
|
|
34
|
-
// white, so below the shoulder the two write the same colour.
|
|
35
|
-
let color_2020 = tonemap_gt7_rec2020(CRM_FROM_REC709_TO_REC2020 * color, PAPER_WHITE_NITS, PAPER_WHITE_NITS);
|
|
36
|
-
|
|
37
|
-
// into the primaries the canvas reports it was configured with (Renderer#configure_context): Display P3, or
|
|
38
|
-
// sRGB where the browser would not configure P3
|
|
39
|
-
let color_display = mat3x3<f32>(
|
|
40
|
-
settings.display_from_rec2020_c0,
|
|
41
|
-
settings.display_from_rec2020_c1,
|
|
42
|
-
settings.display_from_rec2020_c2
|
|
43
|
-
) * color_2020;
|
|
44
|
-
|
|
45
|
-
// apply gamma. Note that gamma is the same for "Display P3" and "sRGB"
|
|
46
|
-
color = sRGBTransferOETF(color_display);
|
|
47
|
-
|
|
48
|
-
// apply dither to remove color banding
|
|
49
|
-
color += dither_color_8bit_triangle_noise(coord.xy);
|
|
50
|
-
|
|
51
|
-
return vec4(color, 1.0);
|
|
52
|
-
}
|
|
53
|
-
`, [
|
|
54
|
-
chunk_tonemap_gt7,
|
|
55
|
-
chunk_PAPER_WHITE_NITS,
|
|
56
|
-
chunk_CRM_FROM_REC709_TO_REC2020,
|
|
57
|
-
chunk_dither_color_8bit_triangle_noise,
|
|
58
|
-
chunk_sRGBTransferOETF,
|
|
59
|
-
]
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* The SDR output with {@link ShadeToneMappingMode.GT7}: exposure, GT7 in its SDR mode, the canvas's primaries, the sRGB
|
|
64
|
-
* transfer curve and an 8-bit dither. {@link shader_tonemap_HDR} is the same operator for an HDR display.
|
|
65
|
-
*
|
|
66
|
-
* @type {ImageShader}
|
|
67
|
-
*/
|
|
68
|
-
export const shader_tonemap_LDR = new ImageShader({
|
|
69
|
-
descriptor: ShaderDescriptor.from({
|
|
70
|
-
label: "Tonemap/LDR",
|
|
71
|
-
resources,
|
|
72
|
-
body
|
|
73
|
-
}),
|
|
74
|
-
targets: [
|
|
75
|
-
{
|
|
76
|
-
label: "tone-mapped",
|
|
77
|
-
format: "rgba8unorm"
|
|
78
|
-
}
|
|
79
|
-
]
|
|
80
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The SDR output with {@link ShadeToneMappingMode.ACES}: exposure, Unreal Engine's default "Filmic" tone mapping, the
|
|
3
|
-
* canvas's primaries, the sRGB transfer curve and an 8-bit dither. {@link shader_tonemap_HDR_aces} expands the same
|
|
4
|
-
* picture into an HDR display's headroom.
|
|
5
|
-
*
|
|
6
|
-
* @type {ImageShader}
|
|
7
|
-
*/
|
|
8
|
-
export const shader_tonemap_LDR_aces: ImageShader;
|
|
9
|
-
import { ImageShader } from "../../shader/ImageShader.js";
|
|
10
|
-
//# sourceMappingURL=shader_tonemap_LDR_aces.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shader_tonemap_LDR_aces.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/deferred/tonemap/shader_tonemap_LDR_aces.js"],"names":[],"mappings":"AAyDA;;;;;;GAMG;AACH,sCAFU,WAAW,CAclB;4BApEyB,6BAA6B"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The SDR output with {@link ShadeToneMappingMode.NONE}: exposure, the canvas's primaries, the sRGB transfer curve and
|
|
3
|
-
* an 8-bit dither, and nothing in between.
|
|
4
|
-
*
|
|
5
|
-
* @type {ImageShader}
|
|
6
|
-
*/
|
|
7
|
-
export const shader_tonemap_LDR_none: ImageShader;
|
|
8
|
-
import { ImageShader } from "../../shader/ImageShader.js";
|
|
9
|
-
//# sourceMappingURL=shader_tonemap_LDR_none.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shader_tonemap_LDR_none.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/deferred/tonemap/shader_tonemap_LDR_none.js"],"names":[],"mappings":"AAoDA;;;;;GAKG;AACH,sCAFU,WAAW,CAclB;4BA/DyB,6BAA6B"}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { F32_CONTAINER_STRUCT } from "../../shader/type/F32_CONTAINER_STRUCT.js";
|
|
2
|
-
import { TONEMAP_SETTINGS_REC709 } from "./TonemapDisplaySettings.js";
|
|
3
|
-
import { chunk_sRGBTransferOETF } from "../../shader/chunk/color/sRGB/chunk_sRGBTransferOETF.js";
|
|
4
|
-
import {
|
|
5
|
-
chunk_dither_color_8bit_triangle_noise
|
|
6
|
-
} from "../../shader/chunk/texture/dither/chunk_dither_color_8bit_triangle_noise.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
|
-
resources.setImmediate("settings", TONEMAP_SETTINGS_REC709);
|
|
14
|
-
resources.createGroup()
|
|
15
|
-
.addTexture("input_color", "float")
|
|
16
|
-
.addUniform("exposure", F32_CONTAINER_STRUCT)
|
|
17
|
-
|
|
18
|
-
const body = CodeChunk.from(
|
|
19
|
-
//language=WGSL
|
|
20
|
-
`
|
|
21
|
-
@fragment
|
|
22
|
-
fn main(
|
|
23
|
-
@builtin(position) coord : vec4<f32>,
|
|
24
|
-
) -> @location(0) vec4<f32> {
|
|
25
|
-
|
|
26
|
-
var color = textureLoad(input_color, vec2i(coord.xy), 0).rgb;
|
|
27
|
-
|
|
28
|
-
color *= exposure.value;
|
|
29
|
-
|
|
30
|
-
// no tone mapping: the exposed colour as it is, 1.0 at SDR white. The 8-bit target clips what lies above.
|
|
31
|
-
|
|
32
|
-
// into the primaries the canvas reports it was configured with (Renderer#configure_context): Display P3, or
|
|
33
|
-
// sRGB where the browser would not configure P3
|
|
34
|
-
let color_display = mat3x3<f32>(
|
|
35
|
-
settings.display_from_rec709_c0,
|
|
36
|
-
settings.display_from_rec709_c1,
|
|
37
|
-
settings.display_from_rec709_c2
|
|
38
|
-
) * color;
|
|
39
|
-
|
|
40
|
-
color = sRGBTransferOETF(color_display);
|
|
41
|
-
|
|
42
|
-
// apply dither to remove color banding
|
|
43
|
-
color += dither_color_8bit_triangle_noise(coord.xy);
|
|
44
|
-
|
|
45
|
-
return vec4(color, 1.0);
|
|
46
|
-
}
|
|
47
|
-
`, [
|
|
48
|
-
chunk_dither_color_8bit_triangle_noise,
|
|
49
|
-
chunk_sRGBTransferOETF,
|
|
50
|
-
]
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* The SDR output with {@link ShadeToneMappingMode.NONE}: exposure, the canvas's primaries, the sRGB transfer curve and
|
|
55
|
-
* an 8-bit dither, and nothing in between.
|
|
56
|
-
*
|
|
57
|
-
* @type {ImageShader}
|
|
58
|
-
*/
|
|
59
|
-
export const shader_tonemap_LDR_none = new ImageShader({
|
|
60
|
-
descriptor: ShaderDescriptor.from({
|
|
61
|
-
label: "Tonemap/LDR/none",
|
|
62
|
-
resources,
|
|
63
|
-
body
|
|
64
|
-
}),
|
|
65
|
-
targets: [
|
|
66
|
-
{
|
|
67
|
-
label: "tone-mapped",
|
|
68
|
-
format: "rgba8unorm"
|
|
69
|
-
}
|
|
70
|
-
]
|
|
71
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The SDR output with {@link ShadeToneMappingMode.PBR_NEUTRAL}: exposure, the Khronos PBR Neutral specification, the
|
|
3
|
-
* canvas's primaries, the sRGB transfer curve and an 8-bit dither. {@link shader_tonemap_HDR_pbr_neutral} is the same
|
|
4
|
-
* operator for an HDR display.
|
|
5
|
-
*
|
|
6
|
-
* @type {ImageShader}
|
|
7
|
-
*/
|
|
8
|
-
export const shader_tonemap_LDR_pbr_neutral: ImageShader;
|
|
9
|
-
import { ImageShader } from "../../shader/ImageShader.js";
|
|
10
|
-
//# sourceMappingURL=shader_tonemap_LDR_pbr_neutral.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shader_tonemap_LDR_pbr_neutral.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/deferred/tonemap/shader_tonemap_LDR_pbr_neutral.js"],"names":[],"mappings":"AAwDA;;;;;;GAMG;AACH,6CAFU,WAAW,CAclB;4BAnEyB,6BAA6B"}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { F32_CONTAINER_STRUCT } from "../../shader/type/F32_CONTAINER_STRUCT.js";
|
|
2
|
-
import { TONEMAP_SETTINGS_REC709 } from "./TonemapDisplaySettings.js";
|
|
3
|
-
import { chunk_sRGBTransferOETF } from "../../shader/chunk/color/sRGB/chunk_sRGBTransferOETF.js";
|
|
4
|
-
import { chunk_tonemap_khronos_pbr } from "../../shader/chunk/color/tonemap/chunk_tonemap_khronos_pbr.js";
|
|
5
|
-
import {
|
|
6
|
-
chunk_dither_color_8bit_triangle_noise
|
|
7
|
-
} from "../../shader/chunk/texture/dither/chunk_dither_color_8bit_triangle_noise.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
|
-
|
|
13
|
-
const resources = new ShaderResourceSetDescriptor();
|
|
14
|
-
resources.setImmediate("settings", TONEMAP_SETTINGS_REC709);
|
|
15
|
-
resources.createGroup()
|
|
16
|
-
.addTexture("input_color", "float")
|
|
17
|
-
.addUniform("exposure", F32_CONTAINER_STRUCT)
|
|
18
|
-
|
|
19
|
-
const body = CodeChunk.from(
|
|
20
|
-
//language=WGSL
|
|
21
|
-
`
|
|
22
|
-
@fragment
|
|
23
|
-
fn main(
|
|
24
|
-
@builtin(position) coord : vec4<f32>,
|
|
25
|
-
) -> @location(0) vec4<f32> {
|
|
26
|
-
|
|
27
|
-
var color = textureLoad(input_color, vec2i(coord.xy), 0).rgb;
|
|
28
|
-
|
|
29
|
-
color *= exposure.value;
|
|
30
|
-
|
|
31
|
-
// the specification: its peak is SDR white. It takes non-negative input.
|
|
32
|
-
color = tonemap_khronos_pbr(max(color, vec3<f32>(0.0)), 1.0);
|
|
33
|
-
|
|
34
|
-
// into the primaries the canvas reports it was configured with (Renderer#configure_context): Display P3, or
|
|
35
|
-
// sRGB where the browser would not configure P3
|
|
36
|
-
let color_display = mat3x3<f32>(
|
|
37
|
-
settings.display_from_rec709_c0,
|
|
38
|
-
settings.display_from_rec709_c1,
|
|
39
|
-
settings.display_from_rec709_c2
|
|
40
|
-
) * color;
|
|
41
|
-
|
|
42
|
-
// apply gamma. Note that gamma is the same for "Display P3" and "sRGB"
|
|
43
|
-
color = sRGBTransferOETF(color_display);
|
|
44
|
-
|
|
45
|
-
// apply dither to remove color banding
|
|
46
|
-
color += dither_color_8bit_triangle_noise(coord.xy);
|
|
47
|
-
|
|
48
|
-
return vec4(color, 1.0);
|
|
49
|
-
}
|
|
50
|
-
`, [
|
|
51
|
-
chunk_tonemap_khronos_pbr,
|
|
52
|
-
chunk_dither_color_8bit_triangle_noise,
|
|
53
|
-
chunk_sRGBTransferOETF,
|
|
54
|
-
]
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* The SDR output with {@link ShadeToneMappingMode.PBR_NEUTRAL}: exposure, the Khronos PBR Neutral specification, the
|
|
59
|
-
* canvas's primaries, the sRGB transfer curve and an 8-bit dither. {@link shader_tonemap_HDR_pbr_neutral} is the same
|
|
60
|
-
* operator for an HDR display.
|
|
61
|
-
*
|
|
62
|
-
* @type {ImageShader}
|
|
63
|
-
*/
|
|
64
|
-
export const shader_tonemap_LDR_pbr_neutral = new ImageShader({
|
|
65
|
-
descriptor: ShaderDescriptor.from({
|
|
66
|
-
label: "Tonemap/LDR/pbr_neutral",
|
|
67
|
-
resources,
|
|
68
|
-
body
|
|
69
|
-
}),
|
|
70
|
-
targets: [
|
|
71
|
-
{
|
|
72
|
-
label: "tone-mapped",
|
|
73
|
-
format: "rgba8unorm"
|
|
74
|
-
}
|
|
75
|
-
]
|
|
76
|
-
});
|