UNPKG

@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.

708 lines 109 kB
/** This file must only contain pure code and pure imports */ import { __classPrivateFieldGet, __classPrivateFieldSet, __esDecorate, __runInitializers } from "../../tslib.es6.js"; import { serialize, serializeAsColor3, expandToProperty, serializeAsTexture } from "../../Misc/decorators.js"; import { GetEnvironmentBRDFTexture } from "../../Misc/brdfTextureTools.js"; import { Color3 } from "../../Maths/math.color.pure.js"; import { PBRBaseMaterial } from "./pbrBaseMaterial.pure.js"; import { RegisterImageProcessingConfiguration } from "../imageProcessingConfiguration.pure.js"; import { Material } from "../material.pure.js"; import { SerializationHelper } from "../../Misc/decorators.serialization.js"; import { RegisterClass } from "../../Misc/typeStore.js"; /** * The Physically based material 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 */ let PBRMaterial = (() => { var _a, _PBRMaterial_directIntensity_accessor_storage, _PBRMaterial_emissiveIntensity_accessor_storage, _PBRMaterial_environmentIntensity_accessor_storage, _PBRMaterial_specularIntensity_accessor_storage, _PBRMaterial_disableBumpMap_accessor_storage, _PBRMaterial_albedoTexture_accessor_storage, _PBRMaterial_baseWeightTexture_accessor_storage, _PBRMaterial_baseDiffuseRoughnessTexture_accessor_storage, _PBRMaterial_ambientTexture_accessor_storage, _PBRMaterial_ambientTextureStrength_accessor_storage, _PBRMaterial_ambientTextureImpactOnAnalyticalLights_accessor_storage, _PBRMaterial_opacityTexture_accessor_storage, _PBRMaterial_reflectionTexture_accessor_storage, _PBRMaterial_emissiveTexture_accessor_storage, _PBRMaterial_reflectivityTexture_accessor_storage, _PBRMaterial_metallicTexture_accessor_storage, _PBRMaterial_metallic_accessor_storage, _PBRMaterial_roughness_accessor_storage, _PBRMaterial_metallicF0Factor_accessor_storage, _PBRMaterial_metallicReflectanceColor_accessor_storage, _PBRMaterial_useOnlyMetallicFromMetallicReflectanceTexture_accessor_storage, _PBRMaterial_metallicReflectanceTexture_accessor_storage, _PBRMaterial_reflectanceTexture_accessor_storage, _PBRMaterial_microSurfaceTexture_accessor_storage, _PBRMaterial_bumpTexture_accessor_storage, _PBRMaterial_lightmapTexture_accessor_storage, _PBRMaterial_ambientColor_accessor_storage, _PBRMaterial_albedoColor_accessor_storage, _PBRMaterial_baseWeight_accessor_storage, _PBRMaterial_baseDiffuseRoughness_accessor_storage, _PBRMaterial_reflectivityColor_accessor_storage, _PBRMaterial_reflectionColor_accessor_storage, _PBRMaterial_emissiveColor_accessor_storage, _PBRMaterial_microSurface_accessor_storage, _PBRMaterial_useLightmapAsShadowmap_accessor_storage, _PBRMaterial_useAlphaFromAlbedoTexture_accessor_storage, _PBRMaterial_forceAlphaTest_accessor_storage, _PBRMaterial_alphaCutOff_accessor_storage, _PBRMaterial_useSpecularOverAlpha_accessor_storage, _PBRMaterial_useMicroSurfaceFromReflectivityMapAlpha_accessor_storage, _PBRMaterial_useRoughnessFromMetallicTextureAlpha_accessor_storage, _PBRMaterial_useRoughnessFromMetallicTextureGreen_accessor_storage, _PBRMaterial_useMetallnessFromMetallicTextureBlue_accessor_storage, _PBRMaterial_useAmbientOcclusionFromMetallicTextureRed_accessor_storage, _PBRMaterial_useAmbientInGrayScale_accessor_storage, _PBRMaterial_useAutoMicroSurfaceFromReflectivityMap_accessor_storage, _PBRMaterial_useRadianceOverAlpha_accessor_storage, _PBRMaterial_useObjectSpaceNormalMap_accessor_storage, _PBRMaterial_useParallax_accessor_storage, _PBRMaterial_useParallaxOcclusion_accessor_storage, _PBRMaterial_parallaxScaleBias_accessor_storage, _PBRMaterial_disableLighting_accessor_storage, _PBRMaterial_forceIrradianceInFragment_accessor_storage, _PBRMaterial_maxSimultaneousLights_accessor_storage, _PBRMaterial_invertNormalMapX_accessor_storage, _PBRMaterial_invertNormalMapY_accessor_storage, _PBRMaterial_twoSidedLighting_accessor_storage, _PBRMaterial_useAlphaFresnel_accessor_storage, _PBRMaterial_useLinearAlphaFresnel_accessor_storage, _PBRMaterial_environmentBRDFTexture_accessor_storage, _PBRMaterial_forceNormalForward_accessor_storage, _PBRMaterial_enableSpecularAntiAliasing_accessor_storage, _PBRMaterial_useHorizonOcclusion_accessor_storage, _PBRMaterial_useRadianceOcclusion_accessor_storage, _PBRMaterial_unlit_accessor_storage, _PBRMaterial_applyDecalMapAfterDetailMap_accessor_storage; let _classSuper = PBRBaseMaterial; let _instanceExtraInitializers = []; let _directIntensity_decorators; let _directIntensity_initializers = []; let _directIntensity_extraInitializers = []; let _emissiveIntensity_decorators; let _emissiveIntensity_initializers = []; let _emissiveIntensity_extraInitializers = []; let _environmentIntensity_decorators; let _environmentIntensity_initializers = []; let _environmentIntensity_extraInitializers = []; let _specularIntensity_decorators; let _specularIntensity_initializers = []; let _specularIntensity_extraInitializers = []; let _disableBumpMap_decorators; let _disableBumpMap_initializers = []; let _disableBumpMap_extraInitializers = []; let _albedoTexture_decorators; let _albedoTexture_initializers = []; let _albedoTexture_extraInitializers = []; let _baseWeightTexture_decorators; let _baseWeightTexture_initializers = []; let _baseWeightTexture_extraInitializers = []; let _baseDiffuseRoughnessTexture_decorators; let _baseDiffuseRoughnessTexture_initializers = []; let _baseDiffuseRoughnessTexture_extraInitializers = []; let _ambientTexture_decorators; let _ambientTexture_initializers = []; let _ambientTexture_extraInitializers = []; let _ambientTextureStrength_decorators; let _ambientTextureStrength_initializers = []; let _ambientTextureStrength_extraInitializers = []; let _ambientTextureImpactOnAnalyticalLights_decorators; let _ambientTextureImpactOnAnalyticalLights_initializers = []; let _ambientTextureImpactOnAnalyticalLights_extraInitializers = []; let _opacityTexture_decorators; let _opacityTexture_initializers = []; let _opacityTexture_extraInitializers = []; let _reflectionTexture_decorators; let _reflectionTexture_initializers = []; let _reflectionTexture_extraInitializers = []; let _emissiveTexture_decorators; let _emissiveTexture_initializers = []; let _emissiveTexture_extraInitializers = []; let _reflectivityTexture_decorators; let _reflectivityTexture_initializers = []; let _reflectivityTexture_extraInitializers = []; let _metallicTexture_decorators; let _metallicTexture_initializers = []; let _metallicTexture_extraInitializers = []; let _metallic_decorators; let _metallic_initializers = []; let _metallic_extraInitializers = []; let _roughness_decorators; let _roughness_initializers = []; let _roughness_extraInitializers = []; let _metallicF0Factor_decorators; let _metallicF0Factor_initializers = []; let _metallicF0Factor_extraInitializers = []; let _metallicReflectanceColor_decorators; let _metallicReflectanceColor_initializers = []; let _metallicReflectanceColor_extraInitializers = []; let _useOnlyMetallicFromMetallicReflectanceTexture_decorators; let _useOnlyMetallicFromMetallicReflectanceTexture_initializers = []; let _useOnlyMetallicFromMetallicReflectanceTexture_extraInitializers = []; let _metallicReflectanceTexture_decorators; let _metallicReflectanceTexture_initializers = []; let _metallicReflectanceTexture_extraInitializers = []; let _reflectanceTexture_decorators; let _reflectanceTexture_initializers = []; let _reflectanceTexture_extraInitializers = []; let _microSurfaceTexture_decorators; let _microSurfaceTexture_initializers = []; let _microSurfaceTexture_extraInitializers = []; let _bumpTexture_decorators; let _bumpTexture_initializers = []; let _bumpTexture_extraInitializers = []; let _lightmapTexture_decorators; let _lightmapTexture_initializers = []; let _lightmapTexture_extraInitializers = []; let _ambientColor_decorators; let _ambientColor_initializers = []; let _ambientColor_extraInitializers = []; let _albedoColor_decorators; let _albedoColor_initializers = []; let _albedoColor_extraInitializers = []; let _baseWeight_decorators; let _baseWeight_initializers = []; let _baseWeight_extraInitializers = []; let _baseDiffuseRoughness_decorators; let _baseDiffuseRoughness_initializers = []; let _baseDiffuseRoughness_extraInitializers = []; let _reflectivityColor_decorators; let _reflectivityColor_initializers = []; let _reflectivityColor_extraInitializers = []; let _reflectionColor_decorators; let _reflectionColor_initializers = []; let _reflectionColor_extraInitializers = []; let _emissiveColor_decorators; let _emissiveColor_initializers = []; let _emissiveColor_extraInitializers = []; let _microSurface_decorators; let _microSurface_initializers = []; let _microSurface_extraInitializers = []; let _useLightmapAsShadowmap_decorators; let _useLightmapAsShadowmap_initializers = []; let _useLightmapAsShadowmap_extraInitializers = []; let _useAlphaFromAlbedoTexture_decorators; let _useAlphaFromAlbedoTexture_initializers = []; let _useAlphaFromAlbedoTexture_extraInitializers = []; let _forceAlphaTest_decorators; let _forceAlphaTest_initializers = []; let _forceAlphaTest_extraInitializers = []; let _alphaCutOff_decorators; let _alphaCutOff_initializers = []; let _alphaCutOff_extraInitializers = []; let _useSpecularOverAlpha_decorators; let _useSpecularOverAlpha_initializers = []; let _useSpecularOverAlpha_extraInitializers = []; let _useMicroSurfaceFromReflectivityMapAlpha_decorators; let _useMicroSurfaceFromReflectivityMapAlpha_initializers = []; let _useMicroSurfaceFromReflectivityMapAlpha_extraInitializers = []; let _useRoughnessFromMetallicTextureAlpha_decorators; let _useRoughnessFromMetallicTextureAlpha_initializers = []; let _useRoughnessFromMetallicTextureAlpha_extraInitializers = []; let _useRoughnessFromMetallicTextureGreen_decorators; let _useRoughnessFromMetallicTextureGreen_initializers = []; let _useRoughnessFromMetallicTextureGreen_extraInitializers = []; let _useMetallnessFromMetallicTextureBlue_decorators; let _useMetallnessFromMetallicTextureBlue_initializers = []; let _useMetallnessFromMetallicTextureBlue_extraInitializers = []; let _useAmbientOcclusionFromMetallicTextureRed_decorators; let _useAmbientOcclusionFromMetallicTextureRed_initializers = []; let _useAmbientOcclusionFromMetallicTextureRed_extraInitializers = []; let _useAmbientInGrayScale_decorators; let _useAmbientInGrayScale_initializers = []; let _useAmbientInGrayScale_extraInitializers = []; let _useAutoMicroSurfaceFromReflectivityMap_decorators; let _useAutoMicroSurfaceFromReflectivityMap_initializers = []; let _useAutoMicroSurfaceFromReflectivityMap_extraInitializers = []; let _get_usePhysicalLightFalloff_decorators; let _get_useGLTFLightFalloff_decorators; let _useRadianceOverAlpha_decorators; let _useRadianceOverAlpha_initializers = []; let _useRadianceOverAlpha_extraInitializers = []; let _useObjectSpaceNormalMap_decorators; let _useObjectSpaceNormalMap_initializers = []; let _useObjectSpaceNormalMap_extraInitializers = []; let _useParallax_decorators; let _useParallax_initializers = []; let _useParallax_extraInitializers = []; let _useParallaxOcclusion_decorators; let _useParallaxOcclusion_initializers = []; let _useParallaxOcclusion_extraInitializers = []; let _parallaxScaleBias_decorators; let _parallaxScaleBias_initializers = []; let _parallaxScaleBias_extraInitializers = []; let _disableLighting_decorators; let _disableLighting_initializers = []; let _disableLighting_extraInitializers = []; let _forceIrradianceInFragment_decorators; let _forceIrradianceInFragment_initializers = []; let _forceIrradianceInFragment_extraInitializers = []; let _maxSimultaneousLights_decorators; let _maxSimultaneousLights_initializers = []; let _maxSimultaneousLights_extraInitializers = []; let _invertNormalMapX_decorators; let _invertNormalMapX_initializers = []; let _invertNormalMapX_extraInitializers = []; let _invertNormalMapY_decorators; let _invertNormalMapY_initializers = []; let _invertNormalMapY_extraInitializers = []; let _twoSidedLighting_decorators; let _twoSidedLighting_initializers = []; let _twoSidedLighting_extraInitializers = []; let _useAlphaFresnel_decorators; let _useAlphaFresnel_initializers = []; let _useAlphaFresnel_extraInitializers = []; let _useLinearAlphaFresnel_decorators; let _useLinearAlphaFresnel_initializers = []; let _useLinearAlphaFresnel_extraInitializers = []; let _environmentBRDFTexture_decorators; let _environmentBRDFTexture_initializers = []; let _environmentBRDFTexture_extraInitializers = []; let _forceNormalForward_decorators; let _forceNormalForward_initializers = []; let _forceNormalForward_extraInitializers = []; let _enableSpecularAntiAliasing_decorators; let _enableSpecularAntiAliasing_initializers = []; let _enableSpecularAntiAliasing_extraInitializers = []; let _useHorizonOcclusion_decorators; let _useHorizonOcclusion_initializers = []; let _useHorizonOcclusion_extraInitializers = []; let _useRadianceOcclusion_decorators; let _useRadianceOcclusion_initializers = []; let _useRadianceOcclusion_extraInitializers = []; let _unlit_decorators; let _unlit_initializers = []; let _unlit_extraInitializers = []; let _applyDecalMapAfterDetailMap_decorators; let _applyDecalMapAfterDetailMap_initializers = []; let _applyDecalMapAfterDetailMap_extraInitializers = []; return _a = class PBRMaterial extends _classSuper { /** * Intensity of the direct lights e.g. the four lights available in your scene. * This impacts both the direct diffuse and specular highlights. */ get directIntensity() { return __classPrivateFieldGet(this, _PBRMaterial_directIntensity_accessor_storage, "f"); } set directIntensity(value) { __classPrivateFieldSet(this, _PBRMaterial_directIntensity_accessor_storage, value, "f"); } /** * Intensity of the emissive part of the material. * This helps controlling the emissive effect without modifying the emissive color. */ get emissiveIntensity() { return __classPrivateFieldGet(this, _PBRMaterial_emissiveIntensity_accessor_storage, "f"); } set emissiveIntensity(value) { __classPrivateFieldSet(this, _PBRMaterial_emissiveIntensity_accessor_storage, value, "f"); } /** * 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. */ get environmentIntensity() { return __classPrivateFieldGet(this, _PBRMaterial_environmentIntensity_accessor_storage, "f"); } set environmentIntensity(value) { __classPrivateFieldSet(this, _PBRMaterial_environmentIntensity_accessor_storage, value, "f"); } /** * 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. */ get specularIntensity() { return __classPrivateFieldGet(this, _PBRMaterial_specularIntensity_accessor_storage, "f"); } set specularIntensity(value) { __classPrivateFieldSet(this, _PBRMaterial_specularIntensity_accessor_storage, value, "f"); } /** * Debug Control allowing disabling the bump map on this material. */ get disableBumpMap() { return __classPrivateFieldGet(this, _PBRMaterial_disableBumpMap_accessor_storage, "f"); } set disableBumpMap(value) { __classPrivateFieldSet(this, _PBRMaterial_disableBumpMap_accessor_storage, value, "f"); } /** * AKA Diffuse Texture in standard nomenclature. */ get albedoTexture() { return __classPrivateFieldGet(this, _PBRMaterial_albedoTexture_accessor_storage, "f"); } set albedoTexture(value) { __classPrivateFieldSet(this, _PBRMaterial_albedoTexture_accessor_storage, value, "f"); } /** * OpenPBR Base Weight texture (multiplier to the diffuse and metal lobes). */ get baseWeightTexture() { return __classPrivateFieldGet(this, _PBRMaterial_baseWeightTexture_accessor_storage, "f"); } set baseWeightTexture(value) { __classPrivateFieldSet(this, _PBRMaterial_baseWeightTexture_accessor_storage, value, "f"); } /** * OpenPBR Base Diffuse Roughness texture (roughness of the diffuse lobe). */ get baseDiffuseRoughnessTexture() { return __classPrivateFieldGet(this, _PBRMaterial_baseDiffuseRoughnessTexture_accessor_storage, "f"); } set baseDiffuseRoughnessTexture(value) { __classPrivateFieldSet(this, _PBRMaterial_baseDiffuseRoughnessTexture_accessor_storage, value, "f"); } /** * AKA Occlusion Texture in other nomenclature. */ get ambientTexture() { return __classPrivateFieldGet(this, _PBRMaterial_ambientTexture_accessor_storage, "f"); } set ambientTexture(value) { __classPrivateFieldSet(this, _PBRMaterial_ambientTexture_accessor_storage, value, "f"); } /** * AKA Occlusion Texture Intensity in other nomenclature. */ get ambientTextureStrength() { return __classPrivateFieldGet(this, _PBRMaterial_ambientTextureStrength_accessor_storage, "f"); } set ambientTextureStrength(value) { __classPrivateFieldSet(this, _PBRMaterial_ambientTextureStrength_accessor_storage, value, "f"); } /** * 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 */ get ambientTextureImpactOnAnalyticalLights() { return __classPrivateFieldGet(this, _PBRMaterial_ambientTextureImpactOnAnalyticalLights_accessor_storage, "f"); } set ambientTextureImpactOnAnalyticalLights(value) { __classPrivateFieldSet(this, _PBRMaterial_ambientTextureImpactOnAnalyticalLights_accessor_storage, value, "f"); } /** * Stores the alpha values in a texture. Use luminance if texture.getAlphaFromRGB is true. */ get opacityTexture() { return __classPrivateFieldGet(this, _PBRMaterial_opacityTexture_accessor_storage, "f"); } set opacityTexture(value) { __classPrivateFieldSet(this, _PBRMaterial_opacityTexture_accessor_storage, value, "f"); } /** * Stores the reflection values in a texture. */ get reflectionTexture() { return __classPrivateFieldGet(this, _PBRMaterial_reflectionTexture_accessor_storage, "f"); } set reflectionTexture(value) { __classPrivateFieldSet(this, _PBRMaterial_reflectionTexture_accessor_storage, value, "f"); } /** * Stores the emissive values in a texture. */ get emissiveTexture() { return __classPrivateFieldGet(this, _PBRMaterial_emissiveTexture_accessor_storage, "f"); } set emissiveTexture(value) { __classPrivateFieldSet(this, _PBRMaterial_emissiveTexture_accessor_storage, value, "f"); } /** * AKA Specular texture in other nomenclature. */ get reflectivityTexture() { return __classPrivateFieldGet(this, _PBRMaterial_reflectivityTexture_accessor_storage, "f"); } set reflectivityTexture(value) { __classPrivateFieldSet(this, _PBRMaterial_reflectivityTexture_accessor_storage, value, "f"); } /** * Used to switch from specular/glossiness to metallic/roughness workflow. */ get metallicTexture() { return __classPrivateFieldGet(this, _PBRMaterial_metallicTexture_accessor_storage, "f"); } set metallicTexture(value) { __classPrivateFieldSet(this, _PBRMaterial_metallicTexture_accessor_storage, value, "f"); } /** * Specifies the metallic scalar of the metallic/roughness workflow. * Can also be used to scale the metalness values of the metallic texture. */ get metallic() { return __classPrivateFieldGet(this, _PBRMaterial_metallic_accessor_storage, "f"); } set metallic(value) { __classPrivateFieldSet(this, _PBRMaterial_metallic_accessor_storage, value, "f"); } /** * Specifies the roughness scalar of the metallic/roughness workflow. * Can also be used to scale the roughness values of the metallic texture. */ get roughness() { return __classPrivateFieldGet(this, _PBRMaterial_roughness_accessor_storage, "f"); } set roughness(value) { __classPrivateFieldSet(this, _PBRMaterial_roughness_accessor_storage, value, "f"); } /** * 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; */ get metallicF0Factor() { return __classPrivateFieldGet(this, _PBRMaterial_metallicF0Factor_accessor_storage, "f"); } set metallicF0Factor(value) { __classPrivateFieldSet(this, _PBRMaterial_metallicF0Factor_accessor_storage, value, "f"); } /** * 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; */ get metallicReflectanceColor() { return __classPrivateFieldGet(this, _PBRMaterial_metallicReflectanceColor_accessor_storage, "f"); } set metallicReflectanceColor(value) { __classPrivateFieldSet(this, _PBRMaterial_metallicReflectanceColor_accessor_storage, value, "f"); } /** * Specifies that only the A channel from metallicReflectanceTexture should be used. * If false, both RGB and A channels will be used */ get useOnlyMetallicFromMetallicReflectanceTexture() { return __classPrivateFieldGet(this, _PBRMaterial_useOnlyMetallicFromMetallicReflectanceTexture_accessor_storage, "f"); } set useOnlyMetallicFromMetallicReflectanceTexture(value) { __classPrivateFieldSet(this, _PBRMaterial_useOnlyMetallicFromMetallicReflectanceTexture_accessor_storage, value, "f"); } /** * Defines to store metallicReflectanceColor in RGB and metallicF0Factor in A * This is multiplied against the scalar values defined in the material. * If useOnlyMetallicFromMetallicReflectanceTexture is true, don't use the RGB channels, only A */ get metallicReflectanceTexture() { return __classPrivateFieldGet(this, _PBRMaterial_metallicReflectanceTexture_accessor_storage, "f"); } set metallicReflectanceTexture(value) { __classPrivateFieldSet(this, _PBRMaterial_metallicReflectanceTexture_accessor_storage, value, "f"); } /** * 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 priority and reflectanceTexture is not used */ get reflectanceTexture() { return __classPrivateFieldGet(this, _PBRMaterial_reflectanceTexture_accessor_storage, "f"); } set reflectanceTexture(value) { __classPrivateFieldSet(this, _PBRMaterial_reflectanceTexture_accessor_storage, value, "f"); } /** * 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. */ get microSurfaceTexture() { return __classPrivateFieldGet(this, _PBRMaterial_microSurfaceTexture_accessor_storage, "f"); } set microSurfaceTexture(value) { __classPrivateFieldSet(this, _PBRMaterial_microSurfaceTexture_accessor_storage, value, "f"); } /** * Stores surface normal data used to displace a mesh in a texture. */ get bumpTexture() { return __classPrivateFieldGet(this, _PBRMaterial_bumpTexture_accessor_storage, "f"); } set bumpTexture(value) { __classPrivateFieldSet(this, _PBRMaterial_bumpTexture_accessor_storage, value, "f"); } /** * Stores the pre-calculated light information of a mesh in a texture. */ get lightmapTexture() { return __classPrivateFieldGet(this, _PBRMaterial_lightmapTexture_accessor_storage, "f"); } set lightmapTexture(value) { __classPrivateFieldSet(this, _PBRMaterial_lightmapTexture_accessor_storage, value, "f"); } /** * Stores the refracted light information in a texture. */ get refractionTexture() { return this.subSurface.refractionTexture; } set refractionTexture(value) { this.subSurface.refractionTexture = value; if (value) { this.subSurface.isRefractionEnabled = true; } else if (!this.subSurface.linkRefractionWithTransparency) { this.subSurface.isRefractionEnabled = false; } } /** * The color of a material in ambient lighting. */ get ambientColor() { return __classPrivateFieldGet(this, _PBRMaterial_ambientColor_accessor_storage, "f"); } set ambientColor(value) { __classPrivateFieldSet(this, _PBRMaterial_ambientColor_accessor_storage, value, "f"); } /** * AKA Diffuse Color in other nomenclature. */ get albedoColor() { return __classPrivateFieldGet(this, _PBRMaterial_albedoColor_accessor_storage, "f"); } set albedoColor(value) { __classPrivateFieldSet(this, _PBRMaterial_albedoColor_accessor_storage, value, "f"); } /** * OpenPBR Base Weight (multiplier to the diffuse and metal lobes). */ get baseWeight() { return __classPrivateFieldGet(this, _PBRMaterial_baseWeight_accessor_storage, "f"); } set baseWeight(value) { __classPrivateFieldSet(this, _PBRMaterial_baseWeight_accessor_storage, value, "f"); } /** * OpenPBR Base Diffuse Roughness (roughness of the diffuse lobe). */ get baseDiffuseRoughness() { return __classPrivateFieldGet(this, _PBRMaterial_baseDiffuseRoughness_accessor_storage, "f"); } set baseDiffuseRoughness(value) { __classPrivateFieldSet(this, _PBRMaterial_baseDiffuseRoughness_accessor_storage, value, "f"); } /** * AKA Specular Color in other nomenclature. */ get reflectivityColor() { return __classPrivateFieldGet(this, _PBRMaterial_reflectivityColor_accessor_storage, "f"); } set reflectivityColor(value) { __classPrivateFieldSet(this, _PBRMaterial_reflectivityColor_accessor_storage, value, "f"); } /** * The color reflected from the material. */ get reflectionColor() { return __classPrivateFieldGet(this, _PBRMaterial_reflectionColor_accessor_storage, "f"); } set reflectionColor(value) { __classPrivateFieldSet(this, _PBRMaterial_reflectionColor_accessor_storage, value, "f"); } /** * The color emitted from the material. */ get emissiveColor() { return __classPrivateFieldGet(this, _PBRMaterial_emissiveColor_accessor_storage, "f"); } set emissiveColor(value) { __classPrivateFieldSet(this, _PBRMaterial_emissiveColor_accessor_storage, value, "f"); } /** * AKA Glossiness in other nomenclature. */ get microSurface() { return __classPrivateFieldGet(this, _PBRMaterial_microSurface_accessor_storage, "f"); } set microSurface(value) { __classPrivateFieldSet(this, _PBRMaterial_microSurface_accessor_storage, value, "f"); } /** * Index of refraction of the material base layer. * https://en.wikipedia.org/wiki/List_of_refractive_indices * * This does not only impact refraction but also the Base F0 of Dielectric Materials. * * From dielectric fresnel rules: F0 = square((iorT - iorI) / (iorT + iorI)) */ get indexOfRefraction() { return this.subSurface.indexOfRefraction; } set indexOfRefraction(value) { this.subSurface.indexOfRefraction = value; } /** * Controls if refraction needs to be inverted on Y. This could be useful for procedural texture. */ get invertRefractionY() { return this.subSurface.invertRefractionY; } set invertRefractionY(value) { this.subSurface.invertRefractionY = value; } /** * This parameters will make the material used its opacity to control how much it is refracting against not. * Materials half opaque for instance using refraction could benefit from this control. */ get linkRefractionWithTransparency() { return this.subSurface.linkRefractionWithTransparency; } set linkRefractionWithTransparency(value) { this.subSurface.linkRefractionWithTransparency = value; if (value) { this.subSurface.isRefractionEnabled = true; } } /** * If true, the light map contains occlusion information instead of lighting info. */ get useLightmapAsShadowmap() { return __classPrivateFieldGet(this, _PBRMaterial_useLightmapAsShadowmap_accessor_storage, "f"); } set useLightmapAsShadowmap(value) { __classPrivateFieldSet(this, _PBRMaterial_useLightmapAsShadowmap_accessor_storage, value, "f"); } /** * Specifies that the alpha is coming form the albedo channel alpha channel for alpha blending. */ get useAlphaFromAlbedoTexture() { return __classPrivateFieldGet(this, _PBRMaterial_useAlphaFromAlbedoTexture_accessor_storage, "f"); } set useAlphaFromAlbedoTexture(value) { __classPrivateFieldSet(this, _PBRMaterial_useAlphaFromAlbedoTexture_accessor_storage, value, "f"); } /** * Enforces alpha test in opaque or blend mode in order to improve the performances of some situations. */ get forceAlphaTest() { return __classPrivateFieldGet(this, _PBRMaterial_forceAlphaTest_accessor_storage, "f"); } set forceAlphaTest(value) { __classPrivateFieldSet(this, _PBRMaterial_forceAlphaTest_accessor_storage, value, "f"); } /** * Defines the alpha limits in alpha test mode. */ get alphaCutOff() { return __classPrivateFieldGet(this, _PBRMaterial_alphaCutOff_accessor_storage, "f"); } set alphaCutOff(value) { __classPrivateFieldSet(this, _PBRMaterial_alphaCutOff_accessor_storage, value, "f"); } /** * Specifies that the material will keep 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. */ get useSpecularOverAlpha() { return __classPrivateFieldGet(this, _PBRMaterial_useSpecularOverAlpha_accessor_storage, "f"); } set useSpecularOverAlpha(value) { __classPrivateFieldSet(this, _PBRMaterial_useSpecularOverAlpha_accessor_storage, value, "f"); } /** * Specifies if the reflectivity texture contains the glossiness information in its alpha channel. */ get useMicroSurfaceFromReflectivityMapAlpha() { return __classPrivateFieldGet(this, _PBRMaterial_useMicroSurfaceFromReflectivityMapAlpha_accessor_storage, "f"); } set useMicroSurfaceFromReflectivityMapAlpha(value) { __classPrivateFieldSet(this, _PBRMaterial_useMicroSurfaceFromReflectivityMapAlpha_accessor_storage, value, "f"); } /** * Specifies if the metallic texture contains the roughness information in its alpha channel. */ get useRoughnessFromMetallicTextureAlpha() { return __classPrivateFieldGet(this, _PBRMaterial_useRoughnessFromMetallicTextureAlpha_accessor_storage, "f"); } set useRoughnessFromMetallicTextureAlpha(value) { __classPrivateFieldSet(this, _PBRMaterial_useRoughnessFromMetallicTextureAlpha_accessor_storage, value, "f"); } /** * Specifies if the metallic texture contains the roughness information in its green channel. * Needs useRoughnessFromMetallicTextureAlpha to be false. */ get useRoughnessFromMetallicTextureGreen() { return __classPrivateFieldGet(this, _PBRMaterial_useRoughnessFromMetallicTextureGreen_accessor_storage, "f"); } set useRoughnessFromMetallicTextureGreen(value) { __classPrivateFieldSet(this, _PBRMaterial_useRoughnessFromMetallicTextureGreen_accessor_storage, value, "f"); } /** * Specifies if the metallic texture contains the metallness information in its blue channel. */ get useMetallnessFromMetallicTextureBlue() { return __classPrivateFieldGet(this, _PBRMaterial_useMetallnessFromMetallicTextureBlue_accessor_storage, "f"); } set useMetallnessFromMetallicTextureBlue(value) { __classPrivateFieldSet(this, _PBRMaterial_useMetallnessFromMetallicTextureBlue_accessor_storage, value, "f"); } /** * Specifies if the metallic texture contains the ambient occlusion information in its red channel. */ get useAmbientOcclusionFromMetallicTextureRed() { return __classPrivateFieldGet(this, _PBRMaterial_useAmbientOcclusionFromMetallicTextureRed_accessor_storage, "f"); } set useAmbientOcclusionFromMetallicTextureRed(value) { __classPrivateFieldSet(this, _PBRMaterial_useAmbientOcclusionFromMetallicTextureRed_accessor_storage, value, "f"); } /** * Specifies if the ambient texture contains the ambient occlusion information in its red channel only. */ get useAmbientInGrayScale() { return __classPrivateFieldGet(this, _PBRMaterial_useAmbientInGrayScale_accessor_storage, "f"); } set useAmbientInGrayScale(value) { __classPrivateFieldSet(this, _PBRMaterial_useAmbientInGrayScale_accessor_storage, value, "f"); } /** * 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. */ get useAutoMicroSurfaceFromReflectivityMap() { return __classPrivateFieldGet(this, _PBRMaterial_useAutoMicroSurfaceFromReflectivityMap_accessor_storage, "f"); } set useAutoMicroSurfaceFromReflectivityMap(value) { __classPrivateFieldSet(this, _PBRMaterial_useAutoMicroSurfaceFromReflectivityMap_accessor_storage, value, "f"); } /** * BJS is using an hardcoded light falloff based on a manually sets up range. * In PBR, one way to represents the falloff is to use the inverse squared root algorithm. * This parameter can help you switch back to the BJS mode in order to create scenes using both materials. */ get usePhysicalLightFalloff() { return this._lightFalloff === PBRBaseMaterial.LIGHTFALLOFF_PHYSICAL; } /** * BJS is using an hardcoded light falloff based on a manually sets up range. * In PBR, one way to represents the falloff is to use the inverse squared root algorithm. * This parameter can help you switch back to the BJS mode in order to create scenes using both materials. */ set usePhysicalLightFalloff(value) { if (value !== this.usePhysicalLightFalloff) { // Ensure the effect will be rebuilt. this._markAllSubMeshesAsTexturesDirty(); if (value) { this._lightFalloff = PBRBaseMaterial.LIGHTFALLOFF_PHYSICAL; } else { this._lightFalloff = PBRBaseMaterial.LIGHTFALLOFF_STANDARD; } } } /** * In order to support the falloff compatibility with gltf, a special mode has been added * to reproduce the gltf light falloff. */ get useGLTFLightFalloff() { return this._lightFalloff === PBRBaseMaterial.LIGHTFALLOFF_GLTF; } /** * In order to support the falloff compatibility with gltf, a special mode has been added * to reproduce the gltf light falloff. */ set useGLTFLightFalloff(value) { if (value !== this.useGLTFLightFalloff) { // Ensure the effect will be rebuilt. this._markAllSubMeshesAsTexturesDirty(); if (value) { this._lightFalloff = PBRBaseMaterial.LIGHTFALLOFF_GLTF; } else { this._lightFalloff = PBRBaseMaterial.LIGHTFALLOFF_STANDARD; } } } /** * 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. */ get useRadianceOverAlpha() { return __classPrivateFieldGet(this, _PBRMaterial_useRadianceOverAlpha_accessor_storage, "f"); } set useRadianceOverAlpha(value) { __classPrivateFieldSet(this, _PBRMaterial_useRadianceOverAlpha_accessor_storage, value, "f"); } /** * Allows using an object space normal map (instead of tangent space). */ get useObjectSpaceNormalMap() { return __classPrivateFieldGet(this, _PBRMaterial_useObjectSpaceNormalMap_accessor_storage, "f"); } set useObjectSpaceNormalMap(value) { __classPrivateFieldSet(this, _PBRMaterial_useObjectSpaceNormalMap_accessor_storage, value, "f"); } /** * Allows using the bump map in parallax mode. */ get useParallax() { return __classPrivateFieldGet(this, _PBRMaterial_useParallax_accessor_storage, "f"); } set useParallax(value) { __classPrivateFieldSet(this, _PBRMaterial_useParallax_accessor_storage, value, "f"); } /** * Allows using the bump map in parallax occlusion mode. */ get useParallaxOcclusion() { return __classPrivateFieldGet(this, _PBRMaterial_useParallaxOcclusion_accessor_storage, "f"); } set useParallaxOcclusion(value) { __classPrivateFieldSet(this, _PBRMaterial_useParallaxOcclusion_accessor_storage, value, "f"); } /** * Controls the scale bias of the parallax mode. */ get parallaxScaleBias() { return __classPrivateFieldGet(this, _PBRMaterial_parallaxScaleBias_accessor_storage, "f"); } set parallaxScaleBias(value) { __classPrivateFieldSet(this, _PBRMaterial_parallaxScaleBias_accessor_storage, value, "f"); } /** * If sets to true, disables all the lights affecting the material. */ get disableLighting() { return __classPrivateFieldGet(this, _PBRMaterial_disableLighting_accessor_storage, "f"); } set disableLighting(value) { __classPrivateFieldSet(this, _PBRMaterial_disableLighting_accessor_storage, value, "f"); } /** * Force the shader to compute irradiance in the fragment shader in order to take bump in account. */ get forceIrradianceInFragment() { return __classPrivateFieldGet(this, _PBRMaterial_forceIrradianceInFragment_accessor_storage, "f"); } set forceIrradianceInFragment(value) { __classPrivateFieldSet(this, _PBRMaterial_forceIrradianceInFragment_accessor_storage, value, "f"); } /** * Number of Simultaneous lights allowed on the material. */ get maxSimultaneousLights() { return __classPrivateFieldGet(this, _PBRMaterial_maxSimultaneousLights_accessor_storage, "f"); } set maxSimultaneousLights(value) { __classPrivateFieldSet(this, _PBRMaterial_maxSimultaneousLights_accessor_storage, value, "f"); } /** * If sets to true, x component of normal map value will invert (x = 1.0 - x). */ get invertNormalMapX() { return __classPrivateFieldGet(this, _PBRMaterial_invertNormalMapX_accessor_storage, "f"); } set invertNormalMapX(value) { __classPrivateFieldSet(this, _PBRMaterial_invertNormalMapX_accessor_storage, value, "f"); } /** * If sets to true, y component of normal map value will invert (y = 1.0 - y). */ get invertNormalMapY() { return __classPrivateFieldGet(this, _PBRMaterial_invertNormalMapY_accessor_storage, "f"); } set invertNormalMapY(value) { __classPrivateFieldSet(this, _PBRMaterial_invertNormalMapY_accessor_storage, value, "f"); } /** * If sets to true and backfaceCulling is false, normals will be flipped on the backside. */ get twoSidedLighting() { return __classPrivateFieldGet(this, _PBRMaterial_twoSidedLighting_accessor_storage, "f"); } set twoSidedLighting(value) { __classPrivateFieldSet(this, _PBRMaterial_twoSidedLighting_accessor_storage, value, "f"); } /** * 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) */ get useAlphaFresnel() { return __classPrivateFieldGet(this, _PBRMaterial_useAlphaFresnel_accessor_storage, "f"); } set useAlphaFresnel(value) { __classPrivateFieldSet(this, _PBRMaterial_useAlphaFresnel_accessor_storage, value, "f"); } /** * 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) */ get useLinearAlphaFresnel() { return __classPrivateFieldGet(this, _PBRMaterial_useLinearAlphaFresnel_accessor_storage, "f"); } set useLinearAlphaFresnel(value) { __classPrivateFieldSet(this, _PBRMaterial_useLinearAlphaFresnel_accessor_storage, value, "f"); } /** * Let user defines the brdf lookup texture used for IBL. * A default 8bit version is embedded but you could point at : * * Default texture: https://assets.babylonjs.com/environments/correlatedMSBRDF_RGBD.png * * Default 16bit pixel depth texture: https://assets.babylonjs.com/environments/correlatedMSBRDF.dds * * LEGACY Default None correlated https://assets.babylonjs.com/environments/uncorrelatedBRDF_RGBD.png * * LEGACY Default None correlated 16bit pixel depth https://assets.babylonjs.com/environments/uncorrelatedBRDF.dds */ get environmentBRDFTexture() { return __classPrivateFieldGet(this, _PBRMaterial_environmentBRDFTexture_accessor_storage, "f"); } set environmentBRDFTexture(value) { __classPrivateFieldSet(this, _PBRMaterial_environmentBRDFTexture_accessor_storage, value, "f"); } /** * Force normal to face away from face. */ get forceNormalForward() { return __classPrivateFieldGet(this, _PBRMaterial_forceNormalForward_accessor_storage, "f"); } set forceNormalForward(value) { __classPrivateFieldSet(this, _PBRMaterial_forceNormalForward_accessor_storage, value, "f"); } /** * 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. */ get enableSpecularAntiAliasing() { return __classPrivateFieldGet(this, _PBRMaterial_enableSpecularAntiAliasing_accessor_storage, "f"); } set enableSpecularAntiAliasing(value) { __classPrivateFieldSet(this, _PBRMaterial_enableSpecularAntiAliasing_accessor_storage, value, "f"); } /** * 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). */ get useHorizonOcclusion() { return __classPrivateFieldGet(this, _PBRMaterial_useHorizonOcclusion_accessor_storage, "f"); } set useHorizonOcclusion(value) { __classPrivateFieldSet(this, _PBRMaterial_useHorizonOcclusion_accessor_storage, value, "f"); } /** * 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. */ get useRadianceOcclusion() { return __classPrivateFieldGet(this, _PBRMaterial_useRadianceOcclusion_accessor_storage, "f"); } set useRadianceOcclusion(value) { __classPrivateFieldSet(this, _PBRMaterial_useRadianceOcclusion_accessor_storage, value, "f"); } /** * If set to true, no lighting calculations will be applied. */ get unlit() { return __classPrivateFieldGet(this, _PBRMaterial_unlit_accessor_storage, "f"); } set unlit(value) { __classPrivateFieldSet(this, _PBRMaterial_unlit_accessor_storage, value, "f"); } /** * If sets to true, the decal map will be applied after the detail map. Else, it is applied before (default: false) */ get applyDecalMapAfterDetailMap() { return __classPrivateFieldGet(this, _PBRMaterial_applyDecalMapAfterDetailMap_accessor_storage, "f"); } set applyDecalMapAfterDetailMap(value) { __classPrivateFieldSet(this, _PBRMaterial_applyDecalMapAfterDetailMap_accessor_storage, value, "f"); } /** * 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, scene, forceGLSL = false) { super(name, scene, forceGLSL); _PBRMaterial_directIntensity_accessor_storage.set(this, (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _directIntensity_initializers, 1.0))); _PBRMaterial_emissiveIntensity_accessor_storage.set(this, (__runInitializers(this, _directIntensity_extraInitializers), __runInitializers(this, _emissiveIntensity_initializers, 1.0))); _PBRMaterial_environmentIntensity_accessor_storage.set(this, (__runInitializers(this, _emissiveIntensity_extraInitializers), __runInitializers(this, _environmentIntensity_initializers, 1.0))); _PBRMaterial_specularIntensity_accessor_storage.set(this, (__runInitializers(this, _environmentIntensity_extraInitializers), __runInitializers(this, _specularIntensity_initializers, 1.0))); _PBRMaterial_disableBumpMap_accessor_storage.set(this, (__runInitializers(this, _specularIntensity_extraInitializers), __runInitializers(this, _disableBumpMap_initializers, false))); _PBRMaterial_albedoTexture_accessor_storage.set(this, (__runInitializers(this, _disableBumpMap_extraInitializers), __runIniti