Skip to content

NgtsMeshDistortMaterial

NgtsMeshDistortMaterial is a port of Drei’s MeshDistortMaterial that applies animated noise-based distortion to mesh surfaces. It extends THREE.MeshPhysicalMaterial with vertex displacement using simplex noise.

Usage

import { NgtsMeshDistortMaterial } from 'angular-three-soba/materials';
<ngt-mesh>
<ngt-sphere-geometry />
<ngts-mesh-distort-material [options]="{ speed: 2, factor: 0.5, color: 'hotpink' }" />
</ngt-mesh>

Advanced Example

@Component({
template: `
<ngt-mesh>
<ngt-icosahedron-geometry *args="[1, 4]" />
<ngts-mesh-distort-material
[options]="{
speed: 5,
factor: 0.8,
color: '#ff6b6b',
roughness: 0,
metalness: 0.8,
clearcoat: 1
}"
/>
</ngt-mesh>
`
})
export class DistortedSphere {}

The distortion effect works best with geometries that have enough vertices for smooth deformation, such as spheres or icosahedrons with higher subdivisions.

Options

options input accepts any properties from THREE.MeshPhysicalMaterial in addition to the following:

Properties

name type description
speed number Animation speed multiplier for the distortion.
factor number Distortion intensity factor.