@babylonjs/core
Version:
Getting started? Play directly with the Babylon.js API using our [playground](https://playground.babylonjs.com/). It also contains a lot of samples to learn how to use it.
860 lines (859 loc) • 30.5 kB
TypeScript
import type { Nullable } from "../../types.js";
import { Scene } from "../../scene.js";
import type { Matrix } from "../../Maths/math.vector.js";
import type { SubMesh } from "../../Meshes/subMesh.js";
import type { AbstractMesh } from "../../Meshes/abstractMesh.js";
import type { Mesh } from "../../Meshes/mesh.js";
import { PBRBRDFConfiguration } from "./pbrBRDFConfiguration.js";
import { PrePassConfiguration } from "../prePassConfiguration.js";
import { Color3 } from "../../Maths/math.color.js";
import type { IImageProcessingConfigurationDefines } from "../../Materials/imageProcessingConfiguration.defines.js";
import { ImageProcessingConfiguration } from "../../Materials/imageProcessingConfiguration.js";
import type { IMaterialCompilationOptions } from "../../Materials/material.js";
import { Material } from "../../Materials/material.js";
import { MaterialDefines } from "../../Materials/materialDefines.js";
import { PushMaterial } from "../../Materials/pushMaterial.js";
import type { BaseTexture } from "../../Materials/Textures/baseTexture.js";
import type { IAnimatable } from "../../Animations/animatable.interface.js";
import "../../Materials/Textures/baseTexture.polynomial.js";
import { PBRClearCoatConfiguration } from "./pbrClearCoatConfiguration.js";
import { PBRIridescenceConfiguration } from "./pbrIridescenceConfiguration.js";
import { PBRAnisotropicConfiguration } from "./pbrAnisotropicConfiguration.js";
import { PBRSheenConfiguration } from "./pbrSheenConfiguration.js";
import { PBRSubSurfaceConfiguration } from "./pbrSubSurfaceConfiguration.js";
import { DetailMapConfiguration } from "../material.detailMapConfiguration.js";
/**
* Manages the defines for the PBR Material.
* @internal
*/
export declare class PBRMaterialDefines extends MaterialDefines implements IImageProcessingConfigurationDefines {
PBR: boolean;
NUM_SAMPLES: string;
REALTIME_FILTERING: boolean;
IBL_CDF_FILTERING: boolean;
MAINUV1: boolean;
MAINUV2: boolean;
MAINUV3: boolean;
MAINUV4: boolean;
MAINUV5: boolean;
MAINUV6: boolean;
UV1: boolean;
UV2: boolean;
UV3: boolean;
UV4: boolean;
UV5: boolean;
UV6: boolean;
ALBEDO: boolean;
GAMMAALBEDO: boolean;
ALBEDODIRECTUV: number;
VERTEXCOLOR: boolean;
BASEWEIGHT: boolean;
BASEWEIGHTDIRECTUV: number;
BAKED_VERTEX_ANIMATION_TEXTURE: boolean;
AMBIENT: boolean;
AMBIENTDIRECTUV: number;
AMBIENTINGRAYSCALE: boolean;
OPACITY: boolean;
VERTEXALPHA: boolean;
OPACITYDIRECTUV: number;
OPACITYRGB: boolean;
ALPHATEST: boolean;
DEPTHPREPASS: boolean;
ALPHABLEND: boolean;
ALPHAFROMALBEDO: boolean;
ALPHATESTVALUE: string;
SPECULAROVERALPHA: boolean;
RADIANCEOVERALPHA: boolean;
ALPHAFRESNEL: boolean;
LINEARALPHAFRESNEL: boolean;
PREMULTIPLYALPHA: boolean;
EMISSIVE: boolean;
EMISSIVEDIRECTUV: number;
GAMMAEMISSIVE: boolean;
REFLECTIVITY: boolean;
REFLECTIVITY_GAMMA: boolean;
REFLECTIVITYDIRECTUV: number;
SPECULARTERM: boolean;
MICROSURFACEFROMREFLECTIVITYMAP: boolean;
MICROSURFACEAUTOMATIC: boolean;
LODBASEDMICROSFURACE: boolean;
MICROSURFACEMAP: boolean;
MICROSURFACEMAPDIRECTUV: number;
METALLICWORKFLOW: boolean;
ROUGHNESSSTOREINMETALMAPALPHA: boolean;
ROUGHNESSSTOREINMETALMAPGREEN: boolean;
METALLNESSSTOREINMETALMAPBLUE: boolean;
AOSTOREINMETALMAPRED: boolean;
METALLIC_REFLECTANCE: boolean;
METALLIC_REFLECTANCE_GAMMA: boolean;
METALLIC_REFLECTANCEDIRECTUV: number;
METALLIC_REFLECTANCE_USE_ALPHA_ONLY: boolean;
REFLECTANCE: boolean;
REFLECTANCE_GAMMA: boolean;
REFLECTANCEDIRECTUV: number;
ENVIRONMENTBRDF: boolean;
ENVIRONMENTBRDF_RGBD: boolean;
NORMAL: boolean;
TANGENT: boolean;
BUMP: boolean;
BUMPDIRECTUV: number;
OBJECTSPACE_NORMALMAP: boolean;
PARALLAX: boolean;
PARALLAX_RHS: boolean;
PARALLAXOCCLUSION: boolean;
NORMALXYSCALE: boolean;
LIGHTMAP: boolean;
LIGHTMAPDIRECTUV: number;
USELIGHTMAPASSHADOWMAP: boolean;
GAMMALIGHTMAP: boolean;
RGBDLIGHTMAP: boolean;
REFLECTION: boolean;
REFLECTIONMAP_3D: boolean;
REFLECTIONMAP_SPHERICAL: boolean;
REFLECTIONMAP_PLANAR: boolean;
REFLECTIONMAP_CUBIC: boolean;
USE_LOCAL_REFLECTIONMAP_CUBIC: boolean;
REFLECTIONMAP_PROJECTION: boolean;
REFLECTIONMAP_SKYBOX: boolean;
REFLECTIONMAP_EXPLICIT: boolean;
REFLECTIONMAP_EQUIRECTANGULAR: boolean;
REFLECTIONMAP_EQUIRECTANGULAR_FIXED: boolean;
REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED: boolean;
INVERTCUBICMAP: boolean;
USESPHERICALFROMREFLECTIONMAP: boolean;
USEIRRADIANCEMAP: boolean;
USESPHERICALINVERTEX: boolean;
REFLECTIONMAP_OPPOSITEZ: boolean;
LODINREFLECTIONALPHA: boolean;
GAMMAREFLECTION: boolean;
RGBDREFLECTION: boolean;
LINEARSPECULARREFLECTION: boolean;
RADIANCEOCCLUSION: boolean;
HORIZONOCCLUSION: boolean;
INSTANCES: boolean;
THIN_INSTANCES: boolean;
INSTANCESCOLOR: boolean;
PREPASS: boolean;
PREPASS_COLOR: boolean;
PREPASS_COLOR_INDEX: number;
PREPASS_IRRADIANCE: boolean;
PREPASS_IRRADIANCE_INDEX: number;
PREPASS_ALBEDO: boolean;
PREPASS_ALBEDO_INDEX: number;
PREPASS_ALBEDO_SQRT: boolean;
PREPASS_ALBEDO_SQRT_INDEX: number;
PREPASS_DEPTH: boolean;
PREPASS_DEPTH_INDEX: number;
PREPASS_SCREENSPACE_DEPTH: boolean;
PREPASS_SCREENSPACE_DEPTH_INDEX: number;
PREPASS_NORMAL: boolean;
PREPASS_NORMAL_INDEX: number;
PREPASS_NORMAL_WORLDSPACE: boolean;
PREPASS_WORLD_NORMAL: boolean;
PREPASS_WORLD_NORMAL_INDEX: number;
PREPASS_POSITION: boolean;
PREPASS_POSITION_INDEX: number;
PREPASS_LOCAL_POSITION: boolean;
PREPASS_LOCAL_POSITION_INDEX: number;
PREPASS_VELOCITY: boolean;
PREPASS_VELOCITY_INDEX: number;
PREPASS_VELOCITY_LINEAR: boolean;
PREPASS_VELOCITY_LINEAR_INDEX: number;
PREPASS_REFLECTIVITY: boolean;
PREPASS_REFLECTIVITY_INDEX: number;
SCENE_MRT_COUNT: number;
NUM_BONE_INFLUENCERS: number;
BonesPerMesh: number;
BONETEXTURE: boolean;
BONES_VELOCITY_ENABLED: boolean;
NONUNIFORMSCALING: boolean;
MORPHTARGETS: boolean;
MORPHTARGETS_POSITION: boolean;
MORPHTARGETS_NORMAL: boolean;
MORPHTARGETS_TANGENT: boolean;
MORPHTARGETS_UV: boolean;
MORPHTARGETS_UV2: boolean;
MORPHTARGETS_COLOR: boolean;
MORPHTARGETTEXTURE_HASPOSITIONS: boolean;
MORPHTARGETTEXTURE_HASNORMALS: boolean;
MORPHTARGETTEXTURE_HASTANGENTS: boolean;
MORPHTARGETTEXTURE_HASUVS: boolean;
MORPHTARGETTEXTURE_HASUV2S: boolean;
MORPHTARGETTEXTURE_HASCOLORS: boolean;
NUM_MORPH_INFLUENCERS: number;
MORPHTARGETS_TEXTURE: boolean;
IMAGEPROCESSING: boolean;
VIGNETTE: boolean;
VIGNETTEBLENDMODEMULTIPLY: boolean;
VIGNETTEBLENDMODEOPAQUE: boolean;
TONEMAPPING: number;
CONTRAST: boolean;
COLORCURVES: boolean;
COLORGRADING: boolean;
COLORGRADING3D: boolean;
SAMPLER3DGREENDEPTH: boolean;
SAMPLER3DBGRMAP: boolean;
DITHER: boolean;
IMAGEPROCESSINGPOSTPROCESS: boolean;
SKIPFINALCOLORCLAMP: boolean;
EXPOSURE: boolean;
MULTIVIEW: boolean;
ORDER_INDEPENDENT_TRANSPARENCY: boolean;
ORDER_INDEPENDENT_TRANSPARENCY_16BITS: boolean;
USEPHYSICALLIGHTFALLOFF: boolean;
USEGLTFLIGHTFALLOFF: boolean;
TWOSIDEDLIGHTING: boolean;
MIRRORED: boolean;
SHADOWFLOAT: boolean;
CLIPPLANE: boolean;
CLIPPLANE2: boolean;
CLIPPLANE3: boolean;
CLIPPLANE4: boolean;
CLIPPLANE5: boolean;
CLIPPLANE6: boolean;
POINTSIZE: boolean;
FOG: boolean;
LOGARITHMICDEPTH: boolean;
CAMERA_ORTHOGRAPHIC: boolean;
CAMERA_PERSPECTIVE: boolean;
AREALIGHTSUPPORTED: boolean;
FORCENORMALFORWARD: boolean;
SPECULARAA: boolean;
UNLIT: boolean;
DECAL_AFTER_DETAIL: boolean;
DEBUGMODE: number;
/**
* Initializes the PBR Material defines.
* @param externalProperties The external properties
*/
constructor(externalProperties?: {
[name: string]: {
type: string;
default: any;
};
});
/**
* Resets the PBR Material defines.
*/
reset(): void;
}
/**
* The Physically based material base class of BJS.
*
* This offers the main features of a standard PBR material.
* For more information, please refer to the documentation :
* https://doc.babylonjs.com/features/featuresDeepDive/materials/using/introToPBR
* @see [WebGL](https://playground.babylonjs.com/#CGHTSM#1)
* @see [WebGPU](https://playground.babylonjs.com/#CGHTSM#2)
*/
export declare abstract class PBRBaseMaterial extends PushMaterial {
/**
* PBRMaterialTransparencyMode: No transparency mode, Alpha channel is not use.
*/
static readonly PBRMATERIAL_OPAQUE = 0;
/**
* PBRMaterialTransparencyMode: Alpha Test mode, pixel are discarded below a certain threshold defined by the alpha cutoff value.
*/
static readonly PBRMATERIAL_ALPHATEST = 1;
/**
* PBRMaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.
*/
static readonly PBRMATERIAL_ALPHABLEND = 2;
/**
* PBRMaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.
* They are also discarded below the alpha cutoff threshold to improve performances.
*/
static readonly PBRMATERIAL_ALPHATESTANDBLEND = 3;
/**
* Defines the default value of how much AO map is occluding the analytical lights
* (point spot...).
*/
static DEFAULT_AO_ON_ANALYTICAL_LIGHTS: number;
/**
* PBRMaterialLightFalloff Physical: light is falling off following the inverse squared distance law.
*/
static readonly LIGHTFALLOFF_PHYSICAL = 0;
/**
* PBRMaterialLightFalloff gltf: light is falling off as described in the gltf moving to PBR document
* to enhance interoperability with other engines.
*/
static readonly LIGHTFALLOFF_GLTF = 1;
/**
* PBRMaterialLightFalloff Standard: light is falling off like in the standard material
* to enhance interoperability with other materials.
*/
static readonly LIGHTFALLOFF_STANDARD = 2;
/**
* Force all the PBR materials to compile to glsl even on WebGPU engines.
* False by default. This is mostly meant for backward compatibility.
*/
static ForceGLSL: boolean;
/**
* Intensity of the direct lights e.g. the four lights available in your scene.
* This impacts both the direct diffuse and specular highlights.
* @internal
*/
_directIntensity: number;
/**
* Intensity of the emissive part of the material.
* This helps controlling the emissive effect without modifying the emissive color.
* @internal
*/
_emissiveIntensity: number;
/**
* Intensity of the environment e.g. how much the environment will light the object
* either through harmonics for rough material or through the reflection for shiny ones.
* @internal
*/
_environmentIntensity: number;
/**
* This is a special control allowing the reduction of the specular highlights coming from the
* four lights of the scene. Those highlights may not be needed in full environment lighting.
* @internal
*/
_specularIntensity: number;
/**
* This stores the direct, emissive, environment, and specular light intensities into a Vector4.
*/
private _lightingInfos;
/**
* Debug Control allowing disabling the bump map on this material.
* @internal
*/
_disableBumpMap: boolean;
/**
* AKA Diffuse Texture in standard nomenclature.
* @internal
*/
_albedoTexture: Nullable<BaseTexture>;
/**
* OpenPBR Base Weight (multiplier to the diffuse and metal lobes).
* @internal
*/
_baseWeightTexture: Nullable<BaseTexture>;
/**
* AKA Occlusion Texture in other nomenclature.
* @internal
*/
_ambientTexture: Nullable<BaseTexture>;
/**
* AKA Occlusion Texture Intensity in other nomenclature.
* @internal
*/
_ambientTextureStrength: number;
/**
* Defines how much the AO map is occluding the analytical lights (point spot...).
* 1 means it completely occludes it
* 0 mean it has no impact
* @internal
*/
_ambientTextureImpactOnAnalyticalLights: number;
/**
* Stores the alpha values in a texture.
* @internal
*/
_opacityTexture: Nullable<BaseTexture>;
/**
* Stores the reflection values in a texture.
* @internal
*/
_reflectionTexture: Nullable<BaseTexture>;
/**
* Stores the emissive values in a texture.
* @internal
*/
_emissiveTexture: Nullable<BaseTexture>;
/**
* AKA Specular texture in other nomenclature.
* @internal
*/
_reflectivityTexture: Nullable<BaseTexture>;
/**
* Used to switch from specular/glossiness to metallic/roughness workflow.
* @internal
*/
_metallicTexture: Nullable<BaseTexture>;
/**
* Specifies the metallic scalar of the metallic/roughness workflow.
* Can also be used to scale the metalness values of the metallic texture.
* @internal
*/
_metallic: Nullable<number>;
/**
* Specifies the roughness scalar of the metallic/roughness workflow.
* Can also be used to scale the roughness values of the metallic texture.
* @internal
*/
_roughness: Nullable<number>;
/**
* In metallic workflow, specifies an F0 factor to help configuring the material F0.
* By default the indexOfrefraction is used to compute F0;
*
* This is used as a factor against the default reflectance at normal incidence to tweak it.
*
* F0 = defaultF0 * metallicF0Factor * metallicReflectanceColor;
* F90 = metallicReflectanceColor;
* @internal
*/
_metallicF0Factor: number;
/**
* In metallic workflow, specifies an F0 color.
* By default the F90 is always 1;
*
* Please note that this factor is also used as a factor against the default reflectance at normal incidence.
*
* F0 = defaultF0_from_IOR * metallicF0Factor * metallicReflectanceColor
* F90 = metallicF0Factor;
* @internal
*/
_metallicReflectanceColor: Color3;
/**
* Specifies that only the A channel from _metallicReflectanceTexture should be used.
* If false, both RGB and A channels will be used
* @internal
*/
_useOnlyMetallicFromMetallicReflectanceTexture: boolean;
/**
* Defines to store metallicReflectanceColor in RGB and metallicF0Factor in A
* This is multiply against the scalar values defined in the material.
* @internal
*/
_metallicReflectanceTexture: Nullable<BaseTexture>;
/**
* Defines to store reflectanceColor in RGB
* This is multiplied against the scalar values defined in the material.
* If both _reflectanceTexture and _metallicReflectanceTexture textures are provided and _useOnlyMetallicFromMetallicReflectanceTexture
* is false, _metallicReflectanceTexture takes precedence and _reflectanceTexture is not used
* @internal
*/
_reflectanceTexture: Nullable<BaseTexture>;
/**
* Used to enable roughness/glossiness fetch from a separate channel depending on the current mode.
* Gray Scale represents roughness in metallic mode and glossiness in specular mode.
* @internal
*/
_microSurfaceTexture: Nullable<BaseTexture>;
/**
* Stores surface normal data used to displace a mesh in a texture.
* @internal
*/
_bumpTexture: Nullable<BaseTexture>;
/**
* Stores the pre-calculated light information of a mesh in a texture.
* @internal
*/
_lightmapTexture: Nullable<BaseTexture>;
/**
* The color of a material in ambient lighting.
* @internal
*/
_ambientColor: Color3;
/**
* AKA Diffuse Color in other nomenclature.
* @internal
*/
_albedoColor: Color3;
/**
* OpenPBR Base Weight (multiplier to the diffuse and metal lobes).
* @internal
*/
_baseWeight: number;
/**
* AKA Specular Color in other nomenclature.
* @internal
*/
_reflectivityColor: Color3;
/**
* The color applied when light is reflected from a material.
* @internal
*/
_reflectionColor: Color3;
/**
* The color applied when light is emitted from a material.
* @internal
*/
_emissiveColor: Color3;
/**
* AKA Glossiness in other nomenclature.
* @internal
*/
_microSurface: number;
/**
* Specifies that the material will use the light map as a show map.
* @internal
*/
_useLightmapAsShadowmap: boolean;
/**
* This parameters will enable/disable Horizon occlusion to prevent normal maps to look shiny when the normal
* makes the reflect vector face the model (under horizon).
* @internal
*/
_useHorizonOcclusion: boolean;
/**
* This parameters will enable/disable radiance occlusion by preventing the radiance to lit
* too much the area relying on ambient texture to define their ambient occlusion.
* @internal
*/
_useRadianceOcclusion: boolean;
/**
* Specifies that the alpha is coming form the albedo channel alpha channel for alpha blending.
* @internal
*/
_useAlphaFromAlbedoTexture: boolean;
/**
* Specifies that the material will keeps the specular highlights over a transparent surface (only the most luminous ones).
* A car glass is a good example of that. When sun reflects on it you can not see what is behind.
* @internal
*/
_useSpecularOverAlpha: boolean;
/**
* Specifies if the reflectivity texture contains the glossiness information in its alpha channel.
* @internal
*/
_useMicroSurfaceFromReflectivityMapAlpha: boolean;
/**
* Specifies if the metallic texture contains the roughness information in its alpha channel.
* @internal
*/
_useRoughnessFromMetallicTextureAlpha: boolean;
/**
* Specifies if the metallic texture contains the roughness information in its green channel.
* @internal
*/
_useRoughnessFromMetallicTextureGreen: boolean;
/**
* Specifies if the metallic texture contains the metallness information in its blue channel.
* @internal
*/
_useMetallnessFromMetallicTextureBlue: boolean;
/**
* Specifies if the metallic texture contains the ambient occlusion information in its red channel.
* @internal
*/
_useAmbientOcclusionFromMetallicTextureRed: boolean;
/**
* Specifies if the ambient texture contains the ambient occlusion information in its red channel only.
* @internal
*/
_useAmbientInGrayScale: boolean;
/**
* In case the reflectivity map does not contain the microsurface information in its alpha channel,
* The material will try to infer what glossiness each pixel should be.
* @internal
*/
_useAutoMicroSurfaceFromReflectivityMap: boolean;
/**
* Defines the falloff type used in this material.
* It by default is Physical.
* @internal
*/
_lightFalloff: number;
/**
* Specifies that the material will keeps the reflection highlights over a transparent surface (only the most luminous ones).
* A car glass is a good example of that. When the street lights reflects on it you can not see what is behind.
* @internal
*/
_useRadianceOverAlpha: boolean;
/**
* Allows using an object space normal map (instead of tangent space).
* @internal
*/
_useObjectSpaceNormalMap: boolean;
/**
* Allows using the bump map in parallax mode.
* @internal
*/
_useParallax: boolean;
/**
* Allows using the bump map in parallax occlusion mode.
* @internal
*/
_useParallaxOcclusion: boolean;
/**
* Controls the scale bias of the parallax mode.
* @internal
*/
_parallaxScaleBias: number;
/**
* If sets to true, disables all the lights affecting the material.
* @internal
*/
_disableLighting: boolean;
/**
* Number of Simultaneous lights allowed on the material.
* @internal
*/
_maxSimultaneousLights: number;
/**
* If sets to true, x component of normal map value will be inverted (x = 1.0 - x).
* @internal
*/
_invertNormalMapX: boolean;
/**
* If sets to true, y component of normal map value will be inverted (y = 1.0 - y).
* @internal
*/
_invertNormalMapY: boolean;
/**
* If sets to true and backfaceCulling is false, normals will be flipped on the backside.
* @internal
*/
_twoSidedLighting: boolean;
/**
* Defines the alpha limits in alpha test mode.
* @internal
*/
_alphaCutOff: number;
/**
* A fresnel is applied to the alpha of the model to ensure grazing angles edges are not alpha tested.
* And/Or occlude the blended part. (alpha is converted to gamma to compute the fresnel)
* @internal
*/
_useAlphaFresnel: boolean;
/**
* A fresnel is applied to the alpha of the model to ensure grazing angles edges are not alpha tested.
* And/Or occlude the blended part. (alpha stays linear to compute the fresnel)
* @internal
*/
_useLinearAlphaFresnel: boolean;
/**
* Specifies the environment BRDF texture used to compute the scale and offset roughness values
* from cos theta and roughness:
* http://blog.selfshadow.com/publications/s2013-shading-course/karis/s2013_pbs_epic_notes_v2.pdf
* @internal
*/
_environmentBRDFTexture: Nullable<BaseTexture>;
/**
* Force the shader to compute irradiance in the fragment shader in order to take bump in account.
* @internal
*/
_forceIrradianceInFragment: boolean;
private _realTimeFiltering;
/**
* Enables realtime filtering on the texture.
*/
get realTimeFiltering(): boolean;
set realTimeFiltering(b: boolean);
private _realTimeFilteringQuality;
/**
* Quality switch for realtime filtering
*/
get realTimeFilteringQuality(): number;
set realTimeFilteringQuality(n: number);
/**
* Can this material render to several textures at once
*/
get canRenderToMRT(): boolean;
/**
* Force normal to face away from face.
* @internal
*/
_forceNormalForward: boolean;
/**
* Enables specular anti aliasing in the PBR shader.
* It will both interacts on the Geometry for analytical and IBL lighting.
* It also prefilter the roughness map based on the bump values.
* @internal
*/
_enableSpecularAntiAliasing: boolean;
/**
* Default configuration related to image processing available in the PBR Material.
*/
protected _imageProcessingConfiguration: ImageProcessingConfiguration;
/**
* Keep track of the image processing observer to allow dispose and replace.
*/
private _imageProcessingObserver;
/**
* Attaches a new image processing configuration to the PBR Material.
* @param configuration
*/
protected _attachImageProcessingConfiguration(configuration: Nullable<ImageProcessingConfiguration>): void;
/**
* Stores the available render targets.
*/
private _renderTargets;
/**
* Sets the global ambient color for the material used in lighting calculations.
*/
private _globalAmbientColor;
/**
* If set to true, no lighting calculations will be applied.
*/
private _unlit;
/**
* If sets to true, the decal map will be applied after the detail map. Else, it is applied before (default: false)
*/
private _applyDecalMapAfterDetailMap;
private _debugMode;
private _shadersLoaded;
private _breakShaderLoadedCheck;
/**
* @internal
* This is reserved for the inspector.
* Defines the material debug mode.
* It helps seeing only some components of the material while troubleshooting.
*/
debugMode: number;
/**
* @internal
* This is reserved for the inspector.
* Specify from where on screen the debug mode should start.
* The value goes from -1 (full screen) to 1 (not visible)
* It helps with side by side comparison against the final render
* This defaults to -1
*/
debugLimit: number;
/**
* @internal
* This is reserved for the inspector.
* As the default viewing range might not be enough (if the ambient is really small for instance)
* You can use the factor to better multiply the final value.
*/
debugFactor: number;
/**
* Defines the clear coat layer parameters for the material.
*/
readonly clearCoat: PBRClearCoatConfiguration;
/**
* Defines the iridescence layer parameters for the material.
*/
readonly iridescence: PBRIridescenceConfiguration;
/**
* Defines the anisotropic parameters for the material.
*/
readonly anisotropy: PBRAnisotropicConfiguration;
/**
* Defines the BRDF parameters for the material.
*/
readonly brdf: PBRBRDFConfiguration;
/**
* Defines the Sheen parameters for the material.
*/
readonly sheen: PBRSheenConfiguration;
/**
* Defines the SubSurface parameters for the material.
*/
readonly subSurface: PBRSubSurfaceConfiguration;
/**
* Defines additional PrePass parameters for the material.
*/
readonly prePassConfiguration: PrePassConfiguration;
/**
* Defines the detail map parameters for the material.
*/
readonly detailMap: DetailMapConfiguration;
protected _cacheHasRenderTargetTextures: boolean;
/**
* Instantiates a new PBRMaterial instance.
*
* @param name The material name
* @param scene The scene the material will be use in.
* @param forceGLSL Use the GLSL code generation for the shader (even on WebGPU). Default is false
*/
constructor(name: string, scene?: Scene, forceGLSL?: boolean);
/**
* Gets a boolean indicating that current material needs to register RTT
*/
get hasRenderTargetTextures(): boolean;
/**
* Can this material render to prepass
*/
get isPrePassCapable(): boolean;
/**
* @returns the name of the material class.
*/
getClassName(): string;
/**
* Returns true if alpha blending should be disabled.
*/
protected get _disableAlphaBlending(): boolean;
/**
* @returns whether or not this material should be rendered in alpha blend mode.
*/
needAlphaBlending(): boolean;
/**
* @returns whether or not this material should be rendered in alpha test mode.
*/
needAlphaTesting(): boolean;
/**
* @returns whether or not the alpha value of the albedo texture should be used for alpha blending.
*/
protected _shouldUseAlphaFromAlbedoTexture(): boolean;
/**
* @returns whether or not there is a usable alpha channel for transparency.
*/
protected _hasAlphaChannel(): boolean;
/**
* @returns the texture used for the alpha test.
*/
getAlphaTestTexture(): Nullable<BaseTexture>;
/**
* Specifies that the submesh is ready to be used.
* @param mesh - BJS mesh.
* @param subMesh - A submesh of the BJS mesh. Used to check if it is ready.
* @param useInstances - Specifies that instances should be used.
* @returns - boolean indicating that the submesh is ready or not.
*/
isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
/**
* Specifies if the material uses metallic roughness workflow.
* @returns boolean specifying if the material uses metallic roughness workflow.
*/
isMetallicWorkflow(): boolean;
private _prepareEffect;
private _prepareDefines;
/**
* Force shader compilation
* @param mesh - Define the mesh we want to force the compilation for
* @param onCompiled - Define a callback triggered when the compilation completes
* @param options - Define the options used to create the compilation
*/
forceCompilation(mesh: AbstractMesh, onCompiled?: (material: Material) => void, options?: Partial<IMaterialCompilationOptions>): void;
/**
* Initializes the uniform buffer layout for the shader.
*/
buildUniformLayout(): void;
/**
* Binds the submesh data.
* @param world - The world matrix.
* @param mesh - The BJS mesh.
* @param subMesh - A submesh of the BJS mesh.
*/
bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
/**
* Returns the animatable textures.
* If material have animatable metallic texture, then reflectivity texture will not be returned, even if it has animations.
* @returns - Array of animatable textures.
*/
getAnimatables(): IAnimatable[];
/**
* Returns the texture used for reflections.
* @returns - Reflection texture if present. Otherwise, returns the environment texture.
*/
private _getReflectionTexture;
/**
* Returns an array of the actively used textures.
* @returns - Array of BaseTextures
*/
getActiveTextures(): BaseTexture[];
/**
* Checks to see if a texture is used in the material.
* @param texture - Base texture to use.
* @returns - Boolean specifying if a texture is used in the material.
*/
hasTexture(texture: BaseTexture): boolean;
/**
* Sets the required values to the prepass renderer.
* It can't be sets when subsurface scattering of this material is disabled.
* When scene have ability to enable subsurface prepass effect, it will enable.
* @returns - If prepass is enabled or not.
*/
setPrePassRenderer(): boolean;
/**
* Disposes the resources of the material.
* @param forceDisposeEffect - Forces the disposal of effects.
* @param forceDisposeTextures - Forces the disposal of all textures.
*/
dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void;
}