Appearance
Scientific geometry
Volumes
const volume = plot.uploadVolume(field(n, 10, blobs));
plot.showVolume(volume, defaultVolumeOpacity());
plot.frameScene();
return { readout: `${n} cubed, ${((n * n * n) / 1e6).toFixed(1)}M samples` };Calls
4 in the code above, in the order it makes them
plot.uploadVolume(field: Field): VolumeHandleUpload a scalar field as a 3D texture for ray-marching.
plot.showVolume(handle: VolumeHandle, opacity?: number): voidDraw the volume
handlenames, ray-marched through the whole field.opacitymultiplies how much each sample along the ray contributes. How solid a field should look depends on what it is, so there is no right value to bake in; the default is one a typical field is visible at.defaultVolumeOpacity(): numberAn opacity a typical field is visible at, as a starting point.
plot.frameScene(): voidPoint the camera at the middle of everything uploaded, far enough back to see it.
Call after uploading. A scene measured in grid cells or in millimetres is nowhere near where a camera starts, and without this the first thing a caller sees is an empty canvas.