@driftengine/core 4.3.0 → 4.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (218) hide show
  1. package/CHANGELOG.json +282 -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/ambientOcclusionPass.js +5 -1
  12. package/dist/render/backend/createRenderer.d.ts +13 -1
  13. package/dist/render/backend/createRenderer.js +6 -5
  14. package/dist/render/backend/webgl2/renderer.d.ts +147 -1
  15. package/dist/render/backend/webgl2/renderer.js +402 -23
  16. package/dist/render/backend/webgpu/buffers.js +46 -8
  17. package/dist/render/backend/webgpu/depthPass.d.ts +81 -3
  18. package/dist/render/backend/webgpu/depthPass.js +75 -14
  19. package/dist/render/backend/webgpu/exposurePass.d.ts +39 -0
  20. package/dist/render/backend/webgpu/exposurePass.js +190 -0
  21. package/dist/render/backend/webgpu/fieldCompose.d.ts +11 -0
  22. package/dist/render/backend/webgpu/fieldCompose.js +13 -0
  23. package/dist/render/backend/webgpu/flatPass.d.ts +3 -1
  24. package/dist/render/backend/webgpu/flatPass.js +12 -5
  25. package/dist/render/backend/webgpu/particlePass.d.ts +8 -0
  26. package/dist/render/backend/webgpu/particlePass.js +1 -0
  27. package/dist/render/backend/webgpu/postPass.d.ts +13 -3
  28. package/dist/render/backend/webgpu/probeBake.d.ts +59 -3
  29. package/dist/render/backend/webgpu/probeBake.js +97 -7
  30. package/dist/render/backend/webgpu/probeTargets.d.ts +65 -0
  31. package/dist/render/backend/webgpu/probeTargets.js +180 -0
  32. package/dist/render/backend/webgpu/renderer.d.ts +174 -11
  33. package/dist/render/backend/webgpu/renderer.js +682 -252
  34. package/dist/render/backend/webgpu/scatterPass.js +7 -7
  35. package/dist/render/backend/webgpu/shaders/clusterBin.wgsl.d.ts +1 -1
  36. package/dist/render/backend/webgpu/skinPaletteRing.d.ts +4 -0
  37. package/dist/render/backend/webgpu/skinPaletteRing.js +9 -0
  38. package/dist/render/backend/webgpu/skyPass.js +5 -1
  39. package/dist/render/backend/webgpu/uniformRing.d.ts +31 -1
  40. package/dist/render/backend/webgpu/uniformRing.js +53 -3
  41. package/dist/render/bloomChain.d.ts +6 -0
  42. package/dist/render/bloomChain.js +8 -0
  43. package/dist/render/clusteredLights.d.ts +19 -11
  44. package/dist/render/clusteredLights.js +96 -45
  45. package/dist/render/cutoutCaster.d.ts +23 -0
  46. package/dist/render/cutoutCaster.js +20 -0
  47. package/dist/render/driftLight/bake.d.ts +34 -0
  48. package/dist/render/driftLight/bake.js +95 -0
  49. package/dist/render/driftLight/falloff.d.ts +16 -0
  50. package/dist/render/driftLight/falloff.js +23 -0
  51. package/dist/render/driftLight/layout.d.ts +59 -0
  52. package/dist/render/driftLight/layout.js +138 -0
  53. package/dist/render/driftLight/lightField.d.ts +108 -0
  54. package/dist/render/driftLight/lightField.js +179 -0
  55. package/dist/render/driftLight/uniforms.d.ts +28 -0
  56. package/dist/render/driftLight/uniforms.js +41 -0
  57. package/dist/render/driftLight/visibility.d.ts +18 -0
  58. package/dist/render/driftLight/visibility.js +47 -0
  59. package/dist/render/emptyTexture.d.ts +6 -0
  60. package/dist/render/emptyTexture.js +19 -0
  61. package/dist/render/exposurePass.d.ts +48 -0
  62. package/dist/render/exposurePass.js +172 -0
  63. package/dist/render/flameLight.d.ts +71 -0
  64. package/dist/render/flameLight.js +63 -0
  65. package/dist/render/gi/bounceLights.d.ts +34 -0
  66. package/dist/render/gi/bounceLights.js +66 -0
  67. package/dist/render/gi/fieldReach.d.ts +12 -0
  68. package/dist/render/gi/fieldReach.js +62 -0
  69. package/dist/render/gi/globalField.d.ts +8 -0
  70. package/dist/render/gi/globalField.js +31 -0
  71. package/dist/render/gi/probeTrace.d.ts +3 -1
  72. package/dist/render/gi/probeTrace.js +3 -1
  73. package/dist/render/gpuCapability.js +19 -4
  74. package/dist/render/lightBudget.d.ts +11 -0
  75. package/dist/render/lightBudget.js +11 -0
  76. package/dist/render/pointLightSelection.d.ts +16 -0
  77. package/dist/render/pointLightSelection.js +178 -83
  78. package/dist/render/pointShadowBudget.d.ts +12 -2
  79. package/dist/render/pointShadowBudget.js +16 -10
  80. package/dist/render/probeGrid.d.ts +11 -1
  81. package/dist/render/probeGrid.js +5 -2
  82. package/dist/render/probeSweeps.d.ts +45 -0
  83. package/dist/render/probeSweeps.js +77 -0
  84. package/dist/render/reflectionProbe.d.ts +43 -1
  85. package/dist/render/reflectionProbe.js +17 -3
  86. package/dist/render/renderQuality.d.ts +3 -1
  87. package/dist/render/rendererHarness.d.ts +9 -0
  88. package/dist/render/rendererHarness.js +18 -3
  89. package/dist/render/sceneTarget.d.ts +20 -0
  90. package/dist/render/sceneTarget.js +62 -1
  91. package/dist/render/shaders/ambientOcclusion.d.ts +63 -6
  92. package/dist/render/shaders/ambientOcclusion.js +188 -71
  93. package/dist/render/shaders/cutoutCoverage.d.ts +31 -0
  94. package/dist/render/shaders/cutoutCoverage.js +40 -0
  95. package/dist/render/shaders/depth.d.ts +25 -0
  96. package/dist/render/shaders/depth.js +69 -3
  97. package/dist/render/shaders/exposure.d.ts +52 -0
  98. package/dist/render/shaders/exposure.js +124 -0
  99. package/dist/render/shaders/filmLook.d.ts +47 -0
  100. package/dist/render/shaders/filmLook.js +98 -0
  101. package/dist/render/shaders/flat/directionalShadow.js +35 -4
  102. package/dist/render/shaders/flat/driftLight.d.ts +29 -0
  103. package/dist/render/shaders/flat/driftLight.js +75 -0
  104. package/dist/render/shaders/flat/index.js +5 -0
  105. package/dist/render/shaders/flat/lobes.js +13 -0
  106. package/dist/render/shaders/flat/main.d.ts +1 -1
  107. package/dist/render/shaders/flat/main.js +68 -9
  108. package/dist/render/shaders/flat/preamble.js +23 -5
  109. package/dist/render/shaders/flat/probeGrid.js +46 -3
  110. package/dist/render/shaders/generated/ambientOcclusion.wgsl.d.ts +8 -3
  111. package/dist/render/shaders/generated/ambientOcclusion.wgsl.js +8 -3
  112. package/dist/render/shaders/generated/depth.wgsl.d.ts +100 -0
  113. package/dist/render/shaders/generated/depth.wgsl.js +100 -0
  114. package/dist/render/shaders/generated/exposure.wgsl.d.ts +42 -0
  115. package/dist/render/shaders/generated/exposure.wgsl.js +48 -0
  116. package/dist/render/shaders/generated/flat.wgsl.d.ts +1800 -1344
  117. package/dist/render/shaders/generated/flat.wgsl.js +1816 -1360
  118. package/dist/render/shaders/generated/localExposure.wgsl.d.ts +18 -0
  119. package/dist/render/shaders/generated/localExposure.wgsl.js +24 -0
  120. package/dist/render/shaders/generated/rush.wgsl.d.ts +40 -10
  121. package/dist/render/shaders/generated/rush.wgsl.js +40 -10
  122. package/dist/render/shaders/generated/temporalResolve.wgsl.d.ts +1 -1
  123. package/dist/render/shaders/generated/temporalResolve.wgsl.js +1 -1
  124. package/dist/render/shaders/gi/driftLight.wgsl.d.ts +16 -0
  125. package/dist/render/shaders/gi/driftLight.wgsl.js +49 -0
  126. package/dist/render/shaders/gi/probeBake.wgsl.d.ts +29 -4
  127. package/dist/render/shaders/gi/probeBake.wgsl.js +190 -20
  128. package/dist/render/shaders/globalMedium.js +4 -0
  129. package/dist/render/shaders/localExposure.d.ts +35 -0
  130. package/dist/render/shaders/localExposure.js +138 -0
  131. package/dist/render/shaders/prefilter.d.ts +1 -1
  132. package/dist/render/shaders/prefilter.js +6 -0
  133. package/dist/render/shaders/rush.js +33 -5
  134. package/dist/render/shaders/tangentFrame.d.ts +1 -1
  135. package/dist/render/shaders/tangentFrame.js +15 -3
  136. package/dist/render/shaders/temporalResolve.js +39 -1
  137. package/dist/render/shadowCasters.d.ts +5 -3
  138. package/dist/render/shadowMap.js +13 -0
  139. package/dist/render/surfaceTexture.d.ts +5 -0
  140. package/package.json +6 -6
  141. package/scripts/gpuCompute.mjs +24 -3
  142. package/scripts/png.mjs +23 -12
  143. package/src/cinematic/cameraPath.ts +178 -0
  144. package/src/environment/daylight.ts +152 -0
  145. package/src/geometry/meshConcat.ts +100 -0
  146. package/src/index.ts +32 -0
  147. package/src/render/ambientOcclusionPass.ts +5 -1
  148. package/src/render/backend/createRenderer.ts +22 -6
  149. package/src/render/backend/webgl2/renderer.ts +439 -20
  150. package/src/render/backend/webgpu/buffers.ts +51 -8
  151. package/src/render/backend/webgpu/depthPass.ts +78 -10
  152. package/src/render/backend/webgpu/exposurePass.ts +234 -0
  153. package/src/render/backend/webgpu/fieldCompose.ts +15 -0
  154. package/src/render/backend/webgpu/flatPass.ts +10 -2
  155. package/src/render/backend/webgpu/particlePass.ts +9 -0
  156. package/src/render/backend/webgpu/probeBake.ts +143 -9
  157. package/src/render/backend/webgpu/probeTargets.ts +211 -0
  158. package/src/render/backend/webgpu/renderer.ts +808 -273
  159. package/src/render/backend/webgpu/scatterPass.ts +7 -7
  160. package/src/render/backend/webgpu/skinPaletteRing.ts +10 -0
  161. package/src/render/backend/webgpu/skyPass.ts +5 -1
  162. package/src/render/backend/webgpu/uniformRing.ts +49 -3
  163. package/src/render/bloomChain.ts +9 -0
  164. package/src/render/clusteredLights.ts +108 -63
  165. package/src/render/cutoutCaster.ts +44 -0
  166. package/src/render/driftLight/bake.ts +125 -0
  167. package/src/render/driftLight/falloff.ts +26 -0
  168. package/src/render/driftLight/layout.ts +177 -0
  169. package/src/render/driftLight/lightField.ts +227 -0
  170. package/src/render/driftLight/uniforms.ts +61 -0
  171. package/src/render/driftLight/visibility.ts +58 -0
  172. package/src/render/emptyTexture.ts +41 -0
  173. package/src/render/exposurePass.ts +186 -0
  174. package/src/render/flameLight.ts +135 -0
  175. package/src/render/gi/bounceLights.ts +68 -0
  176. package/src/render/gi/fieldReach.ts +74 -0
  177. package/src/render/gi/globalField.ts +39 -0
  178. package/src/render/gi/probeTrace.ts +3 -1
  179. package/src/render/gpuCapability.ts +18 -5
  180. package/src/render/lightBudget.ts +12 -0
  181. package/src/render/pointLightSelection.ts +191 -79
  182. package/src/render/pointShadowBudget.ts +16 -8
  183. package/src/render/probeGrid.ts +13 -2
  184. package/src/render/probeSweeps.ts +80 -0
  185. package/src/render/reflectionProbe.ts +54 -2
  186. package/src/render/renderQuality.ts +3 -1
  187. package/src/render/rendererHarness.ts +25 -3
  188. package/src/render/sceneTarget.ts +75 -1
  189. package/src/render/shaders/ambientOcclusion.ts +205 -71
  190. package/src/render/shaders/cutoutCoverage.ts +43 -0
  191. package/src/render/shaders/depth.ts +80 -3
  192. package/src/render/shaders/exposure.ts +128 -0
  193. package/src/render/shaders/filmLook.ts +111 -0
  194. package/src/render/shaders/flat/directionalShadow.ts +35 -4
  195. package/src/render/shaders/flat/driftLight.ts +75 -0
  196. package/src/render/shaders/flat/index.ts +5 -0
  197. package/src/render/shaders/flat/lobes.ts +13 -0
  198. package/src/render/shaders/flat/main.ts +68 -9
  199. package/src/render/shaders/flat/preamble.ts +23 -5
  200. package/src/render/shaders/flat/probeGrid.ts +46 -3
  201. package/src/render/shaders/generated/ambientOcclusion.wgsl.ts +8 -3
  202. package/src/render/shaders/generated/depth.wgsl.ts +103 -0
  203. package/src/render/shaders/generated/exposure.wgsl.ts +51 -0
  204. package/src/render/shaders/generated/flat.wgsl.ts +1816 -1360
  205. package/src/render/shaders/generated/localExposure.wgsl.ts +26 -0
  206. package/src/render/shaders/generated/rush.wgsl.ts +40 -10
  207. package/src/render/shaders/generated/temporalResolve.wgsl.ts +1 -1
  208. package/src/render/shaders/gi/driftLight.wgsl.ts +49 -0
  209. package/src/render/shaders/gi/probeBake.wgsl.ts +191 -20
  210. package/src/render/shaders/globalMedium.ts +4 -0
  211. package/src/render/shaders/localExposure.ts +154 -0
  212. package/src/render/shaders/prefilter.ts +6 -0
  213. package/src/render/shaders/rush.ts +33 -5
  214. package/src/render/shaders/tangentFrame.ts +15 -3
  215. package/src/render/shaders/temporalResolve.ts +39 -1
  216. package/src/render/shadowCasters.ts +5 -3
  217. package/src/render/shadowMap.ts +14 -0
  218. package/src/render/surfaceTexture.ts +5 -0
