@hology/webgpu-renderer 0.1.5 → 0.1.7
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 +220 -9
- package/dist/index.js +1 -1
- package/package.json +42 -42
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, DirectionalLight, Object3D, PerspectiveCamera, OrthographicCamera, Scene } from 'three';
|
|
2
|
+
import { Color, Vector2, Vector3, Vector4, Matrix3, Matrix4, Material, Texture, MaterialParameters, DirectionalLight, PointLight, SpotLight, 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 {
|
|
@@ -137,6 +137,8 @@ declare class WGSLShaderMaterial extends Material {
|
|
|
137
137
|
customProgramCacheKey(): string;
|
|
138
138
|
getTexturesList(): readonly Texture[];
|
|
139
139
|
usesSceneTextures(): boolean;
|
|
140
|
+
usesSceneColor(): boolean;
|
|
141
|
+
usesSceneDepth(): boolean;
|
|
140
142
|
getGraphTextureInputs(): Record<string, WGSLGraphTextureInput>;
|
|
141
143
|
requiresLatePass(): boolean;
|
|
142
144
|
getUniformValueHash(): number;
|
|
@@ -177,6 +179,9 @@ declare class RenderGraph {
|
|
|
177
179
|
private resolveExecutionOrder;
|
|
178
180
|
}
|
|
179
181
|
|
|
182
|
+
/** Shared renderer lighting ABI for procedural particle geometry. */
|
|
183
|
+
declare function buildParticleLightingShaderHeader(receiveShadow?: boolean, modelMatrixBody?: string): string;
|
|
184
|
+
|
|
180
185
|
interface TextureResource {
|
|
181
186
|
version: number;
|
|
182
187
|
width: number;
|
|
@@ -230,10 +235,12 @@ interface ExtractedDirectionalLight {
|
|
|
230
235
|
shadowCameraFar: number;
|
|
231
236
|
}
|
|
232
237
|
interface ExtractedPointLight {
|
|
238
|
+
sourceLight: PointLight;
|
|
233
239
|
position: Vector3;
|
|
234
240
|
color: Vector3;
|
|
235
241
|
intensity: number;
|
|
236
242
|
volumetricIntensity: number;
|
|
243
|
+
distance: number;
|
|
237
244
|
range: number;
|
|
238
245
|
decay: number;
|
|
239
246
|
castShadow: boolean;
|
|
@@ -246,6 +253,7 @@ interface ExtractedPointLight {
|
|
|
246
253
|
shadowCameraFar: number;
|
|
247
254
|
}
|
|
248
255
|
interface ExtractedSpotLight {
|
|
256
|
+
sourceLight: SpotLight;
|
|
249
257
|
position: Vector3;
|
|
250
258
|
direction: Vector3;
|
|
251
259
|
color: Vector3;
|
|
@@ -308,6 +316,12 @@ interface RendererOptions {
|
|
|
308
316
|
interface StaticDrawSetOptions {
|
|
309
317
|
label?: string;
|
|
310
318
|
onUnsupported?: "throw" | "skip";
|
|
319
|
+
/**
|
|
320
|
+
* Admit transparent and scene-texture materials and render them, in their
|
|
321
|
+
* stable recorded order, during the late pass. No camera-depth sorting is
|
|
322
|
+
* performed inside the set.
|
|
323
|
+
*/
|
|
324
|
+
allowUnsortedLateDraws?: boolean;
|
|
311
325
|
}
|
|
312
326
|
interface StaticDrawSet {
|
|
313
327
|
readonly label: string;
|
|
@@ -337,7 +351,10 @@ interface RendererGraphBuilderContext {
|
|
|
337
351
|
defineTextureTarget(name: string, descriptor?: RendererTextureTargetDescriptor): void;
|
|
338
352
|
addForwardPass(output?: string): void;
|
|
339
353
|
addOpaquePass(output?: string): void;
|
|
340
|
-
addSceneTextureCopyPass(source?: string
|
|
354
|
+
addSceneTextureCopyPass(source?: string, requirements?: {
|
|
355
|
+
readonly sceneColor?: boolean;
|
|
356
|
+
readonly sceneDepth?: boolean;
|
|
357
|
+
}): void;
|
|
341
358
|
addLatePass(output?: string): void;
|
|
342
359
|
addHiZHistoryPass(dependsOn?: string): void;
|
|
343
360
|
addMaterialPass(descriptor?: RendererMaterialPassDescriptor): void;
|
|
@@ -411,7 +428,10 @@ interface RendererCustomPassContext {
|
|
|
411
428
|
getSceneLightingResources(): RendererSceneLightingResources;
|
|
412
429
|
}
|
|
413
430
|
interface RendererSceneLightingResources {
|
|
431
|
+
readonly cameraBuffer: GPUBuffer;
|
|
414
432
|
readonly lightBuffer: GPUBuffer;
|
|
433
|
+
readonly shadowSampler: GPUSampler;
|
|
434
|
+
readonly linearSampler: GPUSampler;
|
|
415
435
|
readonly directionalShadowView: GPUTextureView;
|
|
416
436
|
readonly pointShadowView: GPUTextureView;
|
|
417
437
|
readonly spotShadowView: GPUTextureView;
|
|
@@ -528,7 +548,10 @@ declare class FrameGraphBuilder {
|
|
|
528
548
|
addVisibilityPass(): void;
|
|
529
549
|
addForwardPass(output?: FrameGraphTextureHandle): void;
|
|
530
550
|
addOpaquePass(output?: FrameGraphTextureHandle): void;
|
|
531
|
-
addSceneTextureCopyPass(source?: FrameGraphTextureHandle
|
|
551
|
+
addSceneTextureCopyPass(source?: FrameGraphTextureHandle, requirements?: {
|
|
552
|
+
readonly sceneColor?: boolean;
|
|
553
|
+
readonly sceneDepth?: boolean;
|
|
554
|
+
}): void;
|
|
532
555
|
addLatePass(output?: FrameGraphTextureHandle): void;
|
|
533
556
|
addHiZHistoryPass(dependsOn?: string): void;
|
|
534
557
|
addMaterialPass(descriptor?: FrameGraphMaterialPassDescriptor): void;
|
|
@@ -539,6 +562,15 @@ declare class FrameGraphBuilder {
|
|
|
539
562
|
}
|
|
540
563
|
|
|
541
564
|
type VolumetricFogScatteringMode = "volumetric" | "lightShaft";
|
|
565
|
+
type VolumetricFogQuality = "low" | "medium" | "high";
|
|
566
|
+
interface VolumetricFogTemporalOptions {
|
|
567
|
+
/** Previous-frame contribution for stable fog. Defaults to 0.92. */
|
|
568
|
+
readonly historyWeight?: number;
|
|
569
|
+
/** Relative view-depth difference that rejects history. Defaults to 0.04. */
|
|
570
|
+
readonly depthRejection?: number;
|
|
571
|
+
/** Clamp reprojected history to the current 3x3 fog neighborhood. */
|
|
572
|
+
readonly neighborhoodClamp?: boolean;
|
|
573
|
+
}
|
|
542
574
|
/** Kept structurally compatible with Hology's legacy FogVolumeSettings. */
|
|
543
575
|
interface VolumetricFogVolumeSettings {
|
|
544
576
|
readonly object: Object3D;
|
|
@@ -559,6 +591,7 @@ declare class VolumetricFogVolumeObject extends Object3D {
|
|
|
559
591
|
constructor(volume: VolumetricFogVolumeSettings);
|
|
560
592
|
}
|
|
561
593
|
interface VolumetricFogOptions {
|
|
594
|
+
readonly enabled?: boolean;
|
|
562
595
|
/** Froxel width/height in pixels. 8 is a good desktop default. */
|
|
563
596
|
readonly froxelPixelSize?: number;
|
|
564
597
|
/** Logarithmically distributed depth slices. */
|
|
@@ -575,8 +608,13 @@ interface VolumetricFogOptions {
|
|
|
575
608
|
readonly ambientColor?: Color;
|
|
576
609
|
/** Rotating shadow taps per froxel. 4 removes block patterns at modest cost. */
|
|
577
610
|
readonly shadowFilterTaps?: 1 | 4;
|
|
578
|
-
/** Temporal sub-froxel jitter
|
|
611
|
+
/** Temporal sub-froxel jitter accumulated by fog history and optionally TAA. */
|
|
579
612
|
readonly temporalJitter?: boolean;
|
|
613
|
+
/**
|
|
614
|
+
* Fog-local temporal reconstruction. Unlike temporalJitter, this retains a
|
|
615
|
+
* resolved fog history and permits cheaper current-frame sampling.
|
|
616
|
+
*/
|
|
617
|
+
readonly temporal?: false | VolumetricFogTemporalOptions;
|
|
580
618
|
/** Stable per-ray depth jitter. Breaks slice bands without animated noise. */
|
|
581
619
|
readonly spatialJitter?: boolean;
|
|
582
620
|
/** Final fog-gradient dithering in approximate 8-bit code values. */
|
|
@@ -601,6 +639,8 @@ interface VolumetricFogBlurOptions {
|
|
|
601
639
|
interface VolumetricFogInputs {
|
|
602
640
|
readonly sceneColor: FrameGraphTextureHandle;
|
|
603
641
|
readonly depth: FrameGraphTextureHandle;
|
|
642
|
+
/** Raw unjittered previous-to-current UV velocity from the opaque MRT. */
|
|
643
|
+
readonly velocity?: FrameGraphTextureHandle;
|
|
604
644
|
/** Explicit volumes can be mixed with compatible scene marker objects. */
|
|
605
645
|
readonly volumes?: readonly VolumetricFogVolumeSettings[];
|
|
606
646
|
/**
|
|
@@ -614,6 +654,7 @@ interface VolumetricFogInputs {
|
|
|
614
654
|
*/
|
|
615
655
|
readonly lights?: RendererExtractedLightState;
|
|
616
656
|
}
|
|
657
|
+
declare const VOLUMETRIC_FOG_PRESETS: Readonly<Record<VolumetricFogQuality, VolumetricFogOptions>>;
|
|
617
658
|
/**
|
|
618
659
|
* Compute-driven froxel fog. Add it after opaque rendering and before the late
|
|
619
660
|
* transparent pass. Existing content can use the composite output; transparent
|
|
@@ -630,27 +671,56 @@ declare class VolumetricFogEffect {
|
|
|
630
671
|
private readonly uniformIntegers;
|
|
631
672
|
private readonly volumeData;
|
|
632
673
|
private readonly lightData;
|
|
674
|
+
private readonly selectedPointIndices;
|
|
675
|
+
private readonly selectedPointScores;
|
|
676
|
+
private readonly selectedSpotIndices;
|
|
677
|
+
private readonly selectedSpotScores;
|
|
678
|
+
private readonly collectedVolumes;
|
|
679
|
+
private readonly collectedDirectionals;
|
|
680
|
+
private readonly collectedPoints;
|
|
681
|
+
private readonly collectedSpots;
|
|
682
|
+
private volumeCount;
|
|
683
|
+
private directionalCount;
|
|
684
|
+
private pointCount;
|
|
685
|
+
private spotCount;
|
|
686
|
+
private collectionCamera;
|
|
687
|
+
private readonly collectVolumeObject;
|
|
688
|
+
private readonly collectLightObject;
|
|
689
|
+
private readonly executeFroxelPass;
|
|
633
690
|
private readonly projectionInverse;
|
|
634
691
|
private readonly viewProjectionInverse;
|
|
692
|
+
private readonly previousTemporalViewProjection;
|
|
635
693
|
private explicitVolumes;
|
|
636
694
|
private volumeObjects;
|
|
637
695
|
private extractedLights;
|
|
638
696
|
private cascadeDirectionalLights;
|
|
639
697
|
private compositePass;
|
|
640
698
|
private readonly blurPassCache;
|
|
699
|
+
private readonly temporalPassCache;
|
|
700
|
+
private temporalWriteIndex;
|
|
701
|
+
private temporalHistoryValid;
|
|
702
|
+
private activeLastFrame;
|
|
641
703
|
private frameIndex;
|
|
642
704
|
constructor(scene?: Scene, options?: VolumetricFogOptions);
|
|
643
705
|
/** Updates the scene traversed for compatible volumes and lights. */
|
|
644
706
|
setScene(scene: Scene): void;
|
|
707
|
+
get enabled(): boolean;
|
|
708
|
+
setOptions(options: VolumetricFogOptions): void;
|
|
709
|
+
applyPreset(quality: VolumetricFogQuality): void;
|
|
710
|
+
reset(): void;
|
|
645
711
|
/** Keeps CSM light data in the same near-to-far order as shadow-array layers. */
|
|
646
712
|
setCascadedDirectionalLights(lights: readonly DirectionalLight[]): void;
|
|
647
713
|
addPasses(graph: FrameGraphBuilder, inputs: VolumetricFogInputs): FrameGraphTextureHandle;
|
|
648
714
|
private addBlurredComposite;
|
|
715
|
+
private addTemporalPass;
|
|
716
|
+
consumeTemporalHistoryValid(): boolean;
|
|
717
|
+
updateTemporalUniforms(uniforms: Float32Array, currentViewProjection: Matrix4, currentViewProjectionInverse: Matrix4, temporal: Required<VolumetricFogTemporalOptions>, context: RendererCustomPassContext): void;
|
|
649
718
|
dispose(): void;
|
|
650
719
|
private executeFroxels;
|
|
651
720
|
private collectSceneData;
|
|
721
|
+
/** Selects the nearest local lights without depending on camera rotation. */
|
|
722
|
+
private selectClosestLights;
|
|
652
723
|
private writeVolume;
|
|
653
|
-
private lightColor;
|
|
654
724
|
private writeDirectional;
|
|
655
725
|
private writeExtractedDirectional;
|
|
656
726
|
private writePoint;
|
|
@@ -798,6 +868,8 @@ declare class WebGpuRenderer {
|
|
|
798
868
|
private readonly standardVertexAttributeCache;
|
|
799
869
|
private readonly geometryVertexBufferFastCache;
|
|
800
870
|
private readonly vertexAttributeGroupCache;
|
|
871
|
+
private readonly materialVertexAttributeCache;
|
|
872
|
+
private readonly vertexBufferBindingPlanCache;
|
|
801
873
|
private readonly vertexAttributeGroupBufferKeyCache;
|
|
802
874
|
private readonly compileDrawScratch;
|
|
803
875
|
private readonly dynamicIndirectSubmissionCache;
|
|
@@ -850,6 +922,14 @@ declare class WebGpuRenderer {
|
|
|
850
922
|
private readonly projectionJitterPixels;
|
|
851
923
|
private readonly temporalVisibilityCurrentViewProj;
|
|
852
924
|
private readonly temporalVisibilityPreviousViewProj;
|
|
925
|
+
private readonly motionVectorProjection;
|
|
926
|
+
private readonly motionVectorCurrentViewProj;
|
|
927
|
+
private readonly motionVectorPreviousViewProj;
|
|
928
|
+
private motionVectorProjectionPending;
|
|
929
|
+
private motionVectorHistoryValid;
|
|
930
|
+
private motionVectorHistoryGeneration;
|
|
931
|
+
private lastMotionVectorTimeSeconds;
|
|
932
|
+
private readonly objectMotionHistory;
|
|
853
933
|
private readonly cameraFrustumPlanesScratch;
|
|
854
934
|
private readonly objectTraversalStackScratch;
|
|
855
935
|
private readonly isSphereVisibleScratch;
|
|
@@ -873,6 +953,7 @@ declare class WebGpuRenderer {
|
|
|
873
953
|
private hasRenderCallbacks;
|
|
874
954
|
initialize(): Promise<void>;
|
|
875
955
|
createComputeKernel(descriptor: ComputeKernelDescriptor): ComputeKernel;
|
|
956
|
+
getDevice(): GPUDevice | null;
|
|
876
957
|
setRenderGraphBuilder(builder: RendererGraphBuilder): void;
|
|
877
958
|
/**
|
|
878
959
|
* Associates the first directional shadow layers with cascaded-shadow-map
|
|
@@ -899,6 +980,13 @@ declare class WebGpuRenderer {
|
|
|
899
980
|
*/
|
|
900
981
|
setProjectionJitter(x: number, y: number): void;
|
|
901
982
|
clearProjectionJitter(): void;
|
|
983
|
+
/**
|
|
984
|
+
* Supplies the unjittered projection used by motion vectors for the next
|
|
985
|
+
* render. The backend calls this before TAA temporarily jitters the camera.
|
|
986
|
+
*/
|
|
987
|
+
setMotionVectorProjection(projection: Matrix4): void;
|
|
988
|
+
/** Suppresses object velocity for one frame without discarding GPU caches. */
|
|
989
|
+
invalidateObjectMotion(object: Object3D): void;
|
|
902
990
|
getLastFrameProfile(): RendererFrameProfile | null;
|
|
903
991
|
/**
|
|
904
992
|
* Invalidates temporal data when this renderer starts presenting a
|
|
@@ -975,6 +1063,8 @@ declare class WebGpuRenderer {
|
|
|
975
1063
|
*/
|
|
976
1064
|
private collectSprite;
|
|
977
1065
|
private hasExtractedDirectionalLight;
|
|
1066
|
+
private getObjectMotionHistory;
|
|
1067
|
+
private commitObjectMotionHistory;
|
|
978
1068
|
private collectMesh;
|
|
979
1069
|
private prepareSceneForCompilation;
|
|
980
1070
|
private collectInstancedMesh;
|
|
@@ -1060,6 +1150,8 @@ declare class WebGpuRenderer {
|
|
|
1060
1150
|
private getInterleavedGeometryVertexBuffer;
|
|
1061
1151
|
private ensureWireframeIndex;
|
|
1062
1152
|
private bindGeometryVertexBuffers;
|
|
1153
|
+
private getStandardVertexAttribute;
|
|
1154
|
+
private prepareDrawGeometryVertexBuffers;
|
|
1063
1155
|
private getDefaultInstanceAttributeBuffer;
|
|
1064
1156
|
private getMeshExtractionCacheEntry;
|
|
1065
1157
|
private getInstancedMeshExtractionCacheEntry;
|
|
@@ -1126,11 +1218,22 @@ declare class WebGpuRenderer {
|
|
|
1126
1218
|
|
|
1127
1219
|
interface GTAODenoiseOptions {
|
|
1128
1220
|
readonly radius?: number;
|
|
1221
|
+
/** Fixed bilateral tap count. Normalized to 4, 8, 12, or 16. */
|
|
1222
|
+
readonly samples?: number;
|
|
1129
1223
|
readonly depthPhi?: number;
|
|
1130
1224
|
readonly normalPhi?: number;
|
|
1131
1225
|
readonly lumaPhi?: number;
|
|
1132
1226
|
}
|
|
1227
|
+
interface GTAOTemporalOptions {
|
|
1228
|
+
/** Previous-frame contribution for accepted history. Defaults to 0.9. */
|
|
1229
|
+
readonly historyWeight?: number;
|
|
1230
|
+
/** Relative linear view-depth rejection threshold. Defaults to 0.08. */
|
|
1231
|
+
readonly depthRejection?: number;
|
|
1232
|
+
/** Clamp history to the current AO cross-neighborhood. Defaults to true. */
|
|
1233
|
+
readonly neighborhoodClamp?: boolean;
|
|
1234
|
+
}
|
|
1133
1235
|
interface GTAOOptions {
|
|
1236
|
+
readonly enabled?: boolean;
|
|
1134
1237
|
/** Resolution relative to the render target. Defaults to 1. */
|
|
1135
1238
|
readonly resolutionScale?: number;
|
|
1136
1239
|
readonly radius?: number;
|
|
@@ -1142,28 +1245,43 @@ interface GTAOOptions {
|
|
|
1142
1245
|
/** Space used by the encoded normal input. Defaults to world. */
|
|
1143
1246
|
readonly normalSpace?: "world" | "view";
|
|
1144
1247
|
readonly denoise?: false | GTAODenoiseOptions;
|
|
1248
|
+
/** Velocity-reprojected accumulation. Requires a velocity input. */
|
|
1249
|
+
readonly temporal?: false | GTAOTemporalOptions;
|
|
1145
1250
|
readonly targetPrefix?: string;
|
|
1146
1251
|
}
|
|
1147
1252
|
interface GTAOInputs {
|
|
1148
1253
|
readonly depth: FrameGraphTextureHandle;
|
|
1149
1254
|
readonly normal: FrameGraphTextureHandle;
|
|
1255
|
+
readonly velocity?: FrameGraphTextureHandle;
|
|
1150
1256
|
}
|
|
1151
1257
|
interface GTAOCompositeOptions {
|
|
1152
1258
|
readonly intensity?: number;
|
|
1153
1259
|
readonly power?: number;
|
|
1154
1260
|
readonly output?: FrameGraphTextureHandle;
|
|
1155
1261
|
}
|
|
1156
|
-
|
|
1262
|
+
type GTAOQuality = "off" | "low" | "medium" | "high";
|
|
1263
|
+
declare const GTAO_PRESETS: Readonly<Record<GTAOQuality, Readonly<GTAOOptions>>>;
|
|
1264
|
+
/** Reusable GTAO pass chain. The caller controls where AO is composited. */
|
|
1157
1265
|
declare class GTAOEffect {
|
|
1158
1266
|
private readonly options;
|
|
1159
1267
|
private readonly noiseTexture;
|
|
1160
1268
|
private readonly gtaoPasses;
|
|
1269
|
+
private readonly temporalPasses;
|
|
1161
1270
|
private readonly denoisePasses;
|
|
1162
1271
|
private readonly compositePasses;
|
|
1272
|
+
private writeIndex;
|
|
1273
|
+
private frameIndex;
|
|
1274
|
+
private historyValid;
|
|
1163
1275
|
constructor(options?: GTAOOptions);
|
|
1276
|
+
get enabled(): boolean;
|
|
1277
|
+
get temporalEnabled(): boolean;
|
|
1278
|
+
setOptions(options: GTAOOptions): void;
|
|
1279
|
+
applyPreset(quality: GTAOQuality): void;
|
|
1280
|
+
reset(): void;
|
|
1164
1281
|
addPasses(graph: FrameGraphBuilder, inputs: GTAOInputs): FrameGraphTextureHandle;
|
|
1165
1282
|
addCompositePass(graph: FrameGraphBuilder, sceneColor: FrameGraphTextureHandle, ambientOcclusion: FrameGraphTextureHandle, options?: GTAOCompositeOptions): FrameGraphTextureHandle;
|
|
1166
1283
|
dispose(): void;
|
|
1284
|
+
consumeHistoryValid(): boolean;
|
|
1167
1285
|
}
|
|
1168
1286
|
|
|
1169
1287
|
interface SSROptions {
|
|
@@ -1218,7 +1336,7 @@ interface TemporalAAOptions {
|
|
|
1218
1336
|
readonly targetPrefix?: string;
|
|
1219
1337
|
}
|
|
1220
1338
|
declare class TemporalAAEffect {
|
|
1221
|
-
|
|
1339
|
+
renderScale: number;
|
|
1222
1340
|
private readonly sampleCount;
|
|
1223
1341
|
private readonly minCurrentWeight;
|
|
1224
1342
|
private readonly motionWeightScale;
|
|
@@ -1250,8 +1368,14 @@ declare class TemporalAAEffect {
|
|
|
1250
1368
|
projectionMatrix: Matrix4;
|
|
1251
1369
|
projectionMatrixInverse?: Matrix4;
|
|
1252
1370
|
}): void;
|
|
1253
|
-
addPass(graph: FrameGraphBuilder, currentColor: FrameGraphTextureHandle, currentDepth?: FrameGraphTextureHandle): FrameGraphTextureHandle;
|
|
1371
|
+
addPass(graph: FrameGraphBuilder, currentColor: FrameGraphTextureHandle, currentDepth?: FrameGraphTextureHandle, velocity?: FrameGraphTextureHandle): FrameGraphTextureHandle;
|
|
1254
1372
|
reset(): void;
|
|
1373
|
+
/**
|
|
1374
|
+
* Updates the internal scene scale used to convert the presentation-space
|
|
1375
|
+
* jitter into internal-render pixels. TAA histories remain at presentation
|
|
1376
|
+
* resolution and therefore act as the temporal upscaling target.
|
|
1377
|
+
*/
|
|
1378
|
+
setRenderScale(renderScale: number): void;
|
|
1255
1379
|
private setSize;
|
|
1256
1380
|
updateResolveUniforms(uniforms: Float32Array, currentViewProjection: Matrix4, currentViewProjectionInverse: Matrix4, context: RendererCustomPassContext): void;
|
|
1257
1381
|
}
|
|
@@ -1400,6 +1524,93 @@ declare class DepthOfFieldEffect {
|
|
|
1400
1524
|
addPass(graph: FrameGraphBuilder, source: FrameGraphTextureHandle, depth: FrameGraphTextureHandle): FrameGraphTextureHandle;
|
|
1401
1525
|
}
|
|
1402
1526
|
|
|
1527
|
+
declare enum MotionBlurMode {
|
|
1528
|
+
Disabled = 0,
|
|
1529
|
+
CameraOnly = 1,
|
|
1530
|
+
ObjectAndCamera = 2,
|
|
1531
|
+
ForceObjectBlur = 3
|
|
1532
|
+
}
|
|
1533
|
+
type MotionBlurQuality = "off" | "low" | "medium" | "high";
|
|
1534
|
+
interface MotionBlurOptions {
|
|
1535
|
+
enabled?: boolean;
|
|
1536
|
+
sampleCount?: number;
|
|
1537
|
+
shutterScale?: number;
|
|
1538
|
+
maxBlurPixels?: number;
|
|
1539
|
+
cameraBlurScale?: number;
|
|
1540
|
+
objectBlurScale?: number;
|
|
1541
|
+
depthRejectionStrength?: number;
|
|
1542
|
+
velocityThresholdPixels?: number;
|
|
1543
|
+
dilation?: boolean;
|
|
1544
|
+
debugVelocity?: boolean;
|
|
1545
|
+
targetFrameRate?: number;
|
|
1546
|
+
maxFrameTime?: number;
|
|
1547
|
+
cameraCutDistance?: number;
|
|
1548
|
+
cameraCutRotationThreshold?: number;
|
|
1549
|
+
projectionCutThreshold?: number;
|
|
1550
|
+
targetPrefix?: string;
|
|
1551
|
+
}
|
|
1552
|
+
interface MotionBlurOverride extends Partial<MotionBlurOptions> {
|
|
1553
|
+
duration: number;
|
|
1554
|
+
}
|
|
1555
|
+
interface MotionBlurOverrideHandle {
|
|
1556
|
+
readonly id: number;
|
|
1557
|
+
cancel(): void;
|
|
1558
|
+
}
|
|
1559
|
+
declare const MOTION_BLUR_PRESETS: Readonly<Record<MotionBlurQuality, Readonly<MotionBlurOptions>>>;
|
|
1560
|
+
/**
|
|
1561
|
+
* HDR, depth-aware motion-blur resolve.
|
|
1562
|
+
*
|
|
1563
|
+
* Velocity convention:
|
|
1564
|
+
* - RG points from the previous position to the current position.
|
|
1565
|
+
* - Units are texture UV displacement per rendered frame.
|
|
1566
|
+
* - Y is texture-space down; the node compiler flips WebGPU's Y-up NDC.
|
|
1567
|
+
* - Current/previous matrices are unjittered, so TAA jitter is excluded.
|
|
1568
|
+
* - B stores MotionBlurMode and A stores the authored object scale.
|
|
1569
|
+
*/
|
|
1570
|
+
declare class MotionBlurEffect {
|
|
1571
|
+
readonly options: Required<Omit<MotionBlurOptions, "targetPrefix">>;
|
|
1572
|
+
private readonly targetPrefix;
|
|
1573
|
+
private readonly currentViewProjection;
|
|
1574
|
+
private readonly currentInverseViewProjection;
|
|
1575
|
+
private readonly currentInverseProjection;
|
|
1576
|
+
private readonly previousViewProjection;
|
|
1577
|
+
private readonly pendingViewProjection;
|
|
1578
|
+
private readonly previousProjection;
|
|
1579
|
+
private readonly previousCameraWorld;
|
|
1580
|
+
private readonly previousCameraPosition;
|
|
1581
|
+
private readonly currentCameraPosition;
|
|
1582
|
+
private readonly currentJitterUv;
|
|
1583
|
+
private historyValid;
|
|
1584
|
+
private pendingCamera;
|
|
1585
|
+
private width;
|
|
1586
|
+
private height;
|
|
1587
|
+
private timeSeconds;
|
|
1588
|
+
private frameDuration;
|
|
1589
|
+
private previousTimeSeconds;
|
|
1590
|
+
private nextOverrideId;
|
|
1591
|
+
private readonly overrides;
|
|
1592
|
+
private readonly passes;
|
|
1593
|
+
constructor(options?: MotionBlurOptions);
|
|
1594
|
+
applyPreset(quality: MotionBlurQuality): void;
|
|
1595
|
+
prepareCamera(camera: PerspectiveCamera | OrthographicCamera, width: number, height: number, timeSeconds: number): void;
|
|
1596
|
+
commitCamera(): void;
|
|
1597
|
+
setJitterUv(x: number, y: number): void;
|
|
1598
|
+
reset(): void;
|
|
1599
|
+
requiresRendererHistoryReset(): boolean;
|
|
1600
|
+
pushOverride(override: MotionBlurOverride): MotionBlurOverrideHandle;
|
|
1601
|
+
addPass(graph: FrameGraphBuilder, sceneColor: FrameGraphTextureHandle, velocity: FrameGraphTextureHandle, depth?: FrameGraphTextureHandle): FrameGraphTextureHandle;
|
|
1602
|
+
dispose(): void;
|
|
1603
|
+
getTemporalMatrices(): {
|
|
1604
|
+
readonly currentInverseViewProjection: Matrix4;
|
|
1605
|
+
readonly currentInverseProjection: Matrix4;
|
|
1606
|
+
readonly previousViewProjection: Matrix4;
|
|
1607
|
+
};
|
|
1608
|
+
getFrameDuration(): number;
|
|
1609
|
+
getJitterUv(): Vector2;
|
|
1610
|
+
private pruneOverrides;
|
|
1611
|
+
private getResolvedSettings;
|
|
1612
|
+
}
|
|
1613
|
+
|
|
1403
1614
|
interface OutlineOptions {
|
|
1404
1615
|
readonly enabled?: boolean;
|
|
1405
1616
|
readonly visibleEdgeColor?: readonly [number, number, number];
|
|
@@ -1441,4 +1652,4 @@ declare class OutlineEffect {
|
|
|
1441
1652
|
dispose(): void;
|
|
1442
1653
|
}
|
|
1443
1654
|
|
|
1444
|
-
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 };
|
|
1655
|
+
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, buildParticleLightingShaderHeader, configureVolumetricFogMaterial };
|