@driftengine/core 4.3.0 → 4.4.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.json +261 -0
- package/README.md +1 -1
- package/dist/cinematic/cameraPath.d.ts +53 -0
- package/dist/cinematic/cameraPath.js +118 -0
- package/dist/environment/daylight.d.ts +77 -0
- package/dist/environment/daylight.js +77 -0
- package/dist/geometry/meshConcat.d.ts +9 -0
- package/dist/geometry/meshConcat.js +101 -0
- package/dist/index.d.ts +12 -2
- package/dist/index.js +14 -1
- package/dist/render/backend/createRenderer.d.ts +13 -1
- package/dist/render/backend/createRenderer.js +6 -5
- package/dist/render/backend/webgl2/renderer.d.ts +147 -1
- package/dist/render/backend/webgl2/renderer.js +402 -23
- package/dist/render/backend/webgpu/buffers.js +46 -8
- package/dist/render/backend/webgpu/depthPass.d.ts +81 -3
- package/dist/render/backend/webgpu/depthPass.js +75 -14
- package/dist/render/backend/webgpu/exposurePass.d.ts +39 -0
- package/dist/render/backend/webgpu/exposurePass.js +190 -0
- package/dist/render/backend/webgpu/fieldCompose.d.ts +11 -0
- package/dist/render/backend/webgpu/fieldCompose.js +13 -0
- package/dist/render/backend/webgpu/flatPass.d.ts +3 -1
- package/dist/render/backend/webgpu/flatPass.js +12 -5
- package/dist/render/backend/webgpu/particlePass.d.ts +8 -0
- package/dist/render/backend/webgpu/particlePass.js +1 -0
- package/dist/render/backend/webgpu/postPass.d.ts +12 -2
- package/dist/render/backend/webgpu/probeBake.d.ts +59 -3
- package/dist/render/backend/webgpu/probeBake.js +97 -7
- package/dist/render/backend/webgpu/probeTargets.d.ts +65 -0
- package/dist/render/backend/webgpu/probeTargets.js +180 -0
- package/dist/render/backend/webgpu/renderer.d.ts +174 -11
- package/dist/render/backend/webgpu/renderer.js +675 -249
- package/dist/render/backend/webgpu/scatterPass.js +7 -7
- package/dist/render/backend/webgpu/shaders/clusterBin.wgsl.d.ts +1 -1
- package/dist/render/backend/webgpu/skinPaletteRing.d.ts +4 -0
- package/dist/render/backend/webgpu/skinPaletteRing.js +9 -0
- package/dist/render/backend/webgpu/skyPass.js +5 -1
- package/dist/render/backend/webgpu/uniformRing.d.ts +31 -1
- package/dist/render/backend/webgpu/uniformRing.js +53 -3
- package/dist/render/bloomChain.d.ts +6 -0
- package/dist/render/bloomChain.js +8 -0
- package/dist/render/clusteredLights.d.ts +19 -11
- package/dist/render/clusteredLights.js +96 -45
- package/dist/render/cutoutCaster.d.ts +23 -0
- package/dist/render/cutoutCaster.js +20 -0
- package/dist/render/driftLight/bake.d.ts +34 -0
- package/dist/render/driftLight/bake.js +95 -0
- package/dist/render/driftLight/falloff.d.ts +16 -0
- package/dist/render/driftLight/falloff.js +23 -0
- package/dist/render/driftLight/layout.d.ts +59 -0
- package/dist/render/driftLight/layout.js +138 -0
- package/dist/render/driftLight/lightField.d.ts +108 -0
- package/dist/render/driftLight/lightField.js +179 -0
- package/dist/render/driftLight/uniforms.d.ts +28 -0
- package/dist/render/driftLight/uniforms.js +41 -0
- package/dist/render/driftLight/visibility.d.ts +18 -0
- package/dist/render/driftLight/visibility.js +47 -0
- package/dist/render/emptyTexture.d.ts +6 -0
- package/dist/render/emptyTexture.js +19 -0
- package/dist/render/exposurePass.d.ts +48 -0
- package/dist/render/exposurePass.js +172 -0
- package/dist/render/flameLight.d.ts +71 -0
- package/dist/render/flameLight.js +63 -0
- package/dist/render/gi/bounceLights.d.ts +34 -0
- package/dist/render/gi/bounceLights.js +66 -0
- package/dist/render/gi/fieldReach.d.ts +12 -0
- package/dist/render/gi/fieldReach.js +62 -0
- package/dist/render/gi/globalField.d.ts +8 -0
- package/dist/render/gi/globalField.js +31 -0
- package/dist/render/gi/probeTrace.d.ts +3 -1
- package/dist/render/gi/probeTrace.js +3 -1
- package/dist/render/gpuCapability.js +19 -4
- package/dist/render/lightBudget.d.ts +11 -0
- package/dist/render/lightBudget.js +11 -0
- package/dist/render/pointLightSelection.d.ts +16 -0
- package/dist/render/pointLightSelection.js +178 -83
- package/dist/render/probeGrid.d.ts +11 -1
- package/dist/render/probeGrid.js +5 -2
- package/dist/render/probeSweeps.d.ts +45 -0
- package/dist/render/probeSweeps.js +77 -0
- package/dist/render/reflectionProbe.d.ts +43 -1
- package/dist/render/reflectionProbe.js +17 -3
- package/dist/render/renderQuality.d.ts +3 -1
- package/dist/render/rendererHarness.d.ts +9 -0
- package/dist/render/rendererHarness.js +18 -3
- package/dist/render/sceneTarget.d.ts +20 -0
- package/dist/render/sceneTarget.js +62 -1
- package/dist/render/shaders/agx.d.ts +31 -0
- package/dist/render/shaders/agx.js +81 -0
- package/dist/render/shaders/ambientOcclusion.d.ts +24 -5
- package/dist/render/shaders/ambientOcclusion.js +120 -63
- package/dist/render/shaders/cutoutCoverage.d.ts +31 -0
- package/dist/render/shaders/cutoutCoverage.js +40 -0
- package/dist/render/shaders/depth.d.ts +25 -0
- package/dist/render/shaders/depth.js +69 -3
- package/dist/render/shaders/exposure.d.ts +52 -0
- package/dist/render/shaders/exposure.js +124 -0
- package/dist/render/shaders/filmLook.d.ts +47 -0
- package/dist/render/shaders/filmLook.js +98 -0
- package/dist/render/shaders/flat/directionalShadow.js +35 -4
- package/dist/render/shaders/flat/driftLight.d.ts +29 -0
- package/dist/render/shaders/flat/driftLight.js +75 -0
- package/dist/render/shaders/flat/index.js +5 -0
- package/dist/render/shaders/flat/lobes.js +13 -0
- package/dist/render/shaders/flat/main.d.ts +1 -1
- package/dist/render/shaders/flat/main.js +68 -9
- package/dist/render/shaders/flat/preamble.js +23 -5
- package/dist/render/shaders/flat/probeGrid.js +46 -3
- package/dist/render/shaders/generated/ambientOcclusion.wgsl.d.ts +1 -1
- package/dist/render/shaders/generated/ambientOcclusion.wgsl.js +1 -1
- package/dist/render/shaders/generated/depth.wgsl.d.ts +100 -0
- package/dist/render/shaders/generated/depth.wgsl.js +100 -0
- package/dist/render/shaders/generated/exposure.wgsl.d.ts +42 -0
- package/dist/render/shaders/generated/exposure.wgsl.js +48 -0
- package/dist/render/shaders/generated/flat.wgsl.d.ts +1800 -1344
- package/dist/render/shaders/generated/flat.wgsl.js +1816 -1360
- package/dist/render/shaders/generated/localExposure.wgsl.d.ts +18 -0
- package/dist/render/shaders/generated/localExposure.wgsl.js +24 -0
- package/dist/render/shaders/generated/rush.wgsl.d.ts +40 -10
- package/dist/render/shaders/generated/rush.wgsl.js +40 -10
- package/dist/render/shaders/generated/temporalResolve.wgsl.d.ts +1 -1
- package/dist/render/shaders/generated/temporalResolve.wgsl.js +1 -1
- package/dist/render/shaders/gi/driftLight.wgsl.d.ts +16 -0
- package/dist/render/shaders/gi/driftLight.wgsl.js +49 -0
- package/dist/render/shaders/gi/probeBake.wgsl.d.ts +29 -4
- package/dist/render/shaders/gi/probeBake.wgsl.js +190 -20
- package/dist/render/shaders/globalMedium.js +4 -0
- package/dist/render/shaders/localExposure.d.ts +35 -0
- package/dist/render/shaders/localExposure.js +138 -0
- package/dist/render/shaders/prefilter.d.ts +1 -1
- package/dist/render/shaders/prefilter.js +6 -0
- package/dist/render/shaders/rush.js +33 -5
- package/dist/render/shaders/tangentFrame.d.ts +1 -1
- package/dist/render/shaders/tangentFrame.js +15 -3
- package/dist/render/shaders/temporalResolve.js +39 -1
- package/dist/render/shadowCasters.d.ts +5 -3
- package/dist/render/shadowMap.js +13 -0
- package/dist/render/surfaceTexture.d.ts +5 -0
- package/package.json +6 -6
- package/scripts/gpuCompute.mjs +24 -3
- package/scripts/png.mjs +23 -12
- package/src/cinematic/cameraPath.ts +178 -0
- package/src/environment/daylight.ts +152 -0
- package/src/geometry/meshConcat.ts +100 -0
- package/src/index.ts +32 -0
- package/src/render/backend/createRenderer.ts +22 -6
- package/src/render/backend/webgl2/renderer.ts +439 -20
- package/src/render/backend/webgpu/buffers.ts +51 -8
- package/src/render/backend/webgpu/depthPass.ts +78 -10
- package/src/render/backend/webgpu/exposurePass.ts +234 -0
- package/src/render/backend/webgpu/fieldCompose.ts +15 -0
- package/src/render/backend/webgpu/flatPass.ts +10 -2
- package/src/render/backend/webgpu/particlePass.ts +9 -0
- package/src/render/backend/webgpu/probeBake.ts +143 -9
- package/src/render/backend/webgpu/probeTargets.ts +211 -0
- package/src/render/backend/webgpu/renderer.ts +801 -270
- package/src/render/backend/webgpu/scatterPass.ts +7 -7
- package/src/render/backend/webgpu/skinPaletteRing.ts +10 -0
- package/src/render/backend/webgpu/skyPass.ts +5 -1
- package/src/render/backend/webgpu/uniformRing.ts +49 -3
- package/src/render/bloomChain.ts +9 -0
- package/src/render/clusteredLights.ts +108 -63
- package/src/render/cutoutCaster.ts +44 -0
- package/src/render/driftLight/bake.ts +125 -0
- package/src/render/driftLight/falloff.ts +26 -0
- package/src/render/driftLight/layout.ts +177 -0
- package/src/render/driftLight/lightField.ts +227 -0
- package/src/render/driftLight/uniforms.ts +61 -0
- package/src/render/driftLight/visibility.ts +58 -0
- package/src/render/emptyTexture.ts +41 -0
- package/src/render/exposurePass.ts +186 -0
- package/src/render/flameLight.ts +135 -0
- package/src/render/gi/bounceLights.ts +68 -0
- package/src/render/gi/fieldReach.ts +74 -0
- package/src/render/gi/globalField.ts +39 -0
- package/src/render/gi/probeTrace.ts +3 -1
- package/src/render/gpuCapability.ts +18 -5
- package/src/render/lightBudget.ts +12 -0
- package/src/render/pointLightSelection.ts +191 -79
- package/src/render/probeGrid.ts +13 -2
- package/src/render/probeSweeps.ts +80 -0
- package/src/render/reflectionProbe.ts +54 -2
- package/src/render/renderQuality.ts +3 -1
- package/src/render/rendererHarness.ts +25 -3
- package/src/render/sceneTarget.ts +75 -1
- package/src/render/shaders/ambientOcclusion.ts +125 -63
- package/src/render/shaders/cutoutCoverage.ts +43 -0
- package/src/render/shaders/depth.ts +80 -3
- package/src/render/shaders/exposure.ts +128 -0
- package/src/render/shaders/filmLook.ts +111 -0
- package/src/render/shaders/flat/directionalShadow.ts +35 -4
- package/src/render/shaders/flat/driftLight.ts +75 -0
- package/src/render/shaders/flat/index.ts +5 -0
- package/src/render/shaders/flat/lobes.ts +13 -0
- package/src/render/shaders/flat/main.ts +68 -9
- package/src/render/shaders/flat/preamble.ts +23 -5
- package/src/render/shaders/flat/probeGrid.ts +46 -3
- package/src/render/shaders/generated/ambientOcclusion.wgsl.ts +1 -1
- package/src/render/shaders/generated/depth.wgsl.ts +103 -0
- package/src/render/shaders/generated/exposure.wgsl.ts +51 -0
- package/src/render/shaders/generated/flat.wgsl.ts +1816 -1360
- package/src/render/shaders/generated/localExposure.wgsl.ts +26 -0
- package/src/render/shaders/generated/rush.wgsl.ts +40 -10
- package/src/render/shaders/generated/temporalResolve.wgsl.ts +1 -1
- package/src/render/shaders/gi/driftLight.wgsl.ts +49 -0
- package/src/render/shaders/gi/probeBake.wgsl.ts +191 -20
- package/src/render/shaders/globalMedium.ts +4 -0
- package/src/render/shaders/localExposure.ts +154 -0
- package/src/render/shaders/prefilter.ts +6 -0
- package/src/render/shaders/rush.ts +33 -5
- package/src/render/shaders/tangentFrame.ts +15 -3
- package/src/render/shaders/temporalResolve.ts +39 -1
- package/src/render/shadowCasters.ts +5 -3
- package/src/render/shadowMap.ts +14 -0
- package/src/render/surfaceTexture.ts +5 -0
|
@@ -55,6 +55,8 @@ import { type ComputeDefinition, type ComputeHandle } from '../../compute.ts';
|
|
|
55
55
|
import type { PassDefinition, PassHandle } from '../../pass.ts';
|
|
56
56
|
import { GpuInstancedBatch } from './instanced.ts';
|
|
57
57
|
import type { MeshInstances } from '../../instances.ts';
|
|
58
|
+
import { LightField } from '../../driftLight/lightField.ts';
|
|
59
|
+
import type { LightFieldOptions, LightFieldSource } from '../../driftLight/lightField.ts';
|
|
58
60
|
/** Which directional shadow map a pass is filling, matching `renderer.ts`. */
|
|
59
61
|
type ShadowLayer = 'static' | 'static-peel' | 'dynamic';
|
|
60
62
|
export declare class WebGPURenderer implements RendererApi {
|
|
@@ -770,11 +772,19 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
770
772
|
private readonly frameEye;
|
|
771
773
|
/** The environment the frame was drawn with. See `bindMeshPass`. */
|
|
772
774
|
private frameEnv;
|
|
775
|
+
/**
|
|
776
|
+
* The sky this frame drew, or null until it draws one. A traced probe's escaping rays read it,
|
|
777
|
+
* so a frame that stops drawing a sky must not go on lighting its probes with the last one.
|
|
778
|
+
*/
|
|
779
|
+
private frameSky;
|
|
773
780
|
/** That matrix with the clip-space correction folded in, rebuilt once a frame. */
|
|
774
781
|
private readonly correctedViewProj;
|
|
775
782
|
private readonly skyLayout;
|
|
783
|
+
/**
|
|
784
|
+
* A slot a sky draw, as every per-draw resource here is: see `UniformRing` and the 2026-08-27 rule.
|
|
785
|
+
* It was one buffer rewritten at each draw, which gave every sky in an encoder the last camera.
|
|
786
|
+
*/
|
|
776
787
|
private readonly skyUniforms;
|
|
777
|
-
private readonly skyStaging;
|
|
778
788
|
private readonly skyFloats;
|
|
779
789
|
private readonly skyBindGroup;
|
|
780
790
|
/** The camera's inverse with the clip correction undone, rebuilt once a frame. */
|
|
@@ -940,7 +950,27 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
940
950
|
* prefix that has already been uploaded costs one write of unchanged bytes and cannot be
|
|
941
951
|
* wrong: a ring only ever appends within a frame.
|
|
942
952
|
*/
|
|
953
|
+
/**
|
|
954
|
+
* Every per-draw ring the frame writes and flushes together, in one list.
|
|
955
|
+
*
|
|
956
|
+
* **One list, read by the flush and by the probe bake's rewind**, so a ring added to one cannot be
|
|
957
|
+
* forgotten by the other: a ring flushed but never rewound would let a grid bake spend it, and one
|
|
958
|
+
* rewound but never flushed would upload nothing. Built on first use, after the constructor has
|
|
959
|
+
* set every field; `growTo` replaces a ring's buffer, never the ring, so the list stays true.
|
|
960
|
+
*/
|
|
961
|
+
private ringList;
|
|
962
|
+
private rings;
|
|
943
963
|
private flushRings;
|
|
964
|
+
/** Where every ring stands before work that submits an encoder of its own. */
|
|
965
|
+
private readonly ringMarks;
|
|
966
|
+
private markRings;
|
|
967
|
+
/**
|
|
968
|
+
* Give back every slot taken since `markRings`, once that work has been submitted.
|
|
969
|
+
*
|
|
970
|
+
* See `UniformRing.rewind` for why this is safe only after the submit. The palette ring goes back
|
|
971
|
+
* with them, and the cached palette slot is dropped if it was one of those given back.
|
|
972
|
+
*/
|
|
973
|
+
private rewindRings;
|
|
944
974
|
private readonly filmLayout;
|
|
945
975
|
private readonly filmVerts;
|
|
946
976
|
private readonly filmFrags;
|
|
@@ -1013,6 +1043,8 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
1013
1043
|
private blankAlbedoBindGroup;
|
|
1014
1044
|
/** Repeats across the mesh's own UV range. Per draw, because `uUvScale` is a vertex uniform. */
|
|
1015
1045
|
private readonly uvScale;
|
|
1046
|
+
/** Whether the bound material is seen from both faces. See `SurfaceMaterial.doubleSided`. */
|
|
1047
|
+
private materialDoubleSided;
|
|
1016
1048
|
createSurfaceTexture(source: TexImageSource, options?: SurfaceTextureOptions): GpuSurfaceTexture;
|
|
1017
1049
|
/**
|
|
1018
1050
|
* GPU textures an `updateSurfaceTexture` replaced, destroyed when the next frame begins.
|
|
@@ -1464,7 +1496,8 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
1464
1496
|
private readonly scatterLayout;
|
|
1465
1497
|
/** One slot per batch: the gust and the trample field belong to the batch, not the frame. */
|
|
1466
1498
|
private readonly scatterVerts;
|
|
1467
|
-
|
|
1499
|
+
/** A slot a draw, beside the vertex block's: see `createScatterBindGroupLayout` for why. */
|
|
1500
|
+
private readonly scatterFrags;
|
|
1468
1501
|
private readonly scatterFragStaging;
|
|
1469
1502
|
private readonly scatterFragFloats;
|
|
1470
1503
|
private readonly scatterFragInts;
|
|
@@ -1607,17 +1640,28 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
1607
1640
|
private readonly dynamicView;
|
|
1608
1641
|
/** The peel's own bind groups: `uPeelShadowLayer` at 1, and the static map to peel against. */
|
|
1609
1642
|
private readonly shadowPeelBindGroup;
|
|
1643
|
+
/**
|
|
1644
|
+
* The cutout casters' layout, and a bind group per cutout map for each layer, built the first
|
|
1645
|
+
* time a map casts and kept: a `createBindGroup` per draw is the allocation the house rules forbid.
|
|
1646
|
+
* Cleared in `forgetBindingsOf`, because a group outliving its texture is a destroyed-texture error
|
|
1647
|
+
* at submit, and a texture's view is new when an update changes its size.
|
|
1648
|
+
*/
|
|
1649
|
+
private readonly shadowCutoutLayout;
|
|
1650
|
+
private readonly cutoutGroups;
|
|
1651
|
+
private readonly cutoutPeelGroups;
|
|
1652
|
+
private shadowPeelPassUniforms;
|
|
1653
|
+
private shadowPeelSampler;
|
|
1610
1654
|
private readonly scatterDepthPeelBindGroup;
|
|
1611
1655
|
/** Which layer the open pass is writing, so the sink picks the bindings that match it. */
|
|
1612
1656
|
private shadowLayerIsPeel;
|
|
1613
1657
|
/**
|
|
1614
1658
|
* Whether a peel pass has filled the map, which is what the frame may sample it on.
|
|
1615
1659
|
*
|
|
1616
|
-
* **Not whether the map exists.** `renderer.ts`
|
|
1617
|
-
* born
|
|
1618
|
-
*
|
|
1619
|
-
* static layer opens and set when a peel pass ends, which
|
|
1620
|
-
*
|
|
1660
|
+
* **Not whether the map exists.** `renderer.ts` asked that question, on the belief that a GL
|
|
1661
|
+
* texture is born reading as the far plane, and it is born zeroed: a scene that built a peel
|
|
1662
|
+
* map and never opened the layer had no sun at all under ANGLE's GL backend. It holds this
|
|
1663
|
+
* rule now as well. Cleared when the static layer opens and set when a peel pass ends, which
|
|
1664
|
+
* is per frame because every scene that peels does so every frame.
|
|
1621
1665
|
*/
|
|
1622
1666
|
private peelFilled;
|
|
1623
1667
|
/** One slot per caster, the same trick `perDraw` uses and for the same reason. */
|
|
@@ -1658,6 +1702,10 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
1658
1702
|
* otherwise. A lookup rather than a rebind, because a `createBindGroup` per draw is the
|
|
1659
1703
|
* per-frame allocation the house rules forbid; both groups are built once at init.
|
|
1660
1704
|
*/
|
|
1705
|
+
/** The cutout bind group for `texture` in the open layer, built the first time it casts there. */
|
|
1706
|
+
private cutoutGroup;
|
|
1707
|
+
/** The cutoff and UV scale into a cutout draw's slot, at the offsets its own variant declares. */
|
|
1708
|
+
private writeCutout;
|
|
1661
1709
|
private shadowGroup;
|
|
1662
1710
|
/**
|
|
1663
1711
|
* The skinned shadow bind group for the current layer, rebuilt only when it must be.
|
|
@@ -1934,6 +1982,14 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
1934
1982
|
private materialSlotForDraw;
|
|
1935
1983
|
/** Said once rather than every frame, for the reason `warnedFull` gives. */
|
|
1936
1984
|
private warnedMaterialsFull;
|
|
1985
|
+
private warnedSkyFull;
|
|
1986
|
+
private warnedParticlesTwice;
|
|
1987
|
+
/**
|
|
1988
|
+
* Which encoder draws are being recorded into, by count: a new one at every `beginFrame`, and one
|
|
1989
|
+
* of its own for each probe bake, restored after. What a batch drawn per encoder is checked by.
|
|
1990
|
+
*/
|
|
1991
|
+
private encoderEpoch;
|
|
1992
|
+
private encoderEpochs;
|
|
1937
1993
|
/**
|
|
1938
1994
|
* Draw one mesh.
|
|
1939
1995
|
*
|
|
@@ -2281,6 +2337,22 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
2281
2337
|
* that is wrong once.
|
|
2282
2338
|
*/
|
|
2283
2339
|
private rebuildFlatGroupsForNewRings;
|
|
2340
|
+
/**
|
|
2341
|
+
* The environment view the cached flat groups bind: the grid, or the blank stand-in while the
|
|
2342
|
+
* grid may not be read. What `rebindEnvironment` compares against.
|
|
2343
|
+
*/
|
|
2344
|
+
private flatEnvironment;
|
|
2345
|
+
/**
|
|
2346
|
+
* Rebuild the flat groups if, and only if, the environment they bind has changed.
|
|
2347
|
+
*
|
|
2348
|
+
* **Every cached group holds the environment view**, so a change of it makes all of them stale;
|
|
2349
|
+
* but nothing else a bake does touches a group. Rebuilding on every bake's two edges regardless
|
|
2350
|
+
* emptied the cache twice a bake, and every material built its group again inside the bake and
|
|
2351
|
+
* again after it: a courtyard re-baking a few faces a frame spent 28% of its CPU there on the
|
|
2352
|
+
* native host, where a `createBindGroup` costs most. What would make this wrong is a second
|
|
2353
|
+
* binding that a bake changes, which would have to be compared here too.
|
|
2354
|
+
*/
|
|
2355
|
+
private rebindEnvironment;
|
|
2284
2356
|
/**
|
|
2285
2357
|
* Rebuild the group for the open material, and drop every cached one.
|
|
2286
2358
|
*
|
|
@@ -3074,6 +3146,8 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
3074
3146
|
/** This frame's exposure into the tone curve. Starts at the profile's own. */
|
|
3075
3147
|
private exposure;
|
|
3076
3148
|
private bloomScale;
|
|
3149
|
+
/** In scene units, once `setBloom` has moved it; null reads the profile's. */
|
|
3150
|
+
private bloomThresholdSet;
|
|
3077
3151
|
private rushStrength;
|
|
3078
3152
|
private motionBlurScale;
|
|
3079
3153
|
/**
|
|
@@ -3085,6 +3159,30 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
3085
3159
|
*/
|
|
3086
3160
|
private readonly veilColor;
|
|
3087
3161
|
private veilAlpha;
|
|
3162
|
+
private vignette;
|
|
3163
|
+
private grain;
|
|
3164
|
+
private grainSeed;
|
|
3165
|
+
private warnedLookWithoutComposite;
|
|
3166
|
+
/** Eye adaptation: how far, this frame's time step, and the pass once asked for. */
|
|
3167
|
+
private autoExposure;
|
|
3168
|
+
private autoExposureDt;
|
|
3169
|
+
/** How far each region is brought toward the frame. See `setLocalExposure`. */
|
|
3170
|
+
private localExposure;
|
|
3171
|
+
private exposurePass;
|
|
3172
|
+
/**
|
|
3173
|
+
* How strongly the lens darkens the frame's corners, held until changed: 0 is none, 0.5 is about
|
|
3174
|
+
* 1.2 stops at the corner. Applied to scene light before the tone curve, as a lens loses light;
|
|
3175
|
+
* see `filmLook.ts`. Needs `screenEffects`, and says so once rather than doing nothing.
|
|
3176
|
+
*/
|
|
3177
|
+
setVignette(strength: number): void;
|
|
3178
|
+
/**
|
|
3179
|
+
* Film grain, held until changed: an amplitude in display values (0 is none, 0.03 is a fine
|
|
3180
|
+
* grain) and this frame's seed. **The seed is the caller's**, because the engine takes time from
|
|
3181
|
+
* its caller: pass a new one each frame for grain that moves, and the same one for a still that
|
|
3182
|
+
* is identical run to run. Applied last, after the grade and the veil; see `filmLook.ts`.
|
|
3183
|
+
*/
|
|
3184
|
+
setFilmGrain(strength: number, seed: number): void;
|
|
3185
|
+
private warnLookWithoutComposite;
|
|
3088
3186
|
/** How much of the frame's bloom to apply, 0 to 1. Scales the profile's `bloom`. */
|
|
3089
3187
|
/**
|
|
3090
3188
|
* The colour grade this and every later frame applies, until it is set again.
|
|
@@ -3111,7 +3209,7 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
3111
3209
|
* a 3D write needs both and a wrong one silently shears the cube.
|
|
3112
3210
|
*/
|
|
3113
3211
|
private uploadGrade;
|
|
3114
|
-
setBloom(scale: number): void;
|
|
3212
|
+
setBloom(scale: number, threshold?: number): void;
|
|
3115
3213
|
/**
|
|
3116
3214
|
* How thick the air is, this frame: a global participating medium filling the whole frustum.
|
|
3117
3215
|
*
|
|
@@ -3124,6 +3222,33 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
3124
3222
|
setSpeedRush(strength: number): void;
|
|
3125
3223
|
/** How much of the frame's camera motion blur to apply, 0 to 1. */
|
|
3126
3224
|
setCameraMotionBlur(scale: number): void;
|
|
3225
|
+
/**
|
|
3226
|
+
* The camera has cut: this frame is a new shot, not the next moment of the last one.
|
|
3227
|
+
*
|
|
3228
|
+
* **Everything temporal reprojects through the previous frame's view**: the motion blur measures
|
|
3229
|
+
* its smear against it, and the temporal resolve reads its history through it. A cut is a jump
|
|
3230
|
+
* the renderer cannot tell from a fast camera, so without this a transport that seeks, a respawn
|
|
3231
|
+
* or an edit smears its first frame along the whole jump and blends in a picture of somewhere
|
|
3232
|
+
* else. The caller knows it cut; this is how it says so, before the frame's `beginFrame`.
|
|
3233
|
+
*
|
|
3234
|
+
* What it gives up is one frame of history: the frame after a cut has no blur and no temporal
|
|
3235
|
+
* blend, as the first frame of a session has none. Nothing else is reset.
|
|
3236
|
+
*/
|
|
3237
|
+
cameraCut(): void;
|
|
3238
|
+
/**
|
|
3239
|
+
* Eye adaptation. **The other backend's `setAutoExposure` carries the reasoning**, whole; this is
|
|
3240
|
+
* the same setter over the same state, and the pass is built the first time it is asked for, so
|
|
3241
|
+
* a renderer that never adapts carries none of it.
|
|
3242
|
+
*/
|
|
3243
|
+
setAutoExposure(strength: number, dtSec: number): void;
|
|
3244
|
+
/**
|
|
3245
|
+
* Local exposure. **The other backend's `setLocalExposure` carries the reasoning**, whole; this is
|
|
3246
|
+
* the same setter over the same state, sharing eye adaptation's pass, which is built the first
|
|
3247
|
+
* time either is asked for.
|
|
3248
|
+
*/
|
|
3249
|
+
setLocalExposure(strength: number): void;
|
|
3250
|
+
/** The exposure pass, built once; the composite's group holds placeholders until it exists. */
|
|
3251
|
+
private ensureExposurePass;
|
|
3127
3252
|
/**
|
|
3128
3253
|
* Where this frame's lens is focused, how deep the sharp zone is, and how much of the ceiling
|
|
3129
3254
|
* to take. **The other backend's `setDepthOfField` carries the reasoning**, whole: the
|
|
@@ -3203,6 +3328,8 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
3203
3328
|
* over a lobe-convolved one.
|
|
3204
3329
|
*/
|
|
3205
3330
|
private readonly probe;
|
|
3331
|
+
/** The views, groups and attachments a bake draws with, made once. See `probeTargets.ts`. */
|
|
3332
|
+
private readonly probeTargets;
|
|
3206
3333
|
/**
|
|
3207
3334
|
* The prefiltered cube: what the lit pass samples, one GGX-convolved level per roughness.
|
|
3208
3335
|
*
|
|
@@ -3234,6 +3361,19 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
3234
3361
|
private readonly probeMipLayout;
|
|
3235
3362
|
/** The photometric atlas, allocated on first use. See `setIesProfiles`. */
|
|
3236
3363
|
private iesTexture;
|
|
3364
|
+
/** The scene's DriftLight field, and its two volumes once it is whole. See `createLightField`. */
|
|
3365
|
+
private lightField;
|
|
3366
|
+
private driftIndex;
|
|
3367
|
+
private driftAtlas;
|
|
3368
|
+
private driftIndexView;
|
|
3369
|
+
private driftAtlasView;
|
|
3370
|
+
private readonly driftUniforms;
|
|
3371
|
+
/** The same field resolved for a traced probe, and what the baker binds; null while not whole. */
|
|
3372
|
+
private readonly bakeDriftUniforms;
|
|
3373
|
+
private bakeLightField;
|
|
3374
|
+
/** The frame's exact lights packed for the traced bake. See `gi/bounceLights.ts`. */
|
|
3375
|
+
private readonly bounceLights;
|
|
3376
|
+
private readonly bakeLamps;
|
|
3237
3377
|
private iesView;
|
|
3238
3378
|
private cookieTexture;
|
|
3239
3379
|
private cookieView;
|
|
@@ -3258,8 +3398,9 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
3258
3398
|
* mirroring uninitialised memory is worse than a car mirroring a gradient — the rule one probe
|
|
3259
3399
|
* already had, unchanged by there being more of them.
|
|
3260
3400
|
*/
|
|
3261
|
-
private
|
|
3262
|
-
|
|
3401
|
+
private probeSweeps;
|
|
3402
|
+
/** `uProbeGridSets`, rewritten in place. */
|
|
3403
|
+
private readonly probeSets;
|
|
3263
3404
|
/**
|
|
3264
3405
|
* Whether a bake is running, which is when the cube may be neither sampled nor bound.
|
|
3265
3406
|
*
|
|
@@ -3267,9 +3408,17 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
3267
3408
|
* load-bearing rather than defensive: WebGPU rejects a pass that holds the texture it writes.
|
|
3268
3409
|
*/
|
|
3269
3410
|
private probePassActive;
|
|
3411
|
+
/** Whether the bake under way lights its faces by the grid. `ProbeBakeOptions.bounce`. */
|
|
3412
|
+
private probeBounce;
|
|
3413
|
+
/**
|
|
3414
|
+
* Whether the shading may read the grid now: once every probe is filled, and not during a bake
|
|
3415
|
+
* unless it is a bounce bake. A bounce bake's faces are drawn into the probe's own cube and only
|
|
3416
|
+
* the resolve writes the array, in a pass of its own, so no pass both samples and writes it.
|
|
3417
|
+
*/
|
|
3418
|
+
private probeReadable;
|
|
3270
3419
|
/** How many mip levels the roughness blur has to work with. `flat.ts` reads this. */
|
|
3271
3420
|
private get probeMaxLod();
|
|
3272
|
-
/** Whether
|
|
3421
|
+
/** Whether a whole sweep of the grid has been convolved. See `probeSweeps.ts`. */
|
|
3273
3422
|
private get probeBaked();
|
|
3274
3423
|
/**
|
|
3275
3424
|
* Record that one layer now holds a convolution, without counting a rebake twice.
|
|
@@ -3378,6 +3527,20 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
3378
3527
|
* call a tile fills the row without a canvas in between.
|
|
3379
3528
|
*/
|
|
3380
3529
|
setSpotCookies(images: readonly TexImageSource[]): void;
|
|
3530
|
+
/**
|
|
3531
|
+
* Sum a scene's many fixed lights into a DriftLight field. The same contract as
|
|
3532
|
+
* `Renderer.createLightField`; see `driftLight/lightField.ts`.
|
|
3533
|
+
*/
|
|
3534
|
+
createLightField(lights: readonly LightFieldSource[], options?: Omit<LightFieldOptions, 'falloff'>): LightField;
|
|
3535
|
+
/** Let go of the field and its volumes; the scene's lights are all exact again. */
|
|
3536
|
+
disposeLightField(): void;
|
|
3537
|
+
private forgetLightFieldVolumes;
|
|
3538
|
+
/**
|
|
3539
|
+
* Upload the field's two volumes, once, when its last brick has baked, and rebuild the groups
|
|
3540
|
+
* that bind them: nothing samples them before that, so uploading as bricks land would be work
|
|
3541
|
+
* for no picture, and a rebuild per brick would be a bind group per brick.
|
|
3542
|
+
*/
|
|
3543
|
+
private uploadLightField;
|
|
3381
3544
|
setIesProfiles(profiles: readonly PhotometricProfile[]): void;
|
|
3382
3545
|
/** Each level from the one above it, six faces at a time. See `probePass.ts`. */
|
|
3383
3546
|
private buildProbeChain;
|