@hology/webgpu-renderer 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +279 -22
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as three from 'three';
|
|
2
|
-
import { Color, Vector2, Vector3, Vector4, Matrix3, Matrix4, Material, Texture, MaterialParameters, Object3D, PerspectiveCamera, OrthographicCamera, Scene
|
|
2
|
+
import { Color, Vector2, Vector3, Vector4, Matrix3, Matrix4, Material, Texture, MaterialParameters, DirectionalLight, Object3D, PerspectiveCamera, OrthographicCamera, Scene } 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 ComputeKernelDescriptor {
|
|
@@ -177,6 +177,97 @@ declare class RenderGraph {
|
|
|
177
177
|
private resolveExecutionOrder;
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
+
interface TextureResource {
|
|
181
|
+
version: number;
|
|
182
|
+
width: number;
|
|
183
|
+
height: number;
|
|
184
|
+
depthOrArrayLayers: number;
|
|
185
|
+
format: GPUTextureFormat;
|
|
186
|
+
textureDimension: GPUTextureDimension;
|
|
187
|
+
viewDimension: GPUTextureViewDimension;
|
|
188
|
+
sampleType: GPUTextureSampleType;
|
|
189
|
+
samplerBindingType: GPUSamplerBindingType;
|
|
190
|
+
mipLevelCount: number;
|
|
191
|
+
texture: GPUTexture;
|
|
192
|
+
view: GPUTextureView;
|
|
193
|
+
sampler: GPUSampler;
|
|
194
|
+
}
|
|
195
|
+
interface ExtractedLightState {
|
|
196
|
+
ambient: Vector4;
|
|
197
|
+
hemisphere: ExtractedHemisphereLight | null;
|
|
198
|
+
directionals: ExtractedDirectionalLight[];
|
|
199
|
+
points: ExtractedPointLight[];
|
|
200
|
+
spots: ExtractedSpotLight[];
|
|
201
|
+
directional: ExtractedDirectionalLight | null;
|
|
202
|
+
point: ExtractedPointLight | null;
|
|
203
|
+
spot: ExtractedSpotLight | null;
|
|
204
|
+
}
|
|
205
|
+
interface ExtractedHemisphereLight {
|
|
206
|
+
direction: Vector3;
|
|
207
|
+
skyColor: Vector3;
|
|
208
|
+
groundColor: Vector3;
|
|
209
|
+
intensity: number;
|
|
210
|
+
}
|
|
211
|
+
interface ExtractedDirectionalLight {
|
|
212
|
+
sourceLight: DirectionalLight | null;
|
|
213
|
+
position: Vector3;
|
|
214
|
+
target: Vector3;
|
|
215
|
+
direction: Vector3;
|
|
216
|
+
color: Vector3;
|
|
217
|
+
intensity: number;
|
|
218
|
+
volumetricIntensity: number;
|
|
219
|
+
castShadow: boolean;
|
|
220
|
+
shadowBias: number;
|
|
221
|
+
shadowNormalBias: number;
|
|
222
|
+
shadowRadius: number;
|
|
223
|
+
shadowIntensity: number;
|
|
224
|
+
shadowMapSize: number;
|
|
225
|
+
shadowCameraLeft: number;
|
|
226
|
+
shadowCameraRight: number;
|
|
227
|
+
shadowCameraTop: number;
|
|
228
|
+
shadowCameraBottom: number;
|
|
229
|
+
shadowCameraNear: number;
|
|
230
|
+
shadowCameraFar: number;
|
|
231
|
+
}
|
|
232
|
+
interface ExtractedPointLight {
|
|
233
|
+
position: Vector3;
|
|
234
|
+
color: Vector3;
|
|
235
|
+
intensity: number;
|
|
236
|
+
volumetricIntensity: number;
|
|
237
|
+
range: number;
|
|
238
|
+
decay: number;
|
|
239
|
+
castShadow: boolean;
|
|
240
|
+
shadowBias: number;
|
|
241
|
+
shadowNormalBias: number;
|
|
242
|
+
shadowRadius: number;
|
|
243
|
+
shadowIntensity: number;
|
|
244
|
+
shadowMapSize: number;
|
|
245
|
+
shadowCameraNear: number;
|
|
246
|
+
shadowCameraFar: number;
|
|
247
|
+
}
|
|
248
|
+
interface ExtractedSpotLight {
|
|
249
|
+
position: Vector3;
|
|
250
|
+
direction: Vector3;
|
|
251
|
+
color: Vector3;
|
|
252
|
+
intensity: number;
|
|
253
|
+
volumetricIntensity: number;
|
|
254
|
+
range: number;
|
|
255
|
+
angle: number;
|
|
256
|
+
penumbra: number;
|
|
257
|
+
decay: number;
|
|
258
|
+
castShadow: boolean;
|
|
259
|
+
shadowBias: number;
|
|
260
|
+
shadowNormalBias: number;
|
|
261
|
+
shadowRadius: number;
|
|
262
|
+
shadowIntensity: number;
|
|
263
|
+
shadowMapSize: number;
|
|
264
|
+
shadowCameraNear: number;
|
|
265
|
+
shadowCameraFar: number;
|
|
266
|
+
shadowCameraFov: number;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/** Camera-visible lights collected during the renderer's scene extraction. */
|
|
270
|
+
type RendererExtractedLightState = ExtractedLightState;
|
|
180
271
|
/**
|
|
181
272
|
* Resolves a scene-authored Three material to a renderer-native WGSL material
|
|
182
273
|
* without mutating the scene's material slots. Return `undefined` to use the
|
|
@@ -231,6 +322,11 @@ interface RendererGraphBuilderContext {
|
|
|
231
322
|
* extraction. Passing this list to volumetric fog avoids another scene walk.
|
|
232
323
|
*/
|
|
233
324
|
readonly fogVolumeObjects: readonly Object3D[];
|
|
325
|
+
/**
|
|
326
|
+
* Camera-visible lights collected during ordinary scene extraction. The
|
|
327
|
+
* ordering matches the renderer's shadow-array layers.
|
|
328
|
+
*/
|
|
329
|
+
readonly extractedLights: RendererExtractedLightState;
|
|
234
330
|
addDirectionalShadowPass(): void;
|
|
235
331
|
addPointShadowPass(): void;
|
|
236
332
|
addSpotShadowPass(): void;
|
|
@@ -443,6 +539,15 @@ declare class FrameGraphBuilder {
|
|
|
443
539
|
}
|
|
444
540
|
|
|
445
541
|
type VolumetricFogScatteringMode = "volumetric" | "lightShaft";
|
|
542
|
+
type VolumetricFogQuality = "low" | "medium" | "high";
|
|
543
|
+
interface VolumetricFogTemporalOptions {
|
|
544
|
+
/** Previous-frame contribution for stable fog. Defaults to 0.92. */
|
|
545
|
+
readonly historyWeight?: number;
|
|
546
|
+
/** Relative view-depth difference that rejects history. Defaults to 0.04. */
|
|
547
|
+
readonly depthRejection?: number;
|
|
548
|
+
/** Clamp reprojected history to the current 3x3 fog neighborhood. */
|
|
549
|
+
readonly neighborhoodClamp?: boolean;
|
|
550
|
+
}
|
|
446
551
|
/** Kept structurally compatible with Hology's legacy FogVolumeSettings. */
|
|
447
552
|
interface VolumetricFogVolumeSettings {
|
|
448
553
|
readonly object: Object3D;
|
|
@@ -463,6 +568,7 @@ declare class VolumetricFogVolumeObject extends Object3D {
|
|
|
463
568
|
constructor(volume: VolumetricFogVolumeSettings);
|
|
464
569
|
}
|
|
465
570
|
interface VolumetricFogOptions {
|
|
571
|
+
readonly enabled?: boolean;
|
|
466
572
|
/** Froxel width/height in pixels. 8 is a good desktop default. */
|
|
467
573
|
readonly froxelPixelSize?: number;
|
|
468
574
|
/** Logarithmically distributed depth slices. */
|
|
@@ -479,8 +585,13 @@ interface VolumetricFogOptions {
|
|
|
479
585
|
readonly ambientColor?: Color;
|
|
480
586
|
/** Rotating shadow taps per froxel. 4 removes block patterns at modest cost. */
|
|
481
587
|
readonly shadowFilterTaps?: 1 | 4;
|
|
482
|
-
/** Temporal sub-froxel jitter
|
|
588
|
+
/** Temporal sub-froxel jitter accumulated by fog history and optionally TAA. */
|
|
483
589
|
readonly temporalJitter?: boolean;
|
|
590
|
+
/**
|
|
591
|
+
* Fog-local temporal reconstruction. Unlike temporalJitter, this retains a
|
|
592
|
+
* resolved fog history and permits cheaper current-frame sampling.
|
|
593
|
+
*/
|
|
594
|
+
readonly temporal?: false | VolumetricFogTemporalOptions;
|
|
484
595
|
/** Stable per-ray depth jitter. Breaks slice bands without animated noise. */
|
|
485
596
|
readonly spatialJitter?: boolean;
|
|
486
597
|
/** Final fog-gradient dithering in approximate 8-bit code values. */
|
|
@@ -505,6 +616,8 @@ interface VolumetricFogBlurOptions {
|
|
|
505
616
|
interface VolumetricFogInputs {
|
|
506
617
|
readonly sceneColor: FrameGraphTextureHandle;
|
|
507
618
|
readonly depth: FrameGraphTextureHandle;
|
|
619
|
+
/** Raw unjittered previous-to-current UV velocity from the opaque MRT. */
|
|
620
|
+
readonly velocity?: FrameGraphTextureHandle;
|
|
508
621
|
/** Explicit volumes can be mixed with compatible scene marker objects. */
|
|
509
622
|
readonly volumes?: readonly VolumetricFogVolumeSettings[];
|
|
510
623
|
/**
|
|
@@ -512,7 +625,13 @@ interface VolumetricFogInputs {
|
|
|
512
625
|
* list is authoritative and avoids traversing the scene for volumes.
|
|
513
626
|
*/
|
|
514
627
|
readonly volumeObjects?: readonly Object3D[];
|
|
628
|
+
/**
|
|
629
|
+
* Lights already collected by the renderer. When supplied, this list is
|
|
630
|
+
* authoritative and avoids traversing the scene for lights.
|
|
631
|
+
*/
|
|
632
|
+
readonly lights?: RendererExtractedLightState;
|
|
515
633
|
}
|
|
634
|
+
declare const VOLUMETRIC_FOG_PRESETS: Readonly<Record<VolumetricFogQuality, VolumetricFogOptions>>;
|
|
516
635
|
/**
|
|
517
636
|
* Compute-driven froxel fog. Add it after opaque rendering and before the late
|
|
518
637
|
* transparent pass. Existing content can use the composite output; transparent
|
|
@@ -531,27 +650,43 @@ declare class VolumetricFogEffect {
|
|
|
531
650
|
private readonly lightData;
|
|
532
651
|
private readonly projectionInverse;
|
|
533
652
|
private readonly viewProjectionInverse;
|
|
653
|
+
private readonly previousTemporalViewProjection;
|
|
534
654
|
private explicitVolumes;
|
|
535
655
|
private volumeObjects;
|
|
656
|
+
private extractedLights;
|
|
536
657
|
private cascadeDirectionalLights;
|
|
537
658
|
private compositePass;
|
|
538
659
|
private readonly blurPassCache;
|
|
660
|
+
private readonly temporalPassCache;
|
|
661
|
+
private temporalWriteIndex;
|
|
662
|
+
private temporalHistoryValid;
|
|
663
|
+
private activeLastFrame;
|
|
539
664
|
private frameIndex;
|
|
540
665
|
constructor(scene?: Scene, options?: VolumetricFogOptions);
|
|
541
666
|
/** Updates the scene traversed for compatible volumes and lights. */
|
|
542
667
|
setScene(scene: Scene): void;
|
|
668
|
+
get enabled(): boolean;
|
|
669
|
+
setOptions(options: VolumetricFogOptions): void;
|
|
670
|
+
applyPreset(quality: VolumetricFogQuality): void;
|
|
671
|
+
reset(): void;
|
|
543
672
|
/** Keeps CSM light data in the same near-to-far order as shadow-array layers. */
|
|
544
673
|
setCascadedDirectionalLights(lights: readonly DirectionalLight[]): void;
|
|
545
674
|
addPasses(graph: FrameGraphBuilder, inputs: VolumetricFogInputs): FrameGraphTextureHandle;
|
|
546
675
|
private addBlurredComposite;
|
|
676
|
+
private addTemporalPass;
|
|
677
|
+
consumeTemporalHistoryValid(): boolean;
|
|
678
|
+
updateTemporalUniforms(uniforms: Float32Array, currentViewProjection: Matrix4, currentViewProjectionInverse: Matrix4, temporal: Required<VolumetricFogTemporalOptions>, context: RendererCustomPassContext): void;
|
|
547
679
|
dispose(): void;
|
|
548
680
|
private executeFroxels;
|
|
549
681
|
private collectSceneData;
|
|
550
682
|
private writeVolume;
|
|
551
683
|
private lightColor;
|
|
552
684
|
private writeDirectional;
|
|
685
|
+
private writeExtractedDirectional;
|
|
553
686
|
private writePoint;
|
|
687
|
+
private writeExtractedPoint;
|
|
554
688
|
private writeSpot;
|
|
689
|
+
private writeExtractedSpot;
|
|
555
690
|
private getResources;
|
|
556
691
|
}
|
|
557
692
|
/** WGSL appended to a material that calls rendererApplyVolumetricFog(). */
|
|
@@ -559,22 +694,6 @@ declare const VOLUMETRIC_FOG_MATERIAL_WGSL = "\nfn rendererSampleIntegratedFog(u
|
|
|
559
694
|
/** Adds the froxel input; append VOLUMETRIC_FOG_MATERIAL_WGSL and call its helper in fsMain. */
|
|
560
695
|
declare function configureVolumetricFogMaterial(material: WGSLShaderMaterial, resource?: string, boundsResource?: string): WGSLShaderMaterial;
|
|
561
696
|
|
|
562
|
-
interface TextureResource {
|
|
563
|
-
version: number;
|
|
564
|
-
width: number;
|
|
565
|
-
height: number;
|
|
566
|
-
depthOrArrayLayers: number;
|
|
567
|
-
format: GPUTextureFormat;
|
|
568
|
-
textureDimension: GPUTextureDimension;
|
|
569
|
-
viewDimension: GPUTextureViewDimension;
|
|
570
|
-
sampleType: GPUTextureSampleType;
|
|
571
|
-
samplerBindingType: GPUSamplerBindingType;
|
|
572
|
-
mipLevelCount: number;
|
|
573
|
-
texture: GPUTexture;
|
|
574
|
-
view: GPUTextureView;
|
|
575
|
-
sampler: GPUSampler;
|
|
576
|
-
}
|
|
577
|
-
|
|
578
697
|
interface WebGpuPMREMGeneratorContext {
|
|
579
698
|
device: GPUDevice;
|
|
580
699
|
getTextureResource(texture: Texture): TextureResource;
|
|
@@ -719,6 +838,7 @@ declare class WebGpuRenderer {
|
|
|
719
838
|
private readonly colorFormatsValueCache;
|
|
720
839
|
private nextColorFormatsId;
|
|
721
840
|
private readonly renderBundleScratch;
|
|
841
|
+
private readonly indirectMaterialResourcesScratch;
|
|
722
842
|
private readonly directBundleDrawStatsScratch;
|
|
723
843
|
private readonly sortedOpaqueBatchesScratch;
|
|
724
844
|
private readonly opaqueBatchPool;
|
|
@@ -760,6 +880,14 @@ declare class WebGpuRenderer {
|
|
|
760
880
|
private readonly projectionJitterPixels;
|
|
761
881
|
private readonly temporalVisibilityCurrentViewProj;
|
|
762
882
|
private readonly temporalVisibilityPreviousViewProj;
|
|
883
|
+
private readonly motionVectorProjection;
|
|
884
|
+
private readonly motionVectorCurrentViewProj;
|
|
885
|
+
private readonly motionVectorPreviousViewProj;
|
|
886
|
+
private motionVectorProjectionPending;
|
|
887
|
+
private motionVectorHistoryValid;
|
|
888
|
+
private motionVectorHistoryGeneration;
|
|
889
|
+
private lastMotionVectorTimeSeconds;
|
|
890
|
+
private readonly objectMotionHistory;
|
|
763
891
|
private readonly cameraFrustumPlanesScratch;
|
|
764
892
|
private readonly objectTraversalStackScratch;
|
|
765
893
|
private readonly isSphereVisibleScratch;
|
|
@@ -809,6 +937,13 @@ declare class WebGpuRenderer {
|
|
|
809
937
|
*/
|
|
810
938
|
setProjectionJitter(x: number, y: number): void;
|
|
811
939
|
clearProjectionJitter(): void;
|
|
940
|
+
/**
|
|
941
|
+
* Supplies the unjittered projection used by motion vectors for the next
|
|
942
|
+
* render. The backend calls this before TAA temporarily jitters the camera.
|
|
943
|
+
*/
|
|
944
|
+
setMotionVectorProjection(projection: Matrix4): void;
|
|
945
|
+
/** Suppresses object velocity for one frame without discarding GPU caches. */
|
|
946
|
+
invalidateObjectMotion(object: Object3D): void;
|
|
812
947
|
getLastFrameProfile(): RendererFrameProfile | null;
|
|
813
948
|
/**
|
|
814
949
|
* Invalidates temporal data when this renderer starts presenting a
|
|
@@ -885,6 +1020,8 @@ declare class WebGpuRenderer {
|
|
|
885
1020
|
*/
|
|
886
1021
|
private collectSprite;
|
|
887
1022
|
private hasExtractedDirectionalLight;
|
|
1023
|
+
private getObjectMotionHistory;
|
|
1024
|
+
private commitObjectMotionHistory;
|
|
888
1025
|
private collectMesh;
|
|
889
1026
|
private prepareSceneForCompilation;
|
|
890
1027
|
private collectInstancedMesh;
|
|
@@ -908,6 +1045,7 @@ declare class WebGpuRenderer {
|
|
|
908
1045
|
private getIndirectStreamKey;
|
|
909
1046
|
private getOrCreateStaticIndirectSubmissionStreams;
|
|
910
1047
|
private getOrCreateIndirectForwardBundle;
|
|
1048
|
+
private submitIndirectStreamDirect;
|
|
911
1049
|
private setRetainedIndirectBundleState;
|
|
912
1050
|
private getIndirectBundleHash;
|
|
913
1051
|
private getColorFormatsId;
|
|
@@ -1035,11 +1173,22 @@ declare class WebGpuRenderer {
|
|
|
1035
1173
|
|
|
1036
1174
|
interface GTAODenoiseOptions {
|
|
1037
1175
|
readonly radius?: number;
|
|
1176
|
+
/** Fixed bilateral tap count. Normalized to 4, 8, 12, or 16. */
|
|
1177
|
+
readonly samples?: number;
|
|
1038
1178
|
readonly depthPhi?: number;
|
|
1039
1179
|
readonly normalPhi?: number;
|
|
1040
1180
|
readonly lumaPhi?: number;
|
|
1041
1181
|
}
|
|
1182
|
+
interface GTAOTemporalOptions {
|
|
1183
|
+
/** Previous-frame contribution for accepted history. Defaults to 0.9. */
|
|
1184
|
+
readonly historyWeight?: number;
|
|
1185
|
+
/** Relative linear view-depth rejection threshold. Defaults to 0.08. */
|
|
1186
|
+
readonly depthRejection?: number;
|
|
1187
|
+
/** Clamp history to the current AO cross-neighborhood. Defaults to true. */
|
|
1188
|
+
readonly neighborhoodClamp?: boolean;
|
|
1189
|
+
}
|
|
1042
1190
|
interface GTAOOptions {
|
|
1191
|
+
readonly enabled?: boolean;
|
|
1043
1192
|
/** Resolution relative to the render target. Defaults to 1. */
|
|
1044
1193
|
readonly resolutionScale?: number;
|
|
1045
1194
|
readonly radius?: number;
|
|
@@ -1051,28 +1200,43 @@ interface GTAOOptions {
|
|
|
1051
1200
|
/** Space used by the encoded normal input. Defaults to world. */
|
|
1052
1201
|
readonly normalSpace?: "world" | "view";
|
|
1053
1202
|
readonly denoise?: false | GTAODenoiseOptions;
|
|
1203
|
+
/** Velocity-reprojected accumulation. Requires a velocity input. */
|
|
1204
|
+
readonly temporal?: false | GTAOTemporalOptions;
|
|
1054
1205
|
readonly targetPrefix?: string;
|
|
1055
1206
|
}
|
|
1056
1207
|
interface GTAOInputs {
|
|
1057
1208
|
readonly depth: FrameGraphTextureHandle;
|
|
1058
1209
|
readonly normal: FrameGraphTextureHandle;
|
|
1210
|
+
readonly velocity?: FrameGraphTextureHandle;
|
|
1059
1211
|
}
|
|
1060
1212
|
interface GTAOCompositeOptions {
|
|
1061
1213
|
readonly intensity?: number;
|
|
1062
1214
|
readonly power?: number;
|
|
1063
1215
|
readonly output?: FrameGraphTextureHandle;
|
|
1064
1216
|
}
|
|
1065
|
-
|
|
1217
|
+
type GTAOQuality = "off" | "low" | "medium" | "high";
|
|
1218
|
+
declare const GTAO_PRESETS: Readonly<Record<GTAOQuality, Readonly<GTAOOptions>>>;
|
|
1219
|
+
/** Reusable GTAO pass chain. The caller controls where AO is composited. */
|
|
1066
1220
|
declare class GTAOEffect {
|
|
1067
1221
|
private readonly options;
|
|
1068
1222
|
private readonly noiseTexture;
|
|
1069
1223
|
private readonly gtaoPasses;
|
|
1224
|
+
private readonly temporalPasses;
|
|
1070
1225
|
private readonly denoisePasses;
|
|
1071
1226
|
private readonly compositePasses;
|
|
1227
|
+
private writeIndex;
|
|
1228
|
+
private frameIndex;
|
|
1229
|
+
private historyValid;
|
|
1072
1230
|
constructor(options?: GTAOOptions);
|
|
1231
|
+
get enabled(): boolean;
|
|
1232
|
+
get temporalEnabled(): boolean;
|
|
1233
|
+
setOptions(options: GTAOOptions): void;
|
|
1234
|
+
applyPreset(quality: GTAOQuality): void;
|
|
1235
|
+
reset(): void;
|
|
1073
1236
|
addPasses(graph: FrameGraphBuilder, inputs: GTAOInputs): FrameGraphTextureHandle;
|
|
1074
1237
|
addCompositePass(graph: FrameGraphBuilder, sceneColor: FrameGraphTextureHandle, ambientOcclusion: FrameGraphTextureHandle, options?: GTAOCompositeOptions): FrameGraphTextureHandle;
|
|
1075
1238
|
dispose(): void;
|
|
1239
|
+
consumeHistoryValid(): boolean;
|
|
1076
1240
|
}
|
|
1077
1241
|
|
|
1078
1242
|
interface SSROptions {
|
|
@@ -1127,7 +1291,7 @@ interface TemporalAAOptions {
|
|
|
1127
1291
|
readonly targetPrefix?: string;
|
|
1128
1292
|
}
|
|
1129
1293
|
declare class TemporalAAEffect {
|
|
1130
|
-
|
|
1294
|
+
renderScale: number;
|
|
1131
1295
|
private readonly sampleCount;
|
|
1132
1296
|
private readonly minCurrentWeight;
|
|
1133
1297
|
private readonly motionWeightScale;
|
|
@@ -1159,8 +1323,14 @@ declare class TemporalAAEffect {
|
|
|
1159
1323
|
projectionMatrix: Matrix4;
|
|
1160
1324
|
projectionMatrixInverse?: Matrix4;
|
|
1161
1325
|
}): void;
|
|
1162
|
-
addPass(graph: FrameGraphBuilder, currentColor: FrameGraphTextureHandle, currentDepth?: FrameGraphTextureHandle): FrameGraphTextureHandle;
|
|
1326
|
+
addPass(graph: FrameGraphBuilder, currentColor: FrameGraphTextureHandle, currentDepth?: FrameGraphTextureHandle, velocity?: FrameGraphTextureHandle): FrameGraphTextureHandle;
|
|
1163
1327
|
reset(): void;
|
|
1328
|
+
/**
|
|
1329
|
+
* Updates the internal scene scale used to convert the presentation-space
|
|
1330
|
+
* jitter into internal-render pixels. TAA histories remain at presentation
|
|
1331
|
+
* resolution and therefore act as the temporal upscaling target.
|
|
1332
|
+
*/
|
|
1333
|
+
setRenderScale(renderScale: number): void;
|
|
1164
1334
|
private setSize;
|
|
1165
1335
|
updateResolveUniforms(uniforms: Float32Array, currentViewProjection: Matrix4, currentViewProjectionInverse: Matrix4, context: RendererCustomPassContext): void;
|
|
1166
1336
|
}
|
|
@@ -1309,6 +1479,93 @@ declare class DepthOfFieldEffect {
|
|
|
1309
1479
|
addPass(graph: FrameGraphBuilder, source: FrameGraphTextureHandle, depth: FrameGraphTextureHandle): FrameGraphTextureHandle;
|
|
1310
1480
|
}
|
|
1311
1481
|
|
|
1482
|
+
declare enum MotionBlurMode {
|
|
1483
|
+
Disabled = 0,
|
|
1484
|
+
CameraOnly = 1,
|
|
1485
|
+
ObjectAndCamera = 2,
|
|
1486
|
+
ForceObjectBlur = 3
|
|
1487
|
+
}
|
|
1488
|
+
type MotionBlurQuality = "off" | "low" | "medium" | "high";
|
|
1489
|
+
interface MotionBlurOptions {
|
|
1490
|
+
enabled?: boolean;
|
|
1491
|
+
sampleCount?: number;
|
|
1492
|
+
shutterScale?: number;
|
|
1493
|
+
maxBlurPixels?: number;
|
|
1494
|
+
cameraBlurScale?: number;
|
|
1495
|
+
objectBlurScale?: number;
|
|
1496
|
+
depthRejectionStrength?: number;
|
|
1497
|
+
velocityThresholdPixels?: number;
|
|
1498
|
+
dilation?: boolean;
|
|
1499
|
+
debugVelocity?: boolean;
|
|
1500
|
+
targetFrameRate?: number;
|
|
1501
|
+
maxFrameTime?: number;
|
|
1502
|
+
cameraCutDistance?: number;
|
|
1503
|
+
cameraCutRotationThreshold?: number;
|
|
1504
|
+
projectionCutThreshold?: number;
|
|
1505
|
+
targetPrefix?: string;
|
|
1506
|
+
}
|
|
1507
|
+
interface MotionBlurOverride extends Partial<MotionBlurOptions> {
|
|
1508
|
+
duration: number;
|
|
1509
|
+
}
|
|
1510
|
+
interface MotionBlurOverrideHandle {
|
|
1511
|
+
readonly id: number;
|
|
1512
|
+
cancel(): void;
|
|
1513
|
+
}
|
|
1514
|
+
declare const MOTION_BLUR_PRESETS: Readonly<Record<MotionBlurQuality, Readonly<MotionBlurOptions>>>;
|
|
1515
|
+
/**
|
|
1516
|
+
* HDR, depth-aware motion-blur resolve.
|
|
1517
|
+
*
|
|
1518
|
+
* Velocity convention:
|
|
1519
|
+
* - RG points from the previous position to the current position.
|
|
1520
|
+
* - Units are texture UV displacement per rendered frame.
|
|
1521
|
+
* - Y is texture-space down; the node compiler flips WebGPU's Y-up NDC.
|
|
1522
|
+
* - Current/previous matrices are unjittered, so TAA jitter is excluded.
|
|
1523
|
+
* - B stores MotionBlurMode and A stores the authored object scale.
|
|
1524
|
+
*/
|
|
1525
|
+
declare class MotionBlurEffect {
|
|
1526
|
+
readonly options: Required<Omit<MotionBlurOptions, "targetPrefix">>;
|
|
1527
|
+
private readonly targetPrefix;
|
|
1528
|
+
private readonly currentViewProjection;
|
|
1529
|
+
private readonly currentInverseViewProjection;
|
|
1530
|
+
private readonly currentInverseProjection;
|
|
1531
|
+
private readonly previousViewProjection;
|
|
1532
|
+
private readonly pendingViewProjection;
|
|
1533
|
+
private readonly previousProjection;
|
|
1534
|
+
private readonly previousCameraWorld;
|
|
1535
|
+
private readonly previousCameraPosition;
|
|
1536
|
+
private readonly currentCameraPosition;
|
|
1537
|
+
private readonly currentJitterUv;
|
|
1538
|
+
private historyValid;
|
|
1539
|
+
private pendingCamera;
|
|
1540
|
+
private width;
|
|
1541
|
+
private height;
|
|
1542
|
+
private timeSeconds;
|
|
1543
|
+
private frameDuration;
|
|
1544
|
+
private previousTimeSeconds;
|
|
1545
|
+
private nextOverrideId;
|
|
1546
|
+
private readonly overrides;
|
|
1547
|
+
private readonly passes;
|
|
1548
|
+
constructor(options?: MotionBlurOptions);
|
|
1549
|
+
applyPreset(quality: MotionBlurQuality): void;
|
|
1550
|
+
prepareCamera(camera: PerspectiveCamera | OrthographicCamera, width: number, height: number, timeSeconds: number): void;
|
|
1551
|
+
commitCamera(): void;
|
|
1552
|
+
setJitterUv(x: number, y: number): void;
|
|
1553
|
+
reset(): void;
|
|
1554
|
+
requiresRendererHistoryReset(): boolean;
|
|
1555
|
+
pushOverride(override: MotionBlurOverride): MotionBlurOverrideHandle;
|
|
1556
|
+
addPass(graph: FrameGraphBuilder, sceneColor: FrameGraphTextureHandle, velocity: FrameGraphTextureHandle, depth?: FrameGraphTextureHandle): FrameGraphTextureHandle;
|
|
1557
|
+
dispose(): void;
|
|
1558
|
+
getTemporalMatrices(): {
|
|
1559
|
+
readonly currentInverseViewProjection: Matrix4;
|
|
1560
|
+
readonly currentInverseProjection: Matrix4;
|
|
1561
|
+
readonly previousViewProjection: Matrix4;
|
|
1562
|
+
};
|
|
1563
|
+
getFrameDuration(): number;
|
|
1564
|
+
getJitterUv(): Vector2;
|
|
1565
|
+
private pruneOverrides;
|
|
1566
|
+
private getResolvedSettings;
|
|
1567
|
+
}
|
|
1568
|
+
|
|
1312
1569
|
interface OutlineOptions {
|
|
1313
1570
|
readonly enabled?: boolean;
|
|
1314
1571
|
readonly visibleEdgeColor?: readonly [number, number, number];
|
|
@@ -1350,4 +1607,4 @@ declare class OutlineEffect {
|
|
|
1350
1607
|
dispose(): void;
|
|
1351
1608
|
}
|
|
1352
1609
|
|
|
1353
|
-
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 FXAACompositeOptions, FXAAEffect, type FXAAOptions, FrameGraphBuilder, type FrameGraphFullscreenPassDescriptor, type FrameGraphMaterialPassDescriptor, type FrameGraphNodeFullscreenPassDescriptor, type FrameGraphPassDescriptor, type FrameGraphTextureHandle, type GTAOCompositeOptions, type GTAODenoiseOptions, GTAOEffect, type GTAOInputs, type GTAOOptions, OutlineEffect, type OutlineInputs, type OutlineInstanceSelection, type OutlineOptions, 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, 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, type VolumetricFogBlurOptions, VolumetricFogEffect, type VolumetricFogInputs, type VolumetricFogOptions, type VolumetricFogScatteringMode, 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, configureVolumetricFogMaterial };
|
|
1610
|
+
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 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, 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, 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, configureVolumetricFogMaterial };
|