MeshDistanceMaterial - Verge3D User Manual - Soft8Soft
Description: Learn how to use MeshDistanceMaterial in your interactive 3D apps made with Verge3D

Material →

# MeshDistanceMaterial

MeshDistanceMaterial is internally used for implementing shadow mapping for PointLights and RectAreaLights.

Can also be used to customize the shadow casting of an object by assigning an instance of MeshDistanceMaterial to Object3D.customDistanceMaterial.

## Constructor

### MeshDistanceMaterial(parameters : Object)

parameters — (optional) an object with one or more properties defining the material's appearance. Any property of the material (including any property inherited from Material) can be passed in here.

## Properties

See the base Material class for inherited properties.

### # .farDistance : Float

The far value of the light's internal shadow camera.

### # .fog : Boolean

Whether the material is affected by fog. Default is `false`.

### # .map : Texture

The color map. May optionally include an alpha channel, typically combined with .transparent or .alphaTest. Default is `null`.

### # .nearDistance : Float

The near value of the point light's internal shadow camera.

### # .referencePosition : Vector3

The position of the point light in world space.

### # .slopeScaledBias : Float

An adaptive bias which depends on the polygon's slope relative to the camera. Applied only if .useSlopeScaledBias is set to `true`. Default is `0`. For materials used for shadow mapping this property is auto-assigned from LightShadow.slopeScaledBias. The exception is ESM shadows, which set `slopeScaledBias` to `0.5`.

### # .useSlopeScaledBias : Boolean

Enables or disables .slopeScaledBias. Default is `false`. For materials used for shadow mapping this property is auto-assigned to `true`.

## Methods

See the base Material class for inherited methods.

## Source

For more info on how to obtain the source code of this module see this page.