@@ -11,6 +11,8 @@ import type { PassDefinition, PassHandle } from '../../pass.ts';
11
11
  import type { Vec3 } from '../../../math/color.ts';
12
12
  import { GpuTimer } from '../../gpuTimer.ts';
13
13
  import type { ColourGradeLut } from '../../colourGrade.ts';
14
+ import { LightField } from '../../driftLight/lightField.ts';
15
+ import type { LightFieldOptions, LightFieldSource } from '../../driftLight/lightField.ts';
14
16
  /**
15
17
  * How far the rush's outermost tap reaches at full strength, in UV.
16
18
  *
@@ -541,6 +543,14 @@ export interface TranslucentMeshOptions {
541
543
  * that two surfaces overlapping in view blend in submission order. And a surface that writes no
542
544
  * depth cannot occlude the sky. A caller wanting both wants the pieces sorted and this left
543
545
  * alone.
546
+ *
547
+ * **And depth a blended surface writes is where the frame's depth-reading passes stop.** The
548
+ * global medium marches to it on both backends, and on WebGPU ambient occlusion, the temporal
549
+ * resolve and motion blur take it for the surface too. Right for a pane that is most of a pixel's
550
+ * colour; wrong for a faint sheet. A bought courtyard's dirt decals stand a centimetre off their
551
+ * stone and overhang every corner they wrap, and the haze stopped at each overhang, a clear band
552
+ * down a pier's whole height. A decal lying on an opaque surface needs no depth to hold the sky
553
+ * off, since the surface under it already does, so `false` costs it only an order among decals.
544
554
  */
