15 – Interactive Visualization¶
This chapter introduces LESS's interactive 3D viewer scene.show(), which allows you to preview scenes and simulation results in a browser.
Start the viewer¶
import less
scene = less.Scene()
# ... Configuring Scenarios ...
# Open interactive viewer
scene.show()
scene.show() starts a local web server and opens a 3D scene preview in the default browser.
Viewer with sensor¶
You can pass in a list of sensors when starting the viewer, which will trigger the simulation directly in the viewer:
sensors = [
less.OpticalImager(
less.Orthographic(image_size=512),
bands=[650, 550, 450],
quality=128,
name="RGB",
),
less.ThermalImager(
less.Orthographic(image_size=512),
bands=[10600],
quality=128,
name="Thermal",
),
]
scene.show(sensors=sensors)
Viewer with Process¶
For advanced simulations that require a Process chain, processes can also be passed in:
processes = [
less.RadiationFieldProcess(
bands=[450, 550, 650, 850],
photons_per_m2=4000,
name="Radiation Field",
),
less.EnergyBalanceProcess(
microclimate=less.Microclimate(
air_temperature=300.0, humidity=0.6, wind_speed=1.5,
),
name="Energy Balance",
),
]
scene.show(sensors=sensors, processes=processes)
Viewer functions¶
Scene navigation¶
- Rotate: drag with left mouse button
- Pan: Right mouse button drag (or Shift + left button)
- Zoom: Mouse wheel
Three tabs¶
The viewer contains three functional areas:
| Tabs | Functions |
|---|---|
| Scene | 3D scene preview, showing objects, terrain, and coordinate axes |
| Render | Trigger sensor simulation and view output image |
| Simulate | Run Process (radiation field, energy balance, etc.) |
Scene tag page¶
- View the 3D structure of the scene
- Display the bounding box and position of the object
- The coordinate axis indicates the direction (red=X/East, green=Y/South, blue=Z/Up)
- Ground grid shows scene range
Render tab¶
- Select a predefined sensor
- Adjust sensor parameters (if supported)
- Click the "Simulate" button to perform the simulation
- View simulation result images
Simulate tab¶
- Run the Process chain
- View Process execution status and results
Viewer for built-in examples¶
When running the built-in examples, the viewer is opened by default:
import less
# Autumn Forest - includes 6 sensors
less.examples.run("autumn_forest")
# cornfield
less.examples.run("maize_field")
The examples are pre-configured with a variety of sensors (RGB, thermal infrared, multispectral, LiDAR, etc.) that can be simulated one by one in the viewer.
Headless mode¶
If you don't need an interactive viewer (for example, running in batches on the server), you can skip show() and use simulate() directly; the first call will automatically build the scene:
# Do not open the viewer
for sensor in sensors:
result = scene.simulate(sensor)
result.save(f"output/{sensor.name}")
The built-in examples also support headless mode:
Next step¶
Related API¶
less.Scene.show()、less.Product.show()less.Scene.simulate()less.OpticalImager、less.ThermalImagerless.RadiationFieldProcess、less.EnergyBalanceProcessless.examples.list()、less.examples.run()