@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.
- 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/graphics/texture/sampler/exr_to_sampler2d.d.ts +27 -0
- package/src/engine/graphics/texture/sampler/exr_to_sampler2d.d.ts.map +1 -0
- package/src/engine/graphics/texture/sampler/exr_to_sampler2d.js +91 -0
- package/src/engine/graphics/texture/sampler/sampler2d_to_exr.d.ts +23 -0
- package/src/engine/graphics/texture/sampler/sampler2d_to_exr.d.ts.map +1 -0
- package/src/engine/graphics/texture/sampler/sampler2d_to_exr.js +64 -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/format/image/exr/ExrCompression.d.ts +22 -0
- package/src/format/image/exr/ExrCompression.d.ts.map +1 -0
- package/src/format/image/exr/ExrCompression.js +27 -0
- package/src/format/image/exr/ExrImage.d.ts +32 -0
- package/src/format/image/exr/ExrImage.d.ts.map +1 -0
- package/src/format/image/exr/ExrImage.js +32 -0
- package/src/format/image/exr/ExrPixelType.d.ts +13 -0
- package/src/format/image/exr/ExrPixelType.d.ts.map +1 -0
- package/src/format/image/exr/ExrPixelType.js +18 -0
- package/src/format/image/exr/exr_compare_names.d.ts +16 -0
- package/src/format/image/exr/exr_compare_names.d.ts.map +1 -0
- package/src/format/image/exr/exr_compare_names.js +25 -0
- package/src/format/image/exr/exr_constants.d.ts +49 -0
- package/src/format/image/exr/exr_constants.d.ts.map +1 -0
- package/src/format/image/exr/exr_constants.js +56 -0
- package/src/format/image/exr/exr_read.d.ts +32 -0
- package/src/format/image/exr/exr_read.d.ts.map +1 -0
- package/src/format/image/exr/exr_read.js +531 -0
- package/src/format/image/exr/exr_sample_bits.d.ts +16 -0
- package/src/format/image/exr/exr_sample_bits.d.ts.map +1 -0
- package/src/format/image/exr/exr_sample_bits.js +21 -0
- package/src/format/image/exr/exr_scanlines_per_chunk.d.ts +17 -0
- package/src/format/image/exr/exr_scanlines_per_chunk.d.ts.map +1 -0
- package/src/format/image/exr/exr_scanlines_per_chunk.js +31 -0
- package/src/format/image/exr/exr_write.d.ts +27 -0
- package/src/format/image/exr/exr_write.d.ts.map +1 -0
- package/src/format/image/exr/exr_write.js +378 -0
- package/src/shade/playground/probe_clipmap/index.html +5 -0
- package/src/shade/playground/probe_clipmap/main.d.ts.map +1 -1
- package/src/shade/playground/probe_clipmap/main.js +34 -1
- 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/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/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP.d.ts +3 -15
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP.js +4 -17
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap.d.ts +3 -3
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap.js +15 -13
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_accumulate.d.ts +7 -3
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_accumulate.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_accumulate.js +28 -17
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_project.d.ts +18 -18
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_project.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_project.js +44 -48
- 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/shader/chunk/filter/chunk_multiscale_mean.d.ts +8 -0
- package/src/shade/renderer/shader/chunk/filter/chunk_multiscale_mean.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/filter/chunk_multiscale_mean.js +21 -3
- 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
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { assert } from "../../../../core/assert.js";
|
|
2
|
+
import { ANIMATION_CURVE_KEYFRAME_STRUCT } from "../../animation/ANIMATION_CURVE_KEYFRAME_STRUCT.js";
|
|
3
|
+
import { chunk_color_grade } from "../../shader/chunk/color/grade/chunk_color_grade.js";
|
|
4
|
+
import { chunk_tonemap_lut } from "../../shader/chunk/color/tonemap/chunk_tonemap_lut.js";
|
|
5
|
+
import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
|
|
6
|
+
import { ComputeShader } from "../../shader/ComputeShader.js";
|
|
7
|
+
import { ShaderResourceSetDescriptor } from "../../shader/resource/ShaderResourceSetDescriptor.js";
|
|
8
|
+
import { f32 } from "../../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
|
|
9
|
+
import { WebGPUArray } from "../../shader/type/WebGPUArray.js";
|
|
10
|
+
import { WebGPUStruct } from "../../shader/type/WebGPUStruct.js";
|
|
11
|
+
import { COLOR_GRADE_STRUCT } from "./ColorGrade.js";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Immediate data of a bake: the peak the operator is evaluated for, `PAPER_WHITE_NITS` for an SDR LUT.
|
|
15
|
+
*/
|
|
16
|
+
export const TONEMAP_LUT_BAKE_SETTINGS = WebGPUStruct.from({ peak_nits: f32 });
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Edge of the cube of LUT texels one workgroup bakes.
|
|
20
|
+
*/
|
|
21
|
+
export const TONEMAP_LUT_BAKE_GROUP = 4;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @type {WeakMap<ToneMapOperator, ComputeShader>}
|
|
25
|
+
*/
|
|
26
|
+
const shaders = new WeakMap();
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The compute shader that bakes `operator` into a LUT, `lut`, one texel a thread: the texel's PQ signal decoded to
|
|
30
|
+
* exposed scene colour, through the colour grade and the operator, and encoded again, as {@link chunk_tonemap_lut}
|
|
31
|
+
* describes. The grade is `grade`, a {@link COLOR_GRADE_STRUCT}, and `grade_keys`, its curves' keyframes; see
|
|
32
|
+
* `ColorGrade#pack`. Built on first use and kept for the operator.
|
|
33
|
+
*
|
|
34
|
+
* Dispatch `ceil(resolution / TONEMAP_LUT_BAKE_GROUP)` workgroups along each axis.
|
|
35
|
+
*
|
|
36
|
+
* @param {ToneMapOperator} operator
|
|
37
|
+
* @returns {ComputeShader}
|
|
38
|
+
*/
|
|
39
|
+
export function shader_tonemap_lut_bake(operator) {
|
|
40
|
+
assert.defined(operator, 'operator');
|
|
41
|
+
|
|
42
|
+
let shader = shaders.get(operator);
|
|
43
|
+
|
|
44
|
+
if (shader !== undefined) {
|
|
45
|
+
return shader;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const resources = new ShaderResourceSetDescriptor();
|
|
49
|
+
|
|
50
|
+
resources.setImmediate("settings", TONEMAP_LUT_BAKE_SETTINGS);
|
|
51
|
+
|
|
52
|
+
const group = resources.createGroup()
|
|
53
|
+
.addStorageTexture("lut", "rgba16float", "3d", "write-only")
|
|
54
|
+
.addUniform("grade", COLOR_GRADE_STRUCT)
|
|
55
|
+
.addStorageBuffer("grade_keys", WebGPUArray.from(ANIMATION_CURVE_KEYFRAME_STRUCT));
|
|
56
|
+
|
|
57
|
+
operator.declare(group);
|
|
58
|
+
|
|
59
|
+
const body = CodeChunk.from(
|
|
60
|
+
//language=WGSL
|
|
61
|
+
`
|
|
62
|
+
@compute @workgroup_size(${TONEMAP_LUT_BAKE_GROUP}, ${TONEMAP_LUT_BAKE_GROUP}, ${TONEMAP_LUT_BAKE_GROUP})
|
|
63
|
+
fn main(@builtin(global_invocation_id) texel: vec3<u32>) {
|
|
64
|
+
let size = textureDimensions(lut);
|
|
65
|
+
|
|
66
|
+
if (any(texel >= size)) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
let scene = tonemap_lut_pq_decode(vec3<f32>(texel) / vec3<f32>(size - 1u));
|
|
71
|
+
|
|
72
|
+
let display = tone_map_operator(color_grade(scene, grade, &grade_keys), settings.peak_nits);
|
|
73
|
+
|
|
74
|
+
textureStore(lut, texel, vec4<f32>(tonemap_lut_pq_encode(display), 1.0));
|
|
75
|
+
}
|
|
76
|
+
`, [
|
|
77
|
+
chunk_tonemap_lut,
|
|
78
|
+
chunk_color_grade,
|
|
79
|
+
operator.chunk,
|
|
80
|
+
]
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
shader = ComputeShader.from({
|
|
84
|
+
label: `Tonemap/LUT bake/${operator.label}`,
|
|
85
|
+
body,
|
|
86
|
+
resources,
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
shaders.set(operator, shader);
|
|
90
|
+
|
|
91
|
+
return shader;
|
|
92
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Immediate data of {@link shader_tonemap_lut_sdr_from_hdr}: the peak the HDR LUT was graded for, cd/m².
|
|
3
|
+
*/
|
|
4
|
+
export const TONEMAP_LUT_SDR_FROM_HDR_SETTINGS: WebGPUStruct;
|
|
5
|
+
/**
|
|
6
|
+
* An SDR LUT from an HDR one of the same resolution: each texel through the BT.2390 EETF, from the HDR LUT's graded
|
|
7
|
+
* peak down to the paper white. The EETF maps the brightest channel's signal and the three channels scale by the
|
|
8
|
+
* same ratio of light, so the hue holds and no channel passes SDR white. Below the EETF's knee a texel is unchanged.
|
|
9
|
+
*
|
|
10
|
+
* @type {ComputeShader}
|
|
11
|
+
*/
|
|
12
|
+
export const shader_tonemap_lut_sdr_from_hdr: ComputeShader;
|
|
13
|
+
import { WebGPUStruct } from "../../shader/type/WebGPUStruct.js";
|
|
14
|
+
import { ComputeShader } from "../../shader/ComputeShader.js";
|
|
15
|
+
//# sourceMappingURL=shader_tonemap_lut_sdr_from_hdr.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shader_tonemap_lut_sdr_from_hdr.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/deferred/tonemap/shader_tonemap_lut_sdr_from_hdr.js"],"names":[],"mappings":"AAUA;;GAEG;AACH,6DAA8F;AAgD9F;;;;;;GAMG;AACH,8CAFU,aAAa,CAMpB;6BAjE0B,mCAAmC;8BAHlC,+BAA+B"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { chunk_bt2390_eetf } from "../../shader/chunk/color/tonemap/chunk_bt2390_eetf.js";
|
|
2
|
+
import { chunk_PAPER_WHITE_NITS } from "../../shader/chunk/color/tonemap/chunk_PAPER_WHITE_NITS.js";
|
|
3
|
+
import { chunk_tonemap_lut } from "../../shader/chunk/color/tonemap/chunk_tonemap_lut.js";
|
|
4
|
+
import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
|
|
5
|
+
import { ComputeShader } from "../../shader/ComputeShader.js";
|
|
6
|
+
import { ShaderResourceSetDescriptor } from "../../shader/resource/ShaderResourceSetDescriptor.js";
|
|
7
|
+
import { f32 } from "../../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
|
|
8
|
+
import { WebGPUStruct } from "../../shader/type/WebGPUStruct.js";
|
|
9
|
+
import { TONEMAP_LUT_BAKE_GROUP } from "./shader_tonemap_lut_bake.js";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Immediate data of {@link shader_tonemap_lut_sdr_from_hdr}: the peak the HDR LUT was graded for, cd/m².
|
|
13
|
+
*/
|
|
14
|
+
export const TONEMAP_LUT_SDR_FROM_HDR_SETTINGS = WebGPUStruct.from({ source_peak_nits: f32 });
|
|
15
|
+
|
|
16
|
+
const resources = new ShaderResourceSetDescriptor();
|
|
17
|
+
|
|
18
|
+
resources.setImmediate("settings", TONEMAP_LUT_SDR_FROM_HDR_SETTINGS);
|
|
19
|
+
resources.createGroup()
|
|
20
|
+
.addTexture("hdr_lut", "unfilterable-float", "3d")
|
|
21
|
+
.addStorageTexture("sdr_lut", "rgba16float", "3d", "write-only");
|
|
22
|
+
|
|
23
|
+
const body = CodeChunk.from(
|
|
24
|
+
//language=WGSL
|
|
25
|
+
`
|
|
26
|
+
@compute @workgroup_size(${TONEMAP_LUT_BAKE_GROUP}, ${TONEMAP_LUT_BAKE_GROUP}, ${TONEMAP_LUT_BAKE_GROUP})
|
|
27
|
+
fn main(@builtin(global_invocation_id) texel: vec3<u32>) {
|
|
28
|
+
let size = textureDimensions(sdr_lut);
|
|
29
|
+
|
|
30
|
+
if (any(texel >= size)) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
let signal = textureLoad(hdr_lut, texel, 0).rgb;
|
|
35
|
+
|
|
36
|
+
// the brightest channel's signal; the other two follow it by the same ratio of light, which keeps the hue
|
|
37
|
+
let brightest = max(signal.r, max(signal.g, signal.b));
|
|
38
|
+
|
|
39
|
+
let source_peak = tonemap_lut_pq_encode(vec3<f32>(settings.source_peak_nits / PAPER_WHITE_NITS)).x;
|
|
40
|
+
let target_peak = tonemap_lut_pq_encode(vec3<f32>(1.0)).x;
|
|
41
|
+
|
|
42
|
+
let mapped = bt2390_eetf(brightest, source_peak, target_peak);
|
|
43
|
+
|
|
44
|
+
let light = tonemap_lut_pq_decode(signal);
|
|
45
|
+
let before = tonemap_lut_pq_decode(vec3<f32>(brightest)).x;
|
|
46
|
+
let after = tonemap_lut_pq_decode(vec3<f32>(mapped)).x;
|
|
47
|
+
|
|
48
|
+
var scale = 1.0;
|
|
49
|
+
if (before > 0.0) {
|
|
50
|
+
scale = after / before;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
textureStore(sdr_lut, texel, vec4<f32>(tonemap_lut_pq_encode(light * scale), 1.0));
|
|
54
|
+
}
|
|
55
|
+
`, [
|
|
56
|
+
chunk_tonemap_lut,
|
|
57
|
+
chunk_bt2390_eetf,
|
|
58
|
+
chunk_PAPER_WHITE_NITS,
|
|
59
|
+
]
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* An SDR LUT from an HDR one of the same resolution: each texel through the BT.2390 EETF, from the HDR LUT's graded
|
|
64
|
+
* peak down to the paper white. The EETF maps the brightest channel's signal and the three channels scale by the
|
|
65
|
+
* same ratio of light, so the hue holds and no channel passes SDR white. Below the EETF's knee a texel is unchanged.
|
|
66
|
+
*
|
|
67
|
+
* @type {ComputeShader}
|
|
68
|
+
*/
|
|
69
|
+
export const shader_tonemap_lut_sdr_from_hdr = ComputeShader.from({
|
|
70
|
+
label: "Tonemap/LUT SDR from HDR",
|
|
71
|
+
body,
|
|
72
|
+
resources,
|
|
73
|
+
});
|
|
@@ -143,7 +143,7 @@ export class GPUFluidCascade {
|
|
|
143
143
|
* @param {*} _resources
|
|
144
144
|
* @param {{encoder: ShadeGPUCommandContext}} context
|
|
145
145
|
*/
|
|
146
|
-
static "__#
|
|
146
|
+
static "__#289@#execute_restrict"(record: object, _resources: any, context: {
|
|
147
147
|
encoder: ShadeGPUCommandContext;
|
|
148
148
|
}): void;
|
|
149
149
|
/**
|
|
@@ -151,7 +151,7 @@ export class GPUFluidCascade {
|
|
|
151
151
|
* @param {*} _resources
|
|
152
152
|
* @param {{encoder: ShadeGPUCommandContext}} context
|
|
153
153
|
*/
|
|
154
|
-
static "__#
|
|
154
|
+
static "__#289@#execute_fill"(record: object, _resources: any, context: {
|
|
155
155
|
encoder: ShadeGPUCommandContext;
|
|
156
156
|
}): void;
|
|
157
157
|
/**
|
|
@@ -159,7 +159,7 @@ export class GPUFluidCascade {
|
|
|
159
159
|
* @param {import("../../../engine/graphics/render/frame_graph/FramePassResources.js").FramePassResources} resources
|
|
160
160
|
* @param {{encoder: ShadeGPUCommandContext}} context
|
|
161
161
|
*/
|
|
162
|
-
static "__#
|
|
162
|
+
static "__#289@#execute"(record: object, resources: import("../../../engine/graphics/render/frame_graph/FramePassResources.js").FramePassResources, context: {
|
|
163
163
|
encoder: ShadeGPUCommandContext;
|
|
164
164
|
}): void;
|
|
165
165
|
/**
|
|
@@ -63,7 +63,7 @@ export class GPUFluidCascadeStack {
|
|
|
63
63
|
* @param {*} _resources
|
|
64
64
|
* @param {{encoder: import("../../device/ShadeGPUCommandContext.js").ShadeGPUCommandContext}} context
|
|
65
65
|
*/
|
|
66
|
-
static "__#
|
|
66
|
+
static "__#291@#execute_publish"(pass: object, _resources: any, context: {
|
|
67
67
|
encoder: import("../../device/ShadeGPUCommandContext.js").ShadeGPUCommandContext;
|
|
68
68
|
}): void;
|
|
69
69
|
/**
|
|
@@ -90,19 +90,19 @@ export class GPUFluidForcing {
|
|
|
90
90
|
* @param {number} clear_size bytes cleared from 0 when the pool reuses the buffer
|
|
91
91
|
* @returns {BufferResourceDescriptor}
|
|
92
92
|
*/
|
|
93
|
-
static "__#
|
|
93
|
+
static "__#292@#descriptor"(kept: BufferResourceDescriptor[], role: number, size: number, usage: number, clear_size: number): BufferResourceDescriptor;
|
|
94
94
|
/**
|
|
95
95
|
* @param {object} record
|
|
96
96
|
* @param {FramePassResources} resources
|
|
97
97
|
* @param {{encoder: ShadeGPUCommandContext}} context
|
|
98
98
|
*/
|
|
99
|
-
static "__#
|
|
99
|
+
static "__#292@#execute_extract"(record: object, resources: FramePassResources, context: {
|
|
100
100
|
encoder: ShadeGPUCommandContext;
|
|
101
101
|
}): void;
|
|
102
|
-
static "__#
|
|
103
|
-
static "__#
|
|
104
|
-
static "__#
|
|
105
|
-
static "__#
|
|
102
|
+
static "__#292@#execute_clear"(record: any, _resources: any, context: any): void;
|
|
103
|
+
static "__#292@#execute_query"(record: any, resources: any, context: any): void;
|
|
104
|
+
static "__#292@#execute_command"(record: any, resources: any, context: any): void;
|
|
105
|
+
static "__#292@#execute_apply"(record: any, resources: any, context: any): void;
|
|
106
106
|
/**
|
|
107
107
|
* @param {object} options
|
|
108
108
|
* @param {GPUDevice} options.device
|
|
@@ -41,7 +41,7 @@ export class GPUFluidPressureSolve {
|
|
|
41
41
|
* @param {*} _resources
|
|
42
42
|
* @param {{encoder: ShadeGPUCommandContext}} context
|
|
43
43
|
*/
|
|
44
|
-
static "__#
|
|
44
|
+
static "__#288@#execute"(data: {
|
|
45
45
|
solve: GPUFluidPressureSolve;
|
|
46
46
|
arm: number;
|
|
47
47
|
count: number;
|
|
@@ -49,7 +49,7 @@ export class GPUFluidQueries {
|
|
|
49
49
|
* @param {import("../../../../engine/graphics/render/frame_graph/FramePassResources.js").FramePassResources} resources
|
|
50
50
|
* @param {{encoder: import("../../../device/ShadeGPUCommandContext.js").ShadeGPUCommandContext}} context
|
|
51
51
|
*/
|
|
52
|
-
static "__#
|
|
52
|
+
static "__#293@#execute"(pass: object, resources: import("../../../../engine/graphics/render/frame_graph/FramePassResources.js").FramePassResources, context: {
|
|
53
53
|
encoder: import("../../../device/ShadeGPUCommandContext.js").ShadeGPUCommandContext;
|
|
54
54
|
}): void;
|
|
55
55
|
/**
|
|
@@ -34,7 +34,7 @@ export class GPUProbeClipmapGI {
|
|
|
34
34
|
* @param {ProbeClipmapSettings} settings
|
|
35
35
|
* @returns {boolean} whether it is what the settings' world cache describes, in their frustum's windows
|
|
36
36
|
*/
|
|
37
|
-
static "__#
|
|
37
|
+
static "__#214@#world_cache_built_for"(world_cache: GPUProbeClipmap, settings: ProbeClipmapSettings): boolean;
|
|
38
38
|
/**
|
|
39
39
|
* @param {GraphicsContext} graphics
|
|
40
40
|
*/
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Words of a listed probe's maps, as accumulation writes them for projection and publish: two a
|
|
3
3
|
* radiance texel, rgba as half floats; one a radiance texel, its rays this update, resolved and back
|
|
4
|
-
* faces; one a depth texel, its moments as half floats; then one a radiance texel,
|
|
5
|
-
*
|
|
6
|
-
* request reads (`PROBE_CHANGE_SIGNIFICANCE`).
|
|
4
|
+
* faces; one a depth texel, its moments as half floats; then one a radiance texel, its estimator's short
|
|
5
|
+
* mean less its mean and its deviation, luminance, as half floats, which the probe's L0 estimator sums.
|
|
7
6
|
*
|
|
8
7
|
* @param {number} radiance_resolution n_r
|
|
9
8
|
* @param {number} depth_resolution n_d
|
|
@@ -276,16 +275,6 @@ export const PROBE_DEAD_RAYS: number;
|
|
|
276
275
|
* @type {number}
|
|
277
276
|
*/
|
|
278
277
|
export const PROBE_RAYS_PER_TEXEL_MAX: number;
|
|
279
|
-
/**
|
|
280
|
-
* How far a probe's change score may go from its own running mean, in its own running deviation, before
|
|
281
|
-
* the probe's light counts as moved (§8.6); and how far a texel's sample may fall from its mean, in its
|
|
282
|
-
* own deviation, before it counts at that. The score sums the texels' falls over the root of their
|
|
283
|
-
* count, each held to this, which the central limit makes near normal however a texel's own fall is
|
|
284
|
-
* spread. A normal score passes it on all but 0.27% of updates; Sponza's probes past 64 updates, the light
|
|
285
|
-
* still, asked for the most on 1.1–1.3% (measured, §8.6), each such update costing one at the most rays.
|
|
286
|
-
* @type {number}
|
|
287
|
-
*/
|
|
288
|
-
export const PROBE_CHANGE_SIGNIFICANCE: number;
|
|
289
278
|
/**
|
|
290
279
|
* Rays a guided update gives one radiance texel at most, the same gather budget as a depth texel's
|
|
291
280
|
* ({@link PROBE_DEPTH_TEXEL_RAYS}). The guide holds each texel's weight down to it and spreads what it
|
|
@@ -366,8 +355,7 @@ export const PROBE_WANT_WORKGROUP_TILES: number;
|
|
|
366
355
|
*/
|
|
367
356
|
export const PROBE_FILL_WORKGROUP_SIZE: number;
|
|
368
357
|
/**
|
|
369
|
-
* Lattice cells a cascade's blend skirt is deep:
|
|
370
|
-
* which the spacing doubles (§8.1).
|
|
358
|
+
* Lattice cells a cascade's blend skirt is deep: two cells of the coarser cascade (§8.1).
|
|
371
359
|
* @type {number}
|
|
372
360
|
*/
|
|
373
361
|
export const PROBE_BLEND_SKIRT: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PROBE_CLIPMAP.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP.js"],"names":[],"mappings":"AAkSA
|
|
1
|
+
{"version":3,"file":"PROBE_CLIPMAP.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP.js"],"names":[],"mappings":"AAkSA;;;;;;;;;GASG;AACH,8DAJW,MAAM,oBACN,MAAM,GACJ,MAAM,CAIlB;AA2DD;;;;;;;;;;;GAWG;AACH,+DAHW,MAAM,GACJ,MAAM,CAIlB;AA5WD;;;GAGG;AACH,iCAFU,MAAM,CAE6B;AAS7C;;;GAGG;AAC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H,iCAFU,MAAM,CAEoB;AAEpC;;;GAGG;AACH,uCAFU,MAAM,CAE4B;AAE5C;;;;;;;;GAQG;AACH,oCAFU,MAAM,CAEiG;AAEjH;;;;GAIG;AACH,wCAFU,MAAM,CAE2B"}
|
|
@@ -291,9 +291,8 @@ export const PROBE_DEPTH_TEXEL_RAYS = 64;
|
|
|
291
291
|
/**
|
|
292
292
|
* Words of a listed probe's maps, as accumulation writes them for projection and publish: two a
|
|
293
293
|
* radiance texel, rgba as half floats; one a radiance texel, its rays this update, resolved and back
|
|
294
|
-
* faces; one a depth texel, its moments as half floats; then one a radiance texel,
|
|
295
|
-
*
|
|
296
|
-
* request reads (`PROBE_CHANGE_SIGNIFICANCE`).
|
|
294
|
+
* faces; one a depth texel, its moments as half floats; then one a radiance texel, its estimator's short
|
|
295
|
+
* mean less its mean and its deviation, luminance, as half floats, which the probe's L0 estimator sums.
|
|
297
296
|
*
|
|
298
297
|
* @param {number} radiance_resolution n_r
|
|
299
298
|
* @param {number} depth_resolution n_d
|
|
@@ -337,17 +336,6 @@ export const PROBE_DEAD_RAYS = 16;
|
|
|
337
336
|
*/
|
|
338
337
|
export const PROBE_RAYS_PER_TEXEL_MAX = 4;
|
|
339
338
|
|
|
340
|
-
/**
|
|
341
|
-
* How far a probe's change score may go from its own running mean, in its own running deviation, before
|
|
342
|
-
* the probe's light counts as moved (§8.6); and how far a texel's sample may fall from its mean, in its
|
|
343
|
-
* own deviation, before it counts at that. The score sums the texels' falls over the root of their
|
|
344
|
-
* count, each held to this, which the central limit makes near normal however a texel's own fall is
|
|
345
|
-
* spread. A normal score passes it on all but 0.27% of updates; Sponza's probes past 64 updates, the light
|
|
346
|
-
* still, asked for the most on 1.1–1.3% (measured, §8.6), each such update costing one at the most rays.
|
|
347
|
-
* @type {number}
|
|
348
|
-
*/
|
|
349
|
-
export const PROBE_CHANGE_SIGNIFICANCE = 3;
|
|
350
|
-
|
|
351
339
|
/**
|
|
352
340
|
* Rays a guided update gives one radiance texel at most, the same gather budget as a depth texel's
|
|
353
341
|
* ({@link PROBE_DEPTH_TEXEL_RAYS}). The guide holds each texel's weight down to it and spreads what it
|
|
@@ -469,11 +457,10 @@ export const PROBE_WANT_WORKGROUP_TILES = 8;
|
|
|
469
457
|
export const PROBE_FILL_WORKGROUP_SIZE = 64;
|
|
470
458
|
|
|
471
459
|
/**
|
|
472
|
-
* Lattice cells a cascade's blend skirt is deep:
|
|
473
|
-
* which the spacing doubles (§8.1).
|
|
460
|
+
* Lattice cells a cascade's blend skirt is deep: two cells of the coarser cascade (§8.1).
|
|
474
461
|
* @type {number}
|
|
475
462
|
*/
|
|
476
|
-
export const PROBE_BLEND_SKIRT =
|
|
463
|
+
export const PROBE_BLEND_SKIRT = 4;
|
|
477
464
|
|
|
478
465
|
/**
|
|
479
466
|
* The receiver bias's length, in lattice cells of the cascade picked (§9.1).
|
|
@@ -189,8 +189,8 @@ export const PROBE_RAY_SUMS_WRITE_RESOURCE: ShaderResourceDescriptor;
|
|
|
189
189
|
*/
|
|
190
190
|
export const PROBE_RAY_SUMS_READ_RESOURCE: ShaderResourceDescriptor;
|
|
191
191
|
/**
|
|
192
|
-
* A slot's
|
|
193
|
-
*
|
|
192
|
+
* A slot's request (§8.6, §8.8), as projection writes it after each update: what the probe's next update takes,
|
|
193
|
+
* by its L0 estimator, a multi-scale mean estimator over the probe's whole light (`shader_probe_clipmap_project`).
|
|
194
194
|
*
|
|
195
195
|
* @type {WebGPUStruct}
|
|
196
196
|
*/
|
|
@@ -201,7 +201,7 @@ export const PROBE_REQUEST_STRUCT: WebGPUStruct;
|
|
|
201
201
|
*/
|
|
202
202
|
export const PROBE_REQUESTS_WRITE_RESOURCE: ShaderResourceDescriptor;
|
|
203
203
|
/**
|
|
204
|
-
* Each slot's
|
|
204
|
+
* Each slot's request, as the ray counts and accumulation read it.
|
|
205
205
|
* @type {ShaderResourceDescriptor}
|
|
206
206
|
*/
|
|
207
207
|
export const PROBE_REQUESTS_READ_RESOURCE: ShaderResourceDescriptor;
|
package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chunk_probe_clipmap.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap.js"],"names":[],"mappings":"AAyEA;;;;;;GAMG;AACH,kCAFU,YAAY,CAsBG;AAEzB;;;;;GAKG;AACH,+BAFU,YAAY,CAuBA;AAEtB;;;;;;GAMG;AACH,oCAFU,wBAAwB,CAEyE;AAE3G;;;;GAIG;AACH,+CAFU,wBAAwB,CAE0G;AAE5I;;;;GAIG;AACH,0CAFU,wBAAwB,CAE+F;AAEjI;;;GAGG;AACH,yCAFU,wBAAwB,CAEwF;AAE1H;;;GAGG;AACH,2CAFU,wBAAwB,CAE+G;AAEjJ;;;GAGG;AACH,0CAFU,wBAAwB,CAEwG;AAE1I;;;GAGG;AACH,sCAFU,wBAAwB,CAEkG;AAEpI;;;;GAIG;AACH,2CAFU,wBAAwB,CAEoF;AAEtH;;;GAGG;AACH,kCAFU,wBAAwB,CAE6E;AAE/G;;;;;GAKG;AACH,oCAFU,YAAY,CAKK;AAE3B;;;GAGG;AACH,2CAFU,wBAAwB,CAE0F;AAE5H;;;GAGG;AACH,4CAFU,wBAAwB,CAEiG;AAEnI;;;GAGG;AACH,yCAFU,wBAAwB,CAEgG;AAElI;;;GAGG;AACH,0CAFU,wBAAwB,CAEyG;AAE3I;;;GAGG;AACH,4CAFU,wBAAwB,CAEoG;AAEtI;;;GAGG;AACH,yCAFU,wBAAwB,CAEwG;AAE1I;;;GAGG;AACH,yCAFU,wBAAwB,CAEiG;AAEnI;;;GAGG;AACH,wCAFU,wBAAwB,CAEyF;AAE3H;;;;GAIG;AACH,yCAFU,wBAAwB,CAEgG;AAElI;;;GAGG;AACH,0CAFU,wBAAwB,CAEmG;AAErI;;;GAGG;AACH,yCAFU,wBAAwB,CAE2F;AA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AAE1I;;;GAGG;AACH,yCAFU,wBAAwB,CAEgG;AAElI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,kCAFU,SAAS,CAgIhB;AAEH;;;;;;;;;;GAUG;AACH,6CAFU,SAAS,CA8BhB;AAIH;;;;;;;;;;;;;;;;;GAiBG;AACH,4CAFU,SAAS,CA+BhB;AAEH;;;;;;;;;;;;;;GAcG;AACH,4CAFU,SAAS,CAehB;AAEH;;;;;;;;;;;;;;GAcG;AACH,6CAFU,SAAS,CAahB;AAEH;;;;;;;;;;;;GAYG;AACH,6CAFU,SAAS,CAehB;AAEH;;;GAGG;AACH,yCAFU,wBAAwB,CAEqF;AAEvH;;;GAGG;AACH,wCAFU,wBAAwB,CAE8E;AAEhH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wCAFU,SAAS,CAwDhB;AAEH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,4CAFU,SAAS,CA6BhB;AAEH;;;;;;;;;GASG;AACH,iDAFU,SAAS,CAahB;AAIH;;;;;;;;;;GAUG;AACH,yCAFU,SAAS,CAgBhB;6BAlgC0B,sCAAsC;yCAZ1B,sDAAsD;0BADrE,uCAAuC"}
|
|
@@ -340,20 +340,20 @@ export const PROBE_RAY_SUMS_WRITE_RESOURCE = ShaderResourceDescriptor.storageBuf
|
|
|
340
340
|
export const PROBE_RAY_SUMS_READ_RESOURCE = ShaderResourceDescriptor.storageBuffer("probe_ray_sums", COLLECTION_U32_STRUCT_READ);
|
|
341
341
|
|
|
342
342
|
/**
|
|
343
|
-
* A slot's
|
|
344
|
-
*
|
|
343
|
+
* A slot's request (§8.6, §8.8), as projection writes it after each update: what the probe's next update takes,
|
|
344
|
+
* by its L0 estimator, a multi-scale mean estimator over the probe's whole light (`shader_probe_clipmap_project`).
|
|
345
345
|
*
|
|
346
346
|
* @type {WebGPUStruct}
|
|
347
347
|
*/
|
|
348
348
|
export const PROBE_REQUEST_STRUCT = WebGPUStruct.from({
|
|
349
349
|
/** the rays the probe's next guided update asks for */
|
|
350
350
|
rays: u32,
|
|
351
|
-
/** the
|
|
352
|
-
|
|
353
|
-
/** the
|
|
354
|
-
|
|
355
|
-
/** the
|
|
356
|
-
|
|
351
|
+
/** the least blend of every texel's long mean on the next update: the L0 estimator's catch-up */
|
|
352
|
+
blend: f32,
|
|
353
|
+
/** the L0 estimator's inconsistency, the smoothed history of its means' gap over its deviation */
|
|
354
|
+
inconsistency: f32,
|
|
355
|
+
/** the L0 estimator's blend reduction */
|
|
356
|
+
reduction: f32,
|
|
357
357
|
}, "ProbeRequest").pack();
|
|
358
358
|
|
|
359
359
|
/**
|
|
@@ -363,7 +363,7 @@ export const PROBE_REQUEST_STRUCT = WebGPUStruct.from({
|
|
|
363
363
|
export const PROBE_REQUESTS_WRITE_RESOURCE = ShaderResourceDescriptor.storageBuffer("probe_requests", WebGPUArray.from(PROBE_REQUEST_STRUCT), true);
|
|
364
364
|
|
|
365
365
|
/**
|
|
366
|
-
* Each slot's
|
|
366
|
+
* Each slot's request, as the ray counts and accumulation read it.
|
|
367
367
|
* @type {ShaderResourceDescriptor}
|
|
368
368
|
*/
|
|
369
369
|
export const PROBE_REQUESTS_READ_RESOURCE = ShaderResourceDescriptor.storageBuffer("probe_requests", WebGPUArray.from(PROBE_REQUEST_STRUCT));
|
|
@@ -463,10 +463,12 @@ export const PROBE_PROJECTION_ROW_STRUCT = WebGPUStruct.from({
|
|
|
463
463
|
resolved: u32,
|
|
464
464
|
/** of them, the back faces */
|
|
465
465
|
back_faces: u32,
|
|
466
|
-
/**
|
|
467
|
-
|
|
468
|
-
/** the texels
|
|
469
|
-
|
|
466
|
+
/** the texels' short means less their means, luminance, each by its solid angle, summed: L0's gap */
|
|
467
|
+
gap: f32,
|
|
468
|
+
/** the texels' deviations squared, luminance, each by its solid angle squared, summed: L0's variance */
|
|
469
|
+
variance: f32,
|
|
470
|
+
/** the texels' short means, luminance, each by its solid angle, summed: L0's short mean */
|
|
471
|
+
level: f32,
|
|
470
472
|
}, "ProbeProjectionRow").pack();
|
|
471
473
|
|
|
472
474
|
/**
|
|
@@ -9,9 +9,9 @@ export const PROBE_ACCUMULATE_SETTINGS: WebGPUStruct;
|
|
|
9
9
|
* `probe_maps` (`probe_clipmap_maps_words`): two words a radiance texel, rgba as half floats; then a
|
|
10
10
|
* word a radiance texel, its rays this update, resolved in the low half and back faces in the high,
|
|
11
11
|
* which classification sums; then a word a depth texel, its moments as half floats; then a word a
|
|
12
|
-
* radiance texel,
|
|
13
|
-
* `
|
|
14
|
-
*
|
|
12
|
+
* radiance texel, its estimator after the update as the probe's L0 estimator sums it
|
|
13
|
+
* (`shader_probe_clipmap_project`): its short mean less its mean and its deviation (the estimator's own,
|
|
14
|
+
* floored at the display's exposure), luminance, as half floats; nothing for a texel no ray has reached.
|
|
15
15
|
*
|
|
16
16
|
* - **A texel's rays**: on a uniform update (`PROBE_UNIFORM_PERIOD`), `probe_clipmap_texel_ray`'s. On a
|
|
17
17
|
* guided one, the run that begins at its walk position in the probe's guide, at most
|
|
@@ -29,6 +29,10 @@ export const PROBE_ACCUMULATE_SETTINGS: WebGPUStruct;
|
|
|
29
29
|
* - The mean blends by at least 1/(a+1) until the count reaches its limit: a young texel is its running
|
|
30
30
|
* mean, which the estimator's blend reduction, nothing at its seed, would otherwise hold back. Past it
|
|
31
31
|
* the estimator alone, down to 1/8192 an update on a noisy texel.
|
|
32
|
+
* - And by at least the probe's L0 blend (`PROBE_REQUEST_STRUCT`'s `blend`), its L0 estimator's catch-up
|
|
33
|
+
* after its last update: a change in the probe's whole light, which the texels' own tests, a one-ray
|
|
34
|
+
* sample's noise apiece, do not see. The texel's own catch-up stays, for light that moves without
|
|
35
|
+
* changing L0.
|
|
32
36
|
* - Samples are clipped once the variance's window has passed, when 1/(a+1) is no longer its blend:
|
|
33
37
|
* before that it holds no spread to clip to.
|
|
34
38
|
* - A texel's first sample seeds both means. A texel no ray reached keeps its history.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shader_probe_clipmap_accumulate.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_accumulate.js"],"names":[],"mappings":"AA+CA;;GAEG;AACH,wCAFU,YAAY,CAmBQ;
|
|
1
|
+
{"version":3,"file":"shader_probe_clipmap_accumulate.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_accumulate.js"],"names":[],"mappings":"AA+CA;;GAEG;AACH,wCAFU,YAAY,CAmBQ;AAwB9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AACH,8CAFU,aAAa,CAgUpB;6BAlc0B,sCAAsC;8BAJrC,kCAAkC"}
|
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
PROBE_RAY_STRUCT,
|
|
30
30
|
PROBE_RAY_SUMS_READ_RESOURCE,
|
|
31
31
|
PROBE_RAYS_READ_RESOURCE,
|
|
32
|
+
PROBE_REQUESTS_READ_RESOURCE,
|
|
32
33
|
PROBE_RESAMPLES_READ_RESOURCE,
|
|
33
34
|
PROBE_STATES_READ_RESOURCE,
|
|
34
35
|
PROBE_TRACE_READ_RESOURCE
|
|
@@ -36,7 +37,6 @@ import {
|
|
|
36
37
|
import { chunk_probe_clipmap_resampled } from "./chunk_probe_clipmap_resampled.js";
|
|
37
38
|
import {
|
|
38
39
|
PROBE_BACK_FACE_DEPTH,
|
|
39
|
-
PROBE_CHANGE_SIGNIFICANCE,
|
|
40
40
|
PROBE_DEPTH_LIMIT,
|
|
41
41
|
PROBE_DEPTH_TEXEL_RAYS,
|
|
42
42
|
PROBE_RADIANCE_SAMPLES_LIMIT,
|
|
@@ -82,6 +82,8 @@ resources.createGroup()
|
|
|
82
82
|
.add(PROBE_RADIANCE_HISTORY_RESOURCE)
|
|
83
83
|
.add(PROBE_DEPTH_HISTORY_RESOURCE)
|
|
84
84
|
.add(PROBE_ESTIMATORS_RESOURCE)
|
|
85
|
+
// the probes' L0 blends, as their last projection left them
|
|
86
|
+
.add(PROBE_REQUESTS_READ_RESOURCE)
|
|
85
87
|
// read only where the frame re-samples (chunk_probe_clipmap_resampled)
|
|
86
88
|
.add(PROBE_RESAMPLES_READ_RESOURCE)
|
|
87
89
|
// the factor the display multiplies radiance by ahead of its tone curve, as the last frame was shown
|
|
@@ -94,9 +96,9 @@ resources.createGroup()
|
|
|
94
96
|
* `probe_maps` (`probe_clipmap_maps_words`): two words a radiance texel, rgba as half floats; then a
|
|
95
97
|
* word a radiance texel, its rays this update, resolved in the low half and back faces in the high,
|
|
96
98
|
* which classification sums; then a word a depth texel, its moments as half floats; then a word a
|
|
97
|
-
* radiance texel,
|
|
98
|
-
* `
|
|
99
|
-
*
|
|
99
|
+
* radiance texel, its estimator after the update as the probe's L0 estimator sums it
|
|
100
|
+
* (`shader_probe_clipmap_project`): its short mean less its mean and its deviation (the estimator's own,
|
|
101
|
+
* floored at the display's exposure), luminance, as half floats; nothing for a texel no ray has reached.
|
|
100
102
|
*
|
|
101
103
|
* - **A texel's rays**: on a uniform update (`PROBE_UNIFORM_PERIOD`), `probe_clipmap_texel_ray`'s. On a
|
|
102
104
|
* guided one, the run that begins at its walk position in the probe's guide, at most
|
|
@@ -114,6 +116,10 @@ resources.createGroup()
|
|
|
114
116
|
* - The mean blends by at least 1/(a+1) until the count reaches its limit: a young texel is its running
|
|
115
117
|
* mean, which the estimator's blend reduction, nothing at its seed, would otherwise hold back. Past it
|
|
116
118
|
* the estimator alone, down to 1/8192 an update on a noisy texel.
|
|
119
|
+
* - And by at least the probe's L0 blend (`PROBE_REQUEST_STRUCT`'s `blend`), its L0 estimator's catch-up
|
|
120
|
+
* after its last update: a change in the probe's whole light, which the texels' own tests, a one-ray
|
|
121
|
+
* sample's noise apiece, do not see. The texel's own catch-up stays, for light that moves without
|
|
122
|
+
* changing L0.
|
|
117
123
|
* - Samples are clipped once the variance's window has passed, when 1/(a+1) is no longer its blend:
|
|
118
124
|
* before that it holds no spread to clip to.
|
|
119
125
|
* - A texel's first sample seeds both means. A texel no ray reached keeps its history.
|
|
@@ -268,34 +274,29 @@ fn main(
|
|
|
268
274
|
let tile = index_to_grid2d(slot, settings.radiance_tiles_per_row) * (n + 2u * settings.radiance_skirt) + settings.radiance_skirt;
|
|
269
275
|
let history = select(textureLoad(probe_radiance, tile + vec2<u32>(i % n, i / n), 0), vec4<f32>(0.0), updates == 0u);
|
|
270
276
|
|
|
277
|
+
let estimator = slot * texels + i;
|
|
278
|
+
|
|
271
279
|
var texel = history;
|
|
272
|
-
//
|
|
273
|
-
|
|
274
|
-
// so that one bright sample is one texel's at most
|
|
275
|
-
var change = vec2<f32>(0.0);
|
|
280
|
+
// the texel's estimator, its history's until a sample is blended
|
|
281
|
+
var e = probe_accumulate_estimator(history.rgb, probe_estimators[estimator]);
|
|
276
282
|
|
|
277
283
|
if (count > 0u) {
|
|
278
284
|
// the rays, and the neighbours' re-samples where the frame took them
|
|
279
285
|
let pooled = probe_clipmap_resampled(k * texels + i, sum, count);
|
|
280
286
|
let sample = pooled.rgb / pooled.w;
|
|
281
|
-
let
|
|
287
|
+
let before = e;
|
|
282
288
|
|
|
283
|
-
|
|
289
|
+
e = multiscale_mean_seed(sample);
|
|
284
290
|
|
|
285
291
|
if (history.a > 0.0) {
|
|
286
292
|
let ramp = 1.0 / (history.a + 1.0);
|
|
287
|
-
let before = probe_accumulate_estimator(history.rgb, probe_estimators[estimator]);
|
|
288
|
-
// the estimator's own floor on the deviation, at the display's exposure
|
|
289
|
-
let deviation = rgb_to_luminance(max(multiscale_mean_deviation_floor(before.short_mean, probe_exposure.value), sqrt(max(vec3<f32>(0.0), before.variance))));
|
|
290
|
-
|
|
291
|
-
change = vec2<f32>(clamp(rgb_to_luminance(sample - history.rgb) / deviation, -${PROBE_CHANGE_SIGNIFICANCE}.0, ${PROBE_CHANGE_SIGNIFICANCE}.0), 1.0);
|
|
292
293
|
|
|
293
294
|
e = multiscale_mean_add(
|
|
294
295
|
before,
|
|
295
296
|
sample,
|
|
296
297
|
max(ramp, ${PROBE_SHORT_BLEND}),
|
|
297
298
|
max(ramp, ${PROBE_VARIANCE_BLEND}),
|
|
298
|
-
select(0.0, ramp, history.a < ${PROBE_RADIANCE_SAMPLES_LIMIT}.0),
|
|
299
|
+
max(select(0.0, ramp, history.a < ${PROBE_RADIANCE_SAMPLES_LIMIT}.0), probe_requests[slot].blend),
|
|
299
300
|
ramp <= ${PROBE_VARIANCE_BLEND},
|
|
300
301
|
probe_exposure.value,
|
|
301
302
|
);
|
|
@@ -306,13 +307,23 @@ fn main(
|
|
|
306
307
|
probe_estimators[estimator] = probe_accumulate_estimator_words(e, slot, per_probe + 2u * i, updates);
|
|
307
308
|
}
|
|
308
309
|
|
|
310
|
+
// the estimator as the probe's L0 estimator sums it, its deviation floored at the display's exposure as
|
|
311
|
+
// the estimator's own; nothing for a texel no ray has reached
|
|
312
|
+
var state = vec2<f32>(0.0);
|
|
313
|
+
|
|
314
|
+
if (texel.a > 0.0) {
|
|
315
|
+
let deviation = max(multiscale_mean_deviation_floor(e.short_mean, probe_exposure.value), sqrt(max(vec3<f32>(0.0), e.variance)));
|
|
316
|
+
|
|
317
|
+
state = vec2<f32>(rgb_to_luminance(e.short_mean - e.mean), rgb_to_luminance(deviation));
|
|
318
|
+
}
|
|
319
|
+
|
|
309
320
|
// the count is whole, which any noise keeps
|
|
310
321
|
let stored = f16_round_stochastic(texel, vec4<f32>(probe_accumulate_store_noise(slot, i, updates), 0.0));
|
|
311
322
|
|
|
312
323
|
probe_maps[maps + 2u * i] = pack2x16float(stored.rg);
|
|
313
324
|
probe_maps[maps + 2u * i + 1u] = pack2x16float(stored.ba);
|
|
314
325
|
probe_maps[maps + 2u * texels + i] = count | (back_faces << 16u);
|
|
315
|
-
probe_maps[maps + 3u * texels + m * m + i] = pack2x16float(
|
|
326
|
+
probe_maps[maps + 3u * texels + m * m + i] = pack2x16float(state);
|
|
316
327
|
|
|
317
328
|
return;
|
|
318
329
|
}
|