545
555
  readonly depthWrite?: boolean;
546
556
  /**
@@ -777,6 +787,8 @@ export declare class WebGL2Renderer implements RendererApi {
777
787
  private readonly panelProgram;
778
788
  private readonly panelUniforms;
779
789
  private readonly panelVao;
790
+ /** The unit quad behind `panelVao`, held so `dispose` can release it. */
791
+ private readonly panelBuffer;
780
792
  private readonly filmProgram;
781
793
  /**
782
794
  * The off-screen colour target, when screen effects are on. Null is not a failure —
@@ -807,6 +819,14 @@ export declare class WebGL2Renderer implements RendererApi {
807
819
  /** Whether a palette is currently chosen. Distinct from whether one was ever uploaded. */
808
820
  private skinPaletteSet;
809
821
  private readonly emptyTexture2D;
822
+ /** DriftLight's stand-ins while no field is whole: no brick anywhere, and no light. */
823
+ private readonly emptyDriftIndex;
824
+ private readonly emptyDriftAtlas;
825
+ /** The scene's DriftLight field, and its two volumes once it is whole. See `createLightField`. */
826
+ private lightField;
827
+ private driftIndex;
828
+ private driftAtlas;
829
+ private readonly driftUniforms;
810
830
  private readonly emptyTexture2DArray;
