Skip to content

Documentation / @ripl/3d / Material

Interface: Material ​

Defined in: 3d/src/core/material.ts:35

How a surface responds to light.

Every property is optional and falls back to the behaviour an element with only a fill has, so attaching an empty material changes nothing.

A material is read as a plain value, not observed: mutating one in place will not repaint. Assign a new object to Shape3D.material instead.

Properties ​

PropertyTypeDescriptionDefined in
color?stringThe surface's own colour. Falls back to the element's fill, then to a neutral grey.3d/src/core/material.ts:37
emissive?stringLight the surface emits regardless of illumination. Defaults to black, emitting nothing.3d/src/core/material.ts:41
emissiveIntensity?numberMultiplier on emissive. Defaults to 1.3d/src/core/material.ts:43
flatShading?booleanShades each face by its own normal rather than its per-vertex normals. Defaults to false.3d/src/core/material.ts:53
map?TextureAn image mapped across the surface using each face's uvs.3d/src/core/material.ts:57
opacity?numberThe surface's opacity, from 0 to 1. Multiplies the colour's own alpha.3d/src/core/material.ts:39
shininess?numberThe Blinn-Phong specular exponent; higher is tighter. 0 disables highlights. Defaults to 0.3d/src/core/material.ts:47
side?MaterialSideWhich faces are drawn. Defaults to 'double', matching the unculled default.3d/src/core/material.ts:49
specular?stringThe colour of specular highlights. Defaults to black, disabling them.3d/src/core/material.ts:45
vertexColors?booleanUses each face's colors in place of the surface colour. Defaults to false.3d/src/core/material.ts:55
wireframe?booleanDraws the surface as edges only, with no fill. Defaults to false.3d/src/core/material.ts:51