Transient histogram path tracer (TransientHistogramPathTracerInline)¶
This render pass renders a transient histogram: for every pixel, the radiance that arrives at
each total optical path length, from the laser through the scene to the camera. The range
[timeMin, timeMax) is split into \(B\) bins (timeBin) of width
\(\Delta = (\text{timeMax} - \text{timeMin}) / B\). With the box filter, bin \(i\) estimates
where \(f\) is the path contribution and \(\ell\) the optical length (the sum of the segment lengths:
refractive indices are not implemented yet). \(H_i\) is radiance per unit path length, so \(\sum_i H_i \Delta\) is the
radiance of all paths in the range. Camera paths start at the primary hits from VBufferRT and
stop once they are longer than timeMax.
The histogram is a 3D texture of width x height x timeBin texels. From Python,
graph.get_output("Tracer.histogram").to_numpy() returns an array of shape
(timeBin, height, width, 4), or (timeBin, height, width) with useSingleChannel. Its memory
grows with all three dimensions: at 1024 x 1024 with 512 bins, an RGBA histogram takes 8 GB.
Parameters¶
Histogram:
Parameter |
Type |
Description |
|---|---|---|
|
float |
Path-length range of the histogram. Paths outside |
|
integer |
Number of bins \(B\). (Default: |
|
string |
The bin filter: |
|
boolean |
Spread each path over the bins with a kernel instead of a bin filter. |
|
float |
With kernel density estimation, the kernel width of a frame’s first sample, as a fraction of
|
Sampling:
Parameter |
Type |
Description |
|---|---|---|
|
integer |
Camera paths traced per pixel in each frame. (Default: |
|
integer |
Maximum number of surface vertices on a camera path, counting the primary hit. Each vertex
is connected to the laser spot (the primary hit only with |
|
string |
|
|
boolean |
Importance-sample the BSDF when extending the camera path; otherwise use the material’s
reference sampler (cosine-weighted for standard materials). (Default: |
Output:
Parameter |
Type |
Description |
|---|---|---|
|
boolean |
Include the shortest path, camera -> primary hit -> laser spot. (Default: |
|
boolean |
Sum the frames in the histogram. See Accumulation. (Default: |
|
boolean |
Store one channel per bin, chosen by |
|
string |
The channel kept by |
|
boolean |
Honor alpha-tested materials when tracing rays. (Default: |
|
string |
Size of the outputs: |
|
integer pair |
Output size with |
Filters¶
Without kernel density estimation, a path is added to the bins with a filter:
box: to the bin that contains its length.tent: split between the two bins whose centers are nearest to its length, in proportion to its distance to them: a tent one bin wide on each side of every bin center, as in TransientHistogramReSTIRInline. The first and last bins also take paths up to half a bin outside the range.
With useKernelDensityEstimation, every path is spread over all bins with the kernel chosen by
histogramFilter. The kernel starts at initialWindowRatio x (timeMax - timeMin) wide for a frame’s
first sample and narrows with every further sample of the frame, then restarts in the next frame.
Paths up to 1.5 x timeMax long can contribute through the kernel’s support.
Accumulation¶
Without accumulate, each frame writes a new histogram: the mean of that frame’s
samplesPerPixel samples. To average frames, add a TransientHistogramAccumulatePass after this
pass.
With accumulate, the histogram is the sum of the frames rendered since the last reset, which
is much cheaper than a separate accumulation pass for large histograms. Divide it by the number
of frames to get the mean; TransientHistogramViewer does this on its own. The sum restarts when
the camera moves, the scene changes, a setting of this pass or an upstream pass (e.g. the laser)
changes, the render graph is recompiled (e.g. on a resize or a new output), or a script calls
reset().
Sampling methods¶
direct: trace camera paths and connect every vertex to the laser spot, as the time-gated path tracer does.tri_approx: a deterministic approximation of the paths primary hit -> one scene triangle -> laser spot, integrated over the scene’s triangles (a single intermediate bounce). It tests visibility at triangle centers and interpolates the path length linearly over each triangle, so it is biased;samplesPerPixel,maxBounces,computeDirect,useImportanceSampling,histogramFilterand kernel density estimation do not apply. It assumes a collimated laser. It uses the same triangles as the time-gated passes’ ellipsoidal connections (see the time-gated path tracer), but with a fixed area cutoff: triangles larger than 10000 (world-space area) are left out.
Laser¶
The laser is set on the LaserLight pass, as for the
time-gated path tracer.
Inputs and outputs¶
Channel |
Description |
|---|---|
|
Primary hits, from |
|
Primary ray directions, from |
|
Transient histogram \(H\), |
|
The frame’s histogram integrated over path length (the sum of its bins times the bin width): the radiance of the paths that fall in the histogram, weighted by the filter or kernel, RGBA32Float. Paths that reach no bin are not shaded. |
The pass also publishes the histogram’s range and the number of summed frames to the render
graph, so a TransientHistogramViewer downstream labels the path lengths and averages the frames
without extra settings.
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.add_edge("VBuffer.vbuffer", "Tracer.vbuffer")
graph.add_edge("VBuffer.viewW", "Tracer.viewW")
graph.add_edge("Laser", "Tracer") # run the laser pass first
graph.create_pass("Accumulate", "TransientHistogramAccumulatePass", {})
graph.add_edge("Tracer.histogram", "Accumulate.input")
graph.mark_output("Accumulate.output")
testbed.render_graph = graph
See the transient rendering tutorial for a complete script.