811
831
  private readonly emptyTextureCube;
812
832
  /** How hard the rush blurs this frame, and how far its outermost tap reaches. */
@@ -865,6 +885,8 @@ export declare class WebGL2Renderer implements RendererApi {
865
885
  private motionBlurScale;
866
886
  /** How much of the bloom ceiling this frame takes. See `setBloom`. */
867
887
  private bloomScale;
888
+ /** In scene units, once `setBloom` has moved it; null reads the profile's. */
889
+ private bloomThresholdSet;
868
890
  /**
869
891
  * This frame's exposure into the tone curve. See `setOutputExposure`.
870
892
  *
@@ -972,6 +994,15 @@ export declare class WebGL2Renderer implements RendererApi {
972
994
  private readonly depthUniforms;
973
995
  private readonly depthInstancedProgram;
974
996
  private readonly depthInstancedUniforms;
997
+ /**
998
+ * The cutout casters' depth programs, rigid and instanced: a leaf or a chain link casts the shape
999
+ * in its texture's alpha, not its whole card. See `DEPTH_CUTOUT_FRAG`. Chosen per draw by
1000
+ * `cutoutOf`, so an opaque caster never touches them.
1001
+ */
1002
+ private readonly depthCutoutProgram;
1003
+ private readonly depthCutoutUniforms;
1004
+ private readonly depthInstancedCutoutProgram;
1005
+ private readonly depthInstancedCutoutUniforms;
975
1006
  private readonly scatterDepthProgram;
976
1007
  private readonly scatterDepthUniforms;
977
1008
  private readonly shadowMap;
@@ -1030,6 +1061,10 @@ export declare class WebGL2Renderer implements RendererApi {
1030
1061
  private readonly probeCapture;
1031
1062
  /** Every probe of the grid, as one array texture. Allocated when a grid is declared. */
1032
1063
  private probeArray;
1064
+ /** Which layers a bake writes and the shading reads. See `probeSweeps.ts`. */
1065
+ private probeSweeps;
1066
+ /** `uProbeGridSets`, rewritten in place. */
1067
+ private readonly probeSets;
1033
1068
  /**
1034
1069
  * Where those probes stand. A single baked probe is a grid of one at that probe's own origin.
1035
1070
  *
@@ -1055,6 +1090,8 @@ export declare class WebGL2Renderer implements RendererApi {
1055
1090
  private warnedEnvironmentAmbient;
1056
1091
  /** Whether a probe is being baked, so the passes that would recurse into one can tell. */
1057
1092
  private probePassActive;
1093
+ /** Whether the bake under way lights its faces by the grid. `ProbeBakeOptions.bounce`. */
1094
+ private probeBounce;
1058
1095
  /** The clip-control extension, or null where this context does not offer it. */
1059
1096
  private clipControl;
1060
1097
  /**
@@ -1157,6 +1194,17 @@ export declare class WebGL2Renderer implements RendererApi {
1157
1194
  */
1158
1195
  private activeDepthViewProj;
1159
1196
  private activeDepthPeel;
1197
+ /**
1198
+ * Whether a peel pass has filled the second layer since the first one last opened, which is
1199
+ * what the frame samples it on: the rule the other backend's `peelFilled` states, held here too.
1200
+ *
1201
+ * **Not whether the map exists.** That was the test here, on the belief that a GL texture is
1202
+ * born reading as the far plane; it is born zeroed, and a scene that built the layer and never
1203
+ * peeled it sampled an occluder at the light. `ShadowMap` now clears itself at birth, so an
1204
+ * unfilled layer would read as lit either way — this is what keeps the two backends one
1205
+ * decision, and a frame that does not peel from paying a fetch per tap for nothing.
1206
+ */
1207
+ private peelFilled;
1160
1208
  /**
1161
1209
  * Whether the depth pass this scatter draw interrupts wants back-face culling.
1162
1210
  *
@@ -1167,6 +1215,11 @@ export declare class WebGL2Renderer implements RendererApi {
1167
1215
  * cubemap — so the pass states what it wants and this restores that.
1168
1216
  */
1169
1217
  private depthPassCullsFaces;
1218
+ /**
1219
+ * Whether the bound material is seen from both faces, so its draws cull nothing. Toggled around
1220
+ * each such draw and handed back, where the other backend bakes it into a pipeline.
1221
+ */
1222
+ private materialDoubleSided;
1170
1223
  /**
1171
1224
  * The one sink handed to every caster enumeration.
1172
1225
  *
@@ -1174,6 +1227,11 @@ export declare class WebGL2Renderer implements RendererApi {
1174
1227
  * per pass would allocate six objects per light per frame.
1175
1228
  */
1176
1229
  private readonly casterSink;
1230
+ /**
1231
+ * What a cutout depth draw needs beyond the plain one: the pass's matrix and peel, the material's
1232
+ * cutoff and UV scale, and its albedo on the surface unit, which the caller gives back after.
1233
+ */
1234
+ private bindCutoutDepth;
1177
1235
  private readonly drawPointShadowFace;
1178
1236
  /**
1179
1237
  * Viewport in CSS pixels rather than device pixels.
@@ -2514,6 +2572,53 @@ export declare class WebGL2Renderer implements RendererApi {
2514
2572
  * than anything in the world.
2515
2573
  */
2516
2574
  setCameraMotionBlur(scale: number): void;
2575
+ /**
2576
+ * The camera has cut: this frame is a new shot, not the next moment of the last one.
2577
+ *
2578
+ * **Everything temporal reprojects through the previous frame's view**: the motion blur measures
2579
+ * its smear against it, and the temporal resolve reads its history through it. A cut is a jump
2580
+ * the renderer cannot tell from a fast camera, so without this a transport that seeks, a respawn
2581
+ * or an edit smears its first frame along the whole jump and blends in a picture of somewhere
2582
+ * else. The caller knows it cut; this is how it says so, before the frame's `beginFrame`.
2583
+ *
2584
+ * What it gives up is one frame of history: the frame after a cut has no blur and no temporal
2585
+ * blend, as the first frame of a session has none. Nothing else is reset.
2586
+ */
2587
+ cameraCut(): void;
2588
+ /**
2589
+ * **Eye adaptation**: how far the frame's exposure follows its own brightness, 0 to 1, and the
2590
+ * seconds since the last frame. 0 is off and the default, and at 0 nothing is metered or allocated.
2591
+ *
2592
+ * The finished scene is metered on the GPU each frame — the log-mean of its luminance — and a
2593
+ * held brightness moves toward it at a fixed rate, about 78% of the way in a second; the composite
2594
+ * then scales scene light toward middle grey by \`strength\` of the stops between them, at most six
2595
+ * either way. So a shaded courtyard floor opens up the way a camera or an eye would, and
2596
+ * \`setOutputExposure\` becomes a bias on top: a night kept darker than a day is a bias under one.
2597
+ * **The time is the caller's**, because the engine takes time from its caller; a held capture
2598
+ * passes 0 and holds. \`cameraCut\` snaps it, so a new shot is metered rather than eased into.
2599
+ *
2600
+ * What it gives up is regional metering: every pixel counts the same. Needs \`screenEffects\` and
2601
+ * \`hdrScene\`, and says so once rather than doing nothing. See \`shaders/exposure.ts\`.
2602
+ */
2603
+ setAutoExposure(strength: number, dtSec: number): void;
2604
+ /**
2605
+ * **Local exposure**: how far each region of the frame is brought toward the frame's own
2606
+ * brightness, 0 to 1. 0 is off and the default, and at 0 nothing more is measured or allocated.
2607
+ *
2608
+ * A tone curve maps one range, and a sunlit courtyard is two: its shaded arcades hold a fiftieth
2609
+ * of the light on its sunlit paving, so exposed for either the other is black or white. This moves
2610
+ * each region `strength` of the stops between it and the frame's held brightness, at most three,
2611
+ * read from a bilateral grid over the exposure meter's tiles, so shade beside sun is lifted as
2612
+ * shade rather than as the average of the two. The eye's held brightness is what regions move
2613
+ * toward, so it is measured whether or not `setAutoExposure` is on; with adaptation off the frame
2614
+ * as a whole keeps the exposure it was given. About 0.5 is a photograph's latitude, and 1 is a
2615
+ * frame with no light and shade left in it.
2616
+ *
2617
+ * What it gives up is contrast between regions, which is the point, and a halo a tile wide where
2618
+ * two regions of one brightness band differ. Needs `screenEffects` and `hdrScene`, and says so
2619
+ * once rather than doing nothing. See `shaders/localExposure.ts`.
2620
+ */
2621
+ setLocalExposure(strength: number): void;
2517
2622
  /**
2518
2623
  * Where this frame's lens is focused, how deep the sharp zone is, and how much of the ceiling
2519
2624
  * to take.
@@ -2562,8 +2667,15 @@ export declare class WebGL2Renderer implements RendererApi {
2562
2667
  *
2563
2668
  * Set before `beginFrame` and held until changed. Ignored entirely when `bloom` is 0, since
2564
2669
  * the chain is never built.
2670
+ *
2671
+ * **`threshold` moves `bloomThreshold` for this frame and every one after**, in the same scene
2672
+ * units. A threshold is compared before exposure is applied, so one fixed at construction means a
2673
+ * different brightness on screen at every exposure. That is harmless while exposure stands still
2674
+ * and wrong for a day whose exposure spans 2.5 to 14: a courtyard blooming at noon, or candles
2675
+ * never blooming at night. A caller whose exposure moves passes what it wants on screen over the
2676
+ * exposure. Omitted leaves it where it was, so a caller that never passes one keeps the profile's.
2565
2677
  */
2566
- setBloom(scale: number): void;
2678
+ setBloom(scale: number, threshold?: number): void;
2567
2679
  /**
2568
2680
  * How thick the air is, this frame: a global participating medium filling the whole frustum.
2569
2681
  *
@@ -2669,6 +2781,21 @@ export declare class WebGL2Renderer implements RendererApi {
2669
2781
  * because a consumer setting a grade every frame would otherwise flood a console.
2670
2782
  */
2671
2783
  setColourGrade(lut: ColourGradeLut | null, strength?: number): void;
2784
+ /**
2785
+ * How strongly the lens darkens the frame's corners, held until changed: 0 is none, 0.5 is about
2786
+ * 1.2 stops at the corner. Applied to scene light before the tone curve, as a lens loses light;
2787
+ * see `filmLook.ts`. Needs `screenEffects`, and says so once rather than doing nothing.
2788
+ */
2789
+ setVignette(strength: number): void;
2790
+ /**
2791
+ * Film grain, held until changed: an amplitude in display values (0 is none, 0.03 is a fine
2792
+ * grain) and this frame's seed. **The seed is the caller's**, because the engine takes time from
2793
+ * its caller: pass a new one each frame for grain that moves, and the same one for a still that
2794
+ * is identical run to run. Applied last, after the grade and the veil; see `filmLook.ts`.
2795
+ */
2796
+ setFilmGrain(strength: number, seed: number): void;
2797
+ private warnedLookWithoutComposite;
2798
+ private warnLookWithoutComposite;
2672
2799
  /**
2673
2800
  * What this frame asked for. **Every ceiling here is `null`, and that is the finding.**
2674
2801
  *
@@ -2842,6 +2969,25 @@ export declare class WebGL2Renderer implements RendererApi {
2842
2969
  private useFlatProgram;
2843
2970
  /** Bind the flat pass once per frame; then issue any number of drawMesh calls. */
2844
2971
  bindMeshPass(camera: Camera, env: Environment): void;
2972
+ /**
2973
+ * Sum a scene's many fixed lights into a DriftLight field, which stands in for each of them
2974
+ * wherever the frame's choice of exact lights does not reach. See `driftLight/lightField.ts`.
2975
+ *
2976
+ * Replaces any field made before. The scene then paces `field.bake(bricks)` and calls
2977
+ * `field.follow(buffer.complete, ...)` each frame with the selection that chose its exact lights;
2978
+ * the volume is summed into the frame once every brick has landed.
2979
+ */
2980
+ createLightField(lights: readonly LightFieldSource[], options?: Omit<LightFieldOptions, 'falloff'>): LightField;
2981
+ /** Let go of the field and its volumes; the scene's lights are all exact again. */
2982
+ disposeLightField(): void;
2983
+ private forgetLightFieldVolumes;
2984
+ /**
2985
+ * Upload the field's two volumes, once, when its last brick has baked: nothing samples them
2986
+ * before that, so uploading as bricks land would be work for no picture.
2987
+ */
2988
+ private uploadLightField;
2989
+ /** The field's uniforms and volumes for this pass, or the stand-ins that switch it off. */
2990
+ private bindDriftLight;
2845
2991
  /**
2846
2992
  * Everything one flat program needs to know about this frame.
2847
2993
  *