Skip to main content

createBackgroundShader

@zylem/game-lib


@zylem/game-lib / graphics / createBackgroundShader

Function: createBackgroundShader()

createBackgroundShader(colorNode, transparent?): ZylemTSLShader

Defined in: packages/game-lib/src/lib/graphics/background-shader.ts:34

Create a background shader from a TSL color node.

The node is rendered via the WebGPU renderer's scene.backgroundNode — a true skybox pass evaluated per background pixel at infinite depth — and should produce a vec4 color output. Use positionWorldDirection (from three/tsl), which in this context is the normalized per-pixel view direction, to compute colors in spherical coordinates.

Parameters​

colorNode​

any

A TSL node expression that evaluates to a vec4 color

transparent?​

boolean = false

Whether the background should be transparent (default: false)

Returns​

ZylemTSLShader

A ZylemTSLShader that can be used as backgroundShader in stage config