babylonjs-editor-tools 5.5.1 → 5.5.2-alpha.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.
@@ -7,6 +7,10 @@ export declare function buildVolumetricLightingLinearDepthShaderWGSL(): string;
7
7
  * @param shadowSlotCount defines the number of shadowed light slots the shader is generated for.
8
8
  */
9
9
  export declare function buildVolumetricLightingScatteringShaderWGSL(shadowSlotCount: number): string;
10
+ /**
11
+ * The temporal accumulation pass. @see buildVolumetricLightingTemporalShader.
12
+ */
13
+ export declare function buildVolumetricLightingTemporalShaderWGSL(): string;
10
14
  /**
11
15
  * The separable bilateral blur pass. @see buildVolumetricLightingBlurShader.
12
16
  */
@@ -16,6 +20,6 @@ export declare function buildVolumetricLightingBlurShaderWGSL(): string;
16
20
  */
17
21
  export declare function buildVolumetricLightingComposeShaderWGSL(): string;
18
22
  /**
19
- * Returns the four WGSL sources of the pipeline, keyed by the name they are registered under.
23
+ * Returns the WGSL sources of the passes of the pipeline, keyed by the name they are registered under.
20
24
  */
21
25
  export declare function getVolumetricLightingShadersWGSL(): Record<string, string>;
@@ -7,6 +7,10 @@ export declare const volumetricLightingLinearDepthShaderName = "volumetricLighti
7
7
  * Defines the name of the raymarching shader in the shader store of Babylon.js.
8
8
  */
9
9
  export declare const volumetricLightingScatteringShaderName = "volumetricLightingScattering";
10
+ /**
11
+ * Defines the name of the temporal accumulation shader in the shader store of Babylon.js.
12
+ */
13
+ export declare const volumetricLightingTemporalShaderName = "volumetricLightingTemporal";
10
14
  /**
11
15
  * Defines the name of the bilateral blur shader in the shader store of Babylon.js.
12
16
  */
@@ -19,8 +23,8 @@ export declare const volumetricLightingComposeShaderName = "volumetricLightingCo
19
23
  * The linear depth pass. It is the first pass of the pipeline, so its input is the untouched color of the
20
24
  * scene that the composition reads back, and it writes the distance along the view axis of each pixel.
21
25
  *
22
- * Every later pass reads this texture instead of the depth map of the depth source: a single 32 bits
23
- * channel is half the memory traffic of the 16 bits RGBA depth map, which matters for the thousands of reads
26
+ * Every later pass reads this texture instead of the depth map of the depth source: a single 16 bits
27
+ * channel is a fraction of the memory traffic of the RGBA depth map, which matters for the thousands of reads
24
28
  * of the depth-buffer occlusion, and it needs neither unpacking nor linearization. It is kept at the full
25
29
  * resolution so the occlusion sees the geometry exactly as the surfaces of the scene draw it.
26
30
  */
@@ -39,6 +43,16 @@ export declare function buildVolumetricLightingLinearDepthShader(): string;
39
43
  * @param shadowSlotCount defines the number of shadowed light slots the shader is generated for.
40
44
  */
41
45
  export declare function buildVolumetricLightingScatteringShader(shadowSlotCount: number): string;
46
+ /**
47
+ * The temporal accumulation pass. Blends the scattering of the current frame, whose samples are offset from one
48
+ * frame to the next, with the scattering accumulated over the previous frames: the result converges to the
49
+ * integral the samples of all these frames estimate together, which is what lets each frame compute fewer of them.
50
+ *
51
+ * The history is reprojected on the current view, and clipped to the range of values the current frame shows
52
+ * around the pixel so that a moving light, a moving occluder or a surface revealed by the motion of the camera
53
+ * never leaves a trail. The blend follows the "factor" of the TAA rendering pipeline: the weight of the current frame.
54
+ */
55
+ export declare function buildVolumetricLightingTemporalShader(): string;
42
56
  /**
43
57
  * The separable bilateral blur pass. Denoises the low resolution scattering buffer without letting the
44
58
  * light shafts bleed across the silhouettes of the geometry.
@@ -21,6 +21,12 @@ export declare const maxVolumetricArrayLights = 256;
21
21
  * point and spot lights, a directional light lights the whole view ray, so each one costs a full march.
22
22
  */
23
23
  export declare const maxVolumetricDirectionalLights = 4;
24
+ /**
25
+ * Defines by how much the temporal accumulation divides the number of samples the raymarching computes each
26
+ * frame. The samples of consecutive frames are offset from each other, so the accumulated result still
27
+ * averages at least as many positions along each view ray as the configured steps.
28
+ */
29
+ export declare const volumetricTemporalSamplesDivider = 3;
24
30
  /**
25
31
  * Defines the available step distributions used while raymarching the participating medium.
26
32
  */
