// luma.gl // SPDX-License-Identifier: MIT // Copyright (c) vis.gl contributors import { lighting } from "../lights/lighting-uniforms.js"; import { vs } from "./pbr-vertex-glsl.js"; import { fs } from "./pbr-fragment-glsl.js"; /** * An implementation of PBR (Physically-Based Rendering). * Physically Based Shading of a microfacet surface defined by a glTF material. */ export const pbrMaterial = { name: 'pbr', vs, fs, defines: { LIGHTING_FRAGMENT: 1, HAS_NORMALMAP: 0, HAS_EMISSIVEMAP: 0, HAS_OCCLUSIONMAP: 0, HAS_BASECOLORMAP: 0, HAS_METALROUGHNESSMAP: 0, ALPHA_CUTOFF: 0, USE_IBL: 0, PBR_DEBUG: 0 }, uniformTypes: { // Material is unlit unlit: 'i32', // Base color map baseColorMapEnabled: 'i32', baseColorFactor: 'vec4', normalMapEnabled: 'i32', normalScale: 'f32', // #ifdef HAS_NORMALMAP emissiveMapEnabled: 'i32', emissiveFactor: 'vec3', // #ifdef HAS_EMISSIVEMAP metallicRoughnessValues: 'vec2', metallicRoughnessMapEnabled: 'i32', occlusionMapEnabled: 'i32', occlusionStrength: 'f32', // #ifdef HAS_OCCLUSIONMAP alphaCutoffEnabled: 'i32', alphaCutoff: 'f32', // #ifdef ALPHA_CUTOFF // IBL IBLenabled: 'i32', scaleIBLAmbient: 'vec2', // #ifdef USE_IBL // debugging flags used for shader output of intermediate PBR variables // #ifdef PBR_DEBUG scaleDiffBaseMR: 'vec4', scaleFGDSpec: 'vec4' }, dependencies: [lighting] };