PathTracer
Defined in: radiance/src/renderers/PathTracer.ts:70
What every renderer shares: a canvas, a size, an animation loop, and render(scene, camera).
The scene graph does not know which renderer draws it, so the path tracer today and a
real-time renderer later (docs/plan.md, the real-time tier) draw the same scene.
Extends
Section titled “Extends”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new PathTracer(
parameters?):PathTracer
Defined in: radiance/src/renderers/PathTracer.ts:117
Parameters
Section titled “Parameters”parameters?
Section titled “parameters?”PathTracerParameters = {}
Returns
Section titled “Returns”PathTracer
Overrides
Section titled “Overrides”Properties
Section titled “Properties”bounces
Section titled “bounces”
readonlybounces:number
Defined in: radiance/src/renderers/PathTracer.ts:79
domElement
Section titled “domElement”
readonlydomElement:HTMLCanvasElement|undefined
Defined in: radiance/src/renderers/Renderer.ts:11
The canvas the renderer draws on, when it has one.
Inherited from
Section titled “Inherited from”
readonlyinfo:object
Defined in: radiance/src/renderers/PathTracer.ts:91
What the last frame cost: its time in milliseconds, the paths it traced per second, the
dispatches (tiles) it took, the pixels of its largest tile, and the mean time of one dispatch
in milliseconds. The frame’s dispatches go to the GPU in one submit, so a dispatch’s own time
is not measured: dispatchTime is the frame’s time over its dispatches.
dispatches
Section titled “dispatches”dispatches:
number=0
dispatchTime
Section titled “dispatchTime”dispatchTime:
number=0
frames
Section titled “frames”frames:
number=0
frameTime
Section titled “frameTime”frameTime:
number=0
pathsPerSecond
Section titled “pathsPerSecond”pathsPerSecond:
number=0
tilePixels
Section titled “tilePixels”tilePixels:
number=0
maxSamples
Section titled “maxSamples”maxSamples:
number=Infinity
Defined in: radiance/src/renderers/PathTracer.ts:74
render adds no samples once every pixel has this many. Default unlimited.
maxSamplesPerFrame
Section titled “maxSamplesPerFrame”maxSamplesPerFrame:
number
Defined in: radiance/src/renderers/PathTracer.ts:82
paused
Section titled “paused”paused:
boolean=false
Defined in: radiance/src/renderers/PathTracer.ts:76
While true, render adds no samples; it still draws when the exposure changes.
preview
Section titled “preview”preview:
number=1
Defined in: radiance/src/renderers/PathTracer.ts:78
Above 1, trace one pixel for each preview by preview block: for a moving camera.
rouletteFrom
Section titled “rouletteFrom”
readonlyrouletteFrom:number
Defined in: radiance/src/renderers/PathTracer.ts:80
samplesPerFrame
Section titled “samplesPerFrame”samplesPerFrame:
number
Defined in: radiance/src/renderers/PathTracer.ts:72
Samples each render adds. Change it between frames to keep a frame near a time budget.
targetFrameTime
Section titled “targetFrameTime”targetFrameTime:
number|undefined
Defined in: radiance/src/renderers/PathTracer.ts:81
watchdogBudget
Section titled “watchdogBudget”watchdogBudget:
number
Defined in: radiance/src/renderers/PathTracer.ts:84
The milliseconds one dispatch may take. The tiles are sized to stay under it.
Accessors
Section titled “Accessors”exposure
Section titled “exposure”Get Signature
Section titled “Get Signature”get exposure():
number
Defined in: radiance/src/renderers/PathTracer.ts:154
Returns
Section titled “Returns”number
Set Signature
Section titled “Set Signature”set exposure(
stops):void
Defined in: radiance/src/renderers/PathTracer.ts:157
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”void
height
Section titled “height”Get Signature
Section titled “Get Signature”get height():
number
Defined in: radiance/src/renderers/PathTracer.ts:135
Returns
Section titled “Returns”number
Overrides
Section titled “Overrides”samples
Section titled “samples”Get Signature
Section titled “Get Signature”get samples():
number
Defined in: radiance/src/renderers/PathTracer.ts:139
How many samples every pixel has.
Returns
Section titled “Returns”number
Get Signature
Section titled “Get Signature”get scale():
number
Defined in: radiance/src/renderers/PathTracer.ts:143
The scale of the frame being traced: 1, or the preview’s.
Returns
Section titled “Returns”number
Get Signature
Section titled “Get Signature”get seed():
number
Defined in: radiance/src/renderers/PathTracer.ts:146
Returns
Section titled “Returns”number
Set Signature
Section titled “Set Signature”set seed(
value):void
Defined in: radiance/src/renderers/PathTracer.ts:150
A new seed starts the accumulation again.
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”void
Get Signature
Section titled “Get Signature”get width():
number
Defined in: radiance/src/renderers/PathTracer.ts:132
The frame’s width and height in pixels.
Returns
Section titled “Returns”number
The frame’s width and height in pixels.
Overrides
Section titled “Overrides”Methods
Section titled “Methods”dispose()
Section titled “dispose()”dispose():
void
Defined in: radiance/src/renderers/PathTracer.ts:321
Free the device’s resources. The renderer cannot be used again.
Returns
Section titled “Returns”void
Overrides
Section titled “Overrides”getPixelRatio()
Section titled “getPixelRatio()”getPixelRatio():
number
Defined in: radiance/src/renderers/Renderer.ts:32
Device pixels per CSS pixel of the frame: 1 by default; below 1 renders faster, coarser.
Returns
Section titled “Returns”number
Inherited from
Section titled “Inherited from”init()
Section titled “init()”init():
Promise<PathTracer>
Defined in: radiance/src/renderers/PathTracer.ts:162
Prepare the device and the pipelines. Resolves to the renderer, ready to render.
Returns
Section titled “Returns”Promise<PathTracer>
Overrides
Section titled “Overrides”readPixels()
Section titled “readPixels()”readPixels():
Promise<Float32Array>
Defined in: radiance/src/renderers/PathTracer.ts:311
The displayed image, tone-mapped, as RGBA floats in [0, 1], top row first.
Returns
Section titled “Returns”Promise<Float32Array>
readRadiance()
Section titled “readRadiance()”readRadiance():
Promise<Float32Array>
Defined in: radiance/src/renderers/PathTracer.ts:298
Every pixel’s mean radiance (RGB) and its sample count, top row first; full frames only.
Returns
Section titled “Returns”Promise<Float32Array>
render()
Section titled “render()”render(
scene,camera):Promise<void>
Defined in: radiance/src/renderers/PathTracer.ts:219
Draw scene as camera sees it; resolves once the GPU has run the frame.
Parameters
Section titled “Parameters”camera
Section titled “camera”Returns
Section titled “Returns”Promise<void>
Overrides
Section titled “Overrides”reset()
Section titled “reset()”reset():
void
Defined in: radiance/src/renderers/PathTracer.ts:215
Start the accumulation again on the next render.
Returns
Section titled “Returns”void
setAnimationLoop()
Section titled “setAnimationLoop()”setAnimationLoop(
callback):void
Defined in: radiance/src/renderers/Renderer.ts:48
Call callback once per display frame, waiting for the one before to finish, as a game
loop does; null stops it. The callback may return a promise, such as render’s.
Parameters
Section titled “Parameters”callback
Section titled “callback”((time) => unknown) | null
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”setPixelRatio()
Section titled “setPixelRatio()”setPixelRatio(
ratio):void
Defined in: radiance/src/renderers/PathTracer.ts:209
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”void
Overrides
Section titled “Overrides”setSize()
Section titled “setSize()”setSize(
width,height):void
Defined in: radiance/src/renderers/PathTracer.ts:195
Change the frame’s size, in CSS pixels; the frame traced is that times getPixelRatio().
A canvas’s style size is left to the page.
Parameters
Section titled “Parameters”number
height
Section titled “height”number
Returns
Section titled “Returns”void