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.
- package/build/index.node.js +411 -125
- package/build/src/rendering/ssao.js +1 -1
- package/build/src/rendering/ssao.js.map +1 -1
- package/build/src/rendering/volumetric/pipeline.js +403 -26
- package/build/src/rendering/volumetric/pipeline.js.map +1 -1
- package/build/src/rendering/volumetric/selector.js +2 -1
- package/build/src/rendering/volumetric/selector.js.map +1 -1
- package/build/src/rendering/volumetric/shaders-wgsl.js +197 -60
- package/build/src/rendering/volumetric/shaders-wgsl.js.map +1 -1
- package/build/src/rendering/volumetric/shaders.js +179 -5
- package/build/src/rendering/volumetric/shaders.js.map +1 -1
- package/build/src/rendering/volumetric/types.js +27 -1
- package/build/src/rendering/volumetric/types.js.map +1 -1
- package/build/src/rendering/volumetric-lighting.js.map +1 -1
- package/declaration/src/rendering/volumetric/pipeline.d.ts +83 -1
- package/declaration/src/rendering/volumetric/selector.d.ts +6 -2
- package/declaration/src/rendering/volumetric/shaders-wgsl.d.ts +5 -1
- package/declaration/src/rendering/volumetric/shaders.d.ts +16 -2
- package/declaration/src/rendering/volumetric/types.d.ts +46 -1
- package/declaration/src/rendering/volumetric-lighting.d.ts +1 -1
- package/package.json +1 -1
|
@@ -10,6 +10,10 @@ export const volumetricLightingLinearDepthShaderName = "volumetricLightingLinear
|
|
|
10
10
|
* Defines the name of the raymarching shader in the shader store of Babylon.js.
|
|
11
11
|
*/
|
|
12
12
|
export const volumetricLightingScatteringShaderName = "volumetricLightingScattering";
|
|
13
|
+
/**
|
|
14
|
+
* Defines the name of the temporal accumulation shader in the shader store of Babylon.js.
|
|
15
|
+
*/
|
|
16
|
+
export const volumetricLightingTemporalShaderName = "volumetricLightingTemporal";
|
|
13
17
|
/**
|
|
14
18
|
* Defines the name of the bilateral blur shader in the shader store of Babylon.js.
|
|
15
19
|
*/
|
|
@@ -19,9 +23,14 @@ export const volumetricLightingBlurShaderName = "volumetricLightingBlur";
|
|
|
19
23
|
*/
|
|
20
24
|
export const volumetricLightingComposeShaderName = "volumetricLightingCompose";
|
|
21
25
|
/**
|
|
22
|
-
*
|
|
26
|
+
* Defines how the linear depth is stored: scaled down in a float texture, or packed in the four channels of an
|
|
27
|
+
* 8 bits RGBA texture, the same way Babylon.js does.
|
|
23
28
|
*/
|
|
24
29
|
const packingHelpers = /* glsl */ `
|
|
30
|
+
// Stored scaled down by a power of two, which is exact: a 16 bits float then holds the far plane of the largest
|
|
31
|
+
// scenes, with a relative precision of 0.05%.
|
|
32
|
+
const float volLinearDepthScale = 1.0 / 1024.0;
|
|
33
|
+
|
|
25
34
|
float volUnpack(vec4 color) {
|
|
26
35
|
const vec4 bitShift = vec4(1.0 / (255.0 * 255.0 * 255.0), 1.0 / (255.0 * 255.0), 1.0 / 255.0, 1.0);
|
|
27
36
|
return dot(color, bitShift);
|
|
@@ -70,7 +79,7 @@ const linearDepthHelpers = /* glsl */ `
|
|
|
70
79
|
#ifdef VOL_LINEAR_DEPTH_PACKED
|
|
71
80
|
return volUnpack(texelFetch(s, coordinates, 0)) * volCameraMinMaxZ.y;
|
|
72
81
|
#else
|
|
73
|
-
return texelFetch(s, coordinates, 0).r;
|
|
82
|
+
return texelFetch(s, coordinates, 0).r * (1.0 / volLinearDepthScale);
|
|
74
83
|
#endif
|
|
75
84
|
}
|
|
76
85
|
|
|
@@ -86,8 +95,8 @@ const linearDepthHelpers = /* glsl */ `
|
|
|
86
95
|
* The linear depth pass. It is the first pass of the pipeline, so its input is the untouched color of the
|
|
87
96
|
* scene that the composition reads back, and it writes the distance along the view axis of each pixel.
|
|
88
97
|
*
|
|
89
|
-
* Every later pass reads this texture instead of the depth map of the depth source: a single
|
|
90
|
-
* channel is
|
|
98
|
+
* Every later pass reads this texture instead of the depth map of the depth source: a single 16 bits
|
|
99
|
+
* channel is a fraction of the memory traffic of the RGBA depth map, which matters for the thousands of reads
|
|
91
100
|
* of the depth-buffer occlusion, and it needs neither unpacking nor linearization. It is kept at the full
|
|
92
101
|
* resolution so the occlusion sees the geometry exactly as the surfaces of the scene draw it.
|
|
93
102
|
*/
|
|
@@ -103,6 +112,9 @@ uniform highp sampler2D depthSampler;
|
|
|
103
112
|
uniform vec2 volCameraMinMaxZ;
|
|
104
113
|
uniform vec2 volDepthUnpack;
|
|
105
114
|
|
|
115
|
+
// (1 when the pipeline has nothing to draw this frame, unused, unused, unused)
|
|
116
|
+
uniform vec4 volPassParams;
|
|
117
|
+
|
|
106
118
|
${packingHelpers}
|
|
107
119
|
${depthMapHelpers}
|
|
108
120
|
|
|
@@ -117,12 +129,19 @@ vec4 volPack(float depth) {
|
|
|
117
129
|
}
|
|
118
130
|
|
|
119
131
|
void main(void) {
|
|
132
|
+
// Nothing reads the linear depth while the pipeline has nothing to draw.
|
|
133
|
+
if (volPassParams.x > 0.5) {
|
|
134
|
+
gl_FragColor = vec4(0.0);
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
|
|
120
138
|
float viewZ = volLinearDepth(volSampleDepth(vUV));
|
|
121
139
|
|
|
122
140
|
#ifdef VOL_LINEAR_DEPTH_PACKED
|
|
123
141
|
gl_FragColor = volPack(clamp(viewZ / volCameraMinMaxZ.y, 0.0, 0.9999999));
|
|
124
142
|
#else
|
|
125
|
-
|
|
143
|
+
// Bounded by the largest 16 bits float.
|
|
144
|
+
gl_FragColor = vec4(min(viewZ * volLinearDepthScale, 65504.0), 0.0, 0.0, 1.0);
|
|
126
145
|
#endif
|
|
127
146
|
}
|
|
128
147
|
`;
|
|
@@ -363,6 +382,9 @@ uniform vec3 volCameraForward;
|
|
|
363
382
|
uniform vec2 volCameraMinMaxZ;
|
|
364
383
|
uniform float volFrameIndex;
|
|
365
384
|
|
|
385
|
+
// Offset of the current frame along the golden ratio sequence the samples walk with the temporal accumulation.
|
|
386
|
+
uniform float volTemporalOffset;
|
|
387
|
+
|
|
366
388
|
uniform vec4 volFogInfos;
|
|
367
389
|
uniform vec3 volFogColor;
|
|
368
390
|
uniform float volLinearFogEps;
|
|
@@ -377,6 +399,9 @@ uniform vec3 volAmbient;
|
|
|
377
399
|
// (maximum distance, dithering strength, light extinction clamp, number of point and spot lights in the arrays)
|
|
378
400
|
uniform vec4 volParams;
|
|
379
401
|
|
|
402
|
+
// (1 when the pipeline has nothing to draw this frame, unused, unused, unused)
|
|
403
|
+
uniform vec4 volPassParams;
|
|
404
|
+
|
|
380
405
|
#if VOL_MAX_ARRAY_LIGHTS > 0
|
|
381
406
|
uniform vec4 volLightData[VOL_MAX_ARRAY_LIGHTS];
|
|
382
407
|
uniform vec4 volLightDiffuse[VOL_MAX_ARRAY_LIGHTS];
|
|
@@ -1008,6 +1033,12 @@ ${globalSlotContributions.join("")}
|
|
|
1008
1033
|
#endif
|
|
1009
1034
|
|
|
1010
1035
|
void main(void) {
|
|
1036
|
+
// Nothing to draw this frame: no light reaches the view and the medium neither glows nor attenuates anything.
|
|
1037
|
+
if (volPassParams.x > 0.5) {
|
|
1038
|
+
gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
|
|
1039
|
+
return;
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1011
1042
|
// Reconstruct the world space direction of the view ray from the UV of the pixel.
|
|
1012
1043
|
vec4 farPoint = volInverseViewProjection * vec4(vUV * 2.0 - 1.0, 1.0, 1.0);
|
|
1013
1044
|
volRayDir = normalize(farPoint.xyz / farPoint.w - volCameraPosition);
|
|
@@ -1037,6 +1068,14 @@ void main(void) {
|
|
|
1037
1068
|
#endif
|
|
1038
1069
|
volNoise = volInterleavedGradientNoise(ditherPosition);
|
|
1039
1070
|
#endif
|
|
1071
|
+
|
|
1072
|
+
#ifdef VOL_TEMPORAL_ACCUMULATION
|
|
1073
|
+
// Each pixel walks the golden ratio sequence from the offset of its dithering pattern, one step per frame:
|
|
1074
|
+
// the samples of consecutive frames spread evenly over their segments, and the accumulation averages them.
|
|
1075
|
+
// The pattern of the pixels around stays the same, which is what lets the accumulation tell its noise from
|
|
1076
|
+
// the changes of the scene.
|
|
1077
|
+
volNoise = fract(volNoise + volTemporalOffset);
|
|
1078
|
+
#endif
|
|
1040
1079
|
volJitter = volNoise * volParams.y;
|
|
1041
1080
|
|
|
1042
1081
|
#ifdef VOL_SCREEN_SHADOWS
|
|
@@ -1100,6 +1139,120 @@ ${localSlotContributions.join("")}
|
|
|
1100
1139
|
}
|
|
1101
1140
|
`;
|
|
1102
1141
|
}
|
|
1142
|
+
/**
|
|
1143
|
+
* The temporal accumulation pass. Blends the scattering of the current frame, whose samples are offset from one
|
|
1144
|
+
* frame to the next, with the scattering accumulated over the previous frames: the result converges to the
|
|
1145
|
+
* integral the samples of all these frames estimate together, which is what lets each frame compute fewer of them.
|
|
1146
|
+
*
|
|
1147
|
+
* The history is reprojected on the current view, and clipped to the range of values the current frame shows
|
|
1148
|
+
* around the pixel so that a moving light, a moving occluder or a surface revealed by the motion of the camera
|
|
1149
|
+
* never leaves a trail. The blend follows the "factor" of the TAA rendering pipeline: the weight of the current frame.
|
|
1150
|
+
*/
|
|
1151
|
+
export function buildVolumetricLightingTemporalShader() {
|
|
1152
|
+
return /* glsl */ `precision highp float;
|
|
1153
|
+
precision highp int;
|
|
1154
|
+
|
|
1155
|
+
varying vec2 vUV;
|
|
1156
|
+
|
|
1157
|
+
// Scattering computed this frame, and scattering accumulated over the previous frames, both at the resolution of
|
|
1158
|
+
// the scattering buffer.
|
|
1159
|
+
uniform sampler2D textureSampler;
|
|
1160
|
+
uniform sampler2D volHistorySampler;
|
|
1161
|
+
|
|
1162
|
+
// Full resolution linear depth of the scene, written by the linear depth pass.
|
|
1163
|
+
uniform highp sampler2D volLinearDepthSampler;
|
|
1164
|
+
|
|
1165
|
+
uniform vec2 volCameraMinMaxZ;
|
|
1166
|
+
uniform vec2 volDepthRatio;
|
|
1167
|
+
uniform mat4 volInverseViewProjection;
|
|
1168
|
+
uniform vec3 volCameraPosition;
|
|
1169
|
+
uniform vec3 volCameraForward;
|
|
1170
|
+
|
|
1171
|
+
// View projection matrix of the previous frame, applied to positions relative to the current camera.
|
|
1172
|
+
uniform mat4 volPreviousViewProjection;
|
|
1173
|
+
|
|
1174
|
+
// (weight of the current frame, width of the clipping of the history in standard deviations, maximum distance of
|
|
1175
|
+
// the march, 1 when the history holds the previous frame, 2 when the previous frame had nothing to draw)
|
|
1176
|
+
uniform vec4 volTemporalParams;
|
|
1177
|
+
|
|
1178
|
+
// (distance the camera moved since the previous frame, part of the medium along the view ray whose change the
|
|
1179
|
+
// delay of the history may lag behind)
|
|
1180
|
+
uniform vec2 volTemporalMotion;
|
|
1181
|
+
|
|
1182
|
+
${packingHelpers}
|
|
1183
|
+
${linearDepthHelpers}
|
|
1184
|
+
|
|
1185
|
+
void main(void) {
|
|
1186
|
+
ivec2 texel = ivec2(gl_FragCoord.xy);
|
|
1187
|
+
ivec2 size = textureSize(textureSampler, 0);
|
|
1188
|
+
|
|
1189
|
+
// Bounded so a light next to the camera, which a half float can't hold, never turns the history infinite.
|
|
1190
|
+
vec4 current = min(texelFetch(textureSampler, texel, 0), vec4(65000.0));
|
|
1191
|
+
|
|
1192
|
+
if (volTemporalParams.w < 0.5) {
|
|
1193
|
+
gl_FragColor = current;
|
|
1194
|
+
return;
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
// The end of the marched part of the view ray is reprojected in the previous frame: the medium in front of it
|
|
1198
|
+
// is spread along the ray, but its scattering varies slowly enough for the surface behind it, or the maximum
|
|
1199
|
+
// distance of the march, to be a faithful anchor.
|
|
1200
|
+
ivec2 depthSize = textureSize(volLinearDepthSampler, 0);
|
|
1201
|
+
float viewZ = volReadLinearDepth(volLinearDepthSampler, volScatterToDepthTexel(texel, depthSize));
|
|
1202
|
+
|
|
1203
|
+
vec4 farPoint = volInverseViewProjection * vec4(vUV * 2.0 - 1.0, 1.0, 1.0);
|
|
1204
|
+
vec3 rayDir = normalize(farPoint.xyz / farPoint.w - volCameraPosition);
|
|
1205
|
+
float t = min(viewZ / max(dot(rayDir, volCameraForward), 1e-4), volTemporalParams.z);
|
|
1206
|
+
|
|
1207
|
+
vec4 previousClip = volPreviousViewProjection * vec4(rayDir * t, 1.0);
|
|
1208
|
+
vec2 previousUV = (previousClip.xy / previousClip.w) * 0.5 + 0.5;
|
|
1209
|
+
|
|
1210
|
+
if (previousClip.w <= 0.0 || previousUV.x < 0.0 || previousUV.x > 1.0 || previousUV.y < 0.0 || previousUV.y > 1.0) {
|
|
1211
|
+
gl_FragColor = current;
|
|
1212
|
+
return;
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
// The pipeline had nothing to draw the previous frame: no light at all, seen through the same medium.
|
|
1216
|
+
vec4 history = volTemporalParams.w > 1.5 ? vec4(0.0, 0.0, 0.0, current.a) : texture2D(volHistorySampler, previousUV);
|
|
1217
|
+
|
|
1218
|
+
// A history holding an infinity or a NaN would never recover from it.
|
|
1219
|
+
if (!all(lessThan(abs(history), vec4(1e20)))) {
|
|
1220
|
+
gl_FragColor = current;
|
|
1221
|
+
return;
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
// Variance clipping: the history is kept within what the current frame shows around the pixel.
|
|
1225
|
+
vec4 m1 = vec4(0.0);
|
|
1226
|
+
vec4 m2 = vec4(0.0);
|
|
1227
|
+
|
|
1228
|
+
for (int y = -1; y <= 1; ++y) {
|
|
1229
|
+
for (int x = -1; x <= 1; ++x) {
|
|
1230
|
+
vec4 c = min(texelFetch(textureSampler, clamp(texel + ivec2(x, y), ivec2(0), size - 1), 0), vec4(65000.0));
|
|
1231
|
+
m1 += c;
|
|
1232
|
+
m2 += c * c;
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1236
|
+
vec4 mean = m1 * (1.0 / 9.0);
|
|
1237
|
+
vec4 sigma = sqrt(max(m2 * (1.0 / 9.0) - mean * mean, vec4(0.0)));
|
|
1238
|
+
vec4 clipped = clamp(history, mean - volTemporalParams.y * sigma, mean + volTemporalParams.y * sigma);
|
|
1239
|
+
|
|
1240
|
+
// The history holds the medium as seen from where the camera was. A rotation of the camera changes nothing to
|
|
1241
|
+
// what a view ray crosses, but moving it changes the medium along the view ray by about the distance it moved
|
|
1242
|
+
// relative to the length of the ray: the weight of the current frame grows with that change, so the delay of
|
|
1243
|
+
// the history never lags behind more than the given part of it.
|
|
1244
|
+
float motion = volTemporalMotion.x / max(t, 1e-3);
|
|
1245
|
+
float factor = max(volTemporalParams.x, motion / (motion + volTemporalMotion.y));
|
|
1246
|
+
|
|
1247
|
+
// The transmittance only depends on the length of medium in front of the surface: when it changed, the history
|
|
1248
|
+
// shows another surface and is dropped. Compared before the clipping, which would hide the change.
|
|
1249
|
+
float transmittanceChange = abs(history.a - current.a) / max(max(history.a, current.a), 1e-3);
|
|
1250
|
+
float historyWeight = (1.0 - factor) * (1.0 - smoothstep(0.02, 0.15, transmittanceChange));
|
|
1251
|
+
|
|
1252
|
+
gl_FragColor = mix(current, clipped, historyWeight);
|
|
1253
|
+
}
|
|
1254
|
+
`;
|
|
1255
|
+
}
|
|
1103
1256
|
/**
|
|
1104
1257
|
* The separable bilateral blur pass. Denoises the low resolution scattering buffer without letting the
|
|
1105
1258
|
* light shafts bleed across the silhouettes of the geometry.
|
|
@@ -1118,10 +1271,19 @@ uniform vec2 volDepthRatio;
|
|
|
1118
1271
|
uniform vec2 volBlurDirection;
|
|
1119
1272
|
uniform vec2 volBlurParams;
|
|
1120
1273
|
|
|
1274
|
+
// (1 when the pipeline has nothing to draw this frame, unused, unused, unused)
|
|
1275
|
+
uniform vec4 volPassParams;
|
|
1276
|
+
|
|
1121
1277
|
${packingHelpers}
|
|
1122
1278
|
${linearDepthHelpers}
|
|
1123
1279
|
|
|
1124
1280
|
void main(void) {
|
|
1281
|
+
// Nothing to draw this frame: the composition doesn't read the scattering buffer.
|
|
1282
|
+
if (volPassParams.x > 0.5) {
|
|
1283
|
+
gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
|
|
1284
|
+
return;
|
|
1285
|
+
}
|
|
1286
|
+
|
|
1125
1287
|
// The blur runs at the resolution of the scattering buffer and every tap is an exact texel, compared using
|
|
1126
1288
|
// the depth the raymarching used for it: no filtering is needed, no depth has to be unpacked nor linearized.
|
|
1127
1289
|
ivec2 size = textureSize(textureSampler, 0);
|
|
@@ -1178,6 +1340,9 @@ uniform vec2 volCameraMinMaxZ;
|
|
|
1178
1340
|
uniform vec2 volDepthRatio;
|
|
1179
1341
|
uniform vec4 volComposeParams;
|
|
1180
1342
|
|
|
1343
|
+
// (1 when the pipeline has nothing to draw this frame, unused, unused, unused)
|
|
1344
|
+
uniform vec4 volPassParams;
|
|
1345
|
+
|
|
1181
1346
|
${packingHelpers}
|
|
1182
1347
|
${linearDepthHelpers}
|
|
1183
1348
|
|
|
@@ -1237,6 +1402,13 @@ vec4 volUpsample(float centerDepth, ivec2 depthSize) {
|
|
|
1237
1402
|
}
|
|
1238
1403
|
|
|
1239
1404
|
void main(void) {
|
|
1405
|
+
// Nothing to draw this frame: the color of the scene passes through, exactly as it would under light shafts of
|
|
1406
|
+
// zero intensity.
|
|
1407
|
+
if (volPassParams.x > 0.5) {
|
|
1408
|
+
gl_FragColor = vec4(texture2D(volSceneSampler, vUV).rgb + (volBayer8(gl_FragCoord.xy) - 0.5) * volComposeParams.w, 1.0);
|
|
1409
|
+
return;
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1240
1412
|
// The linear depth has the full resolution of the canvas: same texel the depth map would give with a nearest filter.
|
|
1241
1413
|
ivec2 depthSize = textureSize(volLinearDepthSampler, 0);
|
|
1242
1414
|
float centerDepth = volReadLinearDepth(volLinearDepthSampler, min(ivec2(vUV * vec2(depthSize)), depthSize - 1));
|
|
@@ -1288,12 +1460,14 @@ export function registerVolumetricLightingShaders(shaderLanguage) {
|
|
|
1288
1460
|
const shaders = getVolumetricLightingShadersWGSL();
|
|
1289
1461
|
ShaderStore.ShadersStoreWGSL[`${volumetricLightingLinearDepthShaderName}PixelShader`] = shaders.linearDepth;
|
|
1290
1462
|
ShaderStore.ShadersStoreWGSL[`${volumetricLightingScatteringShaderName}PixelShader`] = shaders.scattering;
|
|
1463
|
+
ShaderStore.ShadersStoreWGSL[`${volumetricLightingTemporalShaderName}PixelShader`] = shaders.temporal;
|
|
1291
1464
|
ShaderStore.ShadersStoreWGSL[`${volumetricLightingBlurShaderName}PixelShader`] = shaders.blur;
|
|
1292
1465
|
ShaderStore.ShadersStoreWGSL[`${volumetricLightingComposeShaderName}PixelShader`] = shaders.compose;
|
|
1293
1466
|
return;
|
|
1294
1467
|
}
|
|
1295
1468
|
ShaderStore.ShadersStore[`${volumetricLightingLinearDepthShaderName}PixelShader`] = buildVolumetricLightingLinearDepthShader();
|
|
1296
1469
|
ShaderStore.ShadersStore[`${volumetricLightingScatteringShaderName}PixelShader`] = buildVolumetricLightingScatteringShader(maxVolumetricShadowSlots);
|
|
1470
|
+
ShaderStore.ShadersStore[`${volumetricLightingTemporalShaderName}PixelShader`] = buildVolumetricLightingTemporalShader();
|
|
1297
1471
|
ShaderStore.ShadersStore[`${volumetricLightingBlurShaderName}PixelShader`] = buildVolumetricLightingBlurShader();
|
|
1298
1472
|
ShaderStore.ShadersStore[`${volumetricLightingComposeShaderName}PixelShader`] = buildVolumetricLightingComposeShader();
|
|
1299
1473
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shaders.js","sourceRoot":"","sources":["../../../../src/rendering/volumetric/shaders.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAE1E,OAAO,EAAE,gCAAgC,EAAE,MAAM,gBAAgB,CAAC;AAElE,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAEnD;;GAEG;AACH,MAAM,CAAC,MAAM,uCAAuC,GAAG,+BAA+B,CAAC;AAEvF;;GAEG;AACH,MAAM,CAAC,MAAM,sCAAsC,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AAY,CAAC,GAAG,uCAAuC,aAAa,CAAC,GAAG,wCAAwC,EAAE,CAAC;IAC/H,WAAW,CAAC,YAAY,CAAC,GAAG,sCAAsC,aAAa,CAAC,GAAG,uCAAuC,CAAC,wBAAwB,CAAC,CAAC;IACrJ,WAAW,CAAC,YAAY,CAAC,GAAG,oCAAoC,aAAa,CAAC,GAAG,qCAAqC,EAAE,CAAC;IACzH,WAAW,CAAC,YAAY,CAAC,GAAG,gCAAgC,aAAa,CAAC,GAAG,iCAAiC,EAAE,CAAC;IACjH,WAAW,CAAC,YAAY,CAAC,GAAG,mCAAmC,aAAa,CAAC,GAAG,oCAAoC,EAAE,CAAC;AACxH,CAAC"}
|
|
@@ -20,6 +20,12 @@ export const maxVolumetricArrayLights = 256;
|
|
|
20
20
|
* point and spot lights, a directional light lights the whole view ray, so each one costs a full march.
|
|
21
21
|
*/
|
|
22
22
|
export const maxVolumetricDirectionalLights = 4;
|
|
23
|
+
/**
|
|
24
|
+
* Defines by how much the temporal accumulation divides the number of samples the raymarching computes each
|
|
25
|
+
* frame. The samples of consecutive frames are offset from each other, so the accumulated result still
|
|
26
|
+
* averages at least as many positions along each view ray as the configured steps.
|
|
27
|
+
*/
|
|
28
|
+
export const volumetricTemporalSamplesDivider = 3;
|
|
23
29
|
/**
|
|
24
30
|
* Defines the available step distributions used while raymarching the participating medium.
|
|
25
31
|
*/
|
|
@@ -105,7 +111,7 @@ export function getDefaultVolumetricLightConfiguration() {
|
|
|
105
111
|
anisotropy: 0.35,
|
|
106
112
|
useCustomColor: false,
|
|
107
113
|
color: [1, 1, 1],
|
|
108
|
-
castVolumetricShadows:
|
|
114
|
+
castVolumetricShadows: false,
|
|
109
115
|
shadowDarkness: 1,
|
|
110
116
|
rangeMultiplier: 1,
|
|
111
117
|
priority: 0,
|
|
@@ -123,6 +129,8 @@ export function getDefaultVolumetricLightingConfiguration() {
|
|
|
123
129
|
ditherMode: VolumetricDitherMode.InterleavedGradientNoise,
|
|
124
130
|
ditherStrength: 1,
|
|
125
131
|
temporalJitter: false,
|
|
132
|
+
temporalAccumulation: false,
|
|
133
|
+
temporalAccumulationFactor: 0.1,
|
|
126
134
|
fogMode: VolumetricFogMode.Exponential,
|
|
127
135
|
fogDensity: 0.0005,
|
|
128
136
|
fogStart: 0,
|
|
@@ -166,6 +174,22 @@ export function getVolumetricLightSteps(configuration) {
|
|
|
166
174
|
}
|
|
167
175
|
return Math.max(4, Math.min(64, Math.round(configuration.steps * 0.3)));
|
|
168
176
|
}
|
|
177
|
+
/**
|
|
178
|
+
* Returns the number of samples the raymarching computes each frame. With the temporal accumulation the
|
|
179
|
+
* configured values are divided, the history of the previous frames providing the samples each frame skips.
|
|
180
|
+
* @param configuration defines the configuration of the pipeline.
|
|
181
|
+
* @param temporalSamplesDivider defines by how much the temporal accumulation divides the number of samples.
|
|
182
|
+
*/
|
|
183
|
+
export function getVolumetricSamplingSteps(configuration, temporalSamplesDivider = volumetricTemporalSamplesDivider) {
|
|
184
|
+
const lightSteps = getVolumetricLightSteps(configuration);
|
|
185
|
+
if (!configuration.temporalAccumulation || temporalSamplesDivider <= 1) {
|
|
186
|
+
return { steps: configuration.steps, lightSteps };
|
|
187
|
+
}
|
|
188
|
+
return {
|
|
189
|
+
steps: Math.max(4, Math.ceil(configuration.steps / temporalSamplesDivider)),
|
|
190
|
+
lightSteps: Math.max(2, Math.ceil(lightSteps / temporalSamplesDivider)),
|
|
191
|
+
};
|
|
192
|
+
}
|
|
169
193
|
function normalizeNumber(value, defaultValue, min, max) {
|
|
170
194
|
const result = typeof value === "number" && isFinite(value) ? value : defaultValue;
|
|
171
195
|
return Math.min(max, Math.max(min, result));
|
|
@@ -215,6 +239,8 @@ export function normalizeVolumetricLightingConfiguration(data) {
|
|
|
215
239
|
ditherMode: Math.round(normalizeNumber(data.ditherMode, defaults.ditherMode, 0, 2)),
|
|
216
240
|
ditherStrength: normalizeNumber(data.ditherStrength, defaults.ditherStrength, 0, 1),
|
|
217
241
|
temporalJitter: data.temporalJitter ?? defaults.temporalJitter,
|
|
242
|
+
temporalAccumulation: data.temporalAccumulation ?? defaults.temporalAccumulation,
|
|
243
|
+
temporalAccumulationFactor: normalizeNumber(data.temporalAccumulationFactor, defaults.temporalAccumulationFactor, 0.005, 1),
|
|
218
244
|
fogMode: Math.round(normalizeNumber(data.fogMode, defaults.fogMode, 0, 2)),
|
|
219
245
|
fogDensity: normalizeNumber(data.fogDensity, defaults.fogDensity, 0, 100),
|
|
220
246
|
fogStart: normalizeNumber(data.fogStart, defaults.fogStart, 0, 1_000_000),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/rendering/volumetric/types.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,oBAAoB,CAAC;AAE/D;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC;AAE1C;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,CAAC;AAE5C;;;GAGG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,CAAC;AAEhD;;GAEG;AACH,MAAM,CAAN,IAAY,0BAUX;AAVD,WAAY,0BAA0B;IACrC;;OAEG;IACH,+EAAU,CAAA;IACV;;;OAGG;IACH,yFAAe,CAAA;AAChB,CAAC,EAVW,0BAA0B,KAA1B,0BAA0B,QAUrC;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,oBAaX;AAbD,WAAY,oBAAoB;IAC/B;;OAEG;IACH,+DAAQ,CAAA;IACR;;OAEG;IACH,iEAAS,CAAA;IACT;;OAEG;IACH,uGAA4B,CAAA;AAC7B,CAAC,EAbW,oBAAoB,KAApB,oBAAoB,QAa/B;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAY,iBAaX;AAbD,WAAY,iBAAiB;IAC5B;;OAEG;IACH,uEAAe,CAAA;IACf;;OAEG;IACH,qFAAsB,CAAA;IACtB;;OAEG;IACH,6DAAU,CAAA;AACX,CAAC,EAbW,iBAAiB,KAAjB,iBAAiB,QAa5B;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,mBAiBX;AAjBD,WAAY,mBAAmB;IAC9B;;OAEG;IACH,6DAAQ,CAAA;IACR;;OAEG;IACH,yEAAc,CAAA;IACd;;OAEG;IACH,+EAAiB,CAAA;IACjB;;OAEG;IACH,yEAAc,CAAA;AACf,CAAC,EAjBW,mBAAmB,KAAnB,mBAAmB,QAiB9B;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/rendering/volumetric/types.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,oBAAoB,CAAC;AAE/D;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC;AAE1C;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,CAAC;AAE5C;;;GAGG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,CAAC;AAEhD;;;;GAIG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,CAAC;AAElD;;GAEG;AACH,MAAM,CAAN,IAAY,0BAUX;AAVD,WAAY,0BAA0B;IACrC;;OAEG;IACH,+EAAU,CAAA;IACV;;;OAGG;IACH,yFAAe,CAAA;AAChB,CAAC,EAVW,0BAA0B,KAA1B,0BAA0B,QAUrC;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,oBAaX;AAbD,WAAY,oBAAoB;IAC/B;;OAEG;IACH,+DAAQ,CAAA;IACR;;OAEG;IACH,iEAAS,CAAA;IACT;;OAEG;IACH,uGAA4B,CAAA;AAC7B,CAAC,EAbW,oBAAoB,KAApB,oBAAoB,QAa/B;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAY,iBAaX;AAbD,WAAY,iBAAiB;IAC5B;;OAEG;IACH,uEAAe,CAAA;IACf;;OAEG;IACH,qFAAsB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K,CAAC,QAAQ,CAAC,0BAA0B,CAAC,CAAC,CAAC;QACvF,OAAO,KAAK,CAAC,QAAQ,CAAC,0BAA0B,CAAC,CAAC;IACnD,CAAC;IAED,IAAI,sCAAsC,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC1D,OAAO,QAAQ,CAAC;IACjB,CAAC;IAED,2FAA2F;IAC3F,MAAM,QAAQ,GAAG,sCAAsC,EAAE,CAAC;IAC1D,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;QACrC,IAAI,QAAQ,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE,CAAC;YACjC,QAAQ,CAAC,GAAG,CAAC,GAAI,QAAgB,CAAC,GAAG,CAAC,CAAC;QACxC,CAAC;IACF,CAAC,CAAC,CAAC;IAEH,sCAAsC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAErD,OAAO,QAAQ,CAAC;AACjB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,+BAA+B,CAAC,KAAY;IAC3D,MAAM,IAAI,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC,0BAA0B,CAAC,CAAC;IAC1D,OAAO,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,kCAAkC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAC5F,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,wBAAwB,CAAC,KAAY;IACpD,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC,0BAA0B,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;AACvE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"volumetric-lighting.js","sourceRoot":"","sources":["../../../src/rendering/volumetric-lighting.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"volumetric-lighting.js","sourceRoot":"","sources":["../../../src/rendering/volumetric-lighting.ts"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,mCAAmC,EAAE,eAAe,EAAE,CAAC;AACxD,CAAC"}
|
|
@@ -22,10 +22,12 @@ import { VolumetricDepthSource } from "./depth";
|
|
|
22
22
|
* light is marched along the whole view ray, but a point or a spot light is only integrated over the part
|
|
23
23
|
* of the view ray crossing its volume, so a light costs nothing to the pixels whose view ray misses it.
|
|
24
24
|
*
|
|
25
|
-
* The pipeline is composed of
|
|
25
|
+
* The pipeline is composed of the following passes:
|
|
26
26
|
* - a pass keeping the color of the scene untouched and extracting its linear depth, which every later pass
|
|
27
27
|
* reads instead of the depth map,
|
|
28
28
|
* - the raymarching pass, rendered at a fraction of the resolution of the canvas,
|
|
29
|
+
* - when the temporal accumulation is enabled, a pass blending the result of the raymarching with the result of
|
|
30
|
+
* the previous frames, which lets the raymarching compute a fraction of its samples each frame,
|
|
29
31
|
* - a separable depth aware blur denoising the result of the raymarching,
|
|
30
32
|
* - a composition pass upsampling the result and adding it to the color of the scene.
|
|
31
33
|
*/
|
|
@@ -38,6 +40,10 @@ export declare class VolumetricLightingRenderingPipeline extends PostProcessRend
|
|
|
38
40
|
* Defines the name of the render effect raymarching the participating medium.
|
|
39
41
|
*/
|
|
40
42
|
static readonly ScatteringEffectName: string;
|
|
43
|
+
/**
|
|
44
|
+
* Defines the name of the render effect accumulating the result of the raymarching over the frames.
|
|
45
|
+
*/
|
|
46
|
+
static readonly TemporalEffectName: string;
|
|
41
47
|
/**
|
|
42
48
|
* Defines the name of the render effect denoising the result of the raymarching.
|
|
43
49
|
*/
|
|
@@ -82,30 +88,51 @@ export declare class VolumetricLightingRenderingPipeline extends PostProcessRend
|
|
|
82
88
|
private _textureType;
|
|
83
89
|
private _shaderLanguage;
|
|
84
90
|
private _ldrEncode;
|
|
91
|
+
private _linearDepthType;
|
|
85
92
|
private _linearDepthPacked;
|
|
86
93
|
private _msaaSamples;
|
|
87
94
|
private _msaaSamplesAssigned;
|
|
88
95
|
private _depthSource;
|
|
89
96
|
private _depthRenderer;
|
|
90
97
|
private _ownsDepthRenderer;
|
|
98
|
+
private _depthMapRenderedWithCamera;
|
|
91
99
|
private _depthMode;
|
|
92
100
|
private _prePassConfiguration;
|
|
93
101
|
private _linearDepthPostProcess;
|
|
94
102
|
private _scatteringPostProcess;
|
|
103
|
+
private _temporalPostProcess;
|
|
95
104
|
private _blurPostProcesses;
|
|
96
105
|
private _composePostProcess;
|
|
106
|
+
private _temporalSamplesDivider;
|
|
107
|
+
private _temporalClippingWidth;
|
|
108
|
+
private _temporalMotionTolerance;
|
|
109
|
+
private _previousCameraPosition;
|
|
110
|
+
private _historyTextures;
|
|
111
|
+
private _historyFrames;
|
|
112
|
+
private _historyEmpty;
|
|
113
|
+
private _historyIndex;
|
|
114
|
+
private _temporalFrame;
|
|
115
|
+
private _previousViewProjection;
|
|
116
|
+
private _previousViewProjectionRelative;
|
|
117
|
+
private _cameraTranslation;
|
|
97
118
|
private _selection;
|
|
98
119
|
private _budget;
|
|
99
120
|
private _linearDepthDefines;
|
|
100
121
|
private _scatteringDefines;
|
|
122
|
+
private _temporalDefines;
|
|
101
123
|
private _blurDefines;
|
|
102
124
|
private _composeDefines;
|
|
103
125
|
private _frameCount;
|
|
104
126
|
private _lightsDirty;
|
|
105
127
|
private _disposed;
|
|
128
|
+
private _idle;
|
|
129
|
+
private _depthWarmup;
|
|
106
130
|
private _beforeCameraRenderObserver;
|
|
131
|
+
private _afterCameraRenderObserver;
|
|
107
132
|
private _lightAddedObserver;
|
|
108
133
|
private _lightRemovedObserver;
|
|
134
|
+
private _meshAddedObserver;
|
|
135
|
+
private _meshRemovedObserver;
|
|
109
136
|
private _inverseViewProjection;
|
|
110
137
|
private _temporaryVector;
|
|
111
138
|
private _temporaryColor;
|
|
@@ -150,6 +177,11 @@ export declare class VolumetricLightingRenderingPipeline extends PostProcessRend
|
|
|
150
177
|
* change immediately, rebuilding the chain of post-processes when the change requires it.
|
|
151
178
|
*/
|
|
152
179
|
get configuration(): IVolumetricLightingConfiguration;
|
|
180
|
+
/**
|
|
181
|
+
* Gets wether or not the pipeline had nothing to draw at its last update: no light reaches the view of the camera
|
|
182
|
+
* and the medium neither glows nor attenuates the scene. Its passes then cost next to nothing.
|
|
183
|
+
*/
|
|
184
|
+
get isIdle(): boolean;
|
|
153
185
|
/**
|
|
154
186
|
* Gets where the depth of the scene is currently read from. @see VolumetricDepthSource
|
|
155
187
|
*/
|
|
@@ -231,6 +263,19 @@ export declare class VolumetricLightingRenderingPipeline extends PostProcessRend
|
|
|
231
263
|
* depth pass, and detects the format it stores so the shader can be compiled for it.
|
|
232
264
|
*/
|
|
233
265
|
private _setupDepthRenderer;
|
|
266
|
+
/**
|
|
267
|
+
* Returns wether or not the depth renderer of the camera the scene hands to the effects asking for it changed
|
|
268
|
+
* since the pipeline chose its own: created by another effect, or disabled by the one that created it.
|
|
269
|
+
*/
|
|
270
|
+
private _hasDepthRendererOfCameraChanged;
|
|
271
|
+
/**
|
|
272
|
+
* Adds the depth map the pipeline owns to the render targets of the camera, or removes it. The scene collects
|
|
273
|
+
* its own render targets before the pipeline decides wether it has anything to draw this frame, but renders
|
|
274
|
+
* the ones of the camera after: the frame the pipeline has something to draw again, only the latter render the
|
|
275
|
+
* depth map in time. They are only used for that frame, rendering it with the ones of the scene costs less
|
|
276
|
+
* time to the CPU.
|
|
277
|
+
*/
|
|
278
|
+
private _setDepthMapRenderedWithCamera;
|
|
234
279
|
/**
|
|
235
280
|
* Binds the two values needed to turn the content of the depth map back into a distance along the view
|
|
236
281
|
* axis. The depth renderer stores "(clipZ + minZ) / (minZ + maxZ)", where "clipZ" is affine in the view
|
|
@@ -238,6 +283,15 @@ export declare class VolumetricLightingRenderingPipeline extends PostProcessRend
|
|
|
238
283
|
* can be derived exactly from the projection matrix instead of being approximated.
|
|
239
284
|
*/
|
|
240
285
|
private _bindDepthUniforms;
|
|
286
|
+
/**
|
|
287
|
+
* Returns the number of samples the raymarching computes each frame, fewer with the temporal accumulation.
|
|
288
|
+
*/
|
|
289
|
+
private _getSamplingSteps;
|
|
290
|
+
/**
|
|
291
|
+
* Returns the dithering mode the raymarching is compiled with. The temporal accumulation needs the samples of
|
|
292
|
+
* neighboring pixels to differ: it tells its own noise from the changes of the scene with it.
|
|
293
|
+
*/
|
|
294
|
+
private _getDitherMode;
|
|
241
295
|
private _getEnvironment;
|
|
242
296
|
/**
|
|
243
297
|
* Returns the defines of the passes reading the linear depth, which only depend on how it is stored.
|
|
@@ -248,11 +302,23 @@ export declare class VolumetricLightingRenderingPipeline extends PostProcessRend
|
|
|
248
302
|
*/
|
|
249
303
|
private _buildLinearDepthDefines;
|
|
250
304
|
private _buildScatteringDefines;
|
|
305
|
+
private _buildTemporalDefines;
|
|
251
306
|
private _buildBlurDefines;
|
|
252
307
|
private _buildComposeDefines;
|
|
253
308
|
private _createPostProcess;
|
|
254
309
|
private _buildRenderEffects;
|
|
255
310
|
private _disposePostProcesses;
|
|
311
|
+
/**
|
|
312
|
+
* Releases the textures holding the history of the temporal accumulation. The next frame starts over from the
|
|
313
|
+
* result of the raymarching alone.
|
|
314
|
+
*/
|
|
315
|
+
private _disposeHistory;
|
|
316
|
+
/**
|
|
317
|
+
* Swaps the two textures holding the history of the temporal accumulation, as the pass is activated: the one
|
|
318
|
+
* written last frame is read back, the other one receives the result of this frame and is what the pass after
|
|
319
|
+
* it reads, the same way the TAA rendering pipeline of Babylon.js does.
|
|
320
|
+
*/
|
|
321
|
+
private _prepareHistory;
|
|
256
322
|
/**
|
|
257
323
|
* Rebuilds the chain of post-processes. Changing the resolution of the scattering buffer or the number
|
|
258
324
|
* of blur passes changes the shape of the chain, which a post-process can't do in place.
|
|
@@ -264,6 +330,21 @@ export declare class VolumetricLightingRenderingPipeline extends PostProcessRend
|
|
|
264
330
|
* uniform update: only the directional lights and the kinds of the shadow maps shape the shader.
|
|
265
331
|
*/
|
|
266
332
|
private _updateSelection;
|
|
333
|
+
/**
|
|
334
|
+
* Detects when the pipeline has nothing to draw: no light reaches the view of the camera and the medium neither
|
|
335
|
+
* glows nor attenuates the scene. Every pass then exits right away, the composition outputs the color of the
|
|
336
|
+
* scene exactly as it would under light shafts of zero intensity, and the depth renderer the pipeline owns stops
|
|
337
|
+
* rendering the scene a second time. This is driven by uniforms rather than by detaching the passes, so a light
|
|
338
|
+
* blinking on and off, a muzzle flash typically, never rebuilds anything.
|
|
339
|
+
*/
|
|
340
|
+
private _updateIdleState;
|
|
341
|
+
/**
|
|
342
|
+
* Prepares the depth shaders of the meshes while the depth renderer the pipeline owns is off, a few meshes per
|
|
343
|
+
* frame. Without this, the first frame with something to draw after the scene got new meshes, or after the
|
|
344
|
+
* pipeline was created without anything to draw, would miss every mesh whose depth shader is still compiling.
|
|
345
|
+
* The checks are the ones the scene runs for its depth renderers when it waits to be ready.
|
|
346
|
+
*/
|
|
347
|
+
private _warmUpDepthRenderer;
|
|
267
348
|
/**
|
|
268
349
|
* Fills the four vectors describing a light in the raymarching shader. The packing follows what
|
|
269
350
|
* "Light.transferToEffect" writes for the surfaces of the scene so the shafts agree with them, except for
|
|
@@ -279,6 +360,7 @@ export declare class VolumetricLightingRenderingPipeline extends PostProcessRend
|
|
|
279
360
|
* makes them all associate each texel of the scattering buffer with the same texel of the linear depth.
|
|
280
361
|
*/
|
|
281
362
|
private _bindDepthRatio;
|
|
363
|
+
private _bindTemporal;
|
|
282
364
|
private _bindBlur;
|
|
283
365
|
private _bindCompose;
|
|
284
366
|
}
|
|
@@ -235,7 +235,7 @@ export interface IVolumetricShaderEnvironment {
|
|
|
235
235
|
transmittance: VolumetricTransmittanceMode;
|
|
236
236
|
/**
|
|
237
237
|
* Defines wether or not the linear depth of the scene is packed in an 8 bits RGBA texture because the
|
|
238
|
-
* engine can't render to a
|
|
238
|
+
* engine can't render to a float one.
|
|
239
239
|
*/
|
|
240
240
|
linearDepthPacked: boolean;
|
|
241
241
|
/**
|
|
@@ -245,7 +245,11 @@ export interface IVolumetricShaderEnvironment {
|
|
|
245
245
|
*/
|
|
246
246
|
arrayLightCapacity: number;
|
|
247
247
|
/**
|
|
248
|
-
* Defines the number of
|
|
248
|
+
* Defines the number of steps the directional lights are marched with each frame. @see getVolumetricSamplingSteps
|
|
249
|
+
*/
|
|
250
|
+
steps: number;
|
|
251
|
+
/**
|
|
252
|
+
* Defines the number of samples taken across the volume of each point and spot light each frame.
|
|
249
253
|
*/
|
|
250
254
|
lightSteps: number;
|
|
251
255
|
}
|