@hology/webgpu-renderer 0.1.22 → 0.1.24
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/index.d.ts +468 -179
- package/dist/index.js +1 -1
- package/package.json +6 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as three from 'three';
|
|
2
|
-
import { Object3D, Color, Vector2, Vector3, Vector4, Matrix3, Matrix4, Material, Texture, MaterialParameters, PerspectiveCamera, OrthographicCamera, BufferGeometry, DirectionalLight, PointLight, SpotLight, Scene } from 'three';
|
|
2
|
+
import { Object3D, Color, Vector2, Vector3, Vector4, Matrix3, Matrix4, Material, Texture, MaterialParameters, PerspectiveCamera, OrthographicCamera, BufferGeometry, DirectionalLight, PointLight, SpotLight, Scene, Camera } from 'three';
|
|
3
3
|
export { AmbientLight, BackSide, BatchedMesh, Bone, BoxGeometry, BufferAttribute, BufferGeometry, CanvasTexture, Color, CompressedArrayTexture, CompressedCubeTexture, CompressedTexture, CompressedArrayTexture as CompressedTextureArray, CubeTexture, Data3DTexture, DataArrayTexture, DataTexture, DepthTexture, DirectionalLight, DoubleSide, FrontSide, Group, HemisphereLight, InstancedMesh, MathUtils, Matrix4, Mesh, Object3D, OrthographicCamera, PerspectiveCamera, PlaneGeometry, PointLight, RepeatWrapping, Scene, Skeleton, SkinnedMesh, SphereGeometry, SpotLight, Texture, Vector2, Vector3, Vector4 } from 'three';
|
|
4
4
|
|
|
5
5
|
interface PipelineDiagnosticOrigin {
|
|
@@ -32,6 +32,14 @@ interface ResolvedDetailCulling {
|
|
|
32
32
|
declare function setObjectDetailCulling(object: Object3D, settings: DetailCullingSettings): void;
|
|
33
33
|
declare function resolveDetailCulling(object: Object3D | null, registration?: DetailCullingSettings): ResolvedDetailCulling;
|
|
34
34
|
|
|
35
|
+
interface StaticSpatialObject {
|
|
36
|
+
/** Refresh after geometry, inherited transforms, or detail policy changes. */
|
|
37
|
+
update(): void;
|
|
38
|
+
/** Edited objects temporarily return to ordinary scene traversal. */
|
|
39
|
+
setEditing(editing: boolean): void;
|
|
40
|
+
dispose(): void;
|
|
41
|
+
}
|
|
42
|
+
|
|
35
43
|
type ShaderDefineValue = string | number | boolean;
|
|
36
44
|
type ShaderDefines = Record<string, ShaderDefineValue | null | undefined>;
|
|
37
45
|
|
|
@@ -65,6 +73,8 @@ interface WGSLStorageBufferBinding {
|
|
|
65
73
|
buffer: GPUBuffer;
|
|
66
74
|
type: string;
|
|
67
75
|
visibility?: WGSLStorageBufferVisibility;
|
|
76
|
+
/** Writable fragment storage is used by surface voxelization. Defaults to read. */
|
|
77
|
+
access?: "read" | "read_write";
|
|
68
78
|
}
|
|
69
79
|
type WGSLSceneTextureSemantic = "sceneColor" | "sceneDepth";
|
|
70
80
|
type WGSLGraphTextureDimension = "2d" | "depth-2d" | "3d";
|
|
@@ -333,6 +343,8 @@ interface RendererTextureTargetDescriptor extends RendererColorTargetDescriptor
|
|
|
333
343
|
}
|
|
334
344
|
interface RendererMaterialPassDescriptor {
|
|
335
345
|
readonly name?: string;
|
|
346
|
+
/** Compute work that must finish before this pass samples its resources. */
|
|
347
|
+
readonly dependsOn?: readonly string[];
|
|
336
348
|
readonly outputs?: string | readonly string[];
|
|
337
349
|
/** Selects which extracted scene draws are submitted. Defaults to all draws. */
|
|
338
350
|
readonly drawStage?: "all" | "opaque" | "late";
|
|
@@ -345,7 +357,39 @@ interface RendererMaterialPassDescriptor {
|
|
|
345
357
|
/** Draw only objects accepted by this predicate. Intended for selection/mask passes. */
|
|
346
358
|
readonly objectFilter?: (object: Object3D | null) => boolean;
|
|
347
359
|
/** Replace each accepted draw's material while preserving its geometry and instance data. */
|
|
348
|
-
readonly overrideMaterial?: WGSLShaderMaterial | ((source: WGSLShaderMaterial, skinned: boolean) => WGSLShaderMaterial);
|
|
360
|
+
readonly overrideMaterial?: WGSLShaderMaterial | ((source: WGSLShaderMaterial, skinned: boolean) => WGSLShaderMaterial | null);
|
|
361
|
+
}
|
|
362
|
+
interface RendererSceneCaptureOptions {
|
|
363
|
+
/** Replace shading while retaining geometry/instances. Receives the source of static snapshots; null skips a draw. */
|
|
364
|
+
readonly overrideMaterial?: (source: WGSLShaderMaterial, skinned: boolean) => WGSLShaderMaterial | null;
|
|
365
|
+
/** Exclude objects/subtrees. Renderer-owned draws without a source object pass null. */
|
|
366
|
+
readonly objectFilter?: (object: Object3D | null) => boolean;
|
|
367
|
+
readonly clearColor?: readonly [number, number, number, number];
|
|
368
|
+
/** Defaults to true. Disable point and spot lights for a consistent map view. */
|
|
369
|
+
readonly includeLocalLights?: boolean;
|
|
370
|
+
/** Optional final pass. Must write display-sRGB color into targetView. */
|
|
371
|
+
readonly postProcess?: (context: RendererSceneCapturePostProcessContext) => void;
|
|
372
|
+
}
|
|
373
|
+
interface RendererSceneCapturePostProcessContext {
|
|
374
|
+
readonly device: GPUDevice;
|
|
375
|
+
readonly encoder: GPUCommandEncoder;
|
|
376
|
+
readonly colorView: GPUTextureView;
|
|
377
|
+
readonly depthView: GPUTextureView;
|
|
378
|
+
readonly sampler: GPUSampler;
|
|
379
|
+
readonly targetView: GPUTextureView;
|
|
380
|
+
readonly targetFormat: GPUTextureFormat;
|
|
381
|
+
readonly width: number;
|
|
382
|
+
readonly height: number;
|
|
383
|
+
readonly camera: PerspectiveCamera | OrthographicCamera;
|
|
384
|
+
}
|
|
385
|
+
/** Non-temporal, unshadowed scene view sharing the renderer's GPU resources. */
|
|
386
|
+
interface RendererSceneCapture {
|
|
387
|
+
/** Triangles submitted by the most recent capture, before raster clipping. */
|
|
388
|
+
readonly triangleCount: number;
|
|
389
|
+
/** Persistent display-space output when created without a canvas. Owned by the capture. */
|
|
390
|
+
readonly textureView?: GPUTextureView;
|
|
391
|
+
capture(scene: three.Scene, camera: PerspectiveCamera | OrthographicCamera, options?: RendererSceneCaptureOptions): void;
|
|
392
|
+
dispose(): void;
|
|
349
393
|
}
|
|
350
394
|
interface RendererShadowMapDebugTextureInfo {
|
|
351
395
|
readonly view: GPUTextureView | null;
|
|
@@ -437,6 +481,12 @@ interface RendererFrameProfile {
|
|
|
437
481
|
gpuIndirectDraws?: number;
|
|
438
482
|
};
|
|
439
483
|
frameIndex: number;
|
|
484
|
+
/** Internal scene attachment dimensions in physical pixels. */
|
|
485
|
+
renderWidth?: number;
|
|
486
|
+
renderHeight?: number;
|
|
487
|
+
/** Presentation dimensions before any internal resolution scaling. */
|
|
488
|
+
presentationWidth?: number;
|
|
489
|
+
presentationHeight?: number;
|
|
440
490
|
cpuTimeMs: number;
|
|
441
491
|
gpuTimeMs: number | null;
|
|
442
492
|
drawCallCount: number;
|
|
@@ -643,13 +693,14 @@ interface FrameGraphNodeFullscreenPassDescriptor {
|
|
|
643
693
|
}
|
|
644
694
|
interface FrameGraphMaterialPassDescriptor {
|
|
645
695
|
readonly name?: string;
|
|
696
|
+
readonly dependsOn?: readonly string[];
|
|
646
697
|
readonly outputs?: FrameGraphTextureHandle | readonly FrameGraphTextureHandle[];
|
|
647
698
|
readonly drawStage?: "all" | "opaque" | "late";
|
|
648
699
|
readonly loadColor?: boolean;
|
|
649
700
|
readonly clearColor?: readonly [number, number, number, number];
|
|
650
701
|
readonly loadDepth?: boolean;
|
|
651
702
|
readonly objectFilter?: (object: Object3D | null) => boolean;
|
|
652
|
-
readonly overrideMaterial?: WGSLShaderMaterial | ((source: WGSLShaderMaterial, skinned: boolean) => WGSLShaderMaterial);
|
|
703
|
+
readonly overrideMaterial?: WGSLShaderMaterial | ((source: WGSLShaderMaterial, skinned: boolean) => WGSLShaderMaterial | null);
|
|
653
704
|
}
|
|
654
705
|
declare class FrameGraphBuilder {
|
|
655
706
|
private readonly context;
|
|
@@ -681,190 +732,176 @@ declare class FrameGraphBuilder {
|
|
|
681
732
|
present(source?: FrameGraphTextureHandle): void;
|
|
682
733
|
}
|
|
683
734
|
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
readonly historyWeight?: number;
|
|
689
|
-
/** Relative view-depth difference that rejects history. Defaults to 0.04. */
|
|
690
|
-
readonly depthRejection?: number;
|
|
691
|
-
/** Clamp reprojected history to the current 3x3 fog neighborhood. */
|
|
692
|
-
readonly neighborhoodClamp?: boolean;
|
|
735
|
+
interface SDFGIVolume {
|
|
736
|
+
readonly origin: Vector3;
|
|
737
|
+
readonly extent: number;
|
|
738
|
+
readonly resolution: number;
|
|
693
739
|
}
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
baseDensity: number;
|
|
698
|
-
heightFalloff: number;
|
|
699
|
-
heightOffset: number;
|
|
700
|
-
startDistance?: number;
|
|
701
|
-
scatteringDistribution: number;
|
|
702
|
-
albedo: Color;
|
|
703
|
-
emissive: Color;
|
|
704
|
-
ambientIntensity?: number;
|
|
705
|
-
scatteringMode: VolumetricFogScatteringMode;
|
|
706
|
-
}
|
|
707
|
-
/** Scene marker compatible with legacy objects through `isFogVolumeObject`. */
|
|
708
|
-
declare class VolumetricFogVolumeObject extends Object3D {
|
|
709
|
-
readonly volume: VolumetricFogVolumeSettings;
|
|
710
|
-
readonly isFogVolumeObject = true;
|
|
711
|
-
constructor(volume: VolumetricFogVolumeSettings);
|
|
740
|
+
interface SDFGISurfaceCaptureDriver {
|
|
741
|
+
capture(scene: Scene, volume: SDFGIVolume, axis: number): number;
|
|
742
|
+
dispose(): void;
|
|
712
743
|
}
|
|
713
|
-
interface
|
|
744
|
+
interface SDFGIOptions {
|
|
714
745
|
readonly enabled?: boolean;
|
|
715
|
-
/**
|
|
716
|
-
readonly
|
|
717
|
-
/**
|
|
718
|
-
readonly
|
|
719
|
-
/**
|
|
720
|
-
readonly
|
|
721
|
-
readonly
|
|
722
|
-
|
|
723
|
-
readonly
|
|
724
|
-
|
|
725
|
-
readonly
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
readonly
|
|
729
|
-
/**
|
|
730
|
-
readonly
|
|
731
|
-
/**
|
|
732
|
-
readonly
|
|
733
|
-
/**
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
readonly volumes?: readonly VolumetricFogVolumeSettings[];
|
|
766
|
-
/**
|
|
767
|
-
* Fog marker objects already collected by the renderer. When supplied, this
|
|
768
|
-
* list is authoritative and avoids traversing the scene for volumes.
|
|
769
|
-
*/
|
|
770
|
-
readonly volumeObjects?: readonly Object3D[];
|
|
771
|
-
/**
|
|
772
|
-
* Lights already collected by the renderer. When supplied, this list is
|
|
773
|
-
* authoritative and avoids traversing the scene for lights.
|
|
774
|
-
*/
|
|
775
|
-
readonly lights?: RendererExtractedLightState;
|
|
746
|
+
/** Immutable voxel resolution. Defaults to 64. */
|
|
747
|
+
readonly resolution?: 32 | 64 | 128;
|
|
748
|
+
/** World-space side length of the camera-following volume. Defaults to 48. */
|
|
749
|
+
readonly extent?: number;
|
|
750
|
+
/** Immutable probes per axis, generated automatically. Defaults to 12. */
|
|
751
|
+
readonly probeResolution?: number;
|
|
752
|
+
readonly intensity?: number;
|
|
753
|
+
/** Directions per updated probe, 16–256. Defaults to 64. */
|
|
754
|
+
readonly raysPerProbe?: number;
|
|
755
|
+
/** Fraction of probes updated per frame, (0, 1]. Defaults to 0.25. */
|
|
756
|
+
readonly updateFraction?: number;
|
|
757
|
+
/** Previous contribution on each probe update, [0, 0.99]. Defaults to 0.85. */
|
|
758
|
+
readonly historyWeight?: number;
|
|
759
|
+
readonly maxSteps?: number;
|
|
760
|
+
/** @deprecated Surface capture now spreads three GPU raster views over three frames. */
|
|
761
|
+
readonly geometryBudgetMs?: number;
|
|
762
|
+
/** Additional environment radiance. Zero by default to avoid doubling IBL. */
|
|
763
|
+
readonly skyColor?: readonly [number, number, number];
|
|
764
|
+
/** Optional distant volumes. Omitted/false preserves the single-volume GPU path. Immutable. */
|
|
765
|
+
readonly cascades?: false | SDFGICascadeOptions;
|
|
766
|
+
}
|
|
767
|
+
interface SDFGICascadeOptions {
|
|
768
|
+
/** Total volume count, including the near volume. Defaults to 2. */
|
|
769
|
+
readonly count?: 2 | 3;
|
|
770
|
+
/** Extent multiplier between volumes. Defaults to 2. */
|
|
771
|
+
readonly extentScale?: number;
|
|
772
|
+
/** Distant-volume voxel resolution. Defaults to 32. */
|
|
773
|
+
readonly resolution?: 32 | 64 | 128;
|
|
774
|
+
/** Distant probes per axis. Defaults to 8. */
|
|
775
|
+
readonly probeResolution?: number;
|
|
776
|
+
/** Maximum directions per distant probe. Defaults to 32. */
|
|
777
|
+
readonly raysPerProbe?: number;
|
|
778
|
+
/** Maximum fraction of distant probes updated per scheduled frame. Defaults to 0.125. */
|
|
779
|
+
readonly updateFraction?: number;
|
|
780
|
+
/** Steady-state update interval. Defaults to 4 frames; doubles for the third volume. */
|
|
781
|
+
readonly updateInterval?: number;
|
|
782
|
+
}
|
|
783
|
+
interface SDFGIStats {
|
|
784
|
+
/** Total volumes, including the near volume. */
|
|
785
|
+
cascadeCount: number;
|
|
786
|
+
/** Near-volume readiness and geometry diagnostics; building includes distant volumes. */
|
|
787
|
+
ready: boolean;
|
|
788
|
+
building: boolean;
|
|
789
|
+
triangles: number;
|
|
790
|
+
occupiedCells: number;
|
|
791
|
+
/** Last frame's CPU surface-capture preparation, separate from GPU frame profiling. */
|
|
792
|
+
geometryCpuMs: number;
|
|
793
|
+
geometryBuildMs: number;
|
|
794
|
+
gpuBytes: number;
|
|
795
|
+
updatedProbes: number;
|
|
776
796
|
}
|
|
777
|
-
declare const VOLUMETRIC_FOG_PRESETS: Readonly<Record<VolumetricFogQuality, VolumetricFogOptions>>;
|
|
778
797
|
/**
|
|
779
|
-
*
|
|
780
|
-
*
|
|
781
|
-
*
|
|
798
|
+
* Experimental one-bounce SDF GI with optional distant cascades. Geometry is static between
|
|
799
|
+
* invalidations; directional/point/spot lights update on each volume's cadence. No surface readbacks,
|
|
800
|
+
* hardware ray tracing, screen-space history, or manually authored probes.
|
|
782
801
|
*/
|
|
783
|
-
declare class
|
|
784
|
-
private
|
|
785
|
-
readonly
|
|
786
|
-
readonly
|
|
787
|
-
readonly
|
|
788
|
-
readonly
|
|
789
|
-
private readonly
|
|
790
|
-
private readonly
|
|
791
|
-
private
|
|
792
|
-
private
|
|
793
|
-
private
|
|
794
|
-
private
|
|
802
|
+
declare class SDFGI {
|
|
803
|
+
private readonly device;
|
|
804
|
+
readonly stats: SDFGIStats;
|
|
805
|
+
private readonly resolution;
|
|
806
|
+
private readonly extent;
|
|
807
|
+
private readonly probeResolution;
|
|
808
|
+
private readonly cellSize;
|
|
809
|
+
private readonly spacing;
|
|
810
|
+
private enabled;
|
|
811
|
+
private intensity;
|
|
812
|
+
private rays;
|
|
813
|
+
private fraction;
|
|
814
|
+
private history;
|
|
815
|
+
private steps;
|
|
816
|
+
private readonly sky;
|
|
817
|
+
private readonly buffers;
|
|
818
|
+
private readonly uniformData;
|
|
819
|
+
private readonly floats;
|
|
820
|
+
private readonly integers;
|
|
821
|
+
private readonly header;
|
|
795
822
|
private readonly lightData;
|
|
796
|
-
private readonly
|
|
797
|
-
private readonly
|
|
798
|
-
private readonly
|
|
799
|
-
private readonly
|
|
800
|
-
private
|
|
801
|
-
private
|
|
802
|
-
private
|
|
803
|
-
private
|
|
804
|
-
private
|
|
805
|
-
private
|
|
806
|
-
private
|
|
807
|
-
private
|
|
808
|
-
private
|
|
809
|
-
private readonly
|
|
810
|
-
private readonly
|
|
811
|
-
private readonly
|
|
812
|
-
private readonly
|
|
813
|
-
private readonly
|
|
814
|
-
private readonly
|
|
815
|
-
private readonly
|
|
816
|
-
private readonly
|
|
817
|
-
private
|
|
818
|
-
private
|
|
819
|
-
private
|
|
820
|
-
private
|
|
821
|
-
private
|
|
822
|
-
private
|
|
823
|
-
private
|
|
824
|
-
private
|
|
825
|
-
private
|
|
826
|
-
private
|
|
827
|
-
private
|
|
823
|
+
private readonly field;
|
|
824
|
+
private readonly fieldBankBytes;
|
|
825
|
+
private readonly snapshot;
|
|
826
|
+
private readonly snapshotBinding;
|
|
827
|
+
private populatedProbes;
|
|
828
|
+
private blend;
|
|
829
|
+
private previousValid;
|
|
830
|
+
private lastUpdateSeconds;
|
|
831
|
+
private readonly params;
|
|
832
|
+
private readonly surfaces;
|
|
833
|
+
private readonly seed;
|
|
834
|
+
private readonly seedBinding;
|
|
835
|
+
private readonly jumps;
|
|
836
|
+
private readonly inject;
|
|
837
|
+
private readonly injectBinding;
|
|
838
|
+
private readonly probes;
|
|
839
|
+
private readonly probeBinding;
|
|
840
|
+
private readonly lightBuffer;
|
|
841
|
+
private readonly surfaceConfig;
|
|
842
|
+
private readonly surfaceAccum;
|
|
843
|
+
private readonly surfaceStatistics;
|
|
844
|
+
private readonly surfaceConfigData;
|
|
845
|
+
private readonly resolveSurface;
|
|
846
|
+
private readonly resolveSurfaceBinding;
|
|
847
|
+
private readonly configuredSurfaces;
|
|
848
|
+
private surfaceCapture;
|
|
849
|
+
private captureAxis;
|
|
850
|
+
private pendingTriangleCount;
|
|
851
|
+
private pendingCounts;
|
|
852
|
+
private readonly configured;
|
|
853
|
+
private readonly watched;
|
|
854
|
+
private readonly lights;
|
|
855
|
+
private readonly staticDrawRoots;
|
|
828
856
|
private cascadeDirectionalLights;
|
|
829
|
-
private
|
|
830
|
-
private
|
|
831
|
-
private
|
|
832
|
-
private
|
|
833
|
-
private
|
|
834
|
-
private
|
|
835
|
-
private
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
857
|
+
private scene;
|
|
858
|
+
private grid;
|
|
859
|
+
private pending;
|
|
860
|
+
private dirty;
|
|
861
|
+
private upload;
|
|
862
|
+
private frame;
|
|
863
|
+
private probeOffset;
|
|
864
|
+
private disposed;
|
|
865
|
+
private readonly cameraPosition;
|
|
866
|
+
private readonly sourcePosition;
|
|
867
|
+
private readonly targetPosition;
|
|
868
|
+
private readonly direction;
|
|
869
|
+
private buildMs;
|
|
870
|
+
private lightCount;
|
|
871
|
+
private readonly distantVolumes;
|
|
872
|
+
private cascadeFrame;
|
|
873
|
+
constructor(device: GPUDevice, options?: SDFGIOptions);
|
|
874
|
+
/** Structural settings (extent/resolutions/cascades) require recreating the backend. */
|
|
875
|
+
setOptions(options: SDFGIOptions): void;
|
|
876
|
+
/** Call after moving/changing static geometry or editing its materials. */
|
|
877
|
+
invalidate(): void;
|
|
878
|
+
get surfaceResolution(): number;
|
|
879
|
+
setSurfaceCapture(capture: SDFGISurfaceCaptureDriver): void;
|
|
880
|
+
/** Install independent capture targets/material bindings for every enabled volume. */
|
|
881
|
+
setSurfaceCaptureFactory(factory: (volume: SDFGI) => SDFGISurfaceCaptureDriver): void;
|
|
882
|
+
configureSurfaceMaterial(material: WGSLShaderMaterial): void;
|
|
883
|
+
/** Track static draw-set registration changes that require recapturing. */
|
|
884
|
+
registerStaticDrawRoot(root: Object3D): () => void;
|
|
885
|
+
/** Cascaded shadow lights represent one sun, including lights outside the scene. */
|
|
844
886
|
setCascadedDirectionalLights(lights: readonly DirectionalLight[]): void;
|
|
845
|
-
|
|
846
|
-
private
|
|
847
|
-
private
|
|
848
|
-
|
|
849
|
-
|
|
887
|
+
configureMaterial(material: WGSLShaderMaterial): void;
|
|
888
|
+
private readonly added;
|
|
889
|
+
private readonly removed;
|
|
890
|
+
private hasStaticGeometry;
|
|
891
|
+
private watch;
|
|
892
|
+
private unwatch;
|
|
893
|
+
/** Capture one all-layer projection per frame, before main-view extraction. */
|
|
894
|
+
prepare(scene: Scene, camera: Camera): void;
|
|
895
|
+
private updateLights;
|
|
896
|
+
addPasses(graph: FrameGraphBuilder): void;
|
|
897
|
+
/** Records the same production path used by the renderer; useful to GPU checks. */
|
|
898
|
+
encode(encoder: GPUCommandEncoder, timeSeconds?: number): void;
|
|
899
|
+
private encodeVolume;
|
|
900
|
+
/** One tiny asynchronous diagnostics read per rebuild; never read surface data to the CPU. */
|
|
901
|
+
private readSurfaceCount;
|
|
902
|
+
private dispatch;
|
|
850
903
|
dispose(): void;
|
|
851
|
-
private executeFroxels;
|
|
852
|
-
private collectSceneData;
|
|
853
|
-
/** Selects the nearest local lights without depending on camera rotation. */
|
|
854
|
-
private selectClosestLights;
|
|
855
|
-
private writeVolume;
|
|
856
|
-
private writeDirectional;
|
|
857
|
-
private writeExtractedDirectional;
|
|
858
|
-
private writePoint;
|
|
859
|
-
private writeExtractedPoint;
|
|
860
|
-
private writeSpot;
|
|
861
|
-
private writeExtractedSpot;
|
|
862
|
-
private getResources;
|
|
863
904
|
}
|
|
864
|
-
/** WGSL appended to a material that calls rendererApplyVolumetricFog(). */
|
|
865
|
-
declare const VOLUMETRIC_FOG_MATERIAL_WGSL = "\nfn rendererSampleIntegratedFogRaw(uv: vec2<f32>, normalizedDepth: f32) -> vec4<f32> {\n let sliceCount = f32(textureDimensions(volumetricFogTexture).z);\n let slicePosition = clamp(normalizedDepth, 0.0, 1.0) * sliceCount;\n let textureZ = clamp((slicePosition - 0.5) / sliceCount, 0.0, 1.0);\n let integrated = textureSampleLevel(volumetricFogTexture, volumetricFogSampler, vec3<f32>(uv, textureZ), 0.0);\n // The volume stores slice endpoints but has no texel for the near-plane\n // identity value. Reconstruct that missing endpoint for the first slice.\n return mix(vec4<f32>(0.0, 0.0, 0.0, 1.0), integrated, min(slicePosition, 1.0));\n}\nfn rendererSampleIntegratedFog(uv: vec2<f32>, normalizedDepth: f32) -> vec4<f32> {\n return rendererSampleIntegratedFogRaw(uv, normalizedDepth);\n}\nfn rendererApplyVolumetricFog(color: vec4<f32>, worldPosition: vec3<f32>) -> vec4<f32> {\n let clip = rendererCamera.viewProj * vec4<f32>(worldPosition, 1.0);\n let uv = clip.xy / clip.w * vec2<f32>(0.5, -0.5) + vec2<f32>(0.5);\n let distance = length(worldPosition - rendererCamera.cameraPosition.xyz);\n let bounds = textureSampleLevel(volumetricFogBoundsTexture, volumetricFogBoundsSampler, uv, 0.0).rg;\n let z = clamp(log(max(distance, bounds.x) / bounds.x) / max(log(bounds.y / bounds.x), 0.0001), 0.0, 1.0);\n let fog = rendererSampleIntegratedFog(uv, z);\n return vec4<f32>(fog.rgb + color.rgb * fog.a, color.a);\n}";
|
|
866
|
-
/** Adds the froxel input; append VOLUMETRIC_FOG_MATERIAL_WGSL and call its helper in fsMain. */
|
|
867
|
-
declare function configureVolumetricFogMaterial(material: WGSLShaderMaterial, resource?: string, boundsResource?: string): WGSLShaderMaterial;
|
|
868
905
|
|
|
869
906
|
interface WebGpuPMREMGeneratorContext {
|
|
870
907
|
device: GPUDevice;
|
|
@@ -919,11 +956,14 @@ declare class WebGpuRenderer {
|
|
|
919
956
|
private sampleCount;
|
|
920
957
|
private renderScale;
|
|
921
958
|
private hiZOcclusionCullingEnabled;
|
|
959
|
+
private frameHiZOcclusionCullingNeeded;
|
|
922
960
|
private multiDrawIndirectEnabled;
|
|
923
961
|
private dynamicBatchingEnabled;
|
|
924
962
|
private multiDrawIndirectSupported;
|
|
925
963
|
private tiledPointLights;
|
|
926
964
|
private tiledLightingEnabled;
|
|
965
|
+
private readonly transientPointLightsScratch;
|
|
966
|
+
private readonly transientPointScoresScratch;
|
|
927
967
|
private renderGraphProfilingEnabled;
|
|
928
968
|
private indirectFirstInstanceSupported;
|
|
929
969
|
private timestampQuerySupported;
|
|
@@ -988,7 +1028,7 @@ declare class WebGpuRenderer {
|
|
|
988
1028
|
* `instance_index`. Keep shared default buffers large enough for the packed
|
|
989
1029
|
* renderer instance range instead of binding one value at index zero.
|
|
990
1030
|
*/
|
|
991
|
-
private readonly
|
|
1031
|
+
private readonly defaultVertexAttributeBuffers;
|
|
992
1032
|
private readonly textureManager;
|
|
993
1033
|
private readonly renderGraph;
|
|
994
1034
|
private readonly nativePostSubmit;
|
|
@@ -1018,6 +1058,7 @@ declare class WebGpuRenderer {
|
|
|
1018
1058
|
private readonly geometryVertexBufferFastCache;
|
|
1019
1059
|
private readonly vertexAttributeGroupCache;
|
|
1020
1060
|
private readonly materialVertexAttributeCache;
|
|
1061
|
+
private readonly sharedVertexAttributeLayouts;
|
|
1021
1062
|
private readonly vertexBufferBindingPlanCache;
|
|
1022
1063
|
private readonly preparedVertexBufferCache;
|
|
1023
1064
|
private readonly vertexAttributeGroupBufferKeyCache;
|
|
@@ -1094,6 +1135,23 @@ declare class WebGpuRenderer {
|
|
|
1094
1135
|
private readonly objectMotionHistory;
|
|
1095
1136
|
private readonly cameraFrustumPlanesScratch;
|
|
1096
1137
|
private readonly objectTraversalStackScratch;
|
|
1138
|
+
private readonly staticSceneSpatialIndex;
|
|
1139
|
+
private readonly staticMeshDraws;
|
|
1140
|
+
private readonly spatialShadowPlanes;
|
|
1141
|
+
private spatialShadowCount;
|
|
1142
|
+
private readonly spatialLocalShadowSpheres;
|
|
1143
|
+
private spatialLocalShadowCount;
|
|
1144
|
+
private readonly spatialShadowMatrix;
|
|
1145
|
+
private spatialIncludeOffscreen;
|
|
1146
|
+
private spatialCameraLayers;
|
|
1147
|
+
private readonly testSpatialCamera;
|
|
1148
|
+
private readonly testSpatialScene;
|
|
1149
|
+
private readonly filterSpatialCaptureObject;
|
|
1150
|
+
private readonly pushSpatialRoot;
|
|
1151
|
+
private readonly collectSpatialMesh;
|
|
1152
|
+
private readonly isSpatialSphereVisible;
|
|
1153
|
+
private isSpatialShadowSphereVisible;
|
|
1154
|
+
private readonly collectSpatialRoot;
|
|
1097
1155
|
private readonly shadowDrawsScratch;
|
|
1098
1156
|
private extractingCaster;
|
|
1099
1157
|
private readonly cameraDetailHistory;
|
|
@@ -1106,6 +1164,10 @@ declare class WebGpuRenderer {
|
|
|
1106
1164
|
private readonly temporalVisibilityPreviousCameraPosition;
|
|
1107
1165
|
private readonly shadowViewProjScratch;
|
|
1108
1166
|
private extractionVersion;
|
|
1167
|
+
private motionHistoryExtractionVersion;
|
|
1168
|
+
private sceneCaptureOptions;
|
|
1169
|
+
private readonly sceneCaptureDisposers;
|
|
1170
|
+
private readonly captureMotionHistory;
|
|
1109
1171
|
private graphBuilder;
|
|
1110
1172
|
private createExtractedDirectionalLightScratch;
|
|
1111
1173
|
private createExtractedHemisphereLightScratch;
|
|
@@ -1122,6 +1184,8 @@ declare class WebGpuRenderer {
|
|
|
1122
1184
|
private opaqueSortSampleTotal;
|
|
1123
1185
|
private sortOpaqueDraws;
|
|
1124
1186
|
constructor(options: RendererOptions);
|
|
1187
|
+
/** Re-run material adapters after enabling renderer features between extractions. */
|
|
1188
|
+
invalidateMaterialResolution(): void;
|
|
1125
1189
|
private resolveMaterial;
|
|
1126
1190
|
private resolveLineMaterial;
|
|
1127
1191
|
private resolveLineBasicMaterial;
|
|
@@ -1179,6 +1243,11 @@ declare class WebGpuRenderer {
|
|
|
1179
1243
|
setHiZOcclusionCullingEnabled(enabled: boolean): void;
|
|
1180
1244
|
getHiZOcclusionCullingEnabled(): boolean;
|
|
1181
1245
|
getHiZOcclusionCullingActive(): boolean;
|
|
1246
|
+
/** Captures and shadow views must not inherit the primary camera's culling. */
|
|
1247
|
+
private isStaticDrawSetCameraVisible;
|
|
1248
|
+
private getCameraStaticDrawSets;
|
|
1249
|
+
private queryStaticShadowResources;
|
|
1250
|
+
private updateVisibilityWorkload;
|
|
1182
1251
|
setMultiDrawIndirectEnabled(enabled: boolean): void;
|
|
1183
1252
|
getMultiDrawIndirectEnabled(): boolean;
|
|
1184
1253
|
/** Toggle without recompiling materials, for scene-specific GPU comparisons. */
|
|
@@ -1191,6 +1260,12 @@ declare class WebGpuRenderer {
|
|
|
1191
1260
|
setClearColor(color: readonly [number, number, number, number]): void;
|
|
1192
1261
|
render(scene: Scene, camera: PerspectiveCamera | OrthographicCamera, timeSeconds?: number): void;
|
|
1193
1262
|
renderAsync(scene: Scene, camera: PerspectiveCamera | OrthographicCamera, timeSeconds?: number): Promise<void>;
|
|
1263
|
+
/**
|
|
1264
|
+
* Creates an independent canvas or sampleable texture view on the same device.
|
|
1265
|
+
* Call capture between frames, before render(): it reuses extraction scratch and
|
|
1266
|
+
* upload buffers, but never advances gameplay motion/visibility history.
|
|
1267
|
+
*/
|
|
1268
|
+
createSceneCapture(canvas: HTMLCanvasElement | null, width?: number, height?: number): RendererSceneCapture;
|
|
1194
1269
|
compile(scene: Scene, camera: PerspectiveCamera | OrthographicCamera): void;
|
|
1195
1270
|
compileAsync(scene: Scene, camera: PerspectiveCamera | OrthographicCamera): Promise<void>;
|
|
1196
1271
|
/**
|
|
@@ -1208,6 +1283,8 @@ declare class WebGpuRenderer {
|
|
|
1208
1283
|
*/
|
|
1209
1284
|
initTexture(texture: Texture): void;
|
|
1210
1285
|
createStaticDrawSet(root: Object3D, options?: StaticDrawSetOptions): StaticDrawSet;
|
|
1286
|
+
/** Register immutable ordinary meshes without changing their authored parents. */
|
|
1287
|
+
registerStaticSpatialObject(root: Object3D): StaticSpatialObject;
|
|
1211
1288
|
private disposeStaticDrawSetResource;
|
|
1212
1289
|
private renderFrame;
|
|
1213
1290
|
private recordPresentationOverlay;
|
|
@@ -1232,6 +1309,7 @@ declare class WebGpuRenderer {
|
|
|
1232
1309
|
private transparentDraws;
|
|
1233
1310
|
private opaqueBatches;
|
|
1234
1311
|
private acquireDrawCall;
|
|
1312
|
+
private createDrawCall;
|
|
1235
1313
|
private acquireOpaqueBatchBuilder;
|
|
1236
1314
|
private populateDrawCall;
|
|
1237
1315
|
private populateDynamicDrawCall;
|
|
@@ -1241,6 +1319,9 @@ declare class WebGpuRenderer {
|
|
|
1241
1319
|
private getToonOutlineMaterial;
|
|
1242
1320
|
private pushToonOutlineDraw;
|
|
1243
1321
|
private updateTransparentDrawSortDepths;
|
|
1322
|
+
/** Bounded importance selection; stable light IDs break exact ties. */
|
|
1323
|
+
private selectTransientPointLight;
|
|
1324
|
+
private extractPointLight;
|
|
1244
1325
|
private extractScene;
|
|
1245
1326
|
private collectLine;
|
|
1246
1327
|
/**
|
|
@@ -1337,6 +1418,7 @@ declare class WebGpuRenderer {
|
|
|
1337
1418
|
private getGeometryAttributeBufferKey;
|
|
1338
1419
|
private getGeometryAttributeGroupBufferKey;
|
|
1339
1420
|
private getMaterialVertexAttributes;
|
|
1421
|
+
private getSharedVertexAttributeLayout;
|
|
1340
1422
|
private getGeometryVertexBuffer;
|
|
1341
1423
|
private cacheGeometryVertexBufferFast;
|
|
1342
1424
|
private readonly packedVertexGroups;
|
|
@@ -1346,7 +1428,7 @@ declare class WebGpuRenderer {
|
|
|
1346
1428
|
private prepareGeometryVertexBuffers;
|
|
1347
1429
|
private getStandardVertexAttribute;
|
|
1348
1430
|
private prepareDrawGeometryVertexBuffers;
|
|
1349
|
-
private
|
|
1431
|
+
private getDefaultVertexAttributeBuffer;
|
|
1350
1432
|
private getMeshExtractionCacheEntry;
|
|
1351
1433
|
private getInstancedMeshExtractionCacheEntry;
|
|
1352
1434
|
private getBatchedMeshExtractionCacheEntry;
|
|
@@ -1412,6 +1494,203 @@ declare class WebGpuRenderer {
|
|
|
1412
1494
|
private writeShadowCameraBuffer;
|
|
1413
1495
|
}
|
|
1414
1496
|
|
|
1497
|
+
/** All-layer rasterization: depth testing and writes are disabled on the variants. */
|
|
1498
|
+
declare class SDFGISurfaceCapture implements SDFGISurfaceCaptureDriver {
|
|
1499
|
+
private readonly camera;
|
|
1500
|
+
private readonly center;
|
|
1501
|
+
private readonly target;
|
|
1502
|
+
private readonly options;
|
|
1503
|
+
private readonly variants;
|
|
1504
|
+
constructor(renderer: Pick<WebGpuRenderer, "createSceneCapture">, gi: SDFGI, resolve: (source: WGSLShaderMaterial) => WGSLShaderMaterial | null, isolateMaterials?: boolean);
|
|
1505
|
+
capture(scene: Scene, volume: SDFGIVolume, axis: number): number;
|
|
1506
|
+
dispose(): void;
|
|
1507
|
+
}
|
|
1508
|
+
|
|
1509
|
+
type VolumetricFogScatteringMode = "volumetric" | "lightShaft";
|
|
1510
|
+
type VolumetricFogQuality = "low" | "medium" | "high";
|
|
1511
|
+
interface VolumetricFogTemporalOptions {
|
|
1512
|
+
/** Previous-frame contribution for stable fog. Defaults to 0.92. */
|
|
1513
|
+
readonly historyWeight?: number;
|
|
1514
|
+
/** Relative view-depth difference that rejects history. Defaults to 0.04. */
|
|
1515
|
+
readonly depthRejection?: number;
|
|
1516
|
+
/** Clamp reprojected history to the current 3x3 fog neighborhood. */
|
|
1517
|
+
readonly neighborhoodClamp?: boolean;
|
|
1518
|
+
}
|
|
1519
|
+
/** Kept structurally compatible with Hology's legacy FogVolumeSettings. */
|
|
1520
|
+
interface VolumetricFogVolumeSettings {
|
|
1521
|
+
readonly object: Object3D;
|
|
1522
|
+
baseDensity: number;
|
|
1523
|
+
heightFalloff: number;
|
|
1524
|
+
heightOffset: number;
|
|
1525
|
+
startDistance?: number;
|
|
1526
|
+
scatteringDistribution: number;
|
|
1527
|
+
albedo: Color;
|
|
1528
|
+
emissive: Color;
|
|
1529
|
+
ambientIntensity?: number;
|
|
1530
|
+
scatteringMode: VolumetricFogScatteringMode;
|
|
1531
|
+
}
|
|
1532
|
+
/** Scene marker compatible with legacy objects through `isFogVolumeObject`. */
|
|
1533
|
+
declare class VolumetricFogVolumeObject extends Object3D {
|
|
1534
|
+
readonly volume: VolumetricFogVolumeSettings;
|
|
1535
|
+
readonly isFogVolumeObject = true;
|
|
1536
|
+
constructor(volume: VolumetricFogVolumeSettings);
|
|
1537
|
+
}
|
|
1538
|
+
interface VolumetricFogOptions {
|
|
1539
|
+
readonly enabled?: boolean;
|
|
1540
|
+
/** Froxel width/height in pixels. 8 is a good desktop default. */
|
|
1541
|
+
readonly froxelPixelSize?: number;
|
|
1542
|
+
/** Logarithmically distributed depth slices. */
|
|
1543
|
+
readonly depthSlices?: number;
|
|
1544
|
+
/** Deterministic integration samples within each depth slice. */
|
|
1545
|
+
readonly integrationSubsteps?: 1 | 2 | 4;
|
|
1546
|
+
readonly maxDistance?: number;
|
|
1547
|
+
readonly targetPrefix?: string;
|
|
1548
|
+
readonly maxVolumes?: number;
|
|
1549
|
+
readonly maxDirectionalLights?: number;
|
|
1550
|
+
readonly maxPointLights?: number;
|
|
1551
|
+
readonly maxSpotLights?: number;
|
|
1552
|
+
/** Used when the scene has no ambient or hemisphere light. */
|
|
1553
|
+
readonly ambientColor?: Color;
|
|
1554
|
+
/** Rotating shadow taps per froxel. 4 removes block patterns at modest cost. */
|
|
1555
|
+
readonly shadowFilterTaps?: 1 | 4;
|
|
1556
|
+
/** Temporal sub-froxel jitter accumulated by fog history and optionally TAA. */
|
|
1557
|
+
readonly temporalJitter?: boolean;
|
|
1558
|
+
/**
|
|
1559
|
+
* Fog-local temporal reconstruction of the 3D scattering/extinction grid.
|
|
1560
|
+
* This history is accumulated before front-to-back integration.
|
|
1561
|
+
*/
|
|
1562
|
+
readonly temporal?: false | VolumetricFogTemporalOptions;
|
|
1563
|
+
/** Stable per-ray depth jitter. Breaks slice bands without animated noise. */
|
|
1564
|
+
readonly spatialJitter?: boolean;
|
|
1565
|
+
/** Final fog-gradient dithering in approximate 8-bit code values. */
|
|
1566
|
+
readonly fogDitherStrength?: number;
|
|
1567
|
+
/** Artistic multiplier for direct in-scattering. Does not change extinction. */
|
|
1568
|
+
readonly scatteringIntensity?: number;
|
|
1569
|
+
/** Optional separable, depth-aware blur of the resolved fog buffer. */
|
|
1570
|
+
readonly blur?: false | VolumetricFogBlurOptions;
|
|
1571
|
+
}
|
|
1572
|
+
interface VolumetricFogBlurOptions {
|
|
1573
|
+
/** Resolution relative to the render target. Defaults to 0.5. */
|
|
1574
|
+
readonly scale?: number;
|
|
1575
|
+
/** Kernel radius per direction, from 1 to 12. Defaults to 5. */
|
|
1576
|
+
readonly radius?: number;
|
|
1577
|
+
/** Log-depth rejection sigma. 0.05 allows about 5% relative depth variation. */
|
|
1578
|
+
readonly depthSigma?: number;
|
|
1579
|
+
/** Gaussian spatial sigma in fog-buffer pixels. */
|
|
1580
|
+
readonly spatialSigma?: number;
|
|
1581
|
+
/** Preserve depth discontinuities during the final upsample. Costs extra depth reads. Defaults to true. */
|
|
1582
|
+
readonly depthAwareUpsample?: boolean;
|
|
1583
|
+
}
|
|
1584
|
+
interface VolumetricFogInputs {
|
|
1585
|
+
readonly sceneColor: FrameGraphTextureHandle;
|
|
1586
|
+
readonly depth: FrameGraphTextureHandle;
|
|
1587
|
+
/** Raw unjittered previous-to-current UV velocity from the opaque MRT. */
|
|
1588
|
+
readonly velocity?: FrameGraphTextureHandle;
|
|
1589
|
+
/** Explicit volumes can be mixed with compatible scene marker objects. */
|
|
1590
|
+
readonly volumes?: readonly VolumetricFogVolumeSettings[];
|
|
1591
|
+
/**
|
|
1592
|
+
* Fog marker objects already collected by the renderer. When supplied, this
|
|
1593
|
+
* list is authoritative and avoids traversing the scene for volumes.
|
|
1594
|
+
*/
|
|
1595
|
+
readonly volumeObjects?: readonly Object3D[];
|
|
1596
|
+
/**
|
|
1597
|
+
* Lights already collected by the renderer. When supplied, this list is
|
|
1598
|
+
* authoritative and avoids traversing the scene for lights.
|
|
1599
|
+
*/
|
|
1600
|
+
readonly lights?: RendererExtractedLightState;
|
|
1601
|
+
}
|
|
1602
|
+
declare const VOLUMETRIC_FOG_PRESETS: Readonly<Record<VolumetricFogQuality, VolumetricFogOptions>>;
|
|
1603
|
+
/**
|
|
1604
|
+
* Compute-driven froxel fog. Add it after opaque rendering and before the late
|
|
1605
|
+
* transparent pass. Existing content can use the composite output; transparent
|
|
1606
|
+
* materials can sample `integratedVolume` with configureVolumetricFogMaterial.
|
|
1607
|
+
*/
|
|
1608
|
+
declare class VolumetricFogEffect {
|
|
1609
|
+
private scene;
|
|
1610
|
+
readonly integratedVolume: FrameGraphTextureHandle;
|
|
1611
|
+
readonly columnDepthBounds: FrameGraphTextureHandle;
|
|
1612
|
+
readonly scatteringHistoryA: FrameGraphTextureHandle;
|
|
1613
|
+
readonly scatteringHistoryB: FrameGraphTextureHandle;
|
|
1614
|
+
private readonly options;
|
|
1615
|
+
private readonly resources;
|
|
1616
|
+
private readonly uniformStorage;
|
|
1617
|
+
private readonly uniforms;
|
|
1618
|
+
private readonly uniformIntegers;
|
|
1619
|
+
private readonly volumeData;
|
|
1620
|
+
private readonly lightData;
|
|
1621
|
+
private readonly selectedPointIndices;
|
|
1622
|
+
private readonly selectedPointScores;
|
|
1623
|
+
private readonly selectedSpotIndices;
|
|
1624
|
+
private readonly selectedSpotScores;
|
|
1625
|
+
private readonly collectedVolumes;
|
|
1626
|
+
private readonly collectedDirectionals;
|
|
1627
|
+
private readonly collectedPoints;
|
|
1628
|
+
private readonly collectedSpots;
|
|
1629
|
+
private volumeCount;
|
|
1630
|
+
private directionalCount;
|
|
1631
|
+
private pointCount;
|
|
1632
|
+
private spotCount;
|
|
1633
|
+
private collectionCamera;
|
|
1634
|
+
private readonly collectVolumeObject;
|
|
1635
|
+
private readonly collectLightObject;
|
|
1636
|
+
private readonly executeFroxelPass;
|
|
1637
|
+
private readonly projectionInverse;
|
|
1638
|
+
private readonly viewProjectionInverse;
|
|
1639
|
+
private readonly previousTemporalViewProjection;
|
|
1640
|
+
private readonly previousFroxelViewProjection;
|
|
1641
|
+
private readonly previousFroxelCameraPosition;
|
|
1642
|
+
private previousFroxelNear;
|
|
1643
|
+
private previousFroxelFar;
|
|
1644
|
+
private previousFroxelWidth;
|
|
1645
|
+
private previousFroxelHeight;
|
|
1646
|
+
private froxelHistoryValid;
|
|
1647
|
+
private froxelHistoryWriteIndex;
|
|
1648
|
+
private activeHistoryRead;
|
|
1649
|
+
private activeHistoryWrite;
|
|
1650
|
+
private explicitVolumes;
|
|
1651
|
+
private volumeObjects;
|
|
1652
|
+
private extractedLights;
|
|
1653
|
+
private cascadeDirectionalLights;
|
|
1654
|
+
private compositePass;
|
|
1655
|
+
private readonly blurPassCache;
|
|
1656
|
+
private readonly temporalPassCache;
|
|
1657
|
+
private temporalWriteIndex;
|
|
1658
|
+
private temporalHistoryValid;
|
|
1659
|
+
private activeLastFrame;
|
|
1660
|
+
private frameIndex;
|
|
1661
|
+
constructor(scene?: Scene, options?: VolumetricFogOptions);
|
|
1662
|
+
/** Updates the scene traversed for compatible volumes and lights. */
|
|
1663
|
+
setScene(scene: Scene): void;
|
|
1664
|
+
get enabled(): boolean;
|
|
1665
|
+
setOptions(options: VolumetricFogOptions): void;
|
|
1666
|
+
applyPreset(quality: VolumetricFogQuality): void;
|
|
1667
|
+
reset(): void;
|
|
1668
|
+
/** Keeps CSM light data in the same near-to-far order as shadow-array layers. */
|
|
1669
|
+
setCascadedDirectionalLights(lights: readonly DirectionalLight[]): void;
|
|
1670
|
+
addPasses(graph: FrameGraphBuilder, inputs: VolumetricFogInputs): FrameGraphTextureHandle;
|
|
1671
|
+
private addBlurredComposite;
|
|
1672
|
+
private addTemporalPass;
|
|
1673
|
+
consumeTemporalHistoryValid(): boolean;
|
|
1674
|
+
updateTemporalUniforms(uniforms: Float32Array, currentViewProjection: Matrix4, currentViewProjectionInverse: Matrix4, temporal: Required<VolumetricFogTemporalOptions>, context: RendererCustomPassContext): void;
|
|
1675
|
+
dispose(): void;
|
|
1676
|
+
private executeFroxels;
|
|
1677
|
+
private collectSceneData;
|
|
1678
|
+
/** Selects the nearest local lights without depending on camera rotation. */
|
|
1679
|
+
private selectClosestLights;
|
|
1680
|
+
private writeVolume;
|
|
1681
|
+
private writeDirectional;
|
|
1682
|
+
private writeExtractedDirectional;
|
|
1683
|
+
private writePoint;
|
|
1684
|
+
private writeExtractedPoint;
|
|
1685
|
+
private writeSpot;
|
|
1686
|
+
private writeExtractedSpot;
|
|
1687
|
+
private getResources;
|
|
1688
|
+
}
|
|
1689
|
+
/** WGSL appended to a material that calls rendererApplyVolumetricFog(). */
|
|
1690
|
+
declare const VOLUMETRIC_FOG_MATERIAL_WGSL = "\nfn rendererSampleIntegratedFogRaw(uv: vec2<f32>, normalizedDepth: f32) -> vec4<f32> {\n let sliceCount = f32(textureDimensions(volumetricFogTexture).z);\n let slicePosition = clamp(normalizedDepth, 0.0, 1.0) * sliceCount;\n let textureZ = clamp((slicePosition - 0.5) / sliceCount, 0.0, 1.0);\n let integrated = textureSampleLevel(volumetricFogTexture, volumetricFogSampler, vec3<f32>(uv, textureZ), 0.0);\n // The volume stores slice endpoints but has no texel for the near-plane\n // identity value. Reconstruct that missing endpoint for the first slice.\n return mix(vec4<f32>(0.0, 0.0, 0.0, 1.0), integrated, min(slicePosition, 1.0));\n}\nfn rendererSampleIntegratedFog(uv: vec2<f32>, normalizedDepth: f32) -> vec4<f32> {\n return rendererSampleIntegratedFogRaw(uv, normalizedDepth);\n}\nfn rendererApplyVolumetricFog(color: vec4<f32>, worldPosition: vec3<f32>) -> vec4<f32> {\n let clip = rendererCamera.viewProj * vec4<f32>(worldPosition, 1.0);\n let uv = clip.xy / clip.w * vec2<f32>(0.5, -0.5) + vec2<f32>(0.5);\n let distance = length(worldPosition - rendererCamera.cameraPosition.xyz);\n let bounds = textureSampleLevel(volumetricFogBoundsTexture, volumetricFogBoundsSampler, uv, 0.0).rg;\n let z = clamp(log(max(distance, bounds.x) / bounds.x) / max(log(bounds.y / bounds.x), 0.0001), 0.0, 1.0);\n let fog = rendererSampleIntegratedFog(uv, z);\n return vec4<f32>(fog.rgb + color.rgb * fog.a, color.a);\n}";
|
|
1691
|
+
/** Adds the froxel input; append VOLUMETRIC_FOG_MATERIAL_WGSL and call its helper in fsMain. */
|
|
1692
|
+
declare function configureVolumetricFogMaterial(material: WGSLShaderMaterial, resource?: string, boundsResource?: string): WGSLShaderMaterial;
|
|
1693
|
+
|
|
1415
1694
|
interface GTAODenoiseOptions {
|
|
1416
1695
|
readonly radius?: number;
|
|
1417
1696
|
/** Fixed bilateral tap count. Normalized to 4, 8, 12, or 16. */
|
|
@@ -1485,6 +1764,10 @@ declare class GTAOEffect {
|
|
|
1485
1764
|
}
|
|
1486
1765
|
|
|
1487
1766
|
interface SSROptions {
|
|
1767
|
+
/** Enables fullscreen SSR. Independent of surfaceSteps. */
|
|
1768
|
+
readonly enabled?: boolean;
|
|
1769
|
+
/** Ray budget for late surface shaders. Zero disables surface SSR. Defaults to 0. */
|
|
1770
|
+
readonly surfaceSteps?: number;
|
|
1488
1771
|
/** Resolution relative to the main render target. Defaults to 0.5. */
|
|
1489
1772
|
readonly resolutionScale?: number;
|
|
1490
1773
|
/** Maximum ray length in view-space units. */
|
|
@@ -1517,6 +1800,10 @@ declare class SSREffect {
|
|
|
1517
1800
|
private readonly options;
|
|
1518
1801
|
private readonly passes;
|
|
1519
1802
|
constructor(options?: SSROptions);
|
|
1803
|
+
get enabled(): boolean;
|
|
1804
|
+
/** Independent ray budget for reflections traced inside late surface shaders. */
|
|
1805
|
+
get surfaceRaySteps(): number;
|
|
1806
|
+
setOptions(options: SSROptions): void;
|
|
1520
1807
|
addPasses(graph: FrameGraphBuilder, inputs: SSRInputs): FrameGraphTextureHandle;
|
|
1521
1808
|
}
|
|
1522
1809
|
|
|
@@ -1842,6 +2129,8 @@ declare class OutlineEffect {
|
|
|
1842
2129
|
edgeThickness: number;
|
|
1843
2130
|
edgeSoftness: number;
|
|
1844
2131
|
readonly selectedObjects: Set<Object3D<three.Object3DEventMap>>;
|
|
2132
|
+
private readonly selectionMembers;
|
|
2133
|
+
private readonly addSelectionMember;
|
|
1845
2134
|
readonly selectedInstances: OutlineInstanceSelection[];
|
|
1846
2135
|
private readonly targetPrefix;
|
|
1847
2136
|
private readonly maskMaterial;
|
|
@@ -1856,4 +2145,4 @@ declare class OutlineEffect {
|
|
|
1856
2145
|
dispose(): void;
|
|
1857
2146
|
}
|
|
1858
2147
|
|
|
1859
|
-
export { type BloomCompositeOptions, BloomEffect, type BloomOptions, ColorGradingEffect, type ColorGradingOptions, type ColorGradingRange, type ColorGradingVector, type CompiledNodeFullscreenShader, ComputeKernel, type ComputeKernelDescriptor, DEFAULT_WGSL_VERTEX_ATTRIBUTES, DepthOfFieldEffect, type DepthOfFieldOptions, type DetailCullingSettings, type DirectionalShadowUpdateOptions, type FXAACompositeOptions, FXAAEffect, type FXAAOptions, FrameGraphBuilder, type FrameGraphFullscreenPassDescriptor, type FrameGraphMaterialPassDescriptor, type FrameGraphNodeFullscreenPassDescriptor, type FrameGraphPassDescriptor, type FrameGraphTextureHandle, type GTAOCompositeOptions, type GTAODenoiseOptions, GTAOEffect, type GTAOInputs, type GTAOOptions, type GTAOQuality, type GTAOTemporalOptions, GTAO_PRESETS, MOTION_BLUR_PRESETS, MotionBlurEffect, MotionBlurMode, type MotionBlurOptions, type MotionBlurOverride, type MotionBlurOverrideHandle, type MotionBlurQuality, OutlineEffect, type OutlineInputs, type OutlineInstanceSelection, type OutlineOptions, type PipelineDiagnosticOrigin, RenderGraph, type RenderGraphContext, type RenderGraphExecutionObserver, type RenderGraphPass, type RendererColorTargetDescriptor, type RendererCustomPassContext, type RendererCustomPassDescriptor, type RendererFrameProfile, type RendererGraphBuilder, type RendererGraphBuilderContext, type RendererMaterialPassDescriptor, type RendererMaterialResolver, type RendererOptions, type RendererPassProfile, type RendererShadowMapDebugInfo, type RendererShadowMapDebugTextureInfo, type RendererTextureTargetDescriptor, type RendererVisibilityProfile, SCENE_COLOR_FORMAT, type SMAACompositeOptions, type SMAAEdgeDetectionMode, SMAAEffect, type SMAAOptions, type SMAAQualityPreset, SSREffect, type SSRInputs, type SSROptions, type ShaderDefineValue, type ShaderDefines, type StaticDrawSet, type StaticDrawSetOptions, TemporalAAEffect, type TemporalAAOptions, type ToneMappingMode, type ToonOutlineParameters, type UniformDefinition, type UniformType, type UniformValue, VOLUMETRIC_FOG_MATERIAL_WGSL, VOLUMETRIC_FOG_PRESETS, type VolumetricFogBlurOptions, VolumetricFogEffect, type VolumetricFogInputs, type VolumetricFogOptions, type VolumetricFogQuality, type VolumetricFogScatteringMode, type VolumetricFogTemporalOptions, VolumetricFogVolumeObject, type VolumetricFogVolumeSettings, type WGSLGraphTextureDimension, type WGSLGraphTextureInput, type WGSLSceneTextureSemantic, WGSLShaderMaterial, type WGSLShaderMaterialParameters, type WGSLShaderMaterialUniform, type WGSLShaderMaterialUniformInput, type WGSLStorageBufferBinding, type WGSLStorageBufferVisibility, type WGSLSupportedVertexFormat, type WGSLVertexAttributeBinding, WebGpuPMREMGenerator, WebGpuRenderer, buildParticleLightingShaderHeader, configureVolumetricFogMaterial, createComputePipelineAsync, createRenderPipelineAsync, registerPipelineDiagnosticOrigin, resolveDetailCulling, setObjectDetailCulling, setPipelineDiagnosticLoading };
|
|
2148
|
+
export { type BloomCompositeOptions, BloomEffect, type BloomOptions, ColorGradingEffect, type ColorGradingOptions, type ColorGradingRange, type ColorGradingVector, type CompiledNodeFullscreenShader, ComputeKernel, type ComputeKernelDescriptor, DEFAULT_WGSL_VERTEX_ATTRIBUTES, DepthOfFieldEffect, type DepthOfFieldOptions, type DetailCullingSettings, type DirectionalShadowUpdateOptions, type FXAACompositeOptions, FXAAEffect, type FXAAOptions, FrameGraphBuilder, type FrameGraphFullscreenPassDescriptor, type FrameGraphMaterialPassDescriptor, type FrameGraphNodeFullscreenPassDescriptor, type FrameGraphPassDescriptor, type FrameGraphTextureHandle, type GTAOCompositeOptions, type GTAODenoiseOptions, GTAOEffect, type GTAOInputs, type GTAOOptions, type GTAOQuality, type GTAOTemporalOptions, GTAO_PRESETS, MOTION_BLUR_PRESETS, MotionBlurEffect, MotionBlurMode, type MotionBlurOptions, type MotionBlurOverride, type MotionBlurOverrideHandle, type MotionBlurQuality, OutlineEffect, type OutlineInputs, type OutlineInstanceSelection, type OutlineOptions, type PipelineDiagnosticOrigin, RenderGraph, type RenderGraphContext, type RenderGraphExecutionObserver, type RenderGraphPass, type RendererColorTargetDescriptor, type RendererCustomPassContext, type RendererCustomPassDescriptor, type RendererFrameProfile, type RendererGraphBuilder, type RendererGraphBuilderContext, type RendererMaterialPassDescriptor, type RendererMaterialResolver, type RendererOptions, type RendererPassProfile, type RendererSceneCapture, type RendererSceneCaptureOptions, type RendererSceneCapturePostProcessContext, type RendererShadowMapDebugInfo, type RendererShadowMapDebugTextureInfo, type RendererTextureTargetDescriptor, type RendererVisibilityProfile, SCENE_COLOR_FORMAT, SDFGI, type SDFGICascadeOptions, type SDFGIOptions, type SDFGIStats, SDFGISurfaceCapture, type SDFGISurfaceCaptureDriver, type SDFGIVolume, type SMAACompositeOptions, type SMAAEdgeDetectionMode, SMAAEffect, type SMAAOptions, type SMAAQualityPreset, SSREffect, type SSRInputs, type SSROptions, type ShaderDefineValue, type ShaderDefines, type StaticDrawSet, type StaticDrawSetOptions, type StaticSpatialObject, TemporalAAEffect, type TemporalAAOptions, type ToneMappingMode, type ToonOutlineParameters, type UniformDefinition, type UniformType, type UniformValue, VOLUMETRIC_FOG_MATERIAL_WGSL, VOLUMETRIC_FOG_PRESETS, type VolumetricFogBlurOptions, VolumetricFogEffect, type VolumetricFogInputs, type VolumetricFogOptions, type VolumetricFogQuality, type VolumetricFogScatteringMode, type VolumetricFogTemporalOptions, VolumetricFogVolumeObject, type VolumetricFogVolumeSettings, type WGSLGraphTextureDimension, type WGSLGraphTextureInput, type WGSLSceneTextureSemantic, WGSLShaderMaterial, type WGSLShaderMaterialParameters, type WGSLShaderMaterialUniform, type WGSLShaderMaterialUniformInput, type WGSLStorageBufferBinding, type WGSLStorageBufferVisibility, type WGSLSupportedVertexFormat, type WGSLVertexAttributeBinding, WebGpuPMREMGenerator, WebGpuRenderer, buildParticleLightingShaderHeader, configureVolumetricFogMaterial, createComputePipelineAsync, createRenderPipelineAsync, registerPipelineDiagnosticOrigin, resolveDetailCulling, setObjectDetailCulling, setPipelineDiagnosticLoading };
|