@driftengine/core 4.8.4 → 4.8.6
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 +4332 -4250
- package/dist/build/shaderComments.js +0 -0
- package/dist/index.d.ts +10 -2
- package/dist/index.js +11 -1
- package/dist/render/ambientHarmonics.d.ts +46 -0
- package/dist/render/ambientHarmonics.js +80 -0
- package/dist/render/areaLights.d.ts +19 -0
- package/dist/render/areaLights.js +20 -0
- package/dist/render/backend/api.d.ts +13 -2
- package/dist/render/backend/webgl2/instanced.d.ts +2 -0
- package/dist/render/backend/webgl2/instanced.js +11 -2
- package/dist/render/backend/webgl2/renderer.d.ts +74 -1
- package/dist/render/backend/webgl2/renderer.js +229 -37
- package/dist/render/backend/webgl2/skinScatter.d.ts +14 -0
- package/dist/render/backend/webgl2/skinScatter.js +88 -26
- package/dist/render/backend/webgpu/buffers.js +2 -1
- package/dist/render/backend/webgpu/clusterBinner.js +3 -2
- package/dist/render/backend/webgpu/flatPass.d.ts +7 -5
- package/dist/render/backend/webgpu/flatPass.js +15 -13
- package/dist/render/backend/webgpu/particlePass.d.ts +37 -4
- package/dist/render/backend/webgpu/particlePass.js +80 -12
- package/dist/render/backend/webgpu/postPass.d.ts +6 -1
- package/dist/render/backend/webgpu/postPass.js +7 -2
- package/dist/render/backend/webgpu/renderer.d.ts +58 -7
- package/dist/render/backend/webgpu/renderer.js +329 -78
- package/dist/render/backend/webgpu/shaders/clusterBin.wgsl.d.ts +1 -1
- package/dist/render/backend/webgpu/shaders/clusterBin.wgsl.js +41 -1
- package/dist/render/backend/webgpu/skinPaletteRing.d.ts +40 -28
- package/dist/render/backend/webgpu/skinPaletteRing.js +69 -32
- package/dist/render/backend/webgpu/skinScatterPass.d.ts +10 -2
- package/dist/render/backend/webgpu/skinScatterPass.js +59 -9
- package/dist/render/backend/webgpu/surfaceTexturePass.d.ts +2 -1
- package/dist/render/backend/webgpu/surfaceTexturePass.js +18 -4
- package/dist/render/bloomChain.d.ts +44 -0
- package/dist/render/bloomChain.js +28 -0
- package/dist/render/bloomPass.d.ts +3 -1
- package/dist/render/bloomPass.js +16 -2
- package/dist/render/clusteredLights.d.ts +55 -1
- package/dist/render/clusteredLights.js +182 -8
- package/dist/render/fixtureAtlas.js +1 -1
- package/dist/render/instanceCull.js +7 -0
- package/dist/render/instances.d.ts +32 -10
- package/dist/render/instances.js +17 -8
- package/dist/render/lightBudget.d.ts +26 -1
- package/dist/render/lightBudget.js +26 -3
- package/dist/render/lightmap.d.ts +102 -0
- package/dist/render/lightmap.js +118 -0
- package/dist/render/mesh.js +2 -1
- package/dist/render/particleBatch.d.ts +59 -3
- package/dist/render/particleBatch.js +53 -2
- package/dist/render/particleMaterial.d.ts +6 -1
- package/dist/render/particleMaterial.js +10 -2
- package/dist/render/particlePool.d.ts +11 -0
- package/dist/render/particlePool.js +2 -0
- package/dist/render/particleSort.d.ts +34 -0
- package/dist/render/particleSort.js +96 -0
- package/dist/render/sceneTarget.d.ts +5 -0
- package/dist/render/sceneTarget.js +8 -1
- package/dist/render/shaders/bloom.d.ts +8 -4
- package/dist/render/shaders/bloom.js +20 -3
- package/dist/render/shaders/flat/areaLight.d.ts +10 -0
- package/dist/render/shaders/flat/areaLight.js +96 -0
- package/dist/render/shaders/flat/index.js +30 -4
- package/dist/render/shaders/flat/main.d.ts +1 -1
- package/dist/render/shaders/flat/main.js +107 -105
- package/dist/render/shaders/flat/models.d.ts +16 -4
- package/dist/render/shaders/flat/models.js +64 -4
- package/dist/render/shaders/flat/normalMap.d.ts +10 -0
- package/dist/render/shaders/flat/normalMap.js +25 -0
- package/dist/render/shaders/flat/preamble.js +74 -37
- package/dist/render/shaders/flat/skin.js +6 -5
- package/dist/render/shaders/generated/bloom.wgsl.d.ts +13 -3
- package/dist/render/shaders/generated/bloom.wgsl.js +13 -3
- package/dist/render/shaders/generated/flat.wgsl.d.ts +1631 -2044
- package/dist/render/shaders/generated/flat.wgsl.js +1669 -2082
- package/dist/render/shaders/generated/particle.wgsl.d.ts +115 -1
- package/dist/render/shaders/generated/particle.wgsl.js +115 -1
- package/dist/render/shaders/generated/skinBlur.wgsl.d.ts +12 -2
- package/dist/render/shaders/generated/skinBlur.wgsl.js +12 -2
- package/dist/render/shaders/particle.d.ts +17 -1
- package/dist/render/shaders/particle.js +133 -1
- package/dist/render/shaders/skinBlur.js +25 -3
- package/dist/render/skinBlur.d.ts +8 -5
- package/dist/render/skinBlur.js +8 -5
- package/dist/render/surfaceModel.d.ts +21 -1
- package/dist/render/surfaceModel.js +22 -0
- package/dist/render/surfaceTexture.d.ts +14 -1
- package/dist/render/surfaceTexture.js +15 -2
- package/package.json +6 -6
- package/src/build/shaderComments.ts +0 -0
- package/src/index.ts +20 -1
- package/src/render/ambientHarmonics.ts +92 -0
- package/src/render/areaLights.ts +39 -0
- package/src/render/backend/api.ts +14 -1
- package/src/render/backend/webgl2/instanced.ts +12 -2
- package/src/render/backend/webgl2/renderer.ts +292 -35
- package/src/render/backend/webgl2/skinScatter.ts +120 -43
- package/src/render/backend/webgpu/buffers.ts +2 -1
- package/src/render/backend/webgpu/clusterBinner.ts +3 -1
- package/src/render/backend/webgpu/flatPass.ts +18 -13
- package/src/render/backend/webgpu/particlePass.ts +118 -12
- package/src/render/backend/webgpu/postPass.ts +7 -2
- package/src/render/backend/webgpu/renderer.ts +396 -95
- package/src/render/backend/webgpu/shaders/clusterBin.wgsl.ts +41 -1
- package/src/render/backend/webgpu/skinPaletteRing.ts +65 -33
- package/src/render/backend/webgpu/skinScatterPass.ts +59 -9
- package/src/render/backend/webgpu/surfaceTexturePass.ts +26 -5
- package/src/render/bloomChain.ts +69 -0
- package/src/render/bloomPass.ts +26 -2
- package/src/render/clusteredLights.ts +221 -7
- package/src/render/fixtureAtlas.ts +1 -1
- package/src/render/instanceCull.ts +5 -0
- package/src/render/instances.ts +40 -11
- package/src/render/lightBudget.ts +48 -2
- package/src/render/lightmap.ts +202 -0
- package/src/render/mesh.ts +2 -1
- package/src/render/particleBatch.ts +95 -4
- package/src/render/particleMaterial.ts +11 -1
- package/src/render/particlePool.ts +13 -0
- package/src/render/particleSort.ts +133 -0
- package/src/render/sceneTarget.ts +18 -1
- package/src/render/shaders/bloom.ts +20 -3
- package/src/render/shaders/flat/areaLight.ts +96 -0
- package/src/render/shaders/flat/index.ts +30 -4
- package/src/render/shaders/flat/main.ts +107 -105
- package/src/render/shaders/flat/models.ts +73 -8
- package/src/render/shaders/flat/normalMap.ts +25 -0
- package/src/render/shaders/flat/preamble.ts +74 -37
- package/src/render/shaders/flat/skin.ts +6 -5
- package/src/render/shaders/generated/bloom.wgsl.ts +13 -3
- package/src/render/shaders/generated/flat.wgsl.ts +1669 -2082
- package/src/render/shaders/generated/particle.wgsl.ts +116 -1
- package/src/render/shaders/generated/skinBlur.wgsl.ts +12 -2
- package/src/render/shaders/particle.ts +134 -1
- package/src/render/shaders/skinBlur.ts +25 -3
- package/src/render/skinBlur.ts +8 -5
- package/src/render/surfaceModel.ts +36 -1
- package/src/render/surfaceTexture.ts +41 -3
|
Binary file
|
package/dist/index.d.ts
CHANGED
|
@@ -145,12 +145,20 @@ export { placeCascade } from './render/gi/globalField.ts';
|
|
|
145
145
|
export type { ReflectionOptions, ReflectiveSample } from './render/gi/reflection.ts';
|
|
146
146
|
export { GRADE_PLACEHOLDER_SIZE, MAX_GRADE_SIZE, identityGradeLut } from './render/colourGrade.ts';
|
|
147
147
|
export type { ColourGradeLut } from './render/colourGrade.ts';
|
|
148
|
+
/**
|
|
149
|
+
* How bloom answers past its threshold — a ramp in place of the subtraction, and a tint for each
|
|
150
|
+
* of the pyramid's `BLOOM_LEVELS` octaves — the third argument of `setBloom`.
|
|
151
|
+
*/
|
|
152
|
+
export { BLOOM_LEVELS } from './render/bloomChain.ts';
|
|
153
|
+
export type { BloomResponse } from './render/bloomChain.ts';
|
|
148
154
|
export { probeDevice } from './render/backend/probe.ts';
|
|
149
155
|
export type { ProbeVerdict } from './render/backend/probe.ts';
|
|
150
156
|
export type { BoltHandle, CausticsHandle, ClothBindingHandle, ClothParticlesHandle, FlockHandle, IncrementalMeshHandle, LineHandle, MeshHandle, MeshOptions, RenderBackend, RendererApi, ParticleHandle, PlumeHandle, ScatterHandle, InstancedHandle, SdfTextHandle, SurfaceTextureHandle, TextHandle, WaterHandle, WindStreakHandle, } from './render/backend/api.ts';
|
|
151
157
|
export type { ClothBindingData } from './render/clothBindingData.ts';
|
|
152
|
-
export { anisotropicModel, eyeModel, hairModel, skinModel } from './render/surfaceModel.ts';
|
|
153
|
-
export type { AnisotropicModel, EyeModel, HairModel, SkinModel, SurfaceModel, SurfaceModelKind, } from './render/surfaceModel.ts';
|
|
158
|
+
export { anisotropicModel, eyeModel, hairModel, lightmapModel, skinModel, } from './render/surfaceModel.ts';
|
|
159
|
+
export type { AnisotropicModel, EyeModel, HairModel, LightmapModel, SkinModel, SurfaceModel, SurfaceModelKind, } from './render/surfaceModel.ts';
|
|
160
|
+
export { WHOLE_PAGE } from './render/lightmap.ts';
|
|
161
|
+
export type { LightmapPage, LightmapRegion } from './render/lightmap.ts';
|
|
154
162
|
export { createSkinnedCloth } from './render/skinnedClothRun.ts';
|
|
155
163
|
export type { SkinnedClothSolver } from './render/skinnedClothRun.ts';
|
|
156
164
|
/**
|
package/dist/index.js
CHANGED
|
@@ -209,13 +209,23 @@ export { placeCascade } from './render/gi/globalField.js';
|
|
|
209
209
|
* take the identity, bend it, hand it back — and because it is what the placeholder is.
|
|
210
210
|
*/
|
|
211
211
|
export { GRADE_PLACEHOLDER_SIZE, MAX_GRADE_SIZE, identityGradeLut } from './render/colourGrade.js';
|
|
212
|
+
/**
|
|
213
|
+
* How bloom answers past its threshold — a ramp in place of the subtraction, and a tint for each
|
|
214
|
+
* of the pyramid's `BLOOM_LEVELS` octaves — the third argument of `setBloom`.
|
|
215
|
+
*/
|
|
216
|
+
export { BLOOM_LEVELS } from './render/bloomChain.js';
|
|
212
217
|
export { probeDevice } from './render/backend/probe.js';
|
|
213
218
|
/*
|
|
214
219
|
* A material's shading model, for what the standard one is not: brushed metal, hair, skin, an eye.
|
|
215
220
|
* A frozen descriptor made by a factory and set as `SurfaceMaterial.model`; each is a pipeline of
|
|
216
221
|
* its own, compiled the first time a draw asks.
|
|
217
222
|
*/
|
|
218
|
-
export { anisotropicModel, eyeModel, hairModel, skinModel } from './render/surfaceModel.js';
|
|
223
|
+
export { anisotropicModel, eyeModel, hairModel, lightmapModel, skinModel, } from './render/surfaceModel.js';
|
|
224
|
+
/*
|
|
225
|
+
* A baked lightmap: the page a consumer decoded, which `createLightmap` uploads as a lightmapped
|
|
226
|
+
* material's `modelMap`, and the region of it a material or an instance reads.
|
|
227
|
+
*/
|
|
228
|
+
export { WHOLE_PAGE } from './render/lightmap.js';
|
|
219
229
|
/*
|
|
220
230
|
* A skinned cloth solved where the renderer can: compute on WebGPU, the CPU under WebGL2. A function
|
|
221
231
|
* rather than a renderer method so only a game that imports it carries the solver.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A draw's own ambient light, as nine spherical-harmonic coefficients: what `setAmbientSH` takes,
|
|
3
|
+
* how both backends pack it, and the arithmetic the lit stage evaluates, which its tests hold.
|
|
4
|
+
*
|
|
5
|
+
* **Why a draw needs its own.** The engine's diffuse ambient is one answer for a whole frame — the
|
|
6
|
+
* sky-and-ground gradient, or the probe grid's irradiance — so everything standing in one place is
|
|
7
|
+
* lit alike. A stage with a baked volume of indirect light (Unreal's volumetric lightmap) lights a
|
|
8
|
+
* character by sampling that volume where the character stands; a consumer that samples it each
|
|
9
|
+
* frame hands the result here, around that character's draws, and the character takes the light of
|
|
10
|
+
* the spot it is in rather than the frame's average.
|
|
11
|
+
*
|
|
12
|
+
* **The coefficients are of incoming radiance**, `L(ω) ≈ Σ c_lm Y_lm(ω)`, on the standard real
|
|
13
|
+
* basis in its usual order — `Y00`, then `Y1,-1 Y1,0 Y1,1`, then `Y2,-2 Y2,-1 Y2,0 Y2,1 Y2,2` —
|
|
14
|
+
* evaluated on the engine's own world axes as written: `Y1,-1 = 0.488603 y`, `Y1,0 = 0.488603 z`,
|
|
15
|
+
* `Y1,1 = 0.488603 x`, `Y2,-2 = 1.092548 xy`, `Y2,-1 = 1.092548 yz`, `Y2,0 = 0.315392 (3z² − 1)`,
|
|
16
|
+
* `Y2,1 = 1.092548 xz`, `Y2,2 = 0.546274 (x² − y²)`, with y up. Three numbers a coefficient, red
|
|
17
|
+
* green blue, twenty-seven in all. A source in another engine's axes is rotated into these first.
|
|
18
|
+
*
|
|
19
|
+
* **What the surface receives is the cosine convolution**, Ramamoorthi and Hanrahan's: the bands
|
|
20
|
+
* scaled by π, 2π/3 and π/4 and divided by π, which is the irradiance over π a Lambertian surface
|
|
21
|
+
* multiplies its albedo by — the same quantity the gradient and the probes hand the shader. A
|
|
22
|
+
* constant radiance `L` everywhere is `c00 = L / 0.282095` and lights a surface exactly as an
|
|
23
|
+
* ambient of `L` does. Negative ringing, which a second-order fit of a sharp source has, is clamped
|
|
24
|
+
* to zero.
|
|
25
|
+
*
|
|
26
|
+
* **What it gives up** is the reflections: these replace the diffuse ambient only, and a glossy
|
|
27
|
+
* surface still reflects the frame's probes or sky. **What would make it wrong** is light the
|
|
28
|
+
* volume holds at a frequency nine coefficients cannot carry — a sharp sun patch — which is the
|
|
29
|
+
* stage's own direct light's job and not this.
|
|
30
|
+
*/
|
|
31
|
+
/** Numbers `setAmbientSH` takes: nine coefficients of three channels. */
|
|
32
|
+
export declare const AMBIENT_SH_VALUES = 27;
|
|
33
|
+
/** Floats the lit stage's `uAmbientSH` holds: the coefficients, and whether they are on. */
|
|
34
|
+
export declare const AMBIENT_SH_FLOATS = 28;
|
|
35
|
+
/**
|
|
36
|
+
* The coefficients as the lit stage reads them, into `out` of `AMBIENT_SH_FLOATS`: the twenty-seven
|
|
37
|
+
* numbers in order and a last one that is 1, or every float zero for `null` — the frame's own
|
|
38
|
+
* ambient. Refuses a list that is not twenty-seven numbers, naming its length.
|
|
39
|
+
*/
|
|
40
|
+
export declare function packAmbientSH(coefficients: ArrayLike<number> | null, out: Float32Array): void;
|
|
41
|
+
/**
|
|
42
|
+
* The ambient a surface facing `nx, ny, nz` (unit) receives from these coefficients, into `out`
|
|
43
|
+
* (three floats): what `ambientHarmonics` in the lit stage computes. Run at no point by the engine;
|
|
44
|
+
* the reference its tests hold.
|
|
45
|
+
*/
|
|
46
|
+
export declare function ambientFromSH(coefficients: ArrayLike<number>, nx: number, ny: number, nz: number, out: Float32Array): void;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A draw's own ambient light, as nine spherical-harmonic coefficients: what `setAmbientSH` takes,
|
|
3
|
+
* how both backends pack it, and the arithmetic the lit stage evaluates, which its tests hold.
|
|
4
|
+
*
|
|
5
|
+
* **Why a draw needs its own.** The engine's diffuse ambient is one answer for a whole frame — the
|
|
6
|
+
* sky-and-ground gradient, or the probe grid's irradiance — so everything standing in one place is
|
|
7
|
+
* lit alike. A stage with a baked volume of indirect light (Unreal's volumetric lightmap) lights a
|
|
8
|
+
* character by sampling that volume where the character stands; a consumer that samples it each
|
|
9
|
+
* frame hands the result here, around that character's draws, and the character takes the light of
|
|
10
|
+
* the spot it is in rather than the frame's average.
|
|
11
|
+
*
|
|
12
|
+
* **The coefficients are of incoming radiance**, `L(ω) ≈ Σ c_lm Y_lm(ω)`, on the standard real
|
|
13
|
+
* basis in its usual order — `Y00`, then `Y1,-1 Y1,0 Y1,1`, then `Y2,-2 Y2,-1 Y2,0 Y2,1 Y2,2` —
|
|
14
|
+
* evaluated on the engine's own world axes as written: `Y1,-1 = 0.488603 y`, `Y1,0 = 0.488603 z`,
|
|
15
|
+
* `Y1,1 = 0.488603 x`, `Y2,-2 = 1.092548 xy`, `Y2,-1 = 1.092548 yz`, `Y2,0 = 0.315392 (3z² − 1)`,
|
|
16
|
+
* `Y2,1 = 1.092548 xz`, `Y2,2 = 0.546274 (x² − y²)`, with y up. Three numbers a coefficient, red
|
|
17
|
+
* green blue, twenty-seven in all. A source in another engine's axes is rotated into these first.
|
|
18
|
+
*
|
|
19
|
+
* **What the surface receives is the cosine convolution**, Ramamoorthi and Hanrahan's: the bands
|
|
20
|
+
* scaled by π, 2π/3 and π/4 and divided by π, which is the irradiance over π a Lambertian surface
|
|
21
|
+
* multiplies its albedo by — the same quantity the gradient and the probes hand the shader. A
|
|
22
|
+
* constant radiance `L` everywhere is `c00 = L / 0.282095` and lights a surface exactly as an
|
|
23
|
+
* ambient of `L` does. Negative ringing, which a second-order fit of a sharp source has, is clamped
|
|
24
|
+
* to zero.
|
|
25
|
+
*
|
|
26
|
+
* **What it gives up** is the reflections: these replace the diffuse ambient only, and a glossy
|
|
27
|
+
* surface still reflects the frame's probes or sky. **What would make it wrong** is light the
|
|
28
|
+
* volume holds at a frequency nine coefficients cannot carry — a sharp sun patch — which is the
|
|
29
|
+
* stage's own direct light's job and not this.
|
|
30
|
+
*/
|
|
31
|
+
/** Numbers `setAmbientSH` takes: nine coefficients of three channels. */
|
|
32
|
+
export const AMBIENT_SH_VALUES = 27;
|
|
33
|
+
/** Floats the lit stage's `uAmbientSH` holds: the coefficients, and whether they are on. */
|
|
34
|
+
export const AMBIENT_SH_FLOATS = 28;
|
|
35
|
+
/**
|
|
36
|
+
* The coefficients as the lit stage reads them, into `out` of `AMBIENT_SH_FLOATS`: the twenty-seven
|
|
37
|
+
* numbers in order and a last one that is 1, or every float zero for `null` — the frame's own
|
|
38
|
+
* ambient. Refuses a list that is not twenty-seven numbers, naming its length.
|
|
39
|
+
*/
|
|
40
|
+
export function packAmbientSH(coefficients, out) {
|
|
41
|
+
if (coefficients === null) {
|
|
42
|
+
out.fill(0);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (coefficients.length !== AMBIENT_SH_VALUES) {
|
|
46
|
+
throw new Error(`setAmbientSH: ${coefficients.length} values, where nine coefficients of red, green and ` +
|
|
47
|
+
`blue are ${AMBIENT_SH_VALUES}`);
|
|
48
|
+
}
|
|
49
|
+
for (let i = 0; i < AMBIENT_SH_VALUES; i++) {
|
|
50
|
+
const value = coefficients[i];
|
|
51
|
+
out[i] = Number.isFinite(value) ? value : 0;
|
|
52
|
+
}
|
|
53
|
+
out[AMBIENT_SH_VALUES] = 1;
|
|
54
|
+
}
|
|
55
|
+
/** The band factors of the cosine convolution, over π: 1, 2/3 and 1/4. */
|
|
56
|
+
const BAND = [1, 2 / 3, 1 / 4];
|
|
57
|
+
/**
|
|
58
|
+
* The ambient a surface facing `nx, ny, nz` (unit) receives from these coefficients, into `out`
|
|
59
|
+
* (three floats): what `ambientHarmonics` in the lit stage computes. Run at no point by the engine;
|
|
60
|
+
* the reference its tests hold.
|
|
61
|
+
*/
|
|
62
|
+
export function ambientFromSH(coefficients, nx, ny, nz, out) {
|
|
63
|
+
const basis = [
|
|
64
|
+
0.282095 * BAND[0],
|
|
65
|
+
0.488603 * ny * BAND[1],
|
|
66
|
+
0.488603 * nz * BAND[1],
|
|
67
|
+
0.488603 * nx * BAND[1],
|
|
68
|
+
1.092548 * nx * ny * BAND[2],
|
|
69
|
+
1.092548 * ny * nz * BAND[2],
|
|
70
|
+
0.315392 * (3 * nz * nz - 1) * BAND[2],
|
|
71
|
+
1.092548 * nx * nz * BAND[2],
|
|
72
|
+
0.546274 * (nx * nx - ny * ny) * BAND[2],
|
|
73
|
+
];
|
|
74
|
+
for (let c = 0; c < 3; c++) {
|
|
75
|
+
let sum = 0;
|
|
76
|
+
for (let k = 0; k < 9; k++)
|
|
77
|
+
sum += coefficients[k * 3 + c] * basis[k];
|
|
78
|
+
out[c] = Math.max(sum, 0);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -86,7 +86,18 @@ export interface AreaLightSource {
|
|
|
86
86
|
* every caster, not just the fixture.
|
|
87
87
|
*/
|
|
88
88
|
shadowNear?: number;
|
|
89
|
+
/**
|
|
90
|
+
* How far the rectangle's light reaches, in metres from its centre: past it the light is zero,
|
|
91
|
+
* windowed down to it, so a clustered rectangle can be binned into the froxels it reaches and no
|
|
92
|
+
* others. **Read only where the rectangle is shaded through the froxel table** — the ones past
|
|
93
|
+
* `maxAreaLights` with `clusteredLights` on; the fixed four light everything they face, as they
|
|
94
|
+
* always have. Absent, it is where the rectangle's irradiance on its axis falls to a thousandth
|
|
95
|
+
* of a scene unit, and never inside the rectangle itself. Unreal's `AttenuationRadius`, in metres.
|
|
96
|
+
*/
|
|
97
|
+
range?: number;
|
|
89
98
|
}
|
|
99
|
+
/** The irradiance a derived `range` ends at, in scene units. See `AreaLightSource.range`. */
|
|
100
|
+
export declare const AREA_RANGE_CUTOFF = 0.001;
|
|
90
101
|
/** The five arrays the shader declares, filled once a frame from whatever a caller supplied. */
|
|
91
102
|
export interface AreaLightBuffer {
|
|
92
103
|
count: number;
|
|
@@ -96,8 +107,16 @@ export interface AreaLightBuffer {
|
|
|
96
107
|
readonly up: Float32Array;
|
|
97
108
|
readonly sizes: Float32Array;
|
|
98
109
|
readonly twoSided: Float32Array;
|
|
110
|
+
/** One a rectangle: how far its light reaches. See `AreaLightSource.range`. */
|
|
111
|
+
readonly ranges?: Float32Array;
|
|
99
112
|
}
|
|
100
113
|
export declare function createAreaLightBuffer(capacity?: number): AreaLightBuffer;
|
|
114
|
+
/**
|
|
115
|
+
* How far a rectangle's light reaches when it names no range: where its irradiance on its own axis,
|
|
116
|
+
* `L · A / d²` for a rectangle of radiance `L` and area `A` seen from far, falls to
|
|
117
|
+
* `AREA_RANGE_CUTOFF`. Never less than the rectangle's own half-diagonal.
|
|
118
|
+
*/
|
|
119
|
+
export declare function areaRange(r: number, g: number, b: number, halfWidth: number, halfHeight: number): number;
|
|
101
120
|
/**
|
|
102
121
|
* Fill the buffer from a caller's list, normalising the axes and orthogonalising them.
|
|
103
122
|
*
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
* iteration of the loop, exactly as `MAX_POINT_LIGHTS` is.
|
|
9
9
|
*/
|
|
10
10
|
export const MAX_AREA_LIGHTS = 4;
|
|
11
|
+
/** The irradiance a derived `range` ends at, in scene units. See `AreaLightSource.range`. */
|
|
12
|
+
export const AREA_RANGE_CUTOFF = 1e-3;
|
|
11
13
|
export function createAreaLightBuffer(capacity = MAX_AREA_LIGHTS) {
|
|
12
14
|
return {
|
|
13
15
|
count: 0,
|
|
@@ -17,8 +19,20 @@ export function createAreaLightBuffer(capacity = MAX_AREA_LIGHTS) {
|
|
|
17
19
|
up: new Float32Array(capacity * 3),
|
|
18
20
|
sizes: new Float32Array(capacity * 2),
|
|
19
21
|
twoSided: new Float32Array(capacity),
|
|
22
|
+
ranges: new Float32Array(capacity),
|
|
20
23
|
};
|
|
21
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* How far a rectangle's light reaches when it names no range: where its irradiance on its own axis,
|
|
27
|
+
* `L · A / d²` for a rectangle of radiance `L` and area `A` seen from far, falls to
|
|
28
|
+
* `AREA_RANGE_CUTOFF`. Never less than the rectangle's own half-diagonal.
|
|
29
|
+
*/
|
|
30
|
+
export function areaRange(r, g, b, halfWidth, halfHeight) {
|
|
31
|
+
const radiance = Math.max(r, g, b, 0);
|
|
32
|
+
const area = 4 * halfWidth * halfHeight;
|
|
33
|
+
const diagonal = Math.hypot(halfWidth, halfHeight);
|
|
34
|
+
return Math.max(Math.sqrt((radiance * area) / AREA_RANGE_CUTOFF), diagonal);
|
|
35
|
+
}
|
|
22
36
|
/**
|
|
23
37
|
* Fill the buffer from a caller's list, normalising the axes and orthogonalising them.
|
|
24
38
|
*
|
|
@@ -86,6 +100,12 @@ export function selectAreaLights(lights, out) {
|
|
|
86
100
|
out.sizes[slot * 2] = Math.max(1e-4, light.halfWidth);
|
|
87
101
|
out.sizes[slot * 2 + 1] = Math.max(1e-4, light.halfHeight);
|
|
88
102
|
out.twoSided[slot] = light.twoSided === true ? 1 : 0;
|
|
103
|
+
if (out.ranges !== undefined) {
|
|
104
|
+
out.ranges[slot] =
|
|
105
|
+
light.range !== undefined && light.range > 0
|
|
106
|
+
? light.range
|
|
107
|
+
: areaRange(light.r, light.g, light.b, light.halfWidth, light.halfHeight);
|
|
108
|
+
}
|
|
89
109
|
}
|
|
90
110
|
return out;
|
|
91
111
|
}
|
|
@@ -7,6 +7,7 @@ import type { Renderer, TranslucentMeshOptions } from './webgl2/renderer.ts';
|
|
|
7
7
|
import type { InstancedOptions, MeshInstances } from '../instances.ts';
|
|
8
8
|
import type { SurfaceMaterial } from '../surfaceTexture.ts';
|
|
9
9
|
import type { SurfaceSource } from '../compressedSource.ts';
|
|
10
|
+
import type { LightmapPage } from '../lightmap.ts';
|
|
10
11
|
import type { ClothBindingData } from '../clothBindingData.ts';
|
|
11
12
|
import type { TextStyle } from '../textLayout.ts';
|
|
12
13
|
import type { SdfFont } from '../sdfFont.ts';
|
|
@@ -186,7 +187,7 @@ export interface MeshOptions {
|
|
|
186
187
|
}
|
|
187
188
|
export type RendererApi = Omit<{
|
|
188
189
|
[K in keyof Renderer]: Renderer[K];
|
|
189
|
-
}, 'gpuTimer' | 'createMesh' | 'createMeshIncremental' | 'updateMesh' | 'drawMesh' | 'disposeMesh' | 'drawTranslucentMesh' | 'drawLightVolume' | 'drawFilm' | 'createScatter' | 'drawScatter' | 'uploadScatter' | 'disposeScatter' | 'createInstanced' | 'uploadInstanced' | 'drawInstanced' | 'drawTranslucentInstanced' | 'disposeInstanced' | 'createWater' | 'drawWater' | 'disposeWater' | 'createPlumes' | 'drawPlumes' | 'disposePlumes' | 'setPlumeScale' | 'createCaustics' | 'drawCaustics' | 'disposeCaustics' | 'createParticles' | 'drawParticles' | 'disposeParticles' | 'createWindStreaks' | 'drawWindStreaks' | 'disposeWindStreaks' | 'createFlock' | 'drawFlock' | 'disposeFlock' | 'createBolts' | 'drawBolts' | 'disposeBolts' | 'createLines' | 'drawLines' | 'disposeLines' | 'createText' | 'setText' | 'setPlate' | 'drawText' | 'textWidth' | 'disposeText' | 'createSdfText' | 'setSdfText' | 'drawSdfText' | 'disposeSdfText' | 'createSurfaceTexture' | 'createSurfaceTextureArray' | 'updateSurfaceTexture' | 'disposeSurfaceTexture' | 'setSurfaceTexture' | 'setMaterial' | 'createClothBinding' | 'createClothParticles' | 'updateClothParticles' | 'setCloth' | 'disposeClothBinding' | 'disposeClothParticles'> & {
|
|
190
|
+
}, 'gpuTimer' | 'createMesh' | 'createMeshIncremental' | 'updateMesh' | 'drawMesh' | 'disposeMesh' | 'drawTranslucentMesh' | 'drawLightVolume' | 'drawFilm' | 'createScatter' | 'drawScatter' | 'uploadScatter' | 'disposeScatter' | 'createInstanced' | 'uploadInstanced' | 'drawInstanced' | 'drawTranslucentInstanced' | 'disposeInstanced' | 'createWater' | 'drawWater' | 'disposeWater' | 'createPlumes' | 'drawPlumes' | 'disposePlumes' | 'setPlumeScale' | 'createCaustics' | 'drawCaustics' | 'disposeCaustics' | 'createParticles' | 'drawParticles' | 'disposeParticles' | 'createWindStreaks' | 'drawWindStreaks' | 'disposeWindStreaks' | 'createFlock' | 'drawFlock' | 'disposeFlock' | 'createBolts' | 'drawBolts' | 'disposeBolts' | 'createLines' | 'drawLines' | 'disposeLines' | 'createText' | 'setText' | 'setPlate' | 'drawText' | 'textWidth' | 'disposeText' | 'createSdfText' | 'setSdfText' | 'drawSdfText' | 'disposeSdfText' | 'createSurfaceTexture' | 'createSurfaceTextureArray' | 'createLightmap' | 'updateSurfaceTexture' | 'disposeSurfaceTexture' | 'setSurfaceTexture' | 'setMaterial' | 'createClothBinding' | 'createClothParticles' | 'updateClothParticles' | 'setCloth' | 'disposeClothBinding' | 'disposeClothParticles'> & {
|
|
190
191
|
/**
|
|
191
192
|
* A mesh's cloth binding: which simulation triangle each of its vertices follows, where on it and
|
|
192
193
|
* by how much (`ClothBindingData`). The mesh must be skinned — a binding blends each vertex
|
|
@@ -229,6 +230,14 @@ export type RendererApi = Omit<{
|
|
|
229
230
|
* `updateSurfaceTexture` refuses an array.
|
|
230
231
|
*/
|
|
231
232
|
createSurfaceTextureArray(sources: readonly SurfaceSource[], options?: Parameters<Renderer['createSurfaceTexture']>[1]): SurfaceTextureHandle;
|
|
233
|
+
/**
|
|
234
|
+
* A baked lightmap page on the device, as the texture a `lightmapModel` material takes for its
|
|
235
|
+
* `modelMap`: two layers of half floats, the irradiance and the direction, filtered linearly and
|
|
236
|
+
* clamped at its edges, with no mip chain. Disposed as any texture is, with
|
|
237
|
+
* `disposeSurfaceTexture`; `updateSurfaceTexture` refuses it, as it refuses any array. See
|
|
238
|
+
* `lightmap.ts` for what a surface does with it.
|
|
239
|
+
*/
|
|
240
|
+
createLightmap(page: LightmapPage): SurfaceTextureHandle;
|
|
232
241
|
/**
|
|
233
242
|
* Replace a texture's pixels, keeping the GPU object and its sampler state.
|
|
234
243
|
*
|
|
@@ -428,8 +437,10 @@ export type RendererApi = Omit<{
|
|
|
428
437
|
* have shared one already do. WebGL2 still needs telling, and still checks that the two
|
|
429
438
|
* materials match.
|
|
430
439
|
*/
|
|
431
|
-
createParticles(capacity: number, options: Omit<Parameters<Renderer['createParticles']>[1], 'reuse'> & {
|
|
440
|
+
createParticles(capacity: number, options: Omit<Parameters<Renderer['createParticles']>[1], 'reuse' | 'texture'> & {
|
|
432
441
|
readonly reuse?: ParticleHandle;
|
|
442
|
+
/** A `'sprite'`'s image. Re-typed to the handle for `reuse`'s reason. */
|
|
443
|
+
readonly texture?: SurfaceTextureHandle;
|
|
433
444
|
}): ParticleHandle;
|
|
434
445
|
/** Draw a pool's live particles, after the opaque scene. */
|
|
435
446
|
drawParticles(batch: ParticleHandle, data: Parameters<Renderer['drawParticles']>[1], camera: Parameters<Renderer['drawParticles']>[2], env: Parameters<Renderer['drawParticles']>[3], timeSeconds: number): void;
|
|
@@ -26,6 +26,8 @@ export declare class InstancedBatch {
|
|
|
26
26
|
private readonly buffer;
|
|
27
27
|
private readonly vao;
|
|
28
28
|
private readonly staging;
|
|
29
|
+
/** The survivors of a lightmapped batch's cull, made the first time one is culled. */
|
|
30
|
+
private keptRegioned;
|
|
29
31
|
private readonly kept;
|
|
30
32
|
constructor(gl: WebGL2RenderingContext, mesh: Mesh, capacity: number, cull?: boolean);
|
|
31
33
|
upload(gl: WebGL2RenderingContext, data: MeshInstances): void;
|
|
@@ -25,6 +25,8 @@ export class InstancedBatch {
|
|
|
25
25
|
buffer;
|
|
26
26
|
vao;
|
|
27
27
|
staging;
|
|
28
|
+
/** The survivors of a lightmapped batch's cull, made the first time one is culled. */
|
|
29
|
+
keptRegioned = null;
|
|
28
30
|
kept;
|
|
29
31
|
constructor(gl, mesh, capacity, cull = false) {
|
|
30
32
|
this.mesh = mesh;
|
|
@@ -67,10 +69,17 @@ export class InstancedBatch {
|
|
|
67
69
|
const kept = this.kept;
|
|
68
70
|
if (kept === null)
|
|
69
71
|
return 0;
|
|
70
|
-
|
|
72
|
+
/* A lightmapped batch's survivors keep their regions, in a copy that carries them. */
|
|
73
|
+
const into = data.lightmapRegions === undefined
|
|
74
|
+
? kept.instances
|
|
75
|
+
: (this.keptRegioned ??= {
|
|
76
|
+
...createMeshInstances(this.capacity),
|
|
77
|
+
lightmapRegions: new Float32Array(this.capacity * 4),
|
|
78
|
+
});
|
|
79
|
+
const count = cullInstances(data, this.mesh.bounds, frustum, into);
|
|
71
80
|
if (count === 0)
|
|
72
81
|
return 0;
|
|
73
|
-
packInstances(
|
|
82
|
+
packInstances(into, this.staging);
|
|
74
83
|
gl.bindBuffer(gl.ARRAY_BUFFER, kept.buffer);
|
|
75
84
|
gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.staging, 0, count * INSTANCE_FLOATS);
|
|
76
85
|
this.mesh.drawInstancesThrough(gl, kept.vao, count);
|
|
@@ -13,6 +13,7 @@ import type { PassDefinition, PassHandle } from '../../pass.ts';
|
|
|
13
13
|
import type { Vec3 } from '../../../math/color.ts';
|
|
14
14
|
import { GpuTimer } from '../../gpuTimer.ts';
|
|
15
15
|
import type { ColourGradeLut } from '../../colourGrade.ts';
|
|
16
|
+
import { type BloomResponse } from '../../bloomChain.ts';
|
|
16
17
|
import { LightField } from '../../driftLight/lightField.ts';
|
|
17
18
|
import type { LightFieldOptions, LightFieldSource } from '../../driftLight/lightField.ts';
|
|
18
19
|
import type { DenseLightVolume } from '../../driftLight/denseField.ts';
|
|
@@ -33,6 +34,7 @@ import type { WorldLightFieldOptions } from '../../driftLight/worldLightField.ts
|
|
|
33
34
|
* Beyond this the velocity is shortened and the direction kept.
|
|
34
35
|
*/
|
|
35
36
|
import type { RendererApi } from '../api.ts';
|
|
37
|
+
import type { LightmapPage } from '../../lightmap.ts';
|
|
36
38
|
import type { ClothBindingData } from '../../clothBindingData.ts';
|
|
37
39
|
import { GlClothBinding, GlClothParticles } from './clothTextures.ts';
|
|
38
40
|
import type { ProbeBakeOptions } from '../../reflectionProbe.ts';
|
|
@@ -208,6 +210,12 @@ export interface Environment extends Atmosphere {
|
|
|
208
210
|
lightIesAxes: Float32Array;
|
|
209
211
|
/** One per active light: a tile of the cookie atlas, or −1 for none. */
|
|
210
212
|
lightCookies: Float32Array;
|
|
213
|
+
/**
|
|
214
|
+
* One per active light: the lighting channels it lights, a mask from 1 to 255. Absent, short, or
|
|
215
|
+
* a light at 1 is the default channel every surface is on too. See `PointLightSet.lightChannels`
|
|
216
|
+
* and `SurfaceMaterial.lightChannels`.
|
|
217
|
+
*/
|
|
218
|
+
lightChannels?: Float32Array;
|
|
211
219
|
/**
|
|
212
220
|
* The rectangular emitters this frame, or null for none.
|
|
213
221
|
*
|
|
@@ -994,6 +1002,23 @@ export declare class WebGL2Renderer implements RendererApi {
|
|
|
994
1002
|
private motionBlurScale;
|
|
995
1003
|
/** How much of the bloom ceiling this frame takes. See `setBloom`. */
|
|
996
1004
|
private bloomScale;
|
|
1005
|
+
/** The draw's own ambient, as `packAmbientSH` writes it; zeros are the frame's. */
|
|
1006
|
+
private readonly ambientSH;
|
|
1007
|
+
/** Scratch for a sprite's depth conversion, so a particle draw allocates nothing. */
|
|
1008
|
+
private readonly spriteInverseProjection;
|
|
1009
|
+
/** Said once: a sprite asked for a soft edge where no depth copy could be had. */
|
|
1010
|
+
private warnedSpriteDepth;
|
|
1011
|
+
/** Said once: more rectangles than the fixed arm shades, and no froxel table for the rest. */
|
|
1012
|
+
private warnedAreaOverflow;
|
|
1013
|
+
/**
|
|
1014
|
+
* `uEnvironmentDials` as it stands: which chain the probe holds, the reflectivity, the gain. One
|
|
1015
|
+
* vector on the device, so written whole, and kept here so a setter moving one keeps the others.
|
|
1016
|
+
*/
|
|
1017
|
+
private readonly environmentDials;
|
|
1018
|
+
/** `uEmission` as it stands: the emissive gain and the night factor. */
|
|
1019
|
+
private readonly emission;
|
|
1020
|
+
/** The ramp and each level's tint, as `resolveBloomResponse` writes them; the subtraction and white. */
|
|
1021
|
+
private readonly bloomResponse;
|
|
997
1022
|
/** In scene units, once `setBloom` has moved it; null reads the profile's. */
|
|
998
1023
|
private bloomThresholdSet;
|
|
999
1024
|
/**
|
|
@@ -1806,6 +1831,8 @@ export declare class WebGL2Renderer implements RendererApi {
|
|
|
1806
1831
|
* refusal names the first that is not.
|
|
1807
1832
|
*/
|
|
1808
1833
|
createSurfaceTextureArray(sources: readonly SurfaceSource[], options?: SurfaceTextureOptions): SurfaceTexture;
|
|
1834
|
+
/** A baked lightmap page, as a `lightmapModel` material's `modelMap`. See `RendererApi`. */
|
|
1835
|
+
createLightmap(page: LightmapPage): SurfaceTexture;
|
|
1809
1836
|
/**
|
|
1810
1837
|
* Replace a surface texture's pixels, keeping the GPU object and its sampler state.
|
|
1811
1838
|
*
|
|
@@ -1948,6 +1975,17 @@ export declare class WebGL2Renderer implements RendererApi {
|
|
|
1948
1975
|
* is 1 and `bindMeshPass` restores it, so it scales geometry that declared grain and
|
|
1949
1976
|
* leaves geometry that did not exactly as it is.
|
|
1950
1977
|
*/
|
|
1978
|
+
/**
|
|
1979
|
+
* The ambient the following draws take, as nine spherical-harmonic coefficients of incoming
|
|
1980
|
+
* radiance — red, green and blue of each, twenty-seven numbers — or `null` for the frame's own:
|
|
1981
|
+
* the sky's gradient, or the probes'. See `ambientHarmonics.ts` for the basis and the axes.
|
|
1982
|
+
*
|
|
1983
|
+
* **For a thing lit by where it stands**: a consumer sampling a stage's baked volume of indirect
|
|
1984
|
+
* light at a character every frame sets the result around that character's draws, and the
|
|
1985
|
+
* character takes the light of its spot rather than the frame's. It replaces the diffuse ambient
|
|
1986
|
+
* only — a glossy surface still reflects the probes — and it is pass state like the material,
|
|
1987
|
+
* which `bindMeshPass` clears, so a mirror or a probe bake drawn after does not inherit it.
|
|
1988
|
+
*/
|
|
1951
1989
|
/**
|
|
1952
1990
|
* How much of the environment the following draws mirror, 0 to 1.
|
|
1953
1991
|
*
|
|
@@ -1958,6 +1996,7 @@ export declare class WebGL2Renderer implements RendererApi {
|
|
|
1958
1996
|
* Defaults to zero and bindMeshPass restores it, so a scene that never calls this looks
|
|
1959
1997
|
* exactly as it did.
|
|
1960
1998
|
*/
|
|
1999
|
+
setAmbientSH(coefficients: ArrayLike<number> | null): void;
|
|
1961
2000
|
setSurfaceReflectivity(amount: number): void;
|
|
1962
2001
|
/**
|
|
1963
2002
|
* How bright the environment the surfaces drawn next reflect is. 1 is the default and identity.
|
|
@@ -2014,6 +2053,8 @@ export declare class WebGL2Renderer implements RendererApi {
|
|
|
2014
2053
|
* reads, drew what was asked.
|
|
2015
2054
|
*/
|
|
2016
2055
|
private writeFlatFloat;
|
|
2056
|
+
/** A vector of material state, two to four floats, into every flat program. */
|
|
2057
|
+
private writeFlatVector;
|
|
2017
2058
|
/** One int of material state, into every flat program, for `writeFlatFloat`'s reason. */
|
|
2018
2059
|
private writeFlatInt;
|
|
2019
2060
|
/**
|
|
@@ -2330,6 +2371,13 @@ export declare class WebGL2Renderer implements RendererApi {
|
|
|
2330
2371
|
* whole milestone from a buffer nothing had ever written.
|
|
2331
2372
|
*/
|
|
2332
2373
|
drawParticles(batch: ParticleBatch, data: ParticleInstances, camera: Camera, env: Environment, timeSeconds: number): void;
|
|
2374
|
+
/**
|
|
2375
|
+
* A sprite's two fades and the depth copy the soft one reads. The copy is the frame's opaque
|
|
2376
|
+
* depth, so it is taken only in the frame's own picture: in a mirror or a probe's face it would
|
|
2377
|
+
* be another view's, and the edge stays hard there. Without a scene target there is no copy at
|
|
2378
|
+
* all, and the renderer says so once rather than drawing a hard edge that was asked to be soft.
|
|
2379
|
+
*/
|
|
2380
|
+
private bindSpriteFades;
|
|
2333
2381
|
/** Build a batch for electrical arcs. `capacity` is in segments, not arcs. */
|
|
2334
2382
|
createBolts(segmentCapacity: number, label?: string): BoltBatch;
|
|
2335
2383
|
/**
|
|
@@ -3039,8 +3087,14 @@ export declare class WebGL2Renderer implements RendererApi {
|
|
|
3039
3087
|
* and wrong for a day whose exposure spans 2.5 to 14: a courtyard blooming at noon, or candles
|
|
3040
3088
|
* never blooming at night. A caller whose exposure moves passes what it wants on screen over the
|
|
3041
3089
|
* exposure. Omitted leaves it where it was, so a caller that never passes one keeps the profile's.
|
|
3090
|
+
*
|
|
3091
|
+
* **`response` is how a colour comes in past the threshold and what colour each octave of the
|
|
3092
|
+
* halo takes** — a ramp in place of the subtraction, and a tint a level — held until moved like
|
|
3093
|
+
* the threshold; `null` goes back to the subtraction and white. See `BloomResponse`: it is what
|
|
3094
|
+
* matches a stage built for another engine's bloom, whose tints are how a strength past 1 is
|
|
3095
|
+
* asked for.
|
|
3042
3096
|
*/
|
|
3043
|
-
setBloom(scale: number, threshold?: number): void;
|
|
3097
|
+
setBloom(scale: number, threshold?: number, response?: BloomResponse | null): void;
|
|
3044
3098
|
/**
|
|
3045
3099
|
* How thick the air is, this frame: a global participating medium filling the whole frustum.
|
|
3046
3100
|
*
|
|
@@ -3550,6 +3604,25 @@ export declare class WebGL2Renderer implements RendererApi {
|
|
|
3550
3604
|
readonly height: number;
|
|
3551
3605
|
readonly data: Float32Array;
|
|
3552
3606
|
}, options?: ProbeBakeOptions): boolean;
|
|
3607
|
+
/**
|
|
3608
|
+
* One layer of the declared probe grid from an image, the way `setEnvironmentImage` fills a
|
|
3609
|
+
* single probe: the same equirectangular image of linear RGB floats, projected onto the capture
|
|
3610
|
+
* cube and prefiltered into that layer, the others left as they are. Returns false — and says
|
|
3611
|
+
* why — where there is no probe, no grid, or no such layer.
|
|
3612
|
+
*
|
|
3613
|
+
* **What it is for**: a scene baked somewhere else. Another engine's reflection captures are
|
|
3614
|
+
* images taken where each one stands; a consumer fits them to a lattice — for each point, the
|
|
3615
|
+
* capture whose reach holds it — and hands each point its image here, where `bakeProbe` would
|
|
3616
|
+
* have drawn this engine's own world into it.
|
|
3617
|
+
*
|
|
3618
|
+
* `options.irradiance` decides, at grid scope as a bake's does, whether the grid also lights the
|
|
3619
|
+
* scene's diffuse ambient. A grid that crossfades writes the set being swept, as a bake does.
|
|
3620
|
+
*/
|
|
3621
|
+
setProbeLayerImage(layer: number, image: {
|
|
3622
|
+
readonly width: number;
|
|
3623
|
+
readonly height: number;
|
|
3624
|
+
readonly data: Float32Array;
|
|
3625
|
+
}, options?: ProbeBakeOptions): boolean;
|
|
3553
3626
|
/**
|
|
3554
3627
|
* Draw a volume of light: a beam from a lamp, a shaft through a window, the cone under a
|
|
3555
3628
|
* street light.
|