13 - Homogeneous participating media¶
HomogeneousMedium describes absorption, scattering and thermal emission that are the same everywhere inside a closed region. It can stand for smoke, turbid water or hot gas. LESS computes how radiation travels through the medium; it does not simulate flow, chemistry or changes of temperature over time.
Creating a medium¶
The region is again bounded by a closed mesh, TurbidBoundary. The boundary does not reflect or refract; it only marks the extent of the medium:
import less
scene = less.Scene()
scene.size = 20
scene.illumination = less.Illumination(
source=less.Sun(irradiance=0), atmosphere=less.NoAtmosphere()) # no sun, thermal emission only
volume = less.Object("hot_volume")
volume.add_component("volume", less.TurbidBoundary(less.asset_path("homogeneous_slab.obj")))
volume.set_property("volume", less.HomogeneousMedium(
absorption=0.3, scattering=0.1, g=0.2, temperature=800))
scene.add(volume, positions=[(10, 10, 0)])
| Parameter | Meaning |
|---|---|
absorption |
Absorption coefficient a (m⁻¹) |
scattering |
Scattering coefficient b (m⁻¹) |
g |
Henyey–Greenstein asymmetry factor, −1 < g < 1; g > 0 means forward scattering |
temperature |
Temperature (K); when given, the medium emits in local thermal equilibrium; None disables emission |
wavelengths |
Wavelengths (nm) of spectral coefficient arrays |
The direct transmittance along a path of length d is exp(−(a+b)d). Scattered light can also re-enter the viewing direction, so the observed radiance is usually larger than the directly transmitted part.
Spectral coefficients¶
The coefficients may vary with wavelength:
medium = less.HomogeneousMedium(
wavelengths=[850, 4000, 10000],
absorption=[0.02, 0.2, 0.1],
scattering=[0.04, 0.024, 0.01],
g=0.3,
temperature=1800,
)
Coefficients are linearly interpolated between the given wavelengths, and every sensor wavelength must lie within the given range. The thermal source term is a(λ)·B(λ, T), with B the Planck function, so there is no emission without absorption. For a non-scattering layer of uniform temperature and thickness d:
Optical and thermal imaging use the same coefficients, so a hot medium also shows thermal emission in the near infrared.
Imaging¶
projection = less.Perspective(image_size=256, fov=22,
position=(20, -20, 6), target=(10, 10, 5))
near_infrared = scene.simulate(less.OpticalImager(projection, bands=[850], quality=64))
mid_infrared = scene.simulate(less.ThermalImager(projection, bands=[4000], quality=64,
mode="property"))
near_infrared.save("medium_850nm.tif")
mid_infrared.save("medium_4000nm.png")
scene.save("medium.less")
After changing the absorption, scattering, g or temperature, simply simulate again.
Several homogeneous regions may touch or overlap; in overlaps the coefficients add up. A medium can be in the same scene as statistical vegetation, but the two may not overlap in space.
Built-in examples¶
python -m less.examples.homogeneous_medium --case slab --backend embree
python -m less.examples.homogeneous_medium --case regions --backend optix
The regions example has three adjacent layers at 300, 280 and 260 K and writes images at 850 nm and 4000 nm.