@types/three 0.184.0 → 0.185.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (208) hide show
  1. three/README.md +1 -1
  2. three/examples/jsm/Addons.d.ts +2 -0
  3. three/examples/jsm/controls/FirstPersonControls.d.ts +9 -0
  4. three/examples/jsm/controls/OrbitControls.d.ts +2 -2
  5. three/examples/jsm/controls/TransformControls.d.ts +32 -1
  6. three/examples/jsm/csm/CSMFrustum.d.ts +73 -13
  7. three/examples/jsm/exporters/DRACOExporter.d.ts +1 -1
  8. three/examples/jsm/exporters/GLTFExporter.d.ts +2 -2
  9. three/examples/jsm/exporters/PLYExporter.d.ts +5 -4
  10. three/examples/jsm/exporters/USDZExporter.d.ts +5 -1
  11. three/examples/jsm/generators/CityGenerator.d.ts +75 -0
  12. three/examples/jsm/generators/ForestGenerator.d.ts +79 -0
  13. three/examples/jsm/generators/TerrainGenerator.d.ts +67 -0
  14. three/examples/jsm/generators/TreeGenerator.d.ts +97 -0
  15. three/examples/jsm/generators/city/SidewalkGenerator.d.ts +40 -0
  16. three/examples/jsm/generators/city/SkyscraperGenerator.d.ts +83 -0
  17. three/examples/jsm/geometries/LoftGeometry.d.ts +83 -0
  18. three/examples/jsm/inspector/tabs/Parameters.d.ts +5 -2
  19. three/examples/jsm/lighting/ClusteredLighting.d.ts +45 -0
  20. three/examples/jsm/lighting/LightProbeGrid.d.ts +131 -13
  21. three/examples/jsm/loaders/DRACOLoader.d.ts +20 -6
  22. three/examples/jsm/loaders/EXRLoader.d.ts +2 -12
  23. three/examples/jsm/loaders/GLTFLoader.d.ts +1 -1
  24. three/examples/jsm/loaders/HDRLoader.d.ts +2 -12
  25. three/examples/jsm/loaders/KTX2Loader.d.ts +1 -1
  26. three/examples/jsm/loaders/LWOLoader.d.ts +6 -0
  27. three/examples/jsm/loaders/RGBELoader.d.ts +1 -7
  28. three/examples/jsm/loaders/SVGLoader.d.ts +9 -6
  29. three/examples/jsm/loaders/TGALoader.d.ts +2 -2
  30. three/examples/jsm/loaders/TIFFLoader.d.ts +2 -11
  31. three/examples/jsm/loaders/USDLoader.d.ts +6 -1
  32. three/examples/jsm/misc/TileCreasedNormalsPlugin.d.ts +49 -0
  33. three/examples/jsm/objects/MarchingCubes.d.ts +2 -2
  34. three/examples/jsm/objects/Reflector.d.ts +38 -5
  35. three/examples/jsm/objects/SkyMesh.d.ts +1 -1
  36. three/examples/jsm/physics/RapierPhysics.d.ts +1 -0
  37. three/examples/jsm/tsl/display/BloomNode.d.ts +23 -6
  38. three/examples/jsm/tsl/display/ImportanceSampledEnvironment.d.ts +84 -0
  39. three/examples/jsm/tsl/display/RecurrentDenoiseNode.d.ts +89 -0
  40. three/examples/jsm/tsl/display/SSAAPassNode.d.ts +0 -2
  41. three/examples/jsm/tsl/display/SSGINode.d.ts +4 -1
  42. three/examples/jsm/tsl/display/SSRNode.d.ts +303 -30
  43. three/examples/jsm/tsl/display/TRAANode.d.ts +1 -1
  44. three/examples/jsm/tsl/display/TemporalReprojectNode.d.ts +64 -0
  45. three/examples/jsm/tsl/lighting/ClusteredLightsNode.d.ts +54 -0
  46. three/examples/jsm/tsl/math/curlNoise.d.ts +38 -0
  47. three/examples/jsm/tsl/utils/GroundedSkybox.d.ts +17 -0
  48. three/examples/jsm/tsl/utils/RNoise.d.ts +12 -0
  49. three/examples/jsm/tsl/utils/SpecularHelpers.d.ts +20 -0
  50. three/examples/jsm/webxr/WebGLXRFallback.d.ts +14 -0
  51. three/package.json +3 -3
  52. three/src/Three.TSL.d.ts +10 -3
  53. three/src/Three.WebGPU.Nodes.d.ts +2 -2
  54. three/src/Three.WebGPU.d.ts +5 -3
  55. three/src/animation/AnimationClip.d.ts +0 -10
  56. three/src/cameras/Camera.d.ts +1 -1
  57. three/src/core/InterleavedBuffer.d.ts +1 -1
  58. three/src/core/Object3D.d.ts +8 -4
  59. three/src/core/RenderTarget.d.ts +11 -0
  60. three/src/core/Timer.d.ts +1 -1
  61. three/src/core/UniformsGroup.d.ts +1 -1
  62. three/src/extras/Controls.d.ts +6 -5
  63. three/src/extras/core/ShapePath.d.ts +61 -65
  64. three/src/loaders/DataTextureLoader.d.ts +37 -3
  65. three/src/loaders/MaterialLoader.d.ts +8 -0
  66. three/src/materials/LineBasicMaterial.d.ts +5 -0
  67. three/src/materials/Material.d.ts +9 -1
  68. three/src/materials/MeshBasicMaterial.d.ts +30 -0
  69. three/src/materials/MeshDepthMaterial.d.ts +13 -0
  70. three/src/materials/MeshDistanceMaterial.d.ts +13 -0
  71. three/src/materials/MeshLambertMaterial.d.ts +50 -1
  72. three/src/materials/MeshMatcapMaterial.d.ts +31 -1
  73. three/src/materials/MeshNormalMaterial.d.ts +11 -1
  74. three/src/materials/MeshPhongMaterial.d.ts +50 -1
  75. three/src/materials/MeshPhysicalMaterial.d.ts +50 -0
  76. three/src/materials/MeshStandardMaterial.d.ts +53 -1
  77. three/src/materials/MeshToonMaterial.d.ts +43 -1
  78. three/src/materials/PointsMaterial.d.ts +9 -0
  79. three/src/materials/ShaderMaterial.d.ts +2 -0
  80. three/src/materials/SpriteMaterial.d.ts +9 -0
  81. three/src/materials/nodes/Line2NodeMaterial.d.ts +18 -13
  82. three/src/materials/nodes/NodeMaterial.d.ts +33 -13
  83. three/src/materials/nodes/manager/NodeMaterialObserver.d.ts +0 -84
  84. three/src/math/Box2.d.ts +3 -3
  85. three/src/math/Box3.d.ts +255 -19
  86. three/src/math/Color.d.ts +10 -10
  87. three/src/math/FrustumArray.d.ts +75 -16
  88. three/src/math/Interpolant.d.ts +111 -8
  89. three/src/math/Matrix2.d.ts +1 -1
  90. three/src/math/Matrix3.d.ts +10 -1
  91. three/src/math/Matrix4.d.ts +329 -105
  92. three/src/math/Vector2.d.ts +1 -2
  93. three/src/math/Vector3.d.ts +3 -4
  94. three/src/math/Vector4.d.ts +1 -2
  95. three/src/math/interpolants/BezierInterpolant.d.ts +19 -3
  96. three/src/math/interpolants/CubicInterpolant.d.ts +18 -3
  97. three/src/math/interpolants/DiscreteInterpolant.d.ts +8 -3
  98. three/src/math/interpolants/LinearInterpolant.d.ts +7 -3
  99. three/src/math/interpolants/QuaternionLinearInterpolant.d.ts +7 -3
  100. three/src/nodes/Nodes.d.ts +4 -13
  101. three/src/nodes/TSL.d.ts +7 -5
  102. three/src/nodes/accessors/Batch.d.ts +19 -0
  103. three/src/nodes/accessors/Instance.d.ts +34 -0
  104. three/src/nodes/accessors/MaterialNode.d.ts +86 -79
  105. three/src/nodes/accessors/Morph.d.ts +11 -0
  106. three/src/nodes/accessors/Skinning.d.ts +23 -0
  107. three/src/nodes/accessors/StorageBufferNode.d.ts +22 -23
  108. three/src/nodes/accessors/StorageTexture3DNode.d.ts +17 -0
  109. three/src/nodes/accessors/StorageTextureNode.d.ts +6 -4
  110. three/src/nodes/accessors/TextureNode.d.ts +15 -10
  111. three/src/nodes/core/ArrayNode.d.ts +16 -8
  112. three/src/nodes/core/ContextNode.d.ts +5 -6
  113. three/src/nodes/core/LightingModel.d.ts +2 -0
  114. three/src/nodes/core/Node.d.ts +50 -51
  115. three/src/nodes/core/NodeBuilder.d.ts +1 -133
  116. three/src/nodes/core/OverrideContextNode.d.ts +92 -0
  117. three/src/nodes/core/PropertyNode.d.ts +13 -2
  118. three/src/nodes/core/StructNode.d.ts +0 -2
  119. three/src/nodes/core/StructTypeNode.d.ts +5 -4
  120. three/src/nodes/core/UniformNode.d.ts +48 -9
  121. three/src/nodes/display/BlendModes.d.ts +72 -11
  122. three/src/nodes/display/FrontFacingNode.d.ts +62 -3
  123. three/src/nodes/display/PassNode.d.ts +0 -2
  124. three/src/nodes/display/PremultiplyAlphaFunctions.d.ts +37 -0
  125. three/src/nodes/gpgpu/AtomicFunctionNode.d.ts +53 -45
  126. three/src/nodes/lighting/LightingContextNode.d.ts +9 -2
  127. three/src/nodes/lighting/LightsNode.d.ts +4 -4
  128. three/src/nodes/math/MathNode.d.ts +358 -304
  129. three/src/nodes/math/OperatorNode.d.ts +253 -82
  130. three/src/nodes/tsl/TSLCore.d.ts +16 -9
  131. three/src/nodes/utils/ArrayElementNode.d.ts +5 -4
  132. three/src/nodes/utils/EquirectUV.d.ts +31 -1
  133. three/src/nodes/utils/Packing.d.ts +50 -3
  134. three/src/nodes/utils/RTTNode.d.ts +7 -12
  135. three/src/nodes/utils/Remap.d.ts +216 -29
  136. three/src/nodes/utils/SampleNode.d.ts +18 -8
  137. three/src/objects/BatchedMesh.d.ts +1 -1
  138. three/src/objects/InstancedMesh.d.ts +0 -8
  139. three/src/objects/Skeleton.d.ts +0 -2
  140. three/src/renderers/common/Backend.d.ts +0 -3
  141. three/src/renderers/common/CanvasTarget.d.ts +0 -49
  142. three/src/renderers/common/ClippingContext.d.ts +6 -1
  143. three/src/renderers/common/CubeRenderTarget.d.ts +2 -1
  144. three/src/renderers/common/Info.d.ts +26 -66
  145. three/src/renderers/common/InspectorBase.d.ts +0 -7
  146. three/src/renderers/common/Lighting.d.ts +49 -5
  147. three/src/renderers/common/Renderer.d.ts +34 -458
  148. three/src/renderers/common/RendererUtils.d.ts +1 -2
  149. three/src/renderers/common/TimestampQueryPool.d.ts +1 -1
  150. three/src/renderers/common/XRManager.d.ts +32 -299
  151. three/src/renderers/common/nodes/NodeLibrary.d.ts +0 -117
  152. three/src/renderers/webgl/WebGLPrograms.d.ts +2 -0
  153. three/src/renderers/webgl/WebGLRenderLists.d.ts +5 -1
  154. three/src/renderers/webgl/WebGLState.d.ts +2 -0
  155. three/src/renderers/webgl-fallback/WebGLBackend.d.ts +1 -1
  156. three/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.d.ts +0 -10
  157. three/src/renderers/webgpu/nodes/StandardNodeLibrary.d.ts +0 -1
  158. three/src/renderers/webgpu/nodes/WGSLNodeBuilder.d.ts +5 -121
  159. three/src/textures/CubeDepthTexture.d.ts +2 -3
  160. three/src/textures/DataTexture.d.ts +2 -1
  161. three/src/textures/DepthTexture.d.ts +5 -5
  162. three/examples/jsm/lighting/TiledLighting.d.ts +0 -9
  163. three/examples/jsm/tsl/display/AnamorphicNode.d.ts +0 -31
  164. three/examples/jsm/tsl/lighting/TiledLightsNode.d.ts +0 -22
  165. three/src/nodes/accessors/BatchNode.d.ts +0 -12
  166. three/src/nodes/accessors/InstanceNode.d.ts +0 -30
  167. three/src/nodes/accessors/InstancedMeshNode.d.ts +0 -10
  168. three/src/nodes/accessors/MorphNode.d.ts +0 -14
  169. three/src/nodes/accessors/SkinningNode.d.ts +0 -32
  170. three/src/renderers/common/Animation.d.ts +0 -102
  171. three/src/renderers/common/Attributes.d.ts +0 -59
  172. three/src/renderers/common/Background.d.ts +0 -47
  173. three/src/renderers/common/BindGroup.d.ts +0 -39
  174. three/src/renderers/common/Binding.d.ts +0 -50
  175. three/src/renderers/common/Bindings.d.ts +0 -132
  176. three/src/renderers/common/Buffer.d.ts +0 -90
  177. three/src/renderers/common/ChainMap.d.ts +0 -49
  178. three/src/renderers/common/Color4.d.ts +0 -55
  179. three/src/renderers/common/ComputePipeline.d.ts +0 -34
  180. three/src/renderers/common/DataMap.d.ts +0 -42
  181. three/src/renderers/common/Geometries.d.ts +0 -111
  182. three/src/renderers/common/Pipeline.d.ts +0 -29
  183. three/src/renderers/common/Pipelines.d.ts +0 -186
  184. three/src/renderers/common/ProgrammableStage.d.ts +0 -73
  185. three/src/renderers/common/RenderBundle.d.ts +0 -25
  186. three/src/renderers/common/RenderBundles.d.ts +0 -34
  187. three/src/renderers/common/RenderContext.d.ts +0 -235
  188. three/src/renderers/common/RenderContexts.d.ts +0 -47
  189. three/src/renderers/common/RenderList.d.ts +0 -226
  190. three/src/renderers/common/RenderLists.d.ts +0 -46
  191. three/src/renderers/common/RenderObject.d.ts +0 -448
  192. three/src/renderers/common/RenderObjectPipeline.d.ts +0 -33
  193. three/src/renderers/common/RenderObjects.d.ts +0 -151
  194. three/src/renderers/common/SampledTexture.d.ts +0 -28
  195. three/src/renderers/common/Sampler.d.ts +0 -19
  196. three/src/renderers/common/Textures.d.ts +0 -125
  197. three/src/renderers/common/Uniform.d.ts +0 -262
  198. three/src/renderers/common/UniformBuffer.d.ts +0 -20
  199. three/src/renderers/common/UniformsGroup.d.ts +0 -152
  200. three/src/renderers/common/XRRenderTarget.d.ts +0 -67
  201. three/src/renderers/common/nodes/NodeBuilderState.d.ts +0 -121
  202. three/src/renderers/common/nodes/NodeManager.d.ts +0 -309
  203. three/src/renderers/common/nodes/NodeSampledTexture.d.ts +0 -29
  204. three/src/renderers/common/nodes/NodeSampler.d.ts +0 -12
  205. three/src/renderers/common/nodes/NodeUniform.d.ts +0 -250
  206. three/src/renderers/common/nodes/NodeUniformsGroup.d.ts +0 -41
  207. three/src/renderers/webgpu/nodes/WGSLNodeFunction.d.ts +0 -6
  208. three/src/renderers/webgpu/nodes/WGSLNodeParser.d.ts +0 -6
