Transient histogram accumulation (TransientHistogramAccumulatePass)¶
This render pass averages a transient histogram over frames, as Falcor’s AccumulatePass does for images. Its
input is one frame’s histogram of width x height x timeBin texels, from
TransientHistogramPathTracerInline or
TransientHistogramReSTIRInline. Its output has the input’s size and format and
holds the mean of the frames since the average last restarted, in the input’s unit (radiance per unit path length).
The pass keeps a running mean,
where \(H_n\) is the histogram of the \(n\)-th frame, so the output is a mean after every frame and needs no division. All four channels are averaged, alpha included.
The input must be a single frame’s histogram. With the path tracer’s accumulate, its histogram is already a sum
over frames, and this pass does not divide it by their number: leave accumulate off when you use this pass. For the
path tracer, accumulate is the cheaper way to combine frames (see Memory);
TransientHistogramReSTIRInline has no accumulate, so its frames are averaged with this pass.
Parameters¶
Parameter |
Type |
Description |
|---|---|---|
|
boolean |
Average the frames. Off, the output is a copy of the input, and the average starts anew when it is turned back
on. (Default: |
|
boolean |
Restart the average when the camera, the scene or the settings of an earlier pass change; see
When the average restarts. Off, the average goes on through such changes and mixes
the frames from before and after them. (Default: |
|
string |
How the running mean is kept: |
|
integer |
Stop averaging after this many frames: the output keeps the last average, and later frames are ignored until
the average restarts. |
When the average restarts¶
With autoReset, the average restarts when:
the camera moves or changes in another way, e.g. its field of view (camera jitter does not count),
the scene changes in any other way, or
a pass that runs before this one in the frame reports a change, as the tracers and
VBufferRTdo when one of their settings changes andLaserLightdoes when the laser moves or changes.
With or without autoReset, it also restarts when:
reset()is called from Python, or Reset is pressed in the pass’s panel,enabledorprecisionModechanges,the input’s size or format changes (e.g. with
timeBin,useSingleChannelor the frame size), ora new scene is loaded.
Changing autoReset or maxFrameCount keeps the current average. The pass’s panel in the Render Graph window shows
the number of averaged frames.
Memory¶
Besides its output, the pass keeps the running mean in a texture of the input’s size, and with SingleCompensated a
second one for the compensation. A graph with this pass after a tracer thus holds three histograms (four with
SingleCompensated): the tracer’s, the mean and the output. At 1024 x 1024 with 512 RGBA bins, that is 24 GB,
against 8 GB for the path tracer with accumulate.
Inputs and outputs¶
Channel |
Description |
|---|---|
|
One frame’s transient histogram, |
|
The mean of the input over the averaged frames, with the input’s size and format. |
The pass publishes the number of averaged frames to the render graph, and that its output is a mean, so a
TransientHistogramViewer downstream shows the frame count and does not divide by it. From Python, reset()
restarts the average, e.g. graph.get_pass("Accumulate").reset() after a few warm-up frames.
Example¶
testbed.load_scene("cornell-box/scene-v4-nolight.pbrt", falcor.SceneBuilderFlags.DontMergeMaterials)
graph = testbed.create_render_graph("Transient")
graph.create_pass("VBuffer", "VBufferRT", {"samplePattern": "Center", "sampleCount": 1})
graph.create_pass("Laser", "LaserLight", {
"laserPosition": [0.0, 1.7, 6.8], "laserDirection": [0.0, 0.0, -1.0], "laserPower": [170.0, 120.0, 40.0],
})
graph.create_pass("Tracer", "TransientHistogramPathTracerInline", {
"samplesPerPixel": 16, "maxBounces": 6,
"timeMin": 16.75, "timeMax": 18.03, "timeBin": 64,
})
graph.create_pass("Accumulate", "TransientHistogramAccumulatePass", {})
graph.add_edge("VBuffer.vbuffer", "Tracer.vbuffer")
graph.add_edge("VBuffer.viewW", "Tracer.viewW")
graph.add_edge("Laser", "Tracer") # run the laser pass first
graph.add_edge("Tracer.histogram", "Accumulate.input")
graph.mark_output("Accumulate.output")
testbed.render_graph = graph
for _ in range(256):
testbed.frame()
histogram = graph.get_output("Accumulate.output").to_numpy() # the mean of 256 frames, (64, height, width, 4)
See the transient rendering tutorial for a complete script, and the
transient ReSTIR tutorial for this pass after
TransientHistogramReSTIRInline.