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 ​
| Property | Type | Description | Defined in |
|---|---|---|---|
color? | string | The surface's own colour. Falls back to the element's fill, then to a neutral grey. | 3d/src/core/material.ts:37 |
emissive? | string | Light the surface emits regardless of illumination. Defaults to black, emitting nothing. | 3d/src/core/material.ts:41 |
emissiveIntensity? | number | Multiplier on emissive. Defaults to 1. | 3d/src/core/material.ts:43 |
flatShading? | boolean | Shades each face by its own normal rather than its per-vertex normals. Defaults to false. | 3d/src/core/material.ts:53 |
map? | Texture | An image mapped across the surface using each face's uvs. | 3d/src/core/material.ts:57 |
opacity? | number | The surface's opacity, from 0 to 1. Multiplies the colour's own alpha. | 3d/src/core/material.ts:39 |
shininess? | number | The Blinn-Phong specular exponent; higher is tighter. 0 disables highlights. Defaults to 0. | 3d/src/core/material.ts:47 |
side? | MaterialSide | Which faces are drawn. Defaults to 'double', matching the unculled default. | 3d/src/core/material.ts:49 |
specular? | string | The colour of specular highlights. Defaults to black, disabling them. | 3d/src/core/material.ts:45 |
vertexColors? | boolean | Uses each face's colors in place of the surface colour. Defaults to false. | 3d/src/core/material.ts:55 |
wireframe? | boolean | Draws the surface as edges only, with no fill. Defaults to false. | 3d/src/core/material.ts:51 |