@@ -1,4 +1,4 @@
1
- import { BufferGeometry, ColorRepresentation, Mesh, WebGLRenderTarget } from "three";
1
+ import { BufferGeometry, Camera, ColorRepresentation, Mesh, WebGLRenderTarget } from "three";
2
2
 
3
3
  export interface ReflectorOptions {
4
4
  color?: ColorRepresentation | undefined;
@@ -10,12 +10,45 @@ export interface ReflectorOptions {
10
10
  }
11
11
 
12
12
  export class Reflector extends Mesh {
13
- type: "Reflector";
13
+ /**
14
+ * This flag can be used for type testing.
15
+ *
16
+ * @type {boolean}
17
+ * @readonly
18
+ * @default true
19
+ */
20
+ readonly isReflector: boolean;
21
+
22
+ /**
23
+ * Whether to force an update, no matter if the reflector
24
+ * is in view or not.
25
+ *
26
+ * @type {boolean}
27
+ * @default false
28
+ */
14
29
  forceUpdate: boolean;
15
30
 
16
- constructor(geometry?: BufferGeometry, options?: ReflectorOptions);
31
+ /**
32
+ * Returns the reflector's internal render target.
33
+ *
34
+ * @return {WebGLRenderTarget} The internal render target
35
+ */
36
+ getRenderTarget: () => WebGLRenderTarget;
37
+
38
+ /**
39
+ * Frees the GPU-related resources allocated by this instance. Call this
40
+ * method whenever this instance is no longer used in your app.
41
+ */
42
+ dispose: () => void;
17
43
 
18
- getRenderTarget(): WebGLRenderTarget;
44
+ /**
45
+ * Returns a reflection camera for the given camera. The reflection camera is used to
46
+ * render the scene from the reflector's view so correct reflections can be produced.
47
+ *
48
+ * @param {Camera} camera - The scene's camera.
49
+ * @return {Camera} The corresponding reflection camera.
50
+ */
51
+ getReflectionCamera: (camera: Camera) => Camera;
19
52
 
20
- dispose(): void;
53
+ constructor(geometry: BufferGeometry, options?: ReflectorOptions);
21
54
  }
@@ -12,7 +12,7 @@ declare class SkyMesh extends Mesh<BoxGeometry, NodeMaterial> {
12
12
  cloudCoverage: UniformNode<"float", number>;
13
13
  cloudDensity: UniformNode<"float", number>;
14
14
  cloudElevation: UniformNode<"float", number>;
15
- showSunDisc: UniformNode<"float", number>;
15
+ showSunDisc: UniformNode<"float", number | boolean>;
16
16
 
17
17
  /**
18
18
  * @deprecated
@@ -18,6 +18,7 @@ export interface RapierPhysicsObject {
18
18
  heights: Float32Array,
19
19
  scale: Vector,
20
20
  ) => RAPIER.RigidBody;
21
+ applyImpulse: (mesh: Mesh, impulse: Vector, index?: number) => void;
21
22
  }
22
23
 
23
24
  export function RapierPhysics(): Promise<RapierPhysicsObject>;
@@ -1,25 +1,42 @@
1
1
  import { Node, TempNode, TextureNode, UniformNode } from "three/webgpu";
2
2
 
3
3
  declare class BloomNode extends TempNode<"vec4"> {
4
- inputNode: Node;
4
+ inputNode: Node<"vec4">;
5
5
  strength: UniformNode<"float", number>;
6
6
  radius: UniformNode<"float", number>;
7
7
  threshold: UniformNode<"float", number>;
8
8
 
9
9
  smoothWidth: UniformNode<"float", number>;
10
10
 
11
- constructor(inputNode: Node, strength?: number, radius?: number, threshold?: number);
11
+ highPassFn: (
12
+ params: {
13
+ input: Node<"vec4">;
14
+ threshold: UniformNode<"float", number>;
15
+ smoothWidth: UniformNode<"float", number>;
16
+ },
17
+ ) => void;
18
+
19
+ constructor(
20
+ inputNode: Node,
21
+ strength?: UniformNode<"float", number> | number,
22
+ radius?: UniformNode<"float", number> | number,
23
+ threshold?: UniformNode<"float", number> | number,
24
+ );
12
25
 
13
26
  getTexture(): TextureNode;
14
27
 
28
+ setResolutionScale(resolutionScale: number): this;
29
+
30
+ getResolutionScale(): number;
31
+
15
32
  setSize(width: number, height: number): void;
16
33
  }
17
34
 
18
35
  export const bloom: (
19
- node: Node,
20
- strength?: number,
21
- radius?: number,
22
- threshold?: number,
36
+ node: Node<"vec4">,
37
+ strength?: UniformNode<"float", number> | number,
38
+ radius?: UniformNode<"float", number> | number,
39
+ threshold?: UniformNode<"float", number> | number,
23
40
  ) => BloomNode;
24
41
 
25
42
  export default BloomNode;
@@ -0,0 +1,84 @@
1
+ import { Matrix4, Node, Texture, UniformNode } from "three/webgpu";
2
+
3
+ /**
4
+ * Manages a preprocessed HDR environment map (CDF textures, uniforms) and exposes
5
+ * TSL helpers for BRDF-direction lookups and MIS importance sampling.
6
+ *
7
+ * @see {@link https://github.com/gkjohnson/three-gpu-pathtracer}
8
+ */
9
+ declare class ImportanceSampledEnvironment {
10
+ /**
11
+ * @param {boolean} [importanceSampling=false] - When `true`, builds luminance CDF tables and enables MIS env sampling.
12
+ */
13
+ constructor(importanceSampling?: boolean);
14
+ intensity: UniformNode<"float", number>;
15
+ /**
16
+ * @param {Texture} hdr - Equirectangular HDR environment map.
17
+ */
18
+ updateFrom(hdr: Texture): void;
19
+ clear(): void;
20
+ /**
21
+ * Simple environment lookup along the reflected direction (no MIS).
22
+ *
23
+ * @param {Object} params
24
+ * @param {UniformNode<Matrix4>} params.cameraWorldMatrix
25
+ * @param {Node<vec3>} params.viewReflectDir
26
+ * @param {Node<float>} [params.sampleWeight] - Optional radiance scale (defaults to 1).
27
+ * @return {Node<vec3>}
28
+ */
29
+ sampleReflect(params: {
30
+ cameraWorldMatrix: UniformNode<"mat4", Matrix4>;
31
+ viewReflectDir: Node<"vec3">;
32
+ sampleWeight?: Node<"float">;
33
+ }): Node<"vec3">;
34
+ /**
35
+ * Environment reflection for a screen-space miss using only the BRDF / reflected-ray direction.
36
+ *
37
+ * @param {Object} params
38
+ * @param {UniformNode<Matrix4>} params.cameraWorldMatrix
39
+ * @param {Node<vec3>} params.viewReflectDir - View-space GGX-sampled reflected ray.
40
+ * @param {Node<vec3>} params.N - View-space shading normal.
41
+ * @param {Node<vec3>} params.V - View-space direction to camera.
42
+ * @param {Node<float>} params.alpha - GGX roughness (alpha).
43
+ * @param {Node<vec3>} params.f0
44
+ * @return {Node<vec3>}
45
+ */
46
+ sampleEnvironmentBRDF(params: {
47
+ cameraWorldMatrix: UniformNode<"mat4", Matrix4>;
48
+ viewReflectDir: Node<"vec3">;
49
+ N: Node<"vec3">;
50
+ V: Node<"vec3">;
51
+ alpha: Node<"float">;
52
+ f0: Node<"vec3">;
53
+ }): Node<"vec3">;
54
+ /**
55
+ * Environment reflection for a screen-space miss, estimated with multiple importance
56
+ * sampling (MIS) between the BRDF / reflected-ray direction and the env-luminance CDF
57
+ * direction. Both techniques use consistent solid-angle PDFs (`D·G1(N·V)/(4·N·V)`), so
58
+ * the power heuristic is unbiased. Adapted from three-gpu-pathtracer.
59
+ *
60
+ * @see {@link https://github.com/gkjohnson/three-gpu-pathtracer}
61
+ *
62
+ * @param {Object} params
63
+ * @param {UniformNode<Matrix4>} params.cameraWorldMatrix
64
+ * @param {Node<vec3>} params.viewReflectDir - View-space GGX-sampled reflected ray.
65
+ * @param {Node<vec3>} params.N - View-space shading normal.
66
+ * @param {Node<vec3>} params.V - View-space direction to camera.
67
+ * @param {Node<float>} params.alpha - GGX roughness (alpha).
68
+ * @param {Node<vec3>} params.f0
69
+ * @param {Node<vec4>} params.Xi2 - Second blue-noise sample (zw used for the CDF).
70
+ * @return {Node<vec3>}
71
+ */
72
+ sampleEnvironmentMIS(params: {
73
+ cameraWorldMatrix: UniformNode<"mat4", Matrix4>;
74
+ viewReflectDir: Node<"vec3">;
75
+ N: Node<"vec3">;
76
+ V: Node<"vec3">;
77
+ alpha: Node<"float">;
78
+ f0: Node<"vec3">;
79
+ Xi2: Node<"vec4">;
80
+ }): Node<"vec3">;
81
+ dispose(): void;
82
+ }
83
+
84
+ export default ImportanceSampledEnvironment;
@@ -0,0 +1,89 @@
1
+ import { Camera, Node, RenderTarget, TempNode, TextureNode, UniformNode } from "three/webgpu";
2
+
3
+ export type DenoiseMode = "diffuse" | "specular";
4
+
5
+ export type DenoiseAlphaSource = "raylength" | "ao" | "none";
6
+
7
+ export interface RecurrentDenoiseNodeOptions {
8
+ depth?: Node<"float"> | Node<"vec4"> | null | undefined;
9
+ normal?: Node<"vec3"> | Node<"vec4"> | null | undefined;
10
+ metalRoughness?: Node<"vec2"> | null | undefined;
11
+ diffuse?: Node<"vec4"> | null | undefined;
12
+ raw?: Node<"vec4"> | null | undefined;
13
+ mode?: DenoiseMode | undefined;
14
+ accumulate?: boolean | undefined;
15
+ }
16
+
17
+ /**
18
+ * Post processing node for denoising temporally-accumulated screen-space effects
19
+ * such as SSGI (ambient occlusion / indirect diffuse) and SSR (specular reflections).
20
+ *
21
+ * The denoising kernel is selected at construction time via `mode`:
22
+ * `'diffuse'` (SSGI) or `'specular'` (SSR). The kernel uses a fixed 8-sample Vogel disk.
23
+ *
24
+ * @augments TempNode
25
+ * @three_import import { recurrentDenoise } from 'three/addons/tsl/display/RecurrentDenoiseNode.js';
26
+ */
27
+ declare class RecurrentDenoiseNode extends TempNode<"vec4"> {
28
+ readonly isRecurrentDenoiseNode: boolean;
29
+ camera: Camera;
30
+
31
+ /**
32
+ * Denoising kernel type.
33
+ *
34
+ * @type {DenoiseMode}
35
+ */
36
+ mode: DenoiseMode;
37
+
38
+ /**
39
+ * When `true`, apply temporal blending after spatial denoising. When `false`, output spatially
40
+ * filtered colour only (alpha is passed through from the input temporal pass).
41
+ *
42
+ * @type {boolean}
43
+ */
44
+ accumulate: boolean;
45
+
46
+ textureNode: Node<"vec4">;
47
+ depthNode: Node<"float"> | Node<"vec4"> | null;
48
+ normalNode: Node<"vec3"> | Node<"vec4"> | null;
49
+ rawNode: TextureNode | null;
50
+ roughnessMetalnessNode: Node<"vec2"> | null;
51
+ diffuseNode: Node<"vec4"> | null;
52
+
53
+ lumaPhi: UniformNode<"float", number>;
54
+ depthPhi: UniformNode<"float", number>;
55
+ normalPhi: UniformNode<"float", number>;
56
+ radius: UniformNode<"float", number>;
57
+ alphaPhi: UniformNode<"float", number>;
58
+ roughnessPhi: UniformNode<"float", number>;
59
+ diffusePhi: UniformNode<"float", number>;
60
+ adapt: UniformNode<"float", number>;
61
+ smoothDisocclusions: UniformNode<"bool", boolean>;
62
+ strength: UniformNode<"float", number>;
63
+ maxFrames: UniformNode<"float", number>;
64
+
65
+ /**
66
+ * Which channel of the raw texture drives alpha-based edge stopping.
67
+ * `'raylength'` — alpha encodes SSR ray length; `'ao'` — alpha encodes AO factor;
68
+ * `'none'` — skip alpha-based edge stopping.
69
+ *
70
+ * @type {DenoiseAlphaSource}
71
+ * @default 'raylength'
72
+ */
73
+ alphaSource: DenoiseAlphaSource;
74
+
75
+ flickerSuppression: UniformNode<"float", number>;
76
+ adaptiveTrust: UniformNode<"float", number>;
77
+
78
+ constructor(inputTexture: Node<"vec4">, camera: Camera, options?: RecurrentDenoiseNodeOptions);
79
+
80
+ getRenderTarget(): RenderTarget;
81
+ }
82
+
83
+ export default RecurrentDenoiseNode;
84
+
85
+ export const recurrentDenoise: (
86
+ inputTexture: Node<"vec4">,
87
+ camera: Camera,
88
+ options?: RecurrentDenoiseNodeOptions,
89
+ ) => RecurrentDenoiseNode;
@@ -5,8 +5,6 @@ declare class SSAAPassNode extends PassNode {
5
5
 
6
6
  sampleLevel: number;
7
7
  unbiased: boolean;
8
- clearColor: Color;
9
- clearAlpha: number;
10
8
 
11
9
  sampleWeight: UniformNode<"float", number>;
12
10
 
@@ -1,4 +1,4 @@
1
- import { Node, PerspectiveCamera, TempNode, UniformNode } from "three/webgpu";
1
+ import { Node, PerspectiveCamera, TempNode, TextureNode, UniformNode } from "three/webgpu";
2
2
 
3
3
  declare class SSGINode extends TempNode<"vec4"> {
4
4
  beautyNode: Node;
@@ -18,6 +18,9 @@ declare class SSGINode extends TempNode<"vec4"> {
18
18
  useTemporalFiltering: boolean;
19
19
 
20
20
  constructor(beautyNode: Node, depthNode: Node, normalNode: Node, camera: PerspectiveCamera);
21
+
22
+ getAONode(): TextureNode;
23
+ getGINode(): TextureNode;
21
24
  }
22
25
 
23
26
  export default SSGINode;
@@ -1,42 +1,315 @@
1
- import { Camera, Node, TempNode, TextureNode, UniformNode } from "three/webgpu";
1
+ import { Camera, Node, RenderTarget, TempNode, Texture, TextureNode, UniformNode } from "three/webgpu";
2
2
 
3
- declare class SSRNode extends TempNode<"vec4"> {
4
- colorNode: Node;
5
- depthNode: Node;
6
- normalNode: Node;
7
- metalnessNode: Node;
8
- roughnessNode: Node | null;
9
- camera: Camera | null;
3
+ export interface SSRNodeOptions {
4
+ /**
5
+ * - When `false`, traces a single mirror reflection and softens roughness with a blur pass (first-generation SSR). When `true`, varies the reflection direction per pixel with stochastic GGX rays (second-generation SSR); higher quality on rough/glossy surfaces but noisier, so it expects a temporal/spatial denoiser downstream.
6
+ */
7
+ stochastic?: boolean | undefined;
8
+ /**
9
+ * - Per-pixel metalness. Drives GGX reflection sampling and, with `reflectNonMetals=false`, the non-metal early-out.
10
+ */
11
+ metalnessNode?: Node<"float"> | undefined;
12
+ /**
13
+ * - Per-pixel roughness. Drives GGX sampling and the blur mip selection.
14
+ */
15
+ roughnessNode?: Node<"float"> | undefined;
16
+ /**
17
+ * - Only used when `stochastic=false`. When `false`, non-metallic surfaces are discarded for a noticeable performance gain; set `true` to also reflect dielectrics (e.g. marble, polished wood, plastic).
18
+ */
19
+ reflectNonMetals?: boolean | undefined;
20
+ /**
21
+ * - Equirectangular HDR environment map with CPU-side `image.data` (e.g. from RGBELoader). Not compatible with PMREM / `scene.environment` cubemaps.
22
+ */
23
+ environmentNode?: Texture | undefined;
24
+ /**
25
+ * - When `true`, precomputes env-luminance CDF tables and uses MIS for environment misses. Build-time only.
26
+ */
27
+ envImportanceSampling?: boolean | undefined;
28
+ /**
29
+ * - Scene diffuse / base color. Defaults to `vec3(1)` in the shader when omitted.
30
+ */
31
+ diffuseNode?: Node<"vec4"> | undefined;
32
+ /**
33
+ * - Sub-step binary-search refinement of detected hits. Compile-time constant (baked into the shader at construction).
34
+ */
35
+ binaryRefine?: boolean | undefined;
36
+ /**
37
+ * - Camera the scene is rendered with. Inferred from the color pass when omitted.
38
+ */
39
+ camera?: Camera | undefined;
40
+ }
10
41
 
42
+ /**
43
+ * Post processing node for computing screen space reflections (SSR).
44
+ *
45
+ * Reference: {@link https://lettier.github.io/3d-game-shaders-for-beginners/screen-space-reflection.html}
46
+ *
47
+ * @augments TempNode
48
+ * @three_import import { ssr } from 'three/addons/tsl/display/SSRNode.js';
49
+ */
50
+ declare class SSRNode extends TempNode<"vec4"> {
51
+ /**
52
+ * Constructs a new SSR node.
53
+ *
54
+ * @param {Node<vec4>} colorNode - The node that represents the beauty pass.
55
+ * @param {Node<float>} depthNode - A node that represents the beauty pass's depth.
56
+ * @param {Node<vec3>} normalNode - A node that represents the beauty pass's normals.
57
+ * @param {SSRNodeOptions} [options] - Optional inputs for material and environment data.
58
+ */
59
+ constructor(
60
+ colorNode: Node<"vec4">,
61
+ depthNode: Node<"float"> | Node<"vec4">,
62
+ normalNode: Node<"vec3">,
63
+ options?: SSRNodeOptions,
64
+ );
65
+ /**
66
+ * When `true`, the reflection direction is varied per pixel with stochastic GGX rays
67
+ * (second-generation SSR). When `false`, a single mirror reflection is traced and
68
+ * roughness is softened with a blur pass (first-generation SSR).
69
+ *
70
+ * @type {boolean}
71
+ */
72
+ stochastic: boolean;
73
+ /**
74
+ * When `true`, env-luminance CDF tables are built and MIS is used for environment misses.
75
+ * Fixed at construction time.
76
+ *
77
+ * @type {boolean}
78
+ */
79
+ envImportanceSampling: boolean;
80
+ /**
81
+ * The node that represents the beauty pass.
82
+ *
83
+ * @type {Node<vec4>}
84
+ */
85
+ colorNode: Node<"vec4">;
86
+ /**
87
+ * A node that represents the scene's diffuse color (typically the MRT `diffuseColor` attachment).
88
+ * When `null`, the shader uses `vec3(1)`.
89
+ *
90
+ * @type {?Node<vec4>}
91
+ */
92
+ diffuseNode: Node<"vec4"> | null;
93
+ /**
94
+ * A node that represents the beauty pass's depth.
95
+ *
96
+ * @type {Node<float>}
97
+ */
98
+ depthNode: Node<"float"> | Node<"vec4">;
99
+ /**
100
+ * A node that represents the beauty pass's normals.
101
+ *
102
+ * @type {Node<vec3>}
103
+ */
104
+ normalNode: Node<"vec3">;
105
+ /**
106
+ * Per-pixel metalness, used to drive the GGX reflection sampling and the non-metal
107
+ * early-out. When `null`, the shader treats surfaces as non-metallic.
108
+ *
109
+ * @type {?Node<float>}
110
+ */
111
+ metalnessNode: Node<"float"> | null;
112
+ /**
113
+ * Per-pixel roughness, used to drive the GGX reflection sampling and the blur mip
114
+ * selection. When `null`, the shader treats surfaces as fully smooth.
115
+ *
116
+ * @type {?Node<float>}
117
+ */
118
+ roughnessNode: Node<"float"> | null;
119
+ /**
120
+ * The resolution scale. Valid values are in the range
121
+ * `[0,1]`. `1` means best quality but also results in
122
+ * more computational overhead. Setting to `0.5` means
123
+ * the effect is computed in half-resolution.
124
+ *
125
+ * @type {number}
126
+ * @default 1
127
+ */
11
128
  resolutionScale: number;
12
-
129
+ /**
130
+ * Controls how far a fragment can reflect. Increasing this value result in more
131
+ * computational overhead but also increases the reflection distance.
132
+ *
133
+ * @type {UniformNode<float>}
134
+ */
13
135
  maxDistance: UniformNode<"float", number>;
136
+ /**
137
+ * Controls the cutoff between what counts as a possible reflection hit and what does not.
138
+ *
139
+ * @type {UniformNode<float>}
140
+ */
14
141
  thickness: UniformNode<"float", number>;
15
- opacity: UniformNode<"float", number>;
142
+ /**
143
+ * A multiplier for the overall reflection intensity. `1` leaves the
144
+ * reflections unchanged, lower values dim them and higher values boost them.
145
+ *
146
+ * @type {UniformNode<float>}
147
+ * @default 1
148
+ */
149
+ intensity: UniformNode<"float", number>;
150
+ /**
151
+ * Screen-edge fade width, in UV units. As a screen-space hit approaches a screen
152
+ * border, the reflection is faded over this distance — either toward the environment
153
+ * reflection ({@link SSRNode#screenEdgeFadeBlack} `false`) or to zero intensity
154
+ * (`true`). `0` disables it.
155
+ *
156
+ * @type {UniformNode<float>}
157
+ * @default 0.2
158
+ */
159
+ screenEdgeFade: UniformNode<"float", number>;
160
+ /**
161
+ * Absolute env luminance cap. HDR env samples above this are scaled down (hue preserved).
162
+ *
163
+ * @type {UniformNode<float>}
164
+ * @default 10
165
+ */
166
+ maxLuminance: UniformNode<"float", number>;
167
+ /**
168
+ * This parameter controls how detailed the raymarching process works.
169
+ * The value ranges is `[0,1]` where `1` means best quality (the maximum number
170
+ * of raymarching iterations/samples) and `0` means no samples at all.
171
+ *
172
+ * A quality of `0.5` is usually sufficient for most use cases. Try to keep
173
+ * this parameter as low as possible. Larger values result in noticeable more
174
+ * overhead.
175
+ *
176
+ * @type {UniformNode<float>}
177
+ */
16
178
  quality: UniformNode<"float", number>;
17
- blurQuality: UniformNode<"float", number>;
18
-
19
- constructor(
20
- colorNode: Node,
21
- depthNode: Node,
22
- normalNode: Node,
23
- metalnessNode: Node,
24
- roughnessNode?: Node | null,
25
- camera?: Camera | null,
26
- );
27
-
179
+ /**
180
+ * Mirror bias for the stochastic GGX sampling. Concentrates the reflected rays toward
181
+ * the lobe's narrow (near-mirror) core, trading a small amount of bias for less noise.
182
+ * `0` samples the full VNDF lobe; values toward `1` tighten the cone. Range `[0,1]`.
183
+ *
184
+ * @type {UniformNode<float>}
185
+ * @default 0.5
186
+ */
187
+ mirrorBias: UniformNode<"float", number>;
188
+ /**
189
+ * HDR environment map for screen-space misses.
190
+ *
191
+ * @type {?Texture}
192
+ */
193
+ environmentNode: Texture | null;
194
+ /**
195
+ * A node that represents the history texture for multi-bounce reflections.
196
+ *
197
+ * @type {?Texture}
198
+ */
199
+ historyTexture: Texture | null;
200
+ /**
201
+ * A node that represents the velocity texture for reprojection.
202
+ *
203
+ * @type {?Node<vec2>}
204
+ */
205
+ velocityTexture: Node<"vec2"> | Node<"vec4"> | null;
206
+ /**
207
+ * The camera the scene is rendered with.
208
+ *
209
+ * @type {Camera}
210
+ */
211
+ camera: Camera;
212
+ /**
213
+ * Intensity multiplier applied to environment-map reflections on screen-space
214
+ * misses and at screen edges. Defaults to π to match the former hardcoded multiplier.
215
+ *
216
+ * @type {UniformNode<float>}
217
+ * @default Math.PI
218
+ */
219
+ environmentIntensity: UniformNode<"float", number>;
220
+ /**
221
+ * Non-linear step distribution exponent (compile-time constant). See the backing
222
+ * field for details. Assigning a new value recompiles the SSR material.
223
+ *
224
+ * @type {number}
225
+ */
226
+ get stepExponent(): number;
227
+ set stepExponent(value: number);
228
+ /**
229
+ * Blur kernel size (compile-time constant). Assigning a new value recompiles the
230
+ * blur material.
231
+ *
232
+ * @type {number}
233
+ */
234
+ get blurQuality(): number;
235
+ set blurQuality(value: number);
236
+ /**
237
+ * Whether SSR fades to black near screen borders (compile-time constant). Assigning
238
+ * a new value recompiles the SSR material.
239
+ *
240
+ * @type {boolean}
241
+ */
242
+ get screenEdgeFadeBlack(): boolean;
243
+ set screenEdgeFadeBlack(value: boolean);
244
+ /**
245
+ * Whether sub-step binary-search hit refinement is enabled (compile-time constant).
246
+ * Assigning a new value rebuilds the SSR material.
247
+ *
248
+ * @type {boolean}
249
+ */
250
+ get binaryRefine(): boolean;
251
+ set binaryRefine(value: boolean);
252
+ /**
253
+ * Whether dielectrics are reflected in the non-stochastic path (compile-time constant).
254
+ * Assigning a new value rebuilds the SSR material.
255
+ *
256
+ * @type {boolean}
257
+ */
258
+ get reflectNonMetals(): boolean;
259
+ set reflectNonMetals(value: boolean);
260
+ /**
261
+ * Returns the result of the effect as a texture node.
262
+ *
263
+ * @return {PassTextureNode} A texture node that represents the result of the effect.
264
+ */
28
265
  getTextureNode(): TextureNode;
29
-
266
+ /**
267
+ * Sets the size of the effect.
268
+ *
269
+ * @param {number} width - The width of the effect.
270
+ * @param {number} height - The height of the effect.
271
+ */
30
272
  setSize(width: number, height: number): void;
273
+ /**
274
+ * Wires the feedback inputs for multi-bounce reflections: the previous frame's
275
+ * denoised result (`history`) and the velocity buffer used to reproject it
276
+ * (`velocity`). `history` accepts the producing node (e.g. a
277
+ * {@link RecurrentDenoiseNode}) — its output render target is used — or a raw
278
+ * texture. Pass `null` for both to disable multi-bounce.
279
+ *
280
+ * @param {Texture} history
281
+ * @param {Node<vec2>} velocity
282
+ */
283
+ setHistory(
284
+ history: Texture | { getRenderTarget(): { texture: Texture } },
285
+ velocity: Node<"vec2"> | Node<"vec4">,
286
+ ): void;
287
+ /**
288
+ * Sets the environment map for importance-sampled env lighting when
289
+ * screen-space rays miss. Call this whenever the scene's env map changes.
290
+ *
291
+ * Uses {@link ImportanceSampledEnvironment} (CDF + MIS adapted from
292
+ * [three-gpu-pathtracer](https://github.com/gkjohnson/three-gpu-pathtracer)).
293
+ *
294
+ * @param {Texture|null} hdr - The equirectangular HDR environment map, or null to disable.
295
+ * @see {@link https://github.com/gkjohnson/three-gpu-pathtracer}
296
+ */
297
+ setEnvMap(hdr: Texture | null): void;
298
+ /**
299
+ * Intensity multiplier for the importance-sampled env contribution.
300
+ * Only available after {@link setEnvMap} has been called.
301
+ *
302
+ * @type {?UniformNode<float>}
303
+ */
304
+ get envMapIntensity(): UniformNode<"float", number> | null;
305
+ getRenderTarget(): RenderTarget;
31
306
  }
32
307
 
33
308
  export default SSRNode;
34
309
 
35
- export const ssr: (
36
- colorNode: Node,
37
- depthNode: Node,
38
- normalNode: Node,
39
- metalnessNode: Node,
40
- roughnessNode?: Node | null,
41
- camera?: Camera | null,
42
- ) => SSRNode;
310
+ export function ssr(
311
+ colorNode: Node<"vec4">,
312
+ depthNode: Node<"float"> | Node<"vec4">,
313
+ normalNode: Node<"vec3">,
314
+ options?: SSRNodeOptions,
315
+ ): SSRNode;
@@ -1,6 +1,6 @@
1
1
  import { Camera, Node, TempNode, TextureNode } from "three/webgpu";
2
2
 
3
- declare class TRAANode extends TempNode {
3
+ declare class TRAANode extends TempNode<"vec4"> {
4
4
  readonly isTRAANode: true;
5
5
 
6
6
  beautyNode: TextureNode;