Double-sided surfaces
Double-sided materials render both faces of thin surfaces and orient their shading normals for the visible face.
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​
| Parameter | Default | Description |
|---|---|---|
defines.DOUBLE_SIDED | false | Enables 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.doubleSideddefaults tofalse. The importer mapstruetocullMode: 'none'andDOUBLE_SIDED: true.