#[non_exhaustive]pub enum Background {
Color(Color),
CubeTexture(CubeTexture),
Node(NodeRef),
Pmrem(PmremHandle),
EnvironmentNode(EnvironmentNode),
}Expand description
Scene.background. three.js accepts a Color, a Texture or a
CubeTexture; Background.update() branches on which one it is — a colour
becomes the clear value, anything else becomes the skybox mesh.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Color(Color)
A flat clear colour.
CubeTexture(CubeTexture)
A skybox drawn from a cube texture.
Node(NodeRef)
scene.backgroundNode = … — Background.update()’s
background.isNode branch, which draws the skybox sphere with
vec4( node ).mul( backgroundIntensity ) instead of clearing. Held in
the same slot because nodes.getBackgroundNode( scene ) || scene.background makes the node win over a plain background.
Any node, not just a color(): webgpu_skinning uses
screenUV.y.mix( color( 0x66bbff ), color( 0x4466ff ) ).
Pmrem(PmremHandle)
scene.background = <the texture of a generated PMREM>.
Upstream this is the PMREM cube render target’s texture, flagged
isPMREMTexture; NodeManager.getBackgroundNode() turns it into
pmremTexture( background ) and Background.update() wraps that in
the node branch’s context — getUV is backgroundRotation.mul( normalWorldGeometry ) and getTextureLevel is backgroundBlurriness.
The port carries the handle rather than the texture, because the
maxLod uniform the read needs travels with it; the renderer builds the
node, so an application writes the one line the page does.
EnvironmentNode(EnvironmentNode)
scene.backgroundNode = <a graph of pmremTexture()s> —
webgpu_cubemap_mix’s mix( pmremTexture( cube2 ), pmremTexture( cube1 ), … ). Background.update() builds it under the same context
as Background::Pmrem.