Skip to main content

Double-sided surfaces

Double-sided materials render both faces of thin surfaces and orient their shading normals for the visible face.

GitHub
0.0s
Orbit the sheet to see the texture from both sides.

Configuration​

import {Model} from '@luma.gl/engine/api';
import {createPBRMaterial, type PBRMaterial} from '@luma.gl/engine/materials';

const material: PBRMaterial = createPBRMaterial(device, {
uniforms: {
baseColorFactor: [0.3, 0.7, 0.2, 1],
metallicRoughnessValues: [0, 0.8]
}
});

// modelProps contains your shaders, geometry, and buffer layout.
const model = new Model(device, {
...modelProps,
material,
defines: {...modelProps.defines, DOUBLE_SIDED: true},
parameters: {...modelProps.parameters, cullMode: 'none'}
});

Disabling culling keeps back faces visible. DOUBLE_SIDED also flips back-facing shading normals; use both settings together. This does not add thickness to the mesh.

Parameters​

ParameterDefaultDescription
defines.DOUBLE_SIDEDfalseEnables back-face normal correction in the PBR shader.
parameters.cullMode'none'Device render-state default; the glTF importer explicitly chooses 'back' for single-sided materials. Values: 'none' | 'front' | 'back'.

See Using PBR materials for material setup.

Remarks​

  • Core glTF material.doubleSided defaults to false. The importer maps true to cullMode: 'none' and DOUBLE_SIDED: true.