three-realtime-rt 0.4.0 → 0.5.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.
package/src/index.d.ts CHANGED
@@ -161,12 +161,35 @@ export interface RealtimeRaytracerOptions {
161
161
  * matters most to each pixel. Cost is flat in light count.
162
162
  */
163
163
  restir?: boolean;
164
- /** Index of refraction used for transmissive surfaces. */
164
+ /**
165
+ * EXPERIMENTAL — ReSTIR GI (v1, temporal-only): per-pixel reservoirs reuse the
166
+ * 1-bounce global-illumination sample across frames (at the reprojected
167
+ * same-surface point; no spatial reuse). When on, the lighting pass skips its
168
+ * inline GI trace and the reservoir's resolved GI is added at the denoise
169
+ * stage — so it only takes effect when `gi` and `denoise` are also on. Its
170
+ * mean matches the inline GI path; convergence character differs. Default
171
+ * `false`. Live-toggleable.
172
+ */
173
+ restirGI?: boolean;
174
+ /** EXPERIMENTAL — temporal M-cap for the ReSTIR GI reservoir (default 20). */
175
+ restirGIMCap?: number;
176
+ /**
177
+ * Global fallback index of refraction for transmissive surfaces. A
178
+ * `MeshPhysicalMaterial.ior` overrides this per material for fully-transmissive
179
+ * glass (encoded in the G-buffer, supported range [1.0, 1.98]); `material.ior`
180
+ * wins when present. This value applies to partial-transmission glass and as
181
+ * the default when no per-material ior is carried.
182
+ */
165
183
  ior?: number;
166
184
  /** History length cap: higher = smoother but slower to react. */
167
185
  maxHistory?: number;
168
186
  /** Clamp on indirect luminance to suppress fireflies. 0 disables. */
169
187
  fireflyClamp?: number;
188
+ /**
189
+ * BVH-cost heatmap scale for the mode-7 debug view: shadow-ray node-visit
190
+ * count is multiplied by this before the palette (default 1/96).
191
+ */
192
+ costScale?: number;
170
193
  /** Reproject accumulated lighting through camera motion. */
171
194
  temporalReprojection?: boolean;
172
195
  /**
@@ -176,6 +199,12 @@ export interface RealtimeRaytracerOptions {
176
199
  taa?: boolean;
177
200
  /** Fresh-sample weight in the TAA blend (lower = smoother/more AA, more lag). */
178
201
  taaBlend?: number;
202
+ /**
203
+ * Scales the TAA sub-pixel jitter amplitude. Set to your canvas scale when
204
+ * rendering a reduced drawing buffer CSS-stretched to the screen, so jitter
205
+ * stays constant in screen pixels (no visible wobble at low quality). Default 1.
206
+ */
207
+ taaJitterScale?: number;
179
208
  /** Edge-aware à-trous denoise on the irradiance buffer. */
180
209
  denoise?: boolean;
181
210
  /**
@@ -235,6 +264,16 @@ export interface CompileSceneOptions {
235
264
  * normal attribute current (e.g. call `geometry.computeVertexNormals()` after
236
265
  * deforming). The live vertex count is fixed at compile time — changing it
237
266
  * throws; call `compileScene()` again after a topology change.
267
+ *
268
+ * A **`SkinnedMesh` is auto-detected** (no flag needed) and CPU-skinned into the
269
+ * dynamic BVH every frame from its live skeleton pose, so an animated character
270
+ * casts a moving traced shadow and rasterizes in its animated pose (the G-buffer
271
+ * skins via three's standard skinning chunks). Pose the skeleton *before*
272
+ * `updateDynamic()` — `mixer.update(dt)` then `characterRoot.updateMatrixWorld(true)`
273
+ * — since the skinning reads each bone's `matrixWorld`. Cost is O(source verts ×
274
+ * 4 bones); secondary-ray normals are per-face (recomputed from the skinned
275
+ * triangles), while primary visibility keeps smooth skinned normals from the
276
+ * raster path. Budget ~10–20k skinned source verts for a sub-2 ms frame.
238
277
  */
239
278
  dynamicMeshes?: Object3D[];
240
279
  }
@@ -288,12 +327,24 @@ export class RealtimeRaytracer {
288
327
  renderer: WebGLRenderer;
289
328
  /** False when the platform can't run the tracer; render() then forwards to renderer.render. */
290
329
  supported: boolean;
330
+ /**
331
+ * False when the 2-attachment lighting buffer fails the construction-time
332
+ * draw probe (WebKit/iOS): the specular buffer is disabled there and
333
+ * alpha-blend surfaces render opaque; everything else keeps working.
334
+ */
335
+ specMRTSupported: boolean;
291
336
  /** The current compiled scene, or null before the first compile / when unsupported. */
292
337
  compiled: CompiledScene | null;
293
338
  /** Accumulated frame counter. */
294
339
  frame: number;
295
- /** Debug view: 0 composite, 1 albedo, 2 normal, 3 irradiance, 4 worldPos, 5 emissive, 6 specular. */
340
+ /** Debug view: 0 composite, 1 albedo, 2 normal, 3 irradiance, 4 worldPos, 5 emissive, 6 specular, 7 bvh cost. */
296
341
  outputMode: number;
342
+ /**
343
+ * BVH-cost heatmap scale (outputMode 7): the per-pixel shadow-ray node-visit
344
+ * count is multiplied by this before the palette (default 1/96 — ~96 visits
345
+ * saturate to white). Live-tunable.
346
+ */
347
+ costScale: number;
297
348
 
298
349
  /** Resolution scale for the ray traced lighting; assigning reallocates targets. */
299
350
  get renderScale(): number;
@@ -332,7 +383,10 @@ export class RealtimeRaytracer {
332
383
  refraction: boolean;
333
384
  /** Alpha-blended transparency: composite `transparent` meshes over the geometry behind them. */
334
385
  transparency: boolean;
335
- /** Index of refraction used for transmissive surfaces. */
386
+ /**
387
+ * Global fallback index of refraction. `MeshPhysicalMaterial.ior` overrides it
388
+ * per material for fully-transmissive glass (range [1.0, 1.98]).
389
+ */
336
390
  ior: number;
337
391
  /** One stochastic direct shadow ray per pixel per frame instead of one per light. */
338
392
  stochasticLights: boolean;
@@ -354,6 +408,13 @@ export class RealtimeRaytracer {
354
408
  taaBlend: number;
355
409
  /** ReSTIR direct lighting toggle. */
356
410
  restir: boolean;
411
+ /**
412
+ * EXPERIMENTAL — ReSTIR GI (temporal-only) toggle. Only takes effect when
413
+ * `gi` and `denoise` are also on (injected at the à-trous stage). Default false.
414
+ */
415
+ restirGI: boolean;
416
+ /** EXPERIMENTAL — temporal M-cap for the ReSTIR GI reservoir. */
417
+ restirGIMCap: number;
357
418
  /** Procedural-sky state. */
358
419
  sky: SkyState;
359
420
  /** Distance-fog state. */