Laser viewer (LaserPositionViewer)¶
This render pass shows where the laser is. It draws two things over an input image, for example a tracer’s color output:
The beam, like light in fog: a cone that starts at the laser with radius
beamRadius, widens at the laser’s cone angle (laserAngleofLaserLight) and ends where the central beam hits the scene. A collimated beam (laserAngle0) is a cylinder of radiusbeamRadius. A camera ray that passes a length \(\ell\) inside the cone, before it hits the scene, is covered with opacity \(1 - e^{-\rho \ell}\), with \(\rho\) =coneDensity.The spot: the light the laser puts on the surface seen in each pixel, tinted with
spotColor. It is the laser’s direct light, without shadows and not time gated. A collimated beam lights a single point, so its spot shows in no pixel; give the laser a cone angle to see it.
The laser is the one the LaserLight pass publishes in the
frame. The beam is never drawn for a laser collocated with the camera, which would cover the image. The overlay is
recomputed every frame, so it follows the camera and the laser at once.
Parameters¶
Parameter |
Type |
Description |
|---|---|---|
|
boolean |
Draw the beam. (Default: |
|
float3 |
Color of the beam. (Default: |
|
float |
Opacity per unit length inside the cone, \(\rho\): a higher density makes a thin beam solid, a lower one makes a
wide cone translucent. (Default: |
|
float |
Radius of the cone at the laser, in scene units; it keeps a collimated beam visible. (Default: |
|
boolean |
Add the spot. (Default: |
|
float3 |
Tint of the spot. (Default: |
|
float |
Multiplies the spot’s radiance (the average of its RGB). (Default: |
|
string |
Size of the output, as for Falcor’s passes: |
|
uint2 |
Output size with |
All of them can also be changed in the pass’s panel of the Render Graph window.
Inputs and outputs¶
Channel |
Description |
|---|---|
|
V-buffer of the camera ( |
|
View directions of the V-buffer, for a camera with jitter or depth of field. |
|
Image to draw on. Draw on linear radiance and tone map afterwards, or draw on a tone-mapped image. |
|
The input with the beam and the spot, RGBA32Float. Without an input: the overlay alone, with premultiplied
alpha (an image under it becomes |
Example¶
testbed.load_scene("cornell-box/scene-v4-nolight.pbrt", falcor.SceneBuilderFlags.DontMergeMaterials)
graph = testbed.create_render_graph("LaserView")
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], "laserAngle": 0.0,
})
graph.create_pass("Tracer", "TimeGatedPathTracerInline", {"timeGateWindow": 0.1, "timeCenter": 17.337})
graph.create_pass("Accumulate", "AccumulatePass", {})
graph.add_edge("VBuffer.vbuffer", "Tracer.vbuffer")
graph.add_edge("VBuffer.viewW", "Tracer.viewW")
graph.add_edge("Laser", "Tracer")
graph.add_edge("Tracer.color", "Accumulate.input")
graph.create_pass("Viewer", "LaserPositionViewer", {"showCone": True, "beamRadius": 0.02, "coneDensity": 20.0})
graph.add_edge("Laser", "Viewer") # the laser is set before the viewer runs
graph.add_edge("VBuffer.vbuffer", "Viewer.vbuffer")
graph.add_edge("VBuffer.viewW", "Viewer.viewW")
graph.add_edge("Accumulate.output", "Viewer.input") # the time-gated image
graph.mark_output("Viewer.output")
testbed.render_graph = graph
The laser visualization tutorial draws the beam over a time-gated image of the Cornell box.