Transient rendering (online)¶
This tutorial shows the transient histogram from Transient rendering in
an interactive window. TransientHistogramViewer draws the histogram summed over its bins on the
left and a 4 x 4 grid of bins on the right; clicking a pixel plots its transient profile.
1. Open a window and load the scene¶
The window is twice as wide as the render: one half for the sum, one for the grid.
import falcorcomp as falcor
SIZE = 512 # render size; the window is twice as wide
testbed = falcor.Testbed(create_window=True, width=2 * SIZE, height=SIZE, title="Transient histogram")
testbed.load_scene("cornell-box/scene-v4-nolight.pbrt")
testbed.scene.camera.aspectRatio = 1.0
testbed.clock.pause()
2. Build the render graph¶
VBufferRT and the tracer render at a fixed SIZE x SIZE (outputSize: Fixed) instead of
the window size. With accumulate, the tracer adds every frame to its histogram and restarts when
the camera moves or a setting changes; the viewer divides by the number of frames, so the picture
stays equally bright while it converges. (TransientHistogramAccumulatePass can average the
frames instead, as in the offline tutorial, at the cost of two more histograms in memory, its mean and its
output; see its memory use.)
fixed_size = {"outputSize": "Fixed", "fixedOutputSize": [SIZE, SIZE]}
graph = testbed.create_render_graph("Transient")
graph.create_pass("VBuffer", "VBufferRT", {"samplePattern": "Center", "sampleCount": 1, **fixed_size})
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], "laserAngle": 0.0,
})
graph.create_pass("Tracer", "TransientHistogramPathTracerInline", {
"samplesPerPixel": 16, "maxBounces": 6, "computeDirect": False,
"timeMin": 16.75, "timeMax": 18.03, "timeBin": 64, "accumulate": True, **fixed_size,
})
graph.create_pass("Viewer", "TransientHistogramViewer", {})
graph.create_pass("ToneMapper", "ToneMapper", {"autoExposure": False})
graph.add_edge("VBuffer.vbuffer", "Tracer.vbuffer")
graph.add_edge("VBuffer.viewW", "Tracer.viewW")
graph.add_edge("Laser", "Tracer")
graph.add_edge("Tracer.histogram", "Viewer.histogram")
graph.add_edge("Viewer.output", "ToneMapper.src")
graph.mark_output("ToneMapper.dst") # shown in the window
testbed.render_graph = graph
3. Run¶
testbed.run()
Controls¶
Transient profile:
Shift+click (or drag) on either half picks a pixel, marked with a crosshair. Open Viewer in the Render Graph window to see its profile: radiance per unit path length over the histogram range, with the peak and the total. Patch radius averages nearby pixels to reduce noise, and Channel picks luminance, red, green or blue.Bins: under Viewer, First bin and Last bin choose the 16 bins in the grid, and Bin exposure brightens them. Under Tracer, Histogram sets the range, the number of bins and the filter.
Camera: drag with the mouse to look around;
W/A/S/Dmove,Q/Emove down and up.Window:
F1shows the help,F2hides the UI,Escexits.
The left half only counts light whose path length lies inside the histogram range, so it is darker than a steady-state image of the scene.
The full script: transient_online.py.