> ## Documentation Index
> Fetch the complete documentation index at: https://docs.speckle.systems/llms.txt
> Use this file to discover all available pages before exploring further.

# SpeckleMaterial

> All speckle-derived materials inherit this class. Internally, all speckle materials are mixins between three materials and this class.

It's not meant to be used directly, but rather the already existing implementations which work just like regular three.js materials but offer relative to eye rendering support.

* SpeckleStandardMaterial
* SpeckleBasicMaterial
* SpeckleLineMaterial
* SpecklePointMaterial
* SpeckleTextMaterial

## Accessors

### baseUniforms

```typescript theme={null}
protected get baseUniforms(): { [uniform: string]: IUniform }
```

Gets the base three.js uniforms for this material. So for example *SpeckleStandardMaterial* has the base uniforms as `ShaderLib.standard.uniforms`.

**Returns**: An object containing the uniforms

### fragmentProgram

```typescript theme={null}
protected get fragmentProgram(): string
```

Gets the fragment program source code.

**Returns**: string

### pointSize

```typescript theme={null}
protected set pointSize(value: number)
```

Sets the point size for point materials.

**Returns**: number

### stencilOutline

```typescript theme={null}
protected set stencilOutline(value: boolean)
```

Can enable the material to have stencil outlines.

**Returns**: void

### uniformsDef

```typescript theme={null}
protected get uniformsDef(): Uniforms
```

Define the custom uniforms for the material.

**Returns**: `_Uniforms_` which is an alias for `Record<string, any>`

### vertexProgram

```typescript theme={null}
protected get vertexProgram(): string
```

Gets the vertex program source code.

**Returns**: string

## Methods

### fastCopy

```typescript theme={null}
fastCopy(from: Material, to: Material)
```

Copies properties from one *from* Material to *to* Material. The data copied over is restricted to no more and no less than what the viewer needs, so unlike three.js default material copying this aims to be as fast as possible.

**Parameters**

* **from**: [*Material*](https://threejs.org/docs/index.html?q=materi#api/en/materials/Material)
* **to**: [*Material*](https://threejs.org/docs/index.html?q=materi#api/en/materials/Material)

**Returns**: void

## Typedefs

### DisplayStyle

```typescript theme={null}
interface DisplayStyle {
  id: string;
  color: number;
  lineWeight: number;
  opacity?: number;
}
```

Speckle model for material properties on lines.

* **id**: The id of the style object
* **color**: The color of the line
* **lineWeigth**: The thickness of the line in world units
* *optional* **opacity**: The opacity of the line
  <br />

### FilterMaterial

```typescript theme={null}
interface FilterMaterial {
  filterType: FilterMaterialType;
  rampIndex?: number;
  rampIndexColor?: Color;
  rampTexture?: Texture;
}
```

Filter materials are pre-defined materials that you can directly apply with as little configuration as possible.

* **filterType**: [*FilterMaterialType*](/developers/viewer/speckle-material-api#filtermaterialtype)
* *optional* **rampIndex**: The index of the color in the ramp texture. Applies only for FilterMaterialType.COLORED and FilterMaterialType.GRADIENT
* *optional* **rampIndexColor**: The actual color from the ramp texture. Applies only for FilterMaterialType.COLORED and FilterMaterialType.GRADIENT
* *optional* **rampTexture**: The ramp texture. Applies only for FilterMaterialType.COLORED and FilterMaterialType.GRADIENT

### FilterMaterialType

```typescript theme={null}
enum FilterMaterialType {
  GHOST,
  GRADIENT,
  COLORED,
  HIDDEN,
}
```

The list of available filter materials.

### MaterialOptions

```typescript theme={null}
interface MaterialOptions {
  stencilOutlines?: StencilOutlineType;
  pointSize?: number;
  depthWrite?: number;
}
```

Custom options for materials.

* *optional* **stencilOutlines**: [*StencilOutlineType*](/developers/viewer/speckle-material-api#stenciloutlinetype). Only applies to meshes
* *optional* **pointSize**: The point size for point materials. Only applies to points
* *optional* **depthWrite**: Whether the material should write to depth

### RenderMaterial

```typescript theme={null}
interface RenderMaterial {
  id: string;
  color: number;
  opacity: number;
  roughness: number;
  metalness: number;
  vertexColors: boolean;
}
```

Speckle model for material properties of meshes.

* **id**: The id if the render material
* **color**: Color as a int32
* **opacity**: Opacity
* **roughness**: Roughness
* **metalness**: Metalness
* **vertexColors**: Whether the material reads vertex colors

### StencilOutlineType

```typescript theme={null}
enum StencilOutlineType {
  NONE,
  OVERLAY,
  OUTLINE_ONLY,
}
```

* **NONE**: No outlines
* **OVERLAY**: Outline on top of object
* **OUTLINE\_ONLY**: Outline only, rest of the object is not visible
