@driftengine/core 4.2.1 → 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.
Files changed (215) hide show
  1. package/CHANGELOG.json +272 -0
  2. package/README.md +1 -1
  3. package/dist/cinematic/cameraPath.d.ts +53 -0
  4. package/dist/cinematic/cameraPath.js +118 -0
  5. package/dist/environment/daylight.d.ts +77 -0
  6. package/dist/environment/daylight.js +77 -0
  7. package/dist/geometry/meshConcat.d.ts +9 -0
  8. package/dist/geometry/meshConcat.js +101 -0
  9. package/dist/index.d.ts +12 -2
  10. package/dist/index.js +14 -1
  11. package/dist/render/backend/createRenderer.d.ts +13 -1
  12. package/dist/render/backend/createRenderer.js +6 -5
  13. package/dist/render/backend/webgl2/renderer.d.ts +166 -1
  14. package/dist/render/backend/webgl2/renderer.js +424 -23
  15. package/dist/render/backend/webgpu/buffers.js +46 -8
  16. package/dist/render/backend/webgpu/depthPass.d.ts +81 -3
  17. package/dist/render/backend/webgpu/depthPass.js +75 -14
  18. package/dist/render/backend/webgpu/exposurePass.d.ts +39 -0
  19. package/dist/render/backend/webgpu/exposurePass.js +190 -0
  20. package/dist/render/backend/webgpu/fieldCompose.d.ts +11 -0
  21. package/dist/render/backend/webgpu/fieldCompose.js +13 -0
  22. package/dist/render/backend/webgpu/flatPass.d.ts +3 -1
  23. package/dist/render/backend/webgpu/flatPass.js +12 -5
  24. package/dist/render/backend/webgpu/particlePass.d.ts +8 -0
  25. package/dist/render/backend/webgpu/particlePass.js +1 -0
  26. package/dist/render/backend/webgpu/postPass.d.ts +12 -2
  27. package/dist/render/backend/webgpu/probeBake.d.ts +59 -3
  28. package/dist/render/backend/webgpu/probeBake.js +97 -7
  29. package/dist/render/backend/webgpu/probeTargets.d.ts +65 -0
  30. package/dist/render/backend/webgpu/probeTargets.js +180 -0
  31. package/dist/render/backend/webgpu/renderer.d.ts +176 -11
  32. package/dist/render/backend/webgpu/renderer.js +680 -250
  33. package/dist/render/backend/webgpu/scatterPass.js +7 -7
  34. package/dist/render/backend/webgpu/shaders/clusterBin.wgsl.d.ts +1 -1
  35. package/dist/render/backend/webgpu/skinPaletteRing.d.ts +4 -0
  36. package/dist/render/backend/webgpu/skinPaletteRing.js +9 -0
  37. package/dist/render/backend/webgpu/skyPass.js +5 -1
  38. package/dist/render/backend/webgpu/uniformRing.d.ts +31 -1
  39. package/dist/render/backend/webgpu/uniformRing.js +53 -3
  40. package/dist/render/bloomChain.d.ts +6 -0
  41. package/dist/render/bloomChain.js +8 -0
  42. package/dist/render/clusteredLights.d.ts +19 -11
  43. package/dist/render/clusteredLights.js +96 -45
  44. package/dist/render/cutoutCaster.d.ts +23 -0
  45. package/dist/render/cutoutCaster.js +20 -0
  46. package/dist/render/driftLight/bake.d.ts +34 -0
  47. package/dist/render/driftLight/bake.js +95 -0
  48. package/dist/render/driftLight/falloff.d.ts +16 -0
  49. package/dist/render/driftLight/falloff.js +23 -0
  50. package/dist/render/driftLight/layout.d.ts +59 -0
  51. package/dist/render/driftLight/layout.js +138 -0
  52. package/dist/render/driftLight/lightField.d.ts +108 -0
  53. package/dist/render/driftLight/lightField.js +179 -0
  54. package/dist/render/driftLight/uniforms.d.ts +28 -0
  55. package/dist/render/driftLight/uniforms.js +41 -0
  56. package/dist/render/driftLight/visibility.d.ts +18 -0
  57. package/dist/render/driftLight/visibility.js +47 -0
  58. package/dist/render/emptyTexture.d.ts +6 -0
  59. package/dist/render/emptyTexture.js +19 -0
  60. package/dist/render/exposurePass.d.ts +48 -0
  61. package/dist/render/exposurePass.js +172 -0
  62. package/dist/render/flameLight.d.ts +71 -0
  63. package/dist/render/flameLight.js +63 -0
  64. package/dist/render/gi/bounceLights.d.ts +34 -0
  65. package/dist/render/gi/bounceLights.js +66 -0
  66. package/dist/render/gi/fieldReach.d.ts +12 -0
  67. package/dist/render/gi/fieldReach.js +62 -0
  68. package/dist/render/gi/globalField.d.ts +8 -0
  69. package/dist/render/gi/globalField.js +31 -0
  70. package/dist/render/gi/probeTrace.d.ts +3 -1
  71. package/dist/render/gi/probeTrace.js +3 -1
  72. package/dist/render/gpuCapability.js +19 -4
  73. package/dist/render/lightBudget.d.ts +11 -0
  74. package/dist/render/lightBudget.js +11 -0
  75. package/dist/render/pointLightSelection.d.ts +16 -0
  76. package/dist/render/pointLightSelection.js +178 -83
  77. package/dist/render/probeGrid.d.ts +11 -1
  78. package/dist/render/probeGrid.js +5 -2
  79. package/dist/render/probeSweeps.d.ts +45 -0
  80. package/dist/render/probeSweeps.js +77 -0
  81. package/dist/render/reflectionProbe.d.ts +43 -1
  82. package/dist/render/reflectionProbe.js +17 -3
  83. package/dist/render/renderQuality.d.ts +3 -1
  84. package/dist/render/rendererHarness.d.ts +9 -0
  85. package/dist/render/rendererHarness.js +18 -3
  86. package/dist/render/sceneTarget.d.ts +20 -0
  87. package/dist/render/sceneTarget.js +62 -1
  88. package/dist/render/shaders/agx.d.ts +31 -0
  89. package/dist/render/shaders/agx.js +81 -0
  90. package/dist/render/shaders/ambientOcclusion.d.ts +24 -5
  91. package/dist/render/shaders/ambientOcclusion.js +120 -63
  92. package/dist/render/shaders/cutoutCoverage.d.ts +31 -0
  93. package/dist/render/shaders/cutoutCoverage.js +40 -0
  94. package/dist/render/shaders/depth.d.ts +25 -0
  95. package/dist/render/shaders/depth.js +69 -3
  96. package/dist/render/shaders/exposure.d.ts +52 -0
  97. package/dist/render/shaders/exposure.js +124 -0
  98. package/dist/render/shaders/filmLook.d.ts +47 -0
  99. package/dist/render/shaders/filmLook.js +98 -0
  100. package/dist/render/shaders/flat/directionalShadow.js +35 -4
  101. package/dist/render/shaders/flat/driftLight.d.ts +29 -0
  102. package/dist/render/shaders/flat/driftLight.js +75 -0
  103. package/dist/render/shaders/flat/index.js +5 -0
  104. package/dist/render/shaders/flat/lobes.js +13 -0
  105. package/dist/render/shaders/flat/main.d.ts +1 -1
  106. package/dist/render/shaders/flat/main.js +68 -9
  107. package/dist/render/shaders/flat/preamble.js +23 -5
  108. package/dist/render/shaders/flat/probeGrid.js +46 -3
  109. package/dist/render/shaders/generated/ambientOcclusion.wgsl.d.ts +1 -1
  110. package/dist/render/shaders/generated/ambientOcclusion.wgsl.js +1 -1
  111. package/dist/render/shaders/generated/depth.wgsl.d.ts +100 -0
  112. package/dist/render/shaders/generated/depth.wgsl.js +100 -0
  113. package/dist/render/shaders/generated/exposure.wgsl.d.ts +42 -0
  114. package/dist/render/shaders/generated/exposure.wgsl.js +48 -0
  115. package/dist/render/shaders/generated/flat.wgsl.d.ts +1800 -1344
  116. package/dist/render/shaders/generated/flat.wgsl.js +1816 -1360
  117. package/dist/render/shaders/generated/localExposure.wgsl.d.ts +18 -0
  118. package/dist/render/shaders/generated/localExposure.wgsl.js +24 -0
  119. package/dist/render/shaders/generated/rush.wgsl.d.ts +40 -10
  120. package/dist/render/shaders/generated/rush.wgsl.js +40 -10
  121. package/dist/render/shaders/generated/temporalResolve.wgsl.d.ts +1 -1
  122. package/dist/render/shaders/generated/temporalResolve.wgsl.js +1 -1
  123. package/dist/render/shaders/gi/driftLight.wgsl.d.ts +16 -0
  124. package/dist/render/shaders/gi/driftLight.wgsl.js +49 -0
  125. package/dist/render/shaders/gi/probeBake.wgsl.d.ts +29 -4
  126. package/dist/render/shaders/gi/probeBake.wgsl.js +190 -20
  127. package/dist/render/shaders/globalMedium.js +4 -0
  128. package/dist/render/shaders/localExposure.d.ts +35 -0
  129. package/dist/render/shaders/localExposure.js +138 -0
  130. package/dist/render/shaders/prefilter.d.ts +1 -1
  131. package/dist/render/shaders/prefilter.js +6 -0
  132. package/dist/render/shaders/rush.js +33 -5
  133. package/dist/render/shaders/tangentFrame.d.ts +1 -1
  134. package/dist/render/shaders/tangentFrame.js +15 -3
  135. package/dist/render/shaders/temporalResolve.js +39 -1
  136. package/dist/render/shadowCasters.d.ts +5 -3
  137. package/dist/render/shadowMap.js +13 -0
  138. package/dist/render/surfaceTexture.d.ts +5 -0
  139. package/package.json +6 -6
  140. package/scripts/gpuCompute.mjs +24 -3
  141. package/scripts/png.mjs +23 -12
  142. package/src/cinematic/cameraPath.ts +178 -0
  143. package/src/environment/daylight.ts +152 -0
  144. package/src/geometry/meshConcat.ts +100 -0
  145. package/src/index.ts +32 -0
  146. package/src/render/backend/createRenderer.ts +22 -6
  147. package/src/render/backend/webgl2/renderer.ts +462 -20
  148. package/src/render/backend/webgpu/buffers.ts +51 -8
  149. package/src/render/backend/webgpu/depthPass.ts +78 -10
  150. package/src/render/backend/webgpu/exposurePass.ts +234 -0
  151. package/src/render/backend/webgpu/fieldCompose.ts +15 -0
  152. package/src/render/backend/webgpu/flatPass.ts +10 -2
  153. package/src/render/backend/webgpu/particlePass.ts +9 -0
  154. package/src/render/backend/webgpu/probeBake.ts +143 -9
  155. package/src/render/backend/webgpu/probeTargets.ts +211 -0
  156. package/src/render/backend/webgpu/renderer.ts +807 -271
  157. package/src/render/backend/webgpu/scatterPass.ts +7 -7
  158. package/src/render/backend/webgpu/skinPaletteRing.ts +10 -0
  159. package/src/render/backend/webgpu/skyPass.ts +5 -1
  160. package/src/render/backend/webgpu/uniformRing.ts +49 -3
  161. package/src/render/bloomChain.ts +9 -0
  162. package/src/render/clusteredLights.ts +108 -63
  163. package/src/render/cutoutCaster.ts +44 -0
  164. package/src/render/driftLight/bake.ts +125 -0
  165. package/src/render/driftLight/falloff.ts +26 -0
  166. package/src/render/driftLight/layout.ts +177 -0
  167. package/src/render/driftLight/lightField.ts +227 -0
  168. package/src/render/driftLight/uniforms.ts +61 -0
  169. package/src/render/driftLight/visibility.ts +58 -0
  170. package/src/render/emptyTexture.ts +41 -0
  171. package/src/render/exposurePass.ts +186 -0
  172. package/src/render/flameLight.ts +135 -0
  173. package/src/render/gi/bounceLights.ts +68 -0
  174. package/src/render/gi/fieldReach.ts +74 -0
  175. package/src/render/gi/globalField.ts +39 -0
  176. package/src/render/gi/probeTrace.ts +3 -1
  177. package/src/render/gpuCapability.ts +18 -5
  178. package/src/render/lightBudget.ts +12 -0
  179. package/src/render/pointLightSelection.ts +191 -79
  180. package/src/render/probeGrid.ts +13 -2
  181. package/src/render/probeSweeps.ts +80 -0
  182. package/src/render/reflectionProbe.ts +54 -2
  183. package/src/render/renderQuality.ts +3 -1
  184. package/src/render/rendererHarness.ts +25 -3
  185. package/src/render/sceneTarget.ts +75 -1
  186. package/src/render/shaders/ambientOcclusion.ts +125 -63
  187. package/src/render/shaders/cutoutCoverage.ts +43 -0
  188. package/src/render/shaders/depth.ts +80 -3
  189. package/src/render/shaders/exposure.ts +128 -0
  190. package/src/render/shaders/filmLook.ts +111 -0
  191. package/src/render/shaders/flat/directionalShadow.ts +35 -4
  192. package/src/render/shaders/flat/driftLight.ts +75 -0
  193. package/src/render/shaders/flat/index.ts +5 -0
  194. package/src/render/shaders/flat/lobes.ts +13 -0
  195. package/src/render/shaders/flat/main.ts +68 -9
  196. package/src/render/shaders/flat/preamble.ts +23 -5
  197. package/src/render/shaders/flat/probeGrid.ts +46 -3
  198. package/src/render/shaders/generated/ambientOcclusion.wgsl.ts +1 -1
  199. package/src/render/shaders/generated/depth.wgsl.ts +103 -0
  200. package/src/render/shaders/generated/exposure.wgsl.ts +51 -0
  201. package/src/render/shaders/generated/flat.wgsl.ts +1816 -1360
  202. package/src/render/shaders/generated/localExposure.wgsl.ts +26 -0
  203. package/src/render/shaders/generated/rush.wgsl.ts +40 -10
  204. package/src/render/shaders/generated/temporalResolve.wgsl.ts +1 -1
  205. package/src/render/shaders/gi/driftLight.wgsl.ts +49 -0
  206. package/src/render/shaders/gi/probeBake.wgsl.ts +191 -20
  207. package/src/render/shaders/globalMedium.ts +4 -0
  208. package/src/render/shaders/localExposure.ts +154 -0
  209. package/src/render/shaders/prefilter.ts +6 -0
  210. package/src/render/shaders/rush.ts +33 -5
  211. package/src/render/shaders/tangentFrame.ts +15 -3
  212. package/src/render/shaders/temporalResolve.ts +39 -1
  213. package/src/render/shadowCasters.ts +5 -3
  214. package/src/render/shadowMap.ts +14 -0
  215. 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.
