123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484 |
- import type { Nullable } from "../../types";
- import type { Scene } from "../../scene";
- import { Color3 } from "../../Maths/math.color";
- import type { ImageProcessingConfiguration } from "../../Materials/imageProcessingConfiguration";
- import type { ColorCurves } from "../../Materials/colorCurves";
- import type { BaseTexture } from "../../Materials/Textures/baseTexture";
- import { PBRBaseMaterial } from "./pbrBaseMaterial";
- /**
- * 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
- */
- export declare class PBRMaterial extends PBRBaseMaterial {
- /**
- * 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;
- /**
- * Intensity of the direct lights e.g. the four lights available in your scene.
- * This impacts both the direct diffuse and specular highlights.
- */
- directIntensity: number;
- /**
- * Intensity of the emissive part of the material.
- * This helps controlling the emissive effect without modifying the emissive color.
- */
- 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.
- */
- 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.
- */
- specularIntensity: number;
- /**
- * Debug Control allowing disabling the bump map on this material.
- */
- disableBumpMap: boolean;
- /**
- * AKA Diffuse Texture in standard nomenclature.
- */
- albedoTexture: Nullable<BaseTexture>;
- /**
- * AKA Occlusion Texture in other nomenclature.
- */
- ambientTexture: Nullable<BaseTexture>;
- /**
- * AKA Occlusion Texture Intensity in other nomenclature.
- */
- 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
- */
- ambientTextureImpactOnAnalyticalLights: number;
- /**
- * Stores the alpha values in a texture. Use luminance if texture.getAlphaFromRGB is true.
- */
- opacityTexture: Nullable<BaseTexture>;
- /**
- * Stores the reflection values in a texture.
- */
- reflectionTexture: Nullable<BaseTexture>;
- /**
- * Stores the emissive values in a texture.
- */
- emissiveTexture: Nullable<BaseTexture>;
- /**
- * AKA Specular texture in other nomenclature.
- */
- reflectivityTexture: Nullable<BaseTexture>;
- /**
- * Used to switch from specular/glossiness to metallic/roughness workflow.
- */
- 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.
- */
- 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.
- */
- 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;
- */
- 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;
- */
- metallicReflectanceColor: Color3;
- /**
- * Specifies that only the A channel from metallicReflectanceTexture should be used.
- * If false, both RGB and A channels will be used
- */
- useOnlyMetallicFromMetallicReflectanceTexture: boolean;
- /**
- * 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
- */
- 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 priority and reflectanceTexture is not used
- */
- 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.
- */
- microSurfaceTexture: Nullable<BaseTexture>;
- /**
- * Stores surface normal data used to displace a mesh in a texture.
- */
- bumpTexture: Nullable<BaseTexture>;
- /**
- * Stores the pre-calculated light information of a mesh in a texture.
- */
- lightmapTexture: Nullable<BaseTexture>;
- /**
- * Stores the refracted light information in a texture.
- */
- get refractionTexture(): Nullable<BaseTexture>;
- set refractionTexture(value: Nullable<BaseTexture>);
- /**
- * The color of a material in ambient lighting.
- */
- ambientColor: Color3;
- /**
- * AKA Diffuse Color in other nomenclature.
- */
- albedoColor: Color3;
- /**
- * AKA Specular Color in other nomenclature.
- */
- reflectivityColor: Color3;
- /**
- * The color reflected from the material.
- */
- reflectionColor: Color3;
- /**
- * The color emitted from the material.
- */
- emissiveColor: Color3;
- /**
- * AKA Glossiness in other nomenclature.
- */
- microSurface: number;
- /**
- * 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(): number;
- set indexOfRefraction(value: number);
- /**
- * Controls if refraction needs to be inverted on Y. This could be useful for procedural texture.
- */
- get invertRefractionY(): boolean;
- set invertRefractionY(value: boolean);
- /**
- * 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(): boolean;
- set linkRefractionWithTransparency(value: boolean);
- /**
- * If true, the light map contains occlusion information instead of lighting info.
- */
- useLightmapAsShadowmap: boolean;
- /**
- * Specifies that the alpha is coming form the albedo channel alpha channel for alpha blending.
- */
- useAlphaFromAlbedoTexture: boolean;
- /**
- * Enforces alpha test in opaque or blend mode in order to improve the performances of some situations.
- */
- forceAlphaTest: boolean;
- /**
- * Defines the alpha limits in alpha test mode.
- */
- alphaCutOff: number;
- /**
- * 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.
- */
- useSpecularOverAlpha: boolean;
- /**
- * Specifies if the reflectivity texture contains the glossiness information in its alpha channel.
- */
- useMicroSurfaceFromReflectivityMapAlpha: boolean;
- /**
- * Specifies if the metallic texture contains the roughness information in its alpha channel.
- */
- useRoughnessFromMetallicTextureAlpha: boolean;
- /**
- * Specifies if the metallic texture contains the roughness information in its green channel.
- * Needs useRoughnessFromMetallicTextureAlpha to be false.
- */
- useRoughnessFromMetallicTextureGreen: boolean;
- /**
- * Specifies if the metallic texture contains the metallness information in its blue channel.
- */
- useMetallnessFromMetallicTextureBlue: boolean;
- /**
- * Specifies if the metallic texture contains the ambient occlusion information in its red channel.
- */
- useAmbientOcclusionFromMetallicTextureRed: boolean;
- /**
- * Specifies if the ambient texture contains the ambient occlusion information in its red channel only.
- */
- 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.
- */
- useAutoMicroSurfaceFromReflectivityMap: boolean;
- /**
- * 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(): boolean;
- /**
- * 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: boolean);
- /**
- * In order to support the falloff compatibility with gltf, a special mode has been added
- * to reproduce the gltf light falloff.
- */
- get useGLTFLightFalloff(): boolean;
- /**
- * In order to support the falloff compatibility with gltf, a special mode has been added
- * to reproduce the gltf light falloff.
- */
- set useGLTFLightFalloff(value: boolean);
- /**
- * 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.
- */
- useRadianceOverAlpha: boolean;
- /**
- * Allows using an object space normal map (instead of tangent space).
- */
- useObjectSpaceNormalMap: boolean;
- /**
- * Allows using the bump map in parallax mode.
- */
- useParallax: boolean;
- /**
- * Allows using the bump map in parallax occlusion mode.
- */
- useParallaxOcclusion: boolean;
- /**
- * Controls the scale bias of the parallax mode.
- */
- parallaxScaleBias: number;
- /**
- * If sets to true, disables all the lights affecting the material.
- */
- disableLighting: boolean;
- /**
- * Force the shader to compute irradiance in the fragment shader in order to take bump in account.
- */
- forceIrradianceInFragment: boolean;
- /**
- * Number of Simultaneous lights allowed on the material.
- */
- maxSimultaneousLights: number;
- /**
- * If sets to true, x component of normal map value will invert (x = 1.0 - x).
- */
- invertNormalMapX: boolean;
- /**
- * If sets to true, y component of normal map value will invert (y = 1.0 - y).
- */
- invertNormalMapY: boolean;
- /**
- * If sets to true and backfaceCulling is false, normals will be flipped on the backside.
- */
- twoSidedLighting: 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 is converted to gamma to compute the fresnel)
- */
- 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)
- */
- useLinearAlphaFresnel: boolean;
- /**
- * 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
- */
- environmentBRDFTexture: Nullable<BaseTexture>;
- /**
- * Force normal to face away from face.
- */
- 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.
- */
- enableSpecularAntiAliasing: 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).
- */
- 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.
- */
- useRadianceOcclusion: boolean;
- /**
- * If set to true, no lighting calculations will be applied.
- */
- unlit: boolean;
- /**
- * If sets to true, the decal map will be applied after the detail map. Else, it is applied before (default: false)
- */
- applyDecalMapAfterDetailMap: boolean;
- /**
- * Gets the image processing configuration used either in this material.
- */
- get imageProcessingConfiguration(): ImageProcessingConfiguration;
- /**
- * Sets the Default image processing configuration used either in the this material.
- *
- * If sets to null, the scene one is in use.
- */
- set imageProcessingConfiguration(value: ImageProcessingConfiguration);
- /**
- * Gets whether the color curves effect is enabled.
- */
- get cameraColorCurvesEnabled(): boolean;
- /**
- * Sets whether the color curves effect is enabled.
- */
- set cameraColorCurvesEnabled(value: boolean);
- /**
- * Gets whether the color grading effect is enabled.
- */
- get cameraColorGradingEnabled(): boolean;
- /**
- * Gets whether the color grading effect is enabled.
- */
- set cameraColorGradingEnabled(value: boolean);
- /**
- * Gets whether tonemapping is enabled or not.
- */
- get cameraToneMappingEnabled(): boolean;
- /**
- * Sets whether tonemapping is enabled or not
- */
- set cameraToneMappingEnabled(value: boolean);
- /**
- * The camera exposure used on this material.
- * This property is here and not in the camera to allow controlling exposure without full screen post process.
- * This corresponds to a photographic exposure.
- */
- get cameraExposure(): number;
- /**
- * The camera exposure used on this material.
- * This property is here and not in the camera to allow controlling exposure without full screen post process.
- * This corresponds to a photographic exposure.
- */
- set cameraExposure(value: number);
- /**
- * Gets The camera contrast used on this material.
- */
- get cameraContrast(): number;
- /**
- * Sets The camera contrast used on this material.
- */
- set cameraContrast(value: number);
- /**
- * Gets the Color Grading 2D Lookup Texture.
- */
- get cameraColorGradingTexture(): Nullable<BaseTexture>;
- /**
- * Sets the Color Grading 2D Lookup Texture.
- */
- set cameraColorGradingTexture(value: Nullable<BaseTexture>);
- /**
- * The color grading curves provide additional color adjustment that is applied after any color grading transform (3D LUT).
- * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
- * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;
- * corresponding to low luminance, medium luminance, and high luminance areas respectively.
- */
- get cameraColorCurves(): Nullable<ColorCurves>;
- /**
- * The color grading curves provide additional color adjustment that is applied after any color grading transform (3D LUT).
- * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
- * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;
- * corresponding to low luminance, medium luminance, and high luminance areas respectively.
- */
- set cameraColorCurves(value: Nullable<ColorCurves>);
- /**
- * Instantiates a new PBRMaterial instance.
- *
- * @param name The material name
- * @param scene The scene the material will be use in.
- */
- constructor(name: string, scene?: Scene);
- /**
- * @returns the name of this material class.
- */
- getClassName(): string;
- /**
- * Makes a duplicate of the current material.
- * @param name - name to use for the new material.
- * @param cloneTexturesOnlyOnce - if a texture is used in more than one channel (e.g diffuse and opacity), only clone it once and reuse it on the other channels. Default false.
- * @param rootUrl defines the root URL to use to load textures
- * @returns cloned material instance
- */
- clone(name: string, cloneTexturesOnlyOnce?: boolean, rootUrl?: string): PBRMaterial;
- /**
- * Serializes this PBR Material.
- * @returns - An object with the serialized material.
- */
- serialize(): any;
- /**
- * Parses a PBR Material from a serialized object.
- * @param source - Serialized object.
- * @param scene - BJS scene instance.
- * @param rootUrl - url for the scene object
- * @returns - PBRMaterial
- */
- static Parse(source: any, scene: Scene, rootUrl: string): PBRMaterial;
- }
|