@@ -168,16 +174,34 @@ export interface IVolumetricLightingConfiguration {
168
174
  stepDistribution: VolumetricStepDistribution;
169
175
  /**
170
176
  * Defines the dithering mode used to hide the banding produced by a low step count. @see VolumetricDitherMode
177
+ * With the temporal accumulation, "None" falls back on the interleaved gradient noise: the accumulation needs
178
+ * the samples of neighboring pixels to differ to tell the noise from the changes of the scene.
171
179
  */
172
180
  ditherMode: VolumetricDitherMode;
173
181
  /**
174
- * Defines the strength of the dithering applied to the starting offset of the rays.
182
+ * Defines the strength of the dithering applied to the starting offset of the rays. Not used by the temporal
183
+ * accumulation, which always spreads the samples over their whole segment.
175
184
  */
176
185
  ditherStrength: number;
177
186
  /**
178
187
  * Defines wether or not the dithering pattern is animated over time. Requires temporal anti-aliasing to converge.
188
+ * Not used by the temporal accumulation, which animates the samples on its own.
179
189
  */
180
190
  temporalJitter: boolean;
191
+ /**
192
+ * Defines wether or not the light shafts are accumulated over the frames. Each frame only computes a fraction
193
+ * of the samples of the raymarching, offset from one frame to the next, and blends them with the result of the
194
+ * previous frames reprojected on the current view: the result converges to the quality of the configured
195
+ * steps, or better, for a fraction of their cost. @see volumetricTemporalSamplesDivider
196
+ */
197
+ temporalAccumulation: boolean;
198
+ /**
199
+ * Defines the weight of the current frame when it is blended with the accumulated previous frames, like the
200
+ * "factor" of the TAA rendering pipeline. Lower values average more frames, which gives smoother light shafts,
201
+ * but make them slower to follow the changes of the scene. The current frame weighs more than this while the
202
+ * camera moves quickly compared to the distance of what it looks at, so the light shafts never lag behind it.
203
+ */
204
+ temporalAccumulationFactor: number;
181
205
  /**
182
206
  * Defines how the density of the medium evolves with the distance to the camera. @see VolumetricFogMode
183
207
  */
@@ -330,6 +354,27 @@ export declare function getDefaultVolumetricLightingConfiguration(): IVolumetric
330
354
  * @param configuration defines the configuration of the pipeline.
331
355
  */
332
356
  export declare function getVolumetricLightSteps(configuration: IVolumetricLightingConfiguration): number;
357
+ /**
358
+ * Defines the number of samples the raymarching computes for each pixel during a single frame.
359
+ */
360
+ export interface IVolumetricSamplingSteps {
361
+ /**
362
+ * Defines the number of steps of the march of the directional lights, and the minimum density of samples
363
+ * along the view ray for the point and spot lights.
364
+ */
365
+ steps: number;
366
+ /**
367
+ * Defines the number of samples taken across the volume of each point and spot light.
368
+ */
369
+ lightSteps: number;
370
+ }
371
+ /**
372
+ * Returns the number of samples the raymarching computes each frame. With the temporal accumulation the
373
+ * configured values are divided, the history of the previous frames providing the samples each frame skips.
374
+ * @param configuration defines the configuration of the pipeline.
375
+ * @param temporalSamplesDivider defines by how much the temporal accumulation divides the number of samples.
376
+ */
377
+ export declare function getVolumetricSamplingSteps(configuration: IVolumetricLightingConfiguration, temporalSamplesDivider?: number): IVolumetricSamplingSteps;
333
378
  /**
334
379
  * Normalizes the given serialized per-light volumetric configuration by merging it over the default one.
335
380
  * This is what makes projects saved by an older version of the editor load without any migration step.
@@ -1,7 +1,7 @@
1
1
  import { Scene } from "@babylonjs/core/scene";
2
2
  import { Camera } from "@babylonjs/core/Cameras/camera";
3
- import { VolumetricLightingRenderingPipeline } from "./volumetric/pipeline";
4
3
  import { IRenderingOptions } from "./tools";
4
+ import { VolumetricLightingRenderingPipeline } from "./volumetric/pipeline";
5
5
  export declare function getVolumetricLightingRenderingPipelineConfiguration(): any;
6
6
  export declare function setVolumetricLightingRenderingPipelineConfiguration(config: any): void;
7
7
  export declare function getVolumetricLightingRenderingPipeline(): VolumetricLightingRenderingPipeline | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "babylonjs-editor-tools",
3
- "version": "5.5.1",
3
+ "version": "5.5.2-alpha.0",
4
4
  "description": "Babylon.js Editor Tools is a set of tools to help you create, edit and manage your Babylon.js scenes made using the Babylon.js Editor",
5
5
  "productName": "Babylon.js Editor Tools",
6
6
  "scripts": {