@@ -1126,6 +1158,8 @@ export declare class WebGPURenderer implements RendererApi {
1126
1158
  createText(): GpuText;
1127
1159
  setText(text: GpuText, content: string): void;
1128
1160
  setPlate(text: GpuText, widthCells: number, heightCells: number, bottomCell: number): void;
1161
+ /** See `Renderer.snapTextCellSize`; only the drawing buffer differs. */
1162
+ snapTextCellSize(cellSize: number, viewportWidth: number): number;
1129
1163
  textWidth(text: GpuText, cellSize: number): number;
1130
1164
  disposeText(text: GpuText): void;
1131
1165
  /** A text label from an SDF font. See `sdfTextPass.ts`; the layout it holds is shared with WebGL2. */
@@ -1462,7 +1496,8 @@ export declare class WebGPURenderer implements RendererApi {
1462
1496
  private readonly scatterLayout;
1463
1497
  /** One slot per batch: the gust and the trample field belong to the batch, not the frame. */
1464
1498
  private readonly scatterVerts;
1465
- private readonly scatterFragUniforms;
1499
+ /** A slot a draw, beside the vertex block's: see `createScatterBindGroupLayout` for why. */
1500
+ private readonly scatterFrags;
1466
1501
  private readonly scatterFragStaging;
1467
1502
  private readonly scatterFragFloats;
1468
1503
  private readonly scatterFragInts;
@@ -1605,17 +1640,28 @@ export declare class WebGPURenderer implements RendererApi {
1605
1640
  private readonly dynamicView;
1606
1641
  /** The peel's own bind groups: `uPeelShadowLayer` at 1, and the static map to peel against. */
1607
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;
1608
1654
  private readonly scatterDepthPeelBindGroup;
1609
1655
  /** Which layer the open pass is writing, so the sink picks the bindings that match it. */
1610
1656
  private shadowLayerIsPeel;
1611
1657
  /**
1612
1658
  * Whether a peel pass has filled the map, which is what the frame may sample it on.
1613
1659
  *
1614
- * **Not whether the map exists.** `renderer.ts` can ask that question because a GL texture is
1615
- * born cleared; a WebGPU texture no pass has written holds undefined contents, so a scene
1616
- * that builds a peel map and never opens the layer would sample garbage. Cleared when the
1617
- * static layer opens and set when a peel pass ends, which is per frame because both demo
1618
- * scenes that peel do so every frame.
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.
1619
1665
  */
1620
1666
  private peelFilled;
1621
1667
  /** One slot per caster, the same trick `perDraw` uses and for the same reason. */
@@ -1656,6 +1702,10 @@ export declare class WebGPURenderer implements RendererApi {
1656
1702
  * otherwise. A lookup rather than a rebind, because a `createBindGroup` per draw is the
1657
1703
  * per-frame allocation the house rules forbid; both groups are built once at init.
1658
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;
1659
1709
  private shadowGroup;
1660
1710
  /**
1661
1711
  * The skinned shadow bind group for the current layer, rebuilt only when it must be.
@@ -1932,6 +1982,14 @@ export declare class WebGPURenderer implements RendererApi {
1932
1982
  private materialSlotForDraw;
1933
1983
  /** Said once rather than every frame, for the reason `warnedFull` gives. */
1934
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;
1935
1993
  /**
1936
1994
  * Draw one mesh.
1937
1995
  *
@@ -2279,6 +2337,22 @@ export declare class WebGPURenderer implements RendererApi {
2279
2337
  * that is wrong once.
2280
2338
  */
2281
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;
2282
2356
  /**
2283
2357
  * Rebuild the group for the open material, and drop every cached one.
2284
2358
  *
@@ -3072,6 +3146,8 @@ export declare class WebGPURenderer implements RendererApi {
3072
3146
  /** This frame's exposure into the tone curve. Starts at the profile's own. */
3073
3147
  private exposure;
3074
3148
  private bloomScale;
3149
+ /** In scene units, once `setBloom` has moved it; null reads the profile's. */
3150
+ private bloomThresholdSet;
3075
3151
  private rushStrength;
3076
3152
  private motionBlurScale;
3077
3153
  /**
@@ -3083,6 +3159,30 @@ export declare class WebGPURenderer implements RendererApi {
3083
3159
  */
3084
3160
  private readonly veilColor;
3085
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;
3086
3186
  /** How much of the frame's bloom to apply, 0 to 1. Scales the profile's `bloom`. */
3087
3187
  /**
3088
3188
  * The colour grade this and every later frame applies, until it is set again.
@@ -3109,7 +3209,7 @@ export declare class WebGPURenderer implements RendererApi {
3109
3209
  * a 3D write needs both and a wrong one silently shears the cube.
3110
3210
  */
3111
3211
  private uploadGrade;
3112
- setBloom(scale: number): void;
3212
+ setBloom(scale: number, threshold?: number): void;
3113
3213
  /**
3114
3214
  * How thick the air is, this frame: a global participating medium filling the whole frustum.
3115
3215
  *
@@ -3122,6 +3222,33 @@ export declare class WebGPURenderer implements RendererApi {
3122
3222
  setSpeedRush(strength: number): void;
3123
3223
  /** How much of the frame's camera motion blur to apply, 0 to 1. */
3124
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;
3125
3252
  /**
3126
3253
  * Where this frame's lens is focused, how deep the sharp zone is, and how much of the ceiling
3127
3254
  * to take. **The other backend's `setDepthOfField` carries the reasoning**, whole: the
@@ -3201,6 +3328,8 @@ export declare class WebGPURenderer implements RendererApi {
3201
3328
  * over a lobe-convolved one.
3202
3329
  */
3203
3330
  private readonly probe;
3331
+ /** The views, groups and attachments a bake draws with, made once. See `probeTargets.ts`. */
3332
+ private readonly probeTargets;
3204
3333
  /**
3205
3334
  * The prefiltered cube: what the lit pass samples, one GGX-convolved level per roughness.
3206
3335
  *
@@ -3232,6 +3361,19 @@ export declare class WebGPURenderer implements RendererApi {
3232
3361
  private readonly probeMipLayout;
3233
3362
  /** The photometric atlas, allocated on first use. See `setIesProfiles`. */
3234
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;
3235
3377
  private iesView;
3236
3378
  private cookieTexture;
3237
3379
  private cookieView;
@@ -3256,8 +3398,9 @@ export declare class WebGPURenderer implements RendererApi {
3256
3398
  * mirroring uninitialised memory is worse than a car mirroring a gradient — the rule one probe
3257
3399
  * already had, unchanged by there being more of them.
3258
3400
  */
3259
- private probeFilled;
3260
- private probeFilledCount;
3401
+ private probeSweeps;
3402
+ /** `uProbeGridSets`, rewritten in place. */
3403
+ private readonly probeSets;
3261
3404
  /**
3262
3405
  * Whether a bake is running, which is when the cube may be neither sampled nor bound.
3263
3406
  *
@@ -3265,9 +3408,17 @@ export declare class WebGPURenderer implements RendererApi {
3265
3408
  * load-bearing rather than defensive: WebGPU rejects a pass that holds the texture it writes.
3266
3409
  */
3267
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;
3268
3419
  /** How many mip levels the roughness blur has to work with. `flat.ts` reads this. */
3269
3420
  private get probeMaxLod();
3270
- /** Whether every layer of the grid has been convolved. See `probeFilled`. */
3421
+ /** Whether a whole sweep of the grid has been convolved. See `probeSweeps.ts`. */
3271
3422
  private get probeBaked();
3272
3423
  /**
3273
3424
  * Record that one layer now holds a convolution, without counting a rebake twice.
@@ -3376,6 +3527,20 @@ export declare class WebGPURenderer implements RendererApi {
3376
3527
  * call a tile fills the row without a canvas in between.
3377
3528
  */
3378
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;
3379
3544
  setIesProfiles(profiles: readonly PhotometricProfile[]): void;
3380
3545
  /** Each level from the one above it, six faces at a time. See `probePass.ts`. */
3381
3546
  private buildProbeChain;