@zephyr3d/scene 0.9.20 → 0.9.22
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/dist/camera/camera.js +208 -208
- package/dist/camera/camera.js.map +1 -1
- package/dist/index.d.ts +9 -0
- package/dist/posteffect/posteffect.js +16 -0
- package/dist/posteffect/posteffect.js.map +1 -1
- package/dist/posteffect/ssgi.js +644 -0
- package/dist/posteffect/ssgi.js.map +1 -0
- package/dist/posteffect/sss.js +129 -44
- package/dist/posteffect/sss.js.map +1 -1
- package/dist/render/lightpass.js +5 -1
- package/dist/render/lightpass.js.map +1 -1
- package/dist/render/rendergraph/forward_plus_builder.js +21 -6
- package/dist/render/rendergraph/forward_plus_builder.js.map +1 -1
- package/dist/render/rendergraph/frame_graph_context.js +41 -0
- package/dist/render/rendergraph/frame_graph_context.js.map +1 -0
- package/dist/render/shadow_mask_pass.js +42 -39
- package/dist/render/shadow_mask_pass.js.map +1 -1
- package/dist/shaders/ssgi.js +63 -0
- package/dist/shaders/ssgi.js.map +1 -0
- package/dist/shadow/esm.js +3 -1
- package/dist/shadow/esm.js.map +1 -1
- package/dist/shadow/pcf_opt.js +4 -1
- package/dist/shadow/pcf_opt.js.map +1 -1
- package/dist/shadow/pcf_pd.js +4 -1
- package/dist/shadow/pcf_pd.js.map +1 -1
- package/dist/shadow/pcss.js +2 -0
- package/dist/shadow/pcss.js.map +1 -1
- package/dist/shadow/shadow_impl.js.map +1 -1
- package/dist/shadow/shadowmapper.js +5 -1
- package/dist/shadow/shadowmapper.js.map +1 -1
- package/dist/shadow/ssm.js +4 -1
- package/dist/shadow/ssm.js.map +1 -1
- package/dist/shadow/vsm.js +3 -1
- package/dist/shadow/vsm.js.map +1 -1
- package/dist/utility/serialization/scene/camera.js.map +1 -1
- package/package.json +1 -1
- package/dist/animation/joint_dynamics/convex_collider.js +0 -320
- package/dist/animation/joint_dynamics/convex_collider.js.map +0 -1
package/dist/camera/camera.js
CHANGED
|
@@ -47,24 +47,24 @@ const SSS_QUALITY_PRESET_SETTINGS = {
|
|
|
47
47
|
normalCutoff: 0.72
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
|
-
/**
|
|
51
|
-
* A renderable camera node that manages view/projection math, frusta,
|
|
52
|
-
* input control, picking, and a post-processing chain via a compositor.
|
|
53
|
-
*
|
|
54
|
-
* Key features:
|
|
55
|
-
* - Maintains projection, view, VP, and inverse VP matrices and lazily recomputes them when invalidated.
|
|
56
|
-
* - Provides world- and view-space frusta for culling and clipping.
|
|
57
|
-
* - Supports perspective and orthographic projections.
|
|
58
|
-
* - Integrates with post effects (Tonemap, FXAA, TAA, Bloom, SSR, SSS, SSAO, Motion Blur) through an internal `Compositor`.
|
|
59
|
-
* - Handles temporal jitter and history state when TAA or motion blur are enabled.
|
|
60
|
-
* - Emits picking rays from screen coordinates and supports async GPU picking.
|
|
61
|
-
* - Optional controller integration for user input handling.
|
|
62
|
-
*
|
|
63
|
-
* Performance notes:
|
|
64
|
-
* - Matrices/frusta are computed on demand and cached until invalidation.
|
|
65
|
-
* - Temporal jitter and history are set up only when required by enabled features and device support.
|
|
66
|
-
*
|
|
67
|
-
* @public
|
|
50
|
+
/**
|
|
51
|
+
* A renderable camera node that manages view/projection math, frusta,
|
|
52
|
+
* input control, picking, and a post-processing chain via a compositor.
|
|
53
|
+
*
|
|
54
|
+
* Key features:
|
|
55
|
+
* - Maintains projection, view, VP, and inverse VP matrices and lazily recomputes them when invalidated.
|
|
56
|
+
* - Provides world- and view-space frusta for culling and clipping.
|
|
57
|
+
* - Supports perspective and orthographic projections.
|
|
58
|
+
* - Integrates with post effects (Tonemap, FXAA, TAA, Bloom, SSR, SSS, SSAO, Motion Blur) through an internal `Compositor`.
|
|
59
|
+
* - Handles temporal jitter and history state when TAA or motion blur are enabled.
|
|
60
|
+
* - Emits picking rays from screen coordinates and supports async GPU picking.
|
|
61
|
+
* - Optional controller integration for user input handling.
|
|
62
|
+
*
|
|
63
|
+
* Performance notes:
|
|
64
|
+
* - Matrices/frusta are computed on demand and cached until invalidation.
|
|
65
|
+
* - Temporal jitter and history are set up only when required by enabled features and device support.
|
|
66
|
+
*
|
|
67
|
+
* @public
|
|
68
68
|
*/ class Camera extends SceneNode {
|
|
69
69
|
/** @internal Halton 2-3 sequence used for TAA jittering. */ static _halton23 = halton23(16);
|
|
70
70
|
/** @internal Per-camera history resources. */ static _historyData = new WeakMap();
|
|
@@ -177,14 +177,14 @@ const SSS_QUALITY_PRESET_SETTINGS = {
|
|
|
177
177
|
/** @internal Post-processing compositor attached to this camera. */ _compositor;
|
|
178
178
|
/** @internal Pointer interaction rectangle in css pixels (relative to canvas) */ _interactionRect;
|
|
179
179
|
/** @internal captured by which mouse button (-1 if not captured) */ _capturedButton;
|
|
180
|
-
/**
|
|
181
|
-
* Creates a new camera node.
|
|
182
|
-
*
|
|
183
|
-
* Initializes projection/view matrices, temporal fields, controller linkage, and
|
|
184
|
-
* builds the default post-processing pipeline on the internal compositor.
|
|
185
|
-
*
|
|
186
|
-
* @param scene - The scene that owns this camera.
|
|
187
|
-
* @param projectionMatrix - Optional projection matrix to initialize with.
|
|
180
|
+
/**
|
|
181
|
+
* Creates a new camera node.
|
|
182
|
+
*
|
|
183
|
+
* Initializes projection/view matrices, temporal fields, controller linkage, and
|
|
184
|
+
* builds the default post-processing pipeline on the internal compositor.
|
|
185
|
+
*
|
|
186
|
+
* @param scene - The scene that owns this camera.
|
|
187
|
+
* @param projectionMatrix - Optional projection matrix to initialize with.
|
|
188
188
|
*/ constructor(scene, projectionMatrix){
|
|
189
189
|
super(scene);
|
|
190
190
|
this._projMatrix = projectionMatrix || Matrix4x4.identity();
|
|
@@ -308,94 +308,94 @@ const SSS_QUALITY_PRESET_SETTINGS = {
|
|
|
308
308
|
scene.mainCamera = this;
|
|
309
309
|
}
|
|
310
310
|
}
|
|
311
|
-
/**
|
|
312
|
-
* The compositor that owns and runs the camera's post-processing chain.
|
|
311
|
+
/**
|
|
312
|
+
* The compositor that owns and runs the camera's post-processing chain.
|
|
313
313
|
*/ get compositor() {
|
|
314
314
|
return this._compositor;
|
|
315
315
|
}
|
|
316
|
-
/**
|
|
317
|
-
* Pointer interaction rectangle in css pixels (relative to canvas)
|
|
316
|
+
/**
|
|
317
|
+
* Pointer interaction rectangle in css pixels (relative to canvas)
|
|
318
318
|
*/ get interactionRect() {
|
|
319
319
|
return this._interactionRect;
|
|
320
320
|
}
|
|
321
321
|
set interactionRect(rect) {
|
|
322
322
|
this._interactionRect = rect;
|
|
323
323
|
}
|
|
324
|
-
/**
|
|
325
|
-
* Framebuffer clear color, or `null` to disable.
|
|
324
|
+
/**
|
|
325
|
+
* Framebuffer clear color, or `null` to disable.
|
|
326
326
|
*/ get clearColor() {
|
|
327
327
|
return this._clearColor;
|
|
328
328
|
}
|
|
329
329
|
set clearColor(v) {
|
|
330
330
|
this._clearColor = v?.clone() ?? null;
|
|
331
331
|
}
|
|
332
|
-
/**
|
|
333
|
-
* Framebuffer stencil clear value, disabled when null. Default is 0.
|
|
332
|
+
/**
|
|
333
|
+
* Framebuffer stencil clear value, disabled when null. Default is 0.
|
|
334
334
|
*/ get clearDepth() {
|
|
335
335
|
return this._clearDepth;
|
|
336
336
|
}
|
|
337
337
|
set clearDepth(v) {
|
|
338
338
|
this._clearDepth = v;
|
|
339
339
|
}
|
|
340
|
-
/**
|
|
341
|
-
* Framebuffer stencil clear value, disabled when null. Default is 0.
|
|
340
|
+
/**
|
|
341
|
+
* Framebuffer stencil clear value, disabled when null. Default is 0.
|
|
342
342
|
*/ get clearStencil() {
|
|
343
343
|
return this._clearStencil;
|
|
344
344
|
}
|
|
345
345
|
set clearStencil(v) {
|
|
346
346
|
this._clearStencil = v;
|
|
347
347
|
}
|
|
348
|
-
/**
|
|
349
|
-
* Whether Hi-Z acceleration is enabled.
|
|
350
|
-
*
|
|
351
|
-
* Often improves SSR performance with little quality impact when supported.
|
|
348
|
+
/**
|
|
349
|
+
* Whether Hi-Z acceleration is enabled.
|
|
350
|
+
*
|
|
351
|
+
* Often improves SSR performance with little quality impact when supported.
|
|
352
352
|
*/ get HiZ() {
|
|
353
353
|
return this._HiZ;
|
|
354
354
|
}
|
|
355
355
|
set HiZ(val) {
|
|
356
356
|
this._HiZ = !!val;
|
|
357
357
|
}
|
|
358
|
-
/**
|
|
359
|
-
* Whether the screen-space shadow mask is enabled.
|
|
360
|
-
*
|
|
361
|
-
* When enabled, shadow-casting lights are lit through the clustered pass and
|
|
362
|
-
* sample a pre-rendered screen-space shadow mask instead of each casting an
|
|
363
|
-
* additional full-scene additive light pass. Requires the depth prepass
|
|
364
|
-
* (always on in Forward+).
|
|
358
|
+
/**
|
|
359
|
+
* Whether the screen-space shadow mask is enabled.
|
|
360
|
+
*
|
|
361
|
+
* When enabled, shadow-casting lights are lit through the clustered pass and
|
|
362
|
+
* sample a pre-rendered screen-space shadow mask instead of each casting an
|
|
363
|
+
* additional full-scene additive light pass. Requires the depth prepass
|
|
364
|
+
* (always on in Forward+).
|
|
365
365
|
*/ get screenSpaceShadowMask() {
|
|
366
366
|
return this._screenSpaceShadowMask;
|
|
367
367
|
}
|
|
368
368
|
set screenSpaceShadowMask(val) {
|
|
369
369
|
this._screenSpaceShadowMask = !!val;
|
|
370
370
|
}
|
|
371
|
-
/**
|
|
372
|
-
* Render path used by the scene renderer.
|
|
371
|
+
/**
|
|
372
|
+
* Render path used by the scene renderer.
|
|
373
373
|
*/ get renderPath() {
|
|
374
374
|
return this._renderPath;
|
|
375
375
|
}
|
|
376
376
|
set renderPath(_val) {
|
|
377
377
|
this._renderPath = 'forward';
|
|
378
378
|
}
|
|
379
|
-
/**
|
|
380
|
-
* Whether HDR backbuffer is enabled.
|
|
381
|
-
*
|
|
382
|
-
* Tonemap should be disabled when not using HDR backbuffer.
|
|
379
|
+
/**
|
|
380
|
+
* Whether HDR backbuffer is enabled.
|
|
381
|
+
*
|
|
382
|
+
* Tonemap should be disabled when not using HDR backbuffer.
|
|
383
383
|
*/ get HDR() {
|
|
384
384
|
return this._HDR;
|
|
385
385
|
}
|
|
386
386
|
set HDR(val) {
|
|
387
387
|
this._HDR = !!val;
|
|
388
388
|
}
|
|
389
|
-
/**
|
|
390
|
-
* Whether tonemapping is enabled via the post effect.
|
|
389
|
+
/**
|
|
390
|
+
* Whether tonemapping is enabled via the post effect.
|
|
391
391
|
*/ get toneMap() {
|
|
392
392
|
return this._postEffectTonemap.get().enabled;
|
|
393
393
|
}
|
|
394
394
|
set toneMap(val) {
|
|
395
395
|
this._postEffectTonemap.get().enabled = !!val;
|
|
396
396
|
}
|
|
397
|
-
/**
|
|
398
|
-
* Whether motion blur is enabled via the post effect.
|
|
397
|
+
/**
|
|
398
|
+
* Whether motion blur is enabled via the post effect.
|
|
399
399
|
*/ get motionBlur() {
|
|
400
400
|
return this._postEffectMotionBlur.get().enabled;
|
|
401
401
|
}
|
|
@@ -411,16 +411,16 @@ const SSS_QUALITY_PRESET_SETTINGS = {
|
|
|
411
411
|
this._postEffectMotionBlur.get().strength = this._motionBlurStrength;
|
|
412
412
|
}
|
|
413
413
|
}
|
|
414
|
-
/**
|
|
415
|
-
* Gets whether Bloom is enabled.
|
|
414
|
+
/**
|
|
415
|
+
* Gets whether Bloom is enabled.
|
|
416
416
|
*/ get bloom() {
|
|
417
417
|
return this._postEffectBloom.get().enabled;
|
|
418
418
|
}
|
|
419
419
|
set bloom(val) {
|
|
420
420
|
this._postEffectBloom.get().enabled = !!val;
|
|
421
421
|
}
|
|
422
|
-
/**
|
|
423
|
-
* Maximum bloom downsample levels
|
|
422
|
+
/**
|
|
423
|
+
* Maximum bloom downsample levels
|
|
424
424
|
*/ get bloomMaxDownsampleLevels() {
|
|
425
425
|
return this._bloomMaxDownsampleLevels;
|
|
426
426
|
}
|
|
@@ -430,8 +430,8 @@ const SSS_QUALITY_PRESET_SETTINGS = {
|
|
|
430
430
|
this._postEffectBloom.get().maxDownsampleLevel = val;
|
|
431
431
|
}
|
|
432
432
|
}
|
|
433
|
-
/**
|
|
434
|
-
* Bloom downsample limit
|
|
433
|
+
/**
|
|
434
|
+
* Bloom downsample limit
|
|
435
435
|
*/ get bloomDownsampleLimit() {
|
|
436
436
|
return this._bloomDownsampleLimit;
|
|
437
437
|
}
|
|
@@ -441,8 +441,8 @@ const SSS_QUALITY_PRESET_SETTINGS = {
|
|
|
441
441
|
this._postEffectBloom.get().downsampleLimit = val;
|
|
442
442
|
}
|
|
443
443
|
}
|
|
444
|
-
/**
|
|
445
|
-
* Bloom threshold
|
|
444
|
+
/**
|
|
445
|
+
* Bloom threshold
|
|
446
446
|
*/ get bloomThreshold() {
|
|
447
447
|
return this._bloomThreshold;
|
|
448
448
|
}
|
|
@@ -452,8 +452,8 @@ const SSS_QUALITY_PRESET_SETTINGS = {
|
|
|
452
452
|
this._postEffectBloom.get().threshold = val;
|
|
453
453
|
}
|
|
454
454
|
}
|
|
455
|
-
/**
|
|
456
|
-
* Bloom threshold knee
|
|
455
|
+
/**
|
|
456
|
+
* Bloom threshold knee
|
|
457
457
|
*/ get bloomThresholdKnee() {
|
|
458
458
|
return this._bloomThresholdKnee;
|
|
459
459
|
}
|
|
@@ -463,8 +463,8 @@ const SSS_QUALITY_PRESET_SETTINGS = {
|
|
|
463
463
|
this._postEffectBloom.get().thresholdKnee = val;
|
|
464
464
|
}
|
|
465
465
|
}
|
|
466
|
-
/**
|
|
467
|
-
* Bloom intensity
|
|
466
|
+
/**
|
|
467
|
+
* Bloom intensity
|
|
468
468
|
*/ get bloomIntensity() {
|
|
469
469
|
return this._bloomIntensity;
|
|
470
470
|
}
|
|
@@ -516,16 +516,16 @@ const SSS_QUALITY_PRESET_SETTINGS = {
|
|
|
516
516
|
this._postEffectColorAdjust.get().sharpen = val;
|
|
517
517
|
}
|
|
518
518
|
}
|
|
519
|
-
/**
|
|
520
|
-
* Gets whether FXAA is enabled.
|
|
519
|
+
/**
|
|
520
|
+
* Gets whether FXAA is enabled.
|
|
521
521
|
*/ get FXAA() {
|
|
522
522
|
return this._postEffectFXAA.get().enabled;
|
|
523
523
|
}
|
|
524
524
|
set FXAA(val) {
|
|
525
525
|
this._postEffectFXAA.get().enabled = !!val;
|
|
526
526
|
}
|
|
527
|
-
/**
|
|
528
|
-
* Tonemap exposure
|
|
527
|
+
/**
|
|
528
|
+
* Tonemap exposure
|
|
529
529
|
*/ get toneMapExposure() {
|
|
530
530
|
return this._tonemapExposure;
|
|
531
531
|
}
|
|
@@ -535,156 +535,156 @@ const SSS_QUALITY_PRESET_SETTINGS = {
|
|
|
535
535
|
this._postEffectTonemap.get().exposure = val;
|
|
536
536
|
}
|
|
537
537
|
}
|
|
538
|
-
/**
|
|
539
|
-
* Gets whether TAA is enabled.
|
|
538
|
+
/**
|
|
539
|
+
* Gets whether TAA is enabled.
|
|
540
540
|
*/ get TAA() {
|
|
541
541
|
return this._postEffectTAA.get().enabled;
|
|
542
542
|
}
|
|
543
543
|
set TAA(val) {
|
|
544
544
|
this._postEffectTAA.get().enabled = !!val;
|
|
545
545
|
}
|
|
546
|
-
/**
|
|
547
|
-
* Gets the debug flag for TAA
|
|
546
|
+
/**
|
|
547
|
+
* Gets the debug flag for TAA
|
|
548
548
|
*/ get TAADebug() {
|
|
549
549
|
return this._TAADebug;
|
|
550
550
|
}
|
|
551
551
|
set TAADebug(val) {
|
|
552
552
|
this._TAADebug = val;
|
|
553
553
|
}
|
|
554
|
-
/**
|
|
555
|
-
* Enables cascade debug visualization for directional shadows.
|
|
554
|
+
/**
|
|
555
|
+
* Enables cascade debug visualization for directional shadows.
|
|
556
556
|
*/ get shadowDebugCascades() {
|
|
557
557
|
return this._shadowDebugCascades;
|
|
558
558
|
}
|
|
559
559
|
set shadowDebugCascades(val) {
|
|
560
560
|
this._shadowDebugCascades = !!val;
|
|
561
561
|
}
|
|
562
|
-
/**
|
|
563
|
-
* Gets whether Screen Space Reflections (SSR) is enabled.
|
|
562
|
+
/**
|
|
563
|
+
* Gets whether Screen Space Reflections (SSR) is enabled.
|
|
564
564
|
*/ get SSR() {
|
|
565
565
|
return this._postEffectSSR.get().enabled;
|
|
566
566
|
}
|
|
567
567
|
set SSR(val) {
|
|
568
568
|
this._postEffectSSR.get().enabled = !!val;
|
|
569
569
|
}
|
|
570
|
-
/**
|
|
571
|
-
* Gets the maximum roughness value for screen space reflections.
|
|
572
|
-
* Controls the cutoff point where surfaces are considered too rough for SSR.
|
|
570
|
+
/**
|
|
571
|
+
* Gets the maximum roughness value for screen space reflections.
|
|
572
|
+
* Controls the cutoff point where surfaces are considered too rough for SSR.
|
|
573
573
|
*/ get ssrMaxRoughness() {
|
|
574
574
|
return this._ssrMaxRoughness;
|
|
575
575
|
}
|
|
576
576
|
set ssrMaxRoughness(val) {
|
|
577
577
|
this._ssrMaxRoughness = val;
|
|
578
578
|
}
|
|
579
|
-
/**
|
|
580
|
-
* Gets the roughness factor for SSR calculations.
|
|
581
|
-
* Affects how surface roughness influences reflection clarity.
|
|
579
|
+
/**
|
|
580
|
+
* Gets the roughness factor for SSR calculations.
|
|
581
|
+
* Affects how surface roughness influences reflection clarity.
|
|
582
582
|
*/ get ssrRoughnessFactor() {
|
|
583
583
|
return this._ssrRoughnessFactor;
|
|
584
584
|
}
|
|
585
585
|
set ssrRoughnessFactor(val) {
|
|
586
586
|
this._ssrRoughnessFactor = val;
|
|
587
587
|
}
|
|
588
|
-
/**
|
|
589
|
-
* Gets the stride value for SSR ray marching.
|
|
590
|
-
* Controls the step size during ray marching. Larger values improve performance but may miss details.
|
|
588
|
+
/**
|
|
589
|
+
* Gets the stride value for SSR ray marching.
|
|
590
|
+
* Controls the step size during ray marching. Larger values improve performance but may miss details.
|
|
591
591
|
*/ get ssrStride() {
|
|
592
592
|
return this._ssrStride;
|
|
593
593
|
}
|
|
594
594
|
set ssrStride(val) {
|
|
595
595
|
this._ssrStride = val;
|
|
596
596
|
}
|
|
597
|
-
/**
|
|
598
|
-
* Gets the maximum distance for SSR ray marching.
|
|
599
|
-
* Defines how far rays will travel when searching for reflection intersections.
|
|
597
|
+
/**
|
|
598
|
+
* Gets the maximum distance for SSR ray marching.
|
|
599
|
+
* Defines how far rays will travel when searching for reflection intersections.
|
|
600
600
|
*/ get ssrMaxDistance() {
|
|
601
601
|
return this._ssrParams.x;
|
|
602
602
|
}
|
|
603
603
|
set ssrMaxDistance(val) {
|
|
604
604
|
this._ssrParams.x = val;
|
|
605
605
|
}
|
|
606
|
-
/**
|
|
607
|
-
* Gets the number of iterations for SSR ray marching.
|
|
608
|
-
* Higher values provide more accurate reflections but impact performance.
|
|
606
|
+
/**
|
|
607
|
+
* Gets the number of iterations for SSR ray marching.
|
|
608
|
+
* Higher values provide more accurate reflections but impact performance.
|
|
609
609
|
*/ get ssrIterations() {
|
|
610
610
|
return this._ssrParams.y;
|
|
611
611
|
}
|
|
612
612
|
set ssrIterations(val) {
|
|
613
613
|
this._ssrParams.y = val;
|
|
614
614
|
}
|
|
615
|
-
/**
|
|
616
|
-
* Gets the thickness value for SSR calculations.
|
|
617
|
-
* Determines the thickness threshold for surfaces when calculating reflections.
|
|
615
|
+
/**
|
|
616
|
+
* Gets the thickness value for SSR calculations.
|
|
617
|
+
* Determines the thickness threshold for surfaces when calculating reflections.
|
|
618
618
|
*/ get ssrThickness() {
|
|
619
619
|
return this._ssrParams.z;
|
|
620
620
|
}
|
|
621
621
|
set ssrThickness(val) {
|
|
622
622
|
this._ssrParams.z = val;
|
|
623
623
|
}
|
|
624
|
-
/**
|
|
625
|
-
* Gets whether SSR should calculate thickness automatically.
|
|
626
|
-
* When enabled, the system will dynamically compute surface thickness for reflections.
|
|
624
|
+
/**
|
|
625
|
+
* Gets whether SSR should calculate thickness automatically.
|
|
626
|
+
* When enabled, the system will dynamically compute surface thickness for reflections.
|
|
627
627
|
*/ get ssrCalcThickness() {
|
|
628
628
|
return this._ssrCalcThickness;
|
|
629
629
|
}
|
|
630
630
|
set ssrCalcThickness(val) {
|
|
631
631
|
this._ssrCalcThickness = !!val;
|
|
632
632
|
}
|
|
633
|
-
/**
|
|
634
|
-
* Gets the blur scale factor for SSR.
|
|
635
|
-
* Controls the overall intensity of the blur effect applied to reflections.
|
|
633
|
+
/**
|
|
634
|
+
* Gets the blur scale factor for SSR.
|
|
635
|
+
* Controls the overall intensity of the blur effect applied to reflections.
|
|
636
636
|
*/ get ssrBlurScale() {
|
|
637
637
|
return this._ssrBlurriness;
|
|
638
638
|
}
|
|
639
639
|
set ssrBlurScale(val) {
|
|
640
640
|
this._ssrBlurriness = val;
|
|
641
641
|
}
|
|
642
|
-
/**
|
|
643
|
-
* Gets the depth cutoff value for SSR blur.
|
|
644
|
-
* Determines at what depth difference the blur effect should be reduced or eliminated.
|
|
642
|
+
/**
|
|
643
|
+
* Gets the depth cutoff value for SSR blur.
|
|
644
|
+
* Determines at what depth difference the blur effect should be reduced or eliminated.
|
|
645
645
|
*/ get ssrBlurDepthCutoff() {
|
|
646
646
|
return this._ssrBlurDepthCutoff;
|
|
647
647
|
}
|
|
648
648
|
set ssrBlurDepthCutoff(val) {
|
|
649
649
|
this._ssrBlurDepthCutoff = val;
|
|
650
650
|
}
|
|
651
|
-
/**
|
|
652
|
-
* Gets the kernel size for the SSR blur effect.
|
|
653
|
-
* Defines the size of the blur kernel. Larger values create softer, more spread-out blur.
|
|
651
|
+
/**
|
|
652
|
+
* Gets the kernel size for the SSR blur effect.
|
|
653
|
+
* Defines the size of the blur kernel. Larger values create softer, more spread-out blur.
|
|
654
654
|
*/ get ssrBlurKernelSize() {
|
|
655
655
|
return this._ssrBlurKernelSize;
|
|
656
656
|
}
|
|
657
657
|
set ssrBlurKernelSize(val) {
|
|
658
658
|
this._ssrBlurKernelSize = val;
|
|
659
659
|
}
|
|
660
|
-
/**
|
|
661
|
-
* Gets the standard deviation for the SSR Gaussian blur.
|
|
662
|
-
* Controls the distribution of the blur effect. Higher values create more pronounced blur.
|
|
660
|
+
/**
|
|
661
|
+
* Gets the standard deviation for the SSR Gaussian blur.
|
|
662
|
+
* Controls the distribution of the blur effect. Higher values create more pronounced blur.
|
|
663
663
|
*/ get ssrBlurStdDev() {
|
|
664
664
|
return this._ssrBlurStdDev;
|
|
665
665
|
}
|
|
666
666
|
set ssrBlurStdDev(val) {
|
|
667
667
|
this._ssrBlurStdDev = val;
|
|
668
668
|
}
|
|
669
|
-
/**
|
|
670
|
-
* Gets whether SSR temporal accumulation is enabled.
|
|
669
|
+
/**
|
|
670
|
+
* Gets whether SSR temporal accumulation is enabled.
|
|
671
671
|
*/ get ssrTemporal() {
|
|
672
672
|
return this._ssrTemporal;
|
|
673
673
|
}
|
|
674
674
|
set ssrTemporal(val) {
|
|
675
675
|
this._ssrTemporal = !!val;
|
|
676
676
|
}
|
|
677
|
-
/**
|
|
678
|
-
* Gets SSR temporal blending weight in [0, 1].
|
|
679
|
-
* Higher values rely more on reprojected history.
|
|
677
|
+
/**
|
|
678
|
+
* Gets SSR temporal blending weight in [0, 1].
|
|
679
|
+
* Higher values rely more on reprojected history.
|
|
680
680
|
*/ get ssrTemporalWeight() {
|
|
681
681
|
return this._ssrTemporalWeight;
|
|
682
682
|
}
|
|
683
683
|
set ssrTemporalWeight(val) {
|
|
684
684
|
this._ssrTemporalWeight = Math.max(0, Math.min(1, val ?? 0));
|
|
685
685
|
}
|
|
686
|
-
/**
|
|
687
|
-
* Gets whether Screen Space Subsurface Scattering (SSS) is enabled.
|
|
686
|
+
/**
|
|
687
|
+
* Gets whether Screen Space Subsurface Scattering (SSS) is enabled.
|
|
688
688
|
*/ get SSS() {
|
|
689
689
|
return this._postEffectSSS.get().enabled;
|
|
690
690
|
}
|
|
@@ -697,11 +697,11 @@ const SSS_QUALITY_PRESET_SETTINGS = {
|
|
|
697
697
|
set sssBlurScale(val) {
|
|
698
698
|
this._sssBlurScale = Math.max(0, val ?? 0);
|
|
699
699
|
}
|
|
700
|
-
/**
|
|
701
|
-
* High-level quality preset for SSS blur controls.
|
|
702
|
-
*
|
|
703
|
-
* This is the primary user-facing SSS quality control and only affects
|
|
704
|
-
* the blur sampling quality/performance tradeoff, not the authored look.
|
|
700
|
+
/**
|
|
701
|
+
* High-level quality preset for SSS blur controls.
|
|
702
|
+
*
|
|
703
|
+
* This is the primary user-facing SSS quality control and only affects
|
|
704
|
+
* the blur sampling quality/performance tradeoff, not the authored look.
|
|
705
705
|
*/ get sssQualityPreset() {
|
|
706
706
|
return this._sssQualityPreset;
|
|
707
707
|
}
|
|
@@ -799,8 +799,8 @@ const SSS_QUALITY_PRESET_SETTINGS = {
|
|
|
799
799
|
/** @internal */ get ssrParams() {
|
|
800
800
|
return this._ssrParams;
|
|
801
801
|
}
|
|
802
|
-
/**
|
|
803
|
-
* Gets whether SSAO is enabled.
|
|
802
|
+
/**
|
|
803
|
+
* Gets whether SSAO is enabled.
|
|
804
804
|
*/ get SSAO() {
|
|
805
805
|
return this._postEffectSSAO.get().enabled;
|
|
806
806
|
}
|
|
@@ -955,27 +955,27 @@ const SSS_QUALITY_PRESET_SETTINGS = {
|
|
|
955
955
|
}
|
|
956
956
|
return this._viewport;
|
|
957
957
|
}
|
|
958
|
-
/**
|
|
959
|
-
* Screen configuration used for adapting the camera viewport
|
|
958
|
+
/**
|
|
959
|
+
* Screen configuration used for adapting the camera viewport
|
|
960
960
|
*/ get screenConfig() {
|
|
961
961
|
return this._screenAdapter.config;
|
|
962
962
|
}
|
|
963
963
|
set screenConfig(config) {
|
|
964
964
|
this._screenAdapter.config = config;
|
|
965
965
|
}
|
|
966
|
-
/**
|
|
967
|
-
* Screen viewport used for adapting the camera viewport
|
|
966
|
+
/**
|
|
967
|
+
* Screen viewport used for adapting the camera viewport
|
|
968
968
|
*/ get screenViewport() {
|
|
969
969
|
return this._screenAdapter.viewport;
|
|
970
970
|
}
|
|
971
971
|
set screenViewport(viewport) {
|
|
972
972
|
this._screenAdapter.viewport = viewport;
|
|
973
973
|
}
|
|
974
|
-
/**
|
|
975
|
-
* Handle input events
|
|
976
|
-
* @param ev - input event object
|
|
977
|
-
* @param type - event type, default to ev.type
|
|
978
|
-
* @returns Boolean value indicates whether the event was handled.
|
|
974
|
+
/**
|
|
975
|
+
* Handle input events
|
|
976
|
+
* @param ev - input event object
|
|
977
|
+
* @param type - event type, default to ev.type
|
|
978
|
+
* @returns Boolean value indicates whether the event was handled.
|
|
979
979
|
*/ handleEvent(ev, type) {
|
|
980
980
|
let handled = false;
|
|
981
981
|
if (this._controller) {
|
|
@@ -1008,12 +1008,12 @@ const SSS_QUALITY_PRESET_SETTINGS = {
|
|
|
1008
1008
|
}
|
|
1009
1009
|
return handled;
|
|
1010
1010
|
}
|
|
1011
|
-
/**
|
|
1012
|
-
* Constructs a ray based on the given screen coordinates.
|
|
1013
|
-
*
|
|
1014
|
-
* @param x - The x-component of the screen coordinates, relative to the top-left corner of the viewport.
|
|
1015
|
-
* @param y - The y-component of the screen coordinates, relative to the top-left corner of the viewport.
|
|
1016
|
-
* @returns The ray originating from the camera position and passing through the given screen coordinates.
|
|
1011
|
+
/**
|
|
1012
|
+
* Constructs a ray based on the given screen coordinates.
|
|
1013
|
+
*
|
|
1014
|
+
* @param x - The x-component of the screen coordinates, relative to the top-left corner of the viewport.
|
|
1015
|
+
* @param y - The y-component of the screen coordinates, relative to the top-left corner of the viewport.
|
|
1016
|
+
* @returns The ray originating from the camera position and passing through the given screen coordinates.
|
|
1017
1017
|
*/ constructRay(x, y) {
|
|
1018
1018
|
const width = this.viewport ? this.viewport[2] : getDevice().getViewport().width;
|
|
1019
1019
|
const height = this.viewport ? this.viewport[3] : getDevice().getViewport().height;
|
|
@@ -1031,54 +1031,54 @@ const SSS_QUALITY_PRESET_SETTINGS = {
|
|
|
1031
1031
|
const vDir = Vector3.sub(farWorld.xyz(), vEye).inplaceNormalize();
|
|
1032
1032
|
return new Ray(vEye, vDir);
|
|
1033
1033
|
}
|
|
1034
|
-
/**
|
|
1035
|
-
* Place the camera by specifying the camera position and the target point
|
|
1036
|
-
* @param eye - The camera position
|
|
1037
|
-
* @param target - The target point to look at
|
|
1038
|
-
* @param up - The up vector
|
|
1039
|
-
* @returns self
|
|
1034
|
+
/**
|
|
1035
|
+
* Place the camera by specifying the camera position and the target point
|
|
1036
|
+
* @param eye - The camera position
|
|
1037
|
+
* @param target - The target point to look at
|
|
1038
|
+
* @param up - The up vector
|
|
1039
|
+
* @returns self
|
|
1040
1040
|
*/ lookAt(eye, target, up) {
|
|
1041
1041
|
return this.setLocalTransform(Matrix4x4.lookAt(eye, target, up));
|
|
1042
1042
|
}
|
|
1043
|
-
/**
|
|
1044
|
-
* Place the camera to look at a given cube face at a given camera position
|
|
1045
|
-
* @param face - The cube face to look at
|
|
1046
|
-
* @param position - The camera position
|
|
1047
|
-
* @returns self
|
|
1043
|
+
/**
|
|
1044
|
+
* Place the camera to look at a given cube face at a given camera position
|
|
1045
|
+
* @param face - The cube face to look at
|
|
1046
|
+
* @param position - The camera position
|
|
1047
|
+
* @returns self
|
|
1048
1048
|
*/ lookAtCubeFace(face, position) {
|
|
1049
1049
|
return this.setLocalTransform(Matrix4x4.lookAtCubeFace(face, position ?? this.position));
|
|
1050
1050
|
}
|
|
1051
|
-
/**
|
|
1052
|
-
* Setup a perspective projection matrix for the camera
|
|
1053
|
-
* @param fovY - The vertical field of view in radians.
|
|
1054
|
-
* @param aspect - The aspect ratio
|
|
1055
|
-
* @param zNear - The near clip plane
|
|
1056
|
-
* @param zFar - The far clip plane
|
|
1057
|
-
* @returns self
|
|
1051
|
+
/**
|
|
1052
|
+
* Setup a perspective projection matrix for the camera
|
|
1053
|
+
* @param fovY - The vertical field of view in radians.
|
|
1054
|
+
* @param aspect - The aspect ratio
|
|
1055
|
+
* @param zNear - The near clip plane
|
|
1056
|
+
* @param zFar - The far clip plane
|
|
1057
|
+
* @returns self
|
|
1058
1058
|
*/ setPerspective(fovY, aspect, zNear, zFar) {
|
|
1059
1059
|
this._projMatrix.perspective(fovY, aspect, zNear, zFar);
|
|
1060
1060
|
Matrix4x4.invert(this._projMatrix, this._invProjMatrix);
|
|
1061
1061
|
this._invalidate(true);
|
|
1062
1062
|
return this;
|
|
1063
1063
|
}
|
|
1064
|
-
/**
|
|
1065
|
-
* Setup a orthogonal projection matrix for the camera
|
|
1066
|
-
* @param left - Left bound of the frustum
|
|
1067
|
-
* @param right - Right bound of the frustum
|
|
1068
|
-
* @param bottom - Bottom bound of the frustum
|
|
1069
|
-
* @param top - Top bound of the frustum
|
|
1070
|
-
* @param near - Near bound of the frustum.
|
|
1071
|
-
* @param far - Far bound of the frustum.
|
|
1072
|
-
* @returns self
|
|
1064
|
+
/**
|
|
1065
|
+
* Setup a orthogonal projection matrix for the camera
|
|
1066
|
+
* @param left - Left bound of the frustum
|
|
1067
|
+
* @param right - Right bound of the frustum
|
|
1068
|
+
* @param bottom - Bottom bound of the frustum
|
|
1069
|
+
* @param top - Top bound of the frustum
|
|
1070
|
+
* @param near - Near bound of the frustum.
|
|
1071
|
+
* @param far - Far bound of the frustum.
|
|
1072
|
+
* @returns self
|
|
1073
1073
|
*/ setOrtho(left, right, bottom, top, near, far) {
|
|
1074
1074
|
this._projMatrix.ortho(left, right, bottom, top, near, far);
|
|
1075
1075
|
Matrix4x4.invert(this._projMatrix, this._invProjMatrix);
|
|
1076
1076
|
this._invalidate(true);
|
|
1077
1077
|
return this;
|
|
1078
1078
|
}
|
|
1079
|
-
/**
|
|
1080
|
-
* Setup a projection matrix for the camera
|
|
1081
|
-
* @param matrix - The projection matrix
|
|
1079
|
+
/**
|
|
1080
|
+
* Setup a projection matrix for the camera
|
|
1081
|
+
* @param matrix - The projection matrix
|
|
1082
1082
|
*/ setProjectionMatrix(matrix) {
|
|
1083
1083
|
if (matrix && matrix !== this._projMatrix) {
|
|
1084
1084
|
this._projMatrix = matrix;
|
|
@@ -1086,18 +1086,18 @@ const SSS_QUALITY_PRESET_SETTINGS = {
|
|
|
1086
1086
|
this._invalidate(true);
|
|
1087
1087
|
}
|
|
1088
1088
|
}
|
|
1089
|
-
/**
|
|
1090
|
-
* Gets the projection matrix of the camera
|
|
1091
|
-
* @returns The projection matrix
|
|
1089
|
+
/**
|
|
1090
|
+
* Gets the projection matrix of the camera
|
|
1091
|
+
* @returns The projection matrix
|
|
1092
1092
|
*/ getProjectionMatrix() {
|
|
1093
1093
|
if (this.dirtyCheck()) {
|
|
1094
1094
|
this._compute();
|
|
1095
1095
|
}
|
|
1096
1096
|
return this._projMatrix;
|
|
1097
1097
|
}
|
|
1098
|
-
/**
|
|
1099
|
-
* Gets the inverse projection matrix of the camera
|
|
1100
|
-
* @returns The projection matrix
|
|
1098
|
+
/**
|
|
1099
|
+
* Gets the inverse projection matrix of the camera
|
|
1100
|
+
* @returns The projection matrix
|
|
1101
1101
|
*/ getInvProjectionMatrix() {
|
|
1102
1102
|
if (this.dirtyCheck()) {
|
|
1103
1103
|
this._compute();
|
|
@@ -1115,11 +1115,11 @@ const SSS_QUALITY_PRESET_SETTINGS = {
|
|
|
1115
1115
|
rotationMatrix.setRow(2, new Vector4(zAxis.x, zAxis.y, zAxis.z, 0));
|
|
1116
1116
|
return rotationMatrix;
|
|
1117
1117
|
}
|
|
1118
|
-
/**
|
|
1119
|
-
* View matrix of the camera
|
|
1120
|
-
*
|
|
1121
|
-
* @remarks
|
|
1122
|
-
* Camera's view matrix will transform a point from the world space to the camera space
|
|
1118
|
+
/**
|
|
1119
|
+
* View matrix of the camera
|
|
1120
|
+
*
|
|
1121
|
+
* @remarks
|
|
1122
|
+
* Camera's view matrix will transform a point from the world space to the camera space
|
|
1123
1123
|
*/ get viewMatrix() {
|
|
1124
1124
|
if (this.dirtyCheck()) {
|
|
1125
1125
|
this._compute();
|
|
@@ -1132,11 +1132,11 @@ const SSS_QUALITY_PRESET_SETTINGS = {
|
|
|
1132
1132
|
}
|
|
1133
1133
|
return this._viewProjMatrix;
|
|
1134
1134
|
}
|
|
1135
|
-
/**
|
|
1136
|
-
* The inverse-view-projection matrix of the camera
|
|
1137
|
-
*
|
|
1138
|
-
* @remarks
|
|
1139
|
-
* The inverse-view-projection matrix transforms a point from the clip space to the camera space
|
|
1135
|
+
/**
|
|
1136
|
+
* The inverse-view-projection matrix of the camera
|
|
1137
|
+
*
|
|
1138
|
+
* @remarks
|
|
1139
|
+
* The inverse-view-projection matrix transforms a point from the clip space to the camera space
|
|
1140
1140
|
*/ get invViewProjectionMatrix() {
|
|
1141
1141
|
if (this.dirtyCheck()) {
|
|
1142
1142
|
this._compute();
|
|
@@ -1188,9 +1188,9 @@ const SSS_QUALITY_PRESET_SETTINGS = {
|
|
|
1188
1188
|
/** Returns true if the camera is orthographic */ isOrtho() {
|
|
1189
1189
|
return this.getProjectionMatrix().isOrtho();
|
|
1190
1190
|
}
|
|
1191
|
-
/**
|
|
1192
|
-
* Gets the camera history data which is used in temporal reprojection
|
|
1193
|
-
* @returns Camera history data
|
|
1191
|
+
/**
|
|
1192
|
+
* Gets the camera history data which is used in temporal reprojection
|
|
1193
|
+
* @returns Camera history data
|
|
1194
1194
|
*/ getHistoryData() {
|
|
1195
1195
|
let data = Camera._historyData.get(this);
|
|
1196
1196
|
if (!data) {
|
|
@@ -1204,8 +1204,8 @@ const SSS_QUALITY_PRESET_SETTINGS = {
|
|
|
1204
1204
|
}
|
|
1205
1205
|
return data;
|
|
1206
1206
|
}
|
|
1207
|
-
/**
|
|
1208
|
-
* Clears the camera history data which is used in temporal reprojection
|
|
1207
|
+
/**
|
|
1208
|
+
* Clears the camera history data which is used in temporal reprojection
|
|
1209
1209
|
*/ clearHistoryData() {
|
|
1210
1210
|
const data = Camera._historyData.get(this);
|
|
1211
1211
|
if (data) {
|
|
@@ -1335,10 +1335,10 @@ const SSS_QUALITY_PRESET_SETTINGS = {
|
|
|
1335
1335
|
this._sssResolvedSettings.blurDepthCutoff = source.blurDepthCutoff;
|
|
1336
1336
|
this._sssResolvedSettings.normalCutoff = source.normalCutoff;
|
|
1337
1337
|
}
|
|
1338
|
-
/**
|
|
1339
|
-
* Renders a scene
|
|
1340
|
-
* @param scene - The scene to be rendered
|
|
1341
|
-
* @param compositor - Compositor instance that will be used to apply postprocess effects
|
|
1338
|
+
/**
|
|
1339
|
+
* Renders a scene
|
|
1340
|
+
* @param scene - The scene to be rendered
|
|
1341
|
+
* @param compositor - Compositor instance that will be used to apply postprocess effects
|
|
1342
1342
|
*/ render(scene) {
|
|
1343
1343
|
const device = getDevice();
|
|
1344
1344
|
//this.updatePostProcessing(device);
|
|
@@ -1412,13 +1412,13 @@ const SSS_QUALITY_PRESET_SETTINGS = {
|
|
|
1412
1412
|
/** @internal */ getPickPosY() {
|
|
1413
1413
|
return this._pickPosY;
|
|
1414
1414
|
}
|
|
1415
|
-
/**
|
|
1416
|
-
* Updates the controller state
|
|
1415
|
+
/**
|
|
1416
|
+
* Updates the controller state
|
|
1417
1417
|
*/ updateController() {
|
|
1418
1418
|
this._controller?.update();
|
|
1419
1419
|
}
|
|
1420
|
-
/**
|
|
1421
|
-
* Reset the controller
|
|
1420
|
+
/**
|
|
1421
|
+
* Reset the controller
|
|
1422
1422
|
*/ resetController() {
|
|
1423
1423
|
this._controller?.reset();
|
|
1424
1424
|
}
|
|
@@ -1443,15 +1443,15 @@ const SSS_QUALITY_PRESET_SETTINGS = {
|
|
|
1443
1443
|
/** @internal */ get prevPosition() {
|
|
1444
1444
|
return this._prevPosition;
|
|
1445
1445
|
}
|
|
1446
|
-
/**
|
|
1447
|
-
* Gets the camera history resource manager for temporal effects.
|
|
1446
|
+
/**
|
|
1447
|
+
* Gets the camera history resource manager for temporal effects.
|
|
1448
1448
|
*/ getHistoryResourceManager() {
|
|
1449
1449
|
return Camera._historyResourceManager.get(this) ?? null;
|
|
1450
1450
|
}
|
|
1451
|
-
/**
|
|
1452
|
-
* Sets the camera history resource manager for temporal effects.
|
|
1453
|
-
*
|
|
1454
|
-
* @internal
|
|
1451
|
+
/**
|
|
1452
|
+
* Sets the camera history resource manager for temporal effects.
|
|
1453
|
+
*
|
|
1454
|
+
* @internal
|
|
1455
1455
|
*/ setHistoryResourceManager(manager) {
|
|
1456
1456
|
const current = Camera._historyResourceManager.get(this);
|
|
1457
1457
|
if (current && current !== manager) {
|