Renderer · interface
GlobalMediumOptions
How thick the air is, this frame.
Explained in Hello world.
interface GlobalMediumOptionsimport type { GlobalMediumOptions } from '@driftengine/core';In depth
A per-frame dial and not a quality setting, in the split renderQuality.ts draws for depth of
field: what a device can afford is globalMediumSteps, and what the weather is doing is this.
A game walks into a fog bank; a profile decides how expensive being in one is allowed to be.
Properties
| Name | Type | Description |
|---|---|---|
densityreadonly | number | Extinction per metre. 0 is off, and off is free — no target is allocated, no pass is
built and the composite is skipped, so a game that never sets this pays nothing at all.MoreAs a scale: 0.02 leaves a wall at 50 m about a third obscured, 0.1 is thick weather, and above about 0.5 nothing is visible past a room. |
albedoreadonly | number | How much of what the medium takes out of a ray comes back as light rather than as heat, 0 to 1.MoreNear 1 for water droplets, which is fog, cloud and steam; lower for smoke, which is soot and absorbs most of what it intercepts. It is the difference between a white fog that a torch lights up and a black smoke that swallows the same torch. |
anisotropyreadonly | number | Henyey-Greenstein anisotropy, -1 back to 1 forward. 0 is isotropic.MoreThis is the term that makes a medium read as weather rather than as a grey wash. Real haze is strongly forward-scattering, which is why the air around a low sun glows and the same air behind the viewer does not. Around 0.6 for atmospheric haze; 0 for a medium with nothing directional about it at all. |
maxDistancereadonly | number | Where the march stops, in metres. Beyond it the medium is not sampled and nothing is added.MoreA bound on the integral, not on the fog: extinction is still integrated over the whole distance a ray travels, so a far wall behind this bound is still obscured. What stops is the search for light to scatter, which is what costs — and past a few extinction lengths there is no transmittance left for a sample to contribute through. |