Atlaslog
Atlaslog / deck.gl / API / SimpleMeshLayer
deck.gl · API reference

SimpleMeshLayer

Quick answer

The SimpleMeshLayer renders a number of instances of an arbitrary 3D geometry. For example, it can be used to visualize a fleet of 3d cars each with a p.

Last verified 2026-11-03 · deck.gl 9.0 · Cite this page
Runnable examplesChinese noteAll API topics

The SimpleMeshLayer renders a number of instances of an arbitrary 3D geometry. For example, it can be used to visualize a fleet of 3d cars each with a position and an orientation over the map.

import {Deck} from '@deck.gl/core';
import {SimpleMeshLayer} from '@deck.gl/mesh-layers';
import {OBJLoader} from '@loaders.gl/obj';

const layer = new SimpleMeshLayer({
id: 'SimpleMeshLayer',
data: 'https://raw.githubusercontent.com/visgl/deck.gl-data/master/website/bart-stations.json',

getColor: d => [Math.sqrt(d.exits), 140, 0],
getOrientation: d => [0, Math.random() * 180, 0],
getPosition: d => d.coordinates,
mesh: 'https://raw.githubusercontent.com/visgl/deck.gl-data/master/website/humanoid_quad.obj',
sizeScale: 30,
pickable: true,
loaders: [OBJLoader]
});

new Deck({
initialViewState: {
longitude: -122.4,
latitude: 37.74,
zoom: 11
},
controller: true,
getTooltip: ({object}) => object && object.name,
layers: [layer]
});

loaders.gl offers a category of loaders for loading meshes from standard formats. For example, the following code adds support for PLY files:

import {SimpleMeshLayer} from '@deck.gl/mesh-layers';
import {PLYLoader} from '@loaders.gl/ply';

new SimpleMeshLayer({
mesh: 'path/to/model.ply',
loaders: [PLYLoader]
});

Installation​

To install the dependencies from NPM:

npm install deck.gl
# or
npm install @deck.gl/core @deck.gl/mesh-layers
import {SimpleMeshLayer} from '@deck.gl/mesh-layers';
import type {SimpleMeshLayerProps} from '@deck.gl/mesh-layers';

new SimpleMeshLayer<DataT>(...props: SimpleMeshLayerProps<DataT>[]);

To use pre-bundled scripts:

<script src="https://unpkg.com/deck.gl@^9.0.0/dist.min.js"></script>
<!-- or -->
<script src="https://unpkg.com/@deck.gl/core@^9.0.0/dist.min.js"></script>
<script src="https://unpkg.com/@deck.gl/mesh-layers@^9.0.0/dist.min.js"></script>
new deck.SimpleMeshLayer({});

Properties​

Inherits from all Base Layer properties.

Mesh​

mesh (string | object)​

The geometry to render for each data object. One of:

texture (string | Texture | Image | ImageData | HTMLCanvasElement | HTMLVideoElement | ImageBitmap | Promise | object, optional)​

The texture of the geometries.

The image data will be converted to a Texture object. See textureParameters prop for advanced customization.

If texture is supplied, texture is used to render the geometries. Otherwise, object color obtained via the getColor accessor is used.

textureParameters (object)​

Customize the texture parameters.

If not specified, the layer uses the following defaults to create a linearly smoothed texture from texture:

{
minFilter: 'linear',
magFilter: 'linear',
mipmapFilter: 'linear',
addressModeU: 'clamp-to-edge',
addressModeV: 'clamp-to-edge'
}

Render Options​

sizeScale (number, optional) ​

Multiplier to scale each geometry by.

wireframe (boolean, optional)​

Whether to render the mesh in wireframe mode.

material (Material, optional)​

This is an object that contains material props for lighting effect applied on extruded polygons. Check the lighting guide for configurable settings.

Data Accessors​

getPosition (Accessor<Position>, optional) ​

Method called to retrieve the center position for each object in the data stream.

getColor (Accessor<Color>, optional) ​

If mesh does not contain vertex colors, use this color to render each object. If mesh contains vertex colors, then the two colors are mixed together. Use [255, 255, 255] to use the original mesh colors. If texture is assigned, then both colors will be ignored.

The color is in the format of [r, g, b, [a]]. Each channel is a number between 0-255 and a is 255 if not supplied.

getOrientation (Accessor<number[3]>, optional)​

Object orientation defined as a vec3 of Euler angles, [pitch, yaw, roll] in degrees. This will be composed with layer's modelMatrix.

getScale (Accessor<number[3]>, optional)​

Scaling factor on the mesh along each axis.

getTranslation (Accessor<number[3]>, optional)​

Translation of the mesh along each axis. Offset from the center position given by getPosition. [x, y, z] in meters. This will be composed with layer's modelMatrix.

getTransformMatrix (Accessor<number[16]>, optional)​

Explicitly define a 4x4 column-major model matrix for the mesh. If provided, will override getOrientation, getScale, getTranslation.

Source​

modules/mesh-layers/src/simple-mesh-layer

TutorialsAPI index
English reference text adapted from the official deck.gl documentation, © vis.gl contributors, licensed under MIT.
Original page: https://deck.gl/docs/api-reference/mesh-layers/simple-mesh-layer · Chinese note: /deckgl/api/simple-mesh-layer.html
Cite this page

Atlaslog (2026). SimpleMeshLayer. https://www.jingweizhi.com/en/deckgl/api/simple-mesh-layer.html (accessed 2026-11-03).