Index of refraction
Index of refraction controls the optical contrast at a dielectric boundary and influences reflection and transmitted light.
Configuration​
import {Model} from '@luma.gl/engine/api';
import {createPBRMaterial, type PBRMaterial} from '@luma.gl/engine/materials';
const material: PBRMaterial = createPBRMaterial(device, {
uniforms: {
ior: 1.5,
metallicRoughnessValues: [0, 0.1]
}
});
// modelProps contains your existing shaders, geometry, and buffer layout.
const model = new Model(device, {
...modelProps,
material,
defines: {...modelProps.defines, USE_MATERIAL_EXTENSIONS: true}
});
Parameters​
| Parameter | Default | Description |
|---|---|---|
ior | 1.5 | Index of refraction of the dielectric material. |
Enable USE_MATERIAL_EXTENSIONS on custom models. The glTF importer enables it automatically.
See Using PBR materials for material setup.
Remarks​
KHR_materials_iorsupplies theiorscalar. UseKHR_materials_transmissionfor glass that transmits light.