MotionScript

@motion-script/core


@motion-script/core / ShaderMaterial3D

Interface: ShaderMaterial3D

Defined in: render3d/material.ts:279

Raw GLSL — total control over both stages.

Uniform values are cheap: the renderer writes them in place each frame, so driving them from signals costs nothing. Uniform names and the shader source are structural — changing either recompiles the program.

Set extends to patch three's built-in lit shader instead of replacing it, which keeps lighting, shadows and fog working while you inject your own vertex displacement or colour maths.

Extends

Properties

alphaTest?

optional alphaTest?: number

Defined in: render3d/material.ts:30

Structural. Discard fragments below this alpha. Cheap cutout transparency.

Inherited from

MaterialCommon3D.alphaTest


blending?

optional blending?: Blending3D

Defined in: render3d/material.ts:36

Structural. How the colour combines with the framebuffer.

Inherited from

MaterialCommon3D.blending


defines?

optional defines?: Readonly<Record<string, string | number | boolean>>

Defined in: render3d/material.ts:287

#defines injected ahead of both stages. Structural.


depthTest?

optional depthTest?: boolean

Defined in: render3d/material.ts:45

Test against the depth buffer. Turn off to force draw-on-top.

Inherited from

MaterialCommon3D.depthTest


depthWrite?

optional depthWrite?: boolean

Defined in: render3d/material.ts:43

Write to the depth buffer. Turn off for additive glows and inside-out shells.

Inherited from

MaterialCommon3D.depthWrite


dithering?

optional dithering?: boolean

Defined in: render3d/material.ts:51

Smooth gradient banding.

Inherited from

MaterialCommon3D.dithering


extends?

optional extends?: "standard" | "basic" | "phong" | null

Defined in: render3d/material.ts:292

Wrap a built-in shading model rather than replacing it, so scene lighting, shadows and fog still apply. Null (the default) is a raw shader.


fragment

fragment: string

Defined in: render3d/material.ts:284

Fragment stage source.


key?

optional key?: string

Defined in: render3d/material.ts:54

Explicit reconciler identity — see Transform3D.key.

Inherited from

MaterialCommon3D.key


opacity?

optional opacity?: number

Defined in: render3d/material.ts:19

0–1. Needs transparent to actually show through. Free to animate.

Inherited from

MaterialCommon3D.opacity


params?

optional params?: Record<string, unknown>

Defined in: render3d/geometry.ts:14

Inherited from

MaterialCommon3D.params


polygonOffset?

optional polygonOffset?: boolean

Defined in: render3d/material.ts:47

Nudge depth to break z-fighting between coplanar surfaces.

Inherited from

MaterialCommon3D.polygonOffset


polygonOffsetFactor?

optional polygonOffsetFactor?: number

Defined in: render3d/material.ts:48

Inherited from

MaterialCommon3D.polygonOffsetFactor


polygonOffsetUnits?

optional polygonOffsetUnits?: number

Defined in: render3d/material.ts:49

Inherited from

MaterialCommon3D.polygonOffsetUnits


raw?

optional raw?: boolean

Defined in: render3d/material.ts:294

Skip three's automatic attribute/uniform prelude (a raw shader).


side?

optional side?: Side3D

Defined in: render3d/material.ts:32

Structural. Which faces to rasterize. Default "front".

Inherited from

MaterialCommon3D.side


toneMapped?

optional toneMapped?: boolean

Defined in: render3d/material.ts:40

Structural. Apply the scene's tone mapping. Default true.

Inherited from

MaterialCommon3D.toneMapped


transparent?

optional transparent?: boolean

Defined in: render3d/material.ts:28

Structural. Opt into alpha blending. Off by default because blended surfaces must be depth-sorted, which costs correctness at intersections — prefer alphaTest for cutouts like foliage.

Inherited from

MaterialCommon3D.transparent


type

type: "shader"

Defined in: render3d/material.ts:280


uniforms?

optional uniforms?: Readonly<Record<string, Uniform3D>>

Defined in: render3d/material.ts:285


vertex

vertex: string

Defined in: render3d/material.ts:282

Vertex stage source.


vertexColors?

optional vertexColors?: boolean

Defined in: render3d/material.ts:38

Structural. Read per-vertex colours from the geometry's color buffer.

Inherited from

MaterialCommon3D.vertexColors


visible?

optional visible?: boolean

Defined in: render3d/material.ts:21

Hide without removing. Free to animate.

Inherited from

MaterialCommon3D.visible


wireframe?

optional wireframe?: boolean

Defined in: render3d/material.ts:34

Structural. Draw edges only.

Inherited from

MaterialCommon3D.wireframe