@babylonjs/core 8.6.1 → 8.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Collisions/gpuPicker.d.ts +1 -0
- package/Collisions/gpuPicker.js +14 -9
- package/Collisions/gpuPicker.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/constants.d.ts +12 -0
- package/Engines/constants.js +12 -0
- package/Engines/constants.js.map +1 -1
- package/Engines/webgpuEngine.js +5 -0
- package/Engines/webgpuEngine.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.d.ts +6 -0
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.js +4 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.d.ts +5 -0
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +23 -0
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/reflectionBlock.js +6 -0
- package/Materials/Node/Blocks/PBR/reflectionBlock.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.d.ts +24 -4
- package/Materials/PBR/pbrBaseMaterial.js +83 -8
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/PBR/pbrMaterial.d.ts +17 -1
- package/Materials/PBR/pbrMaterial.js +21 -0
- package/Materials/PBR/pbrMaterial.js.map +1 -1
- package/Materials/Textures/Filtering/hdrIrradianceFiltering.js +5 -0
- package/Materials/Textures/Filtering/hdrIrradianceFiltering.js.map +1 -1
- package/Materials/Textures/baseTexture.d.ts +8 -0
- package/Materials/Textures/baseTexture.js +7 -0
- package/Materials/Textures/baseTexture.js.map +1 -1
- package/Materials/materialFlags.d.ts +6 -0
- package/Materials/materialFlags.js +14 -0
- package/Materials/materialFlags.js.map +1 -1
- package/Misc/assetsManager.js +13 -23
- package/Misc/assetsManager.js.map +1 -1
- package/Misc/minMaxReducer.d.ts +1 -0
- package/Misc/minMaxReducer.js +3 -2
- package/Misc/minMaxReducer.js.map +1 -1
- package/Offline/database.js +25 -6
- package/Offline/database.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsAccumulationPass.js +1 -1
- package/Rendering/IBLShadows/iblShadowsAccumulationPass.js.map +1 -1
- package/Rendering/iblCdfGenerator.d.ts +12 -0
- package/Rendering/iblCdfGenerator.js +67 -3
- package/Rendering/iblCdfGenerator.js.map +1 -1
- package/Rendering/iblCdfGeneratorSceneComponent.js +4 -0
- package/Rendering/iblCdfGeneratorSceneComponent.js.map +1 -1
- package/Rendering/index.d.ts +2 -0
- package/Rendering/index.js +2 -0
- package/Rendering/index.js.map +1 -1
- package/Shaders/ShadersInclude/hdrFilteringFunctions.js +29 -9
- package/Shaders/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/lightFragment.js +4 -3
- package/Shaders/ShadersInclude/lightFragment.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBRDFFunctions.js +21 -0
- package/Shaders/ShadersInclude/pbrBRDFFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.js +2 -2
- package/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockReflection.js +22 -1
- package/Shaders/ShadersInclude/pbrBlockReflection.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockReflectivity.js +11 -2
- package/Shaders/ShadersInclude/pbrBlockReflectivity.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockSubSurface.js +1 -1
- package/Shaders/ShadersInclude/pbrBlockSubSurface.js.map +1 -1
- package/Shaders/ShadersInclude/pbrDirectLightingFunctions.js +16 -3
- package/Shaders/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/pbrDirectLightingSetupFunctions.js +4 -4
- package/Shaders/ShadersInclude/pbrDirectLightingSetupFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/pbrFragmentDeclaration.js +8 -2
- package/Shaders/ShadersInclude/pbrFragmentDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.js +2 -1
- package/Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/pbrUboDeclaration.js +1 -1
- package/Shaders/ShadersInclude/pbrUboDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/pbrVertexDeclaration.js +6 -2
- package/Shaders/ShadersInclude/pbrVertexDeclaration.js.map +1 -1
- package/Shaders/hdrIrradianceFiltering.fragment.js +1 -1
- package/Shaders/hdrIrradianceFiltering.fragment.js.map +1 -1
- package/Shaders/iblDominantDirection.fragment.d.ts +9 -0
- package/Shaders/iblDominantDirection.fragment.js +22 -0
- package/Shaders/iblDominantDirection.fragment.js.map +1 -0
- package/Shaders/pbr.fragment.js +17 -3
- package/Shaders/pbr.fragment.js.map +1 -1
- package/Shaders/pbr.vertex.js +8 -2
- package/Shaders/pbr.vertex.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.js +28 -8
- package/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/lightFragment.js +6 -5
- package/ShadersWGSL/ShadersInclude/lightFragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBRDFFunctions.js +21 -0
- package/ShadersWGSL/ShadersInclude/pbrBRDFFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockAlbedoOpacity.js +2 -2
- package/ShadersWGSL/ShadersInclude/pbrBlockAlbedoOpacity.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockReflection.js +23 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockReflection.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockReflectivity.js +11 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockReflectivity.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockSubSurface.js +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockSubSurface.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js +19 -3
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingSetupFunctions.js +4 -1
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingSetupFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrFragmentSamplersDeclaration.js +2 -1
- package/ShadersWGSL/ShadersInclude/pbrFragmentSamplersDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrUboDeclaration.js +1 -1
- package/ShadersWGSL/ShadersInclude/pbrUboDeclaration.js.map +1 -1
- package/ShadersWGSL/hdrIrradianceFiltering.fragment.js +1 -1
- package/ShadersWGSL/hdrIrradianceFiltering.fragment.js.map +1 -1
- package/ShadersWGSL/iblDominantDirection.fragment.d.ts +9 -0
- package/ShadersWGSL/iblDominantDirection.fragment.js +22 -0
- package/ShadersWGSL/iblDominantDirection.fragment.js.map +1 -0
- package/ShadersWGSL/minmaxRedux.fragment.d.ts +5 -0
- package/ShadersWGSL/minmaxRedux.fragment.js +32 -0
- package/ShadersWGSL/minmaxRedux.fragment.js.map +1 -0
- package/ShadersWGSL/pbr.fragment.js +19 -5
- package/ShadersWGSL/pbr.fragment.js.map +1 -1
- package/ShadersWGSL/pbr.vertex.js +8 -2
- package/ShadersWGSL/pbr.vertex.js.map +1 -1
- package/package.json +1 -1
|
@@ -35,6 +35,10 @@ export declare class PBRMaterial extends PBRBaseMaterial {
|
|
|
35
35
|
* (point spot...).
|
|
36
36
|
*/
|
|
37
37
|
static DEFAULT_AO_ON_ANALYTICAL_LIGHTS: number;
|
|
38
|
+
/**
|
|
39
|
+
* Defines the default diffuse model used by the material.
|
|
40
|
+
*/
|
|
41
|
+
static DEFAULT_DIFFUSE_MODEL: number;
|
|
38
42
|
/**
|
|
39
43
|
* Intensity of the direct lights e.g. the four lights available in your scene.
|
|
40
44
|
* This impacts both the direct diffuse and specular highlights.
|
|
@@ -64,9 +68,13 @@ export declare class PBRMaterial extends PBRBaseMaterial {
|
|
|
64
68
|
*/
|
|
65
69
|
albedoTexture: Nullable<BaseTexture>;
|
|
66
70
|
/**
|
|
67
|
-
* OpenPBR Base Weight (multiplier to the diffuse and metal lobes).
|
|
71
|
+
* OpenPBR Base Weight texture (multiplier to the diffuse and metal lobes).
|
|
68
72
|
*/
|
|
69
73
|
baseWeightTexture: Nullable<BaseTexture>;
|
|
74
|
+
/**
|
|
75
|
+
* OpenPBR Base Diffuse Roughness texture (roughness of the diffuse lobe).
|
|
76
|
+
*/
|
|
77
|
+
baseDiffuseRoughnessTexture: Nullable<BaseTexture>;
|
|
70
78
|
/**
|
|
71
79
|
* AKA Occlusion Texture in other nomenclature.
|
|
72
80
|
*/
|
|
@@ -179,6 +187,14 @@ export declare class PBRMaterial extends PBRBaseMaterial {
|
|
|
179
187
|
* OpenPBR Base Weight (multiplier to the diffuse and metal lobes).
|
|
180
188
|
*/
|
|
181
189
|
baseWeight: number;
|
|
190
|
+
/**
|
|
191
|
+
* OpenPBR Base Diffuse Roughness (roughness of the diffuse lobe).
|
|
192
|
+
*/
|
|
193
|
+
baseDiffuseRoughness: Nullable<number>;
|
|
194
|
+
/**
|
|
195
|
+
* Defines the base diffuse roughness model of the material.
|
|
196
|
+
*/
|
|
197
|
+
baseDiffuseModel: number;
|
|
182
198
|
/**
|
|
183
199
|
* AKA Specular Color in other nomenclature.
|
|
184
200
|
*/
|
|
@@ -2,6 +2,7 @@ import { __decorate } from "../../tslib.es6.js";
|
|
|
2
2
|
import { serialize, serializeAsColor3, expandToProperty, serializeAsTexture } from "../../Misc/decorators.js";
|
|
3
3
|
import { GetEnvironmentBRDFTexture } from "../../Misc/brdfTextureTools.js";
|
|
4
4
|
import { Color3 } from "../../Maths/math.color.js";
|
|
5
|
+
|
|
5
6
|
import { PBRBaseMaterial } from "./pbrBaseMaterial.js";
|
|
6
7
|
import { RegisterClass } from "../../Misc/typeStore.js";
|
|
7
8
|
import { Material } from "../material.js";
|
|
@@ -303,6 +304,10 @@ export class PBRMaterial extends PBRBaseMaterial {
|
|
|
303
304
|
* OpenPBR Base Weight (multiplier to the diffuse and metal lobes).
|
|
304
305
|
*/
|
|
305
306
|
this.baseWeight = 1;
|
|
307
|
+
/**
|
|
308
|
+
* Defines the base diffuse roughness model of the material.
|
|
309
|
+
*/
|
|
310
|
+
this.baseDiffuseModel = PBRMaterial.DEFAULT_DIFFUSE_MODEL;
|
|
306
311
|
/**
|
|
307
312
|
* AKA Specular Color in other nomenclature.
|
|
308
313
|
*/
|
|
@@ -552,6 +557,10 @@ PBRMaterial.PBRMATERIAL_ALPHATESTANDBLEND = PBRBaseMaterial.PBRMATERIAL_ALPHATES
|
|
|
552
557
|
* (point spot...).
|
|
553
558
|
*/
|
|
554
559
|
PBRMaterial.DEFAULT_AO_ON_ANALYTICAL_LIGHTS = PBRBaseMaterial.DEFAULT_AO_ON_ANALYTICAL_LIGHTS;
|
|
560
|
+
/**
|
|
561
|
+
* Defines the default diffuse model used by the material.
|
|
562
|
+
*/
|
|
563
|
+
PBRMaterial.DEFAULT_DIFFUSE_MODEL = 0;
|
|
555
564
|
__decorate([
|
|
556
565
|
serialize(),
|
|
557
566
|
expandToProperty("_markAllSubMeshesAsTexturesDirty")
|
|
@@ -580,6 +589,10 @@ __decorate([
|
|
|
580
589
|
serializeAsTexture(),
|
|
581
590
|
expandToProperty("_markAllSubMeshesAsTexturesDirty")
|
|
582
591
|
], PBRMaterial.prototype, "baseWeightTexture", void 0);
|
|
592
|
+
__decorate([
|
|
593
|
+
serializeAsTexture(),
|
|
594
|
+
expandToProperty("_markAllSubMeshesAsTexturesDirty")
|
|
595
|
+
], PBRMaterial.prototype, "baseDiffuseRoughnessTexture", void 0);
|
|
583
596
|
__decorate([
|
|
584
597
|
serializeAsTexture(),
|
|
585
598
|
expandToProperty("_markAllSubMeshesAsTexturesDirty")
|
|
@@ -664,6 +677,14 @@ __decorate([
|
|
|
664
677
|
serialize("baseWeight"),
|
|
665
678
|
expandToProperty("_markAllSubMeshesAsTexturesDirty")
|
|
666
679
|
], PBRMaterial.prototype, "baseWeight", void 0);
|
|
680
|
+
__decorate([
|
|
681
|
+
serialize("baseDiffuseRoughness"),
|
|
682
|
+
expandToProperty("_markAllSubMeshesAsTexturesDirty")
|
|
683
|
+
], PBRMaterial.prototype, "baseDiffuseRoughness", void 0);
|
|
684
|
+
__decorate([
|
|
685
|
+
serialize("baseDiffuseModel"),
|
|
686
|
+
expandToProperty("_markAllSubMeshesAsMiscDirty")
|
|
687
|
+
], PBRMaterial.prototype, "baseDiffuseModel", void 0);
|
|
667
688
|
__decorate([
|
|
668
689
|
serializeAsColor3("reflectivity"),
|
|
669
690
|
expandToProperty("_markAllSubMeshesAsTexturesDirty")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pbrMaterial.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/PBR/pbrMaterial.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3G,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAGxE,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAIhD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAE1E;;;;;;GAMG;AACH,MAAM,OAA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AAOd;IAFN,SAAS,EAAE;IACX,gBAAgB,CAAC,8BAA8B,CAAC;gEACN;AAuN/C,aAAa,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC","sourcesContent":["import { serialize, serializeAsColor3, expandToProperty, serializeAsTexture } from \"../../Misc/decorators\";\r\nimport { GetEnvironmentBRDFTexture } from \"../../Misc/brdfTextureTools\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { Color3 } from \"../../Maths/math.color\";\r\nimport type { ImageProcessingConfiguration } from \"../../Materials/imageProcessingConfiguration\";\r\nimport type { ColorCurves } from \"../../Materials/colorCurves\";\r\nimport type { BaseTexture } from \"../../Materials/Textures/baseTexture\";\r\nimport { PBRBaseMaterial } from \"./pbrBaseMaterial\";\r\nimport { RegisterClass } from \"../../Misc/typeStore\";\r\nimport { Material } from \"../material\";\r\nimport { SerializationHelper } from \"../../Misc/decorators.serialization\";\r\n\r\n/**\r\n * The Physically based material of BJS.\r\n *\r\n * This offers the main features of a standard PBR material.\r\n * For more information, please refer to the documentation :\r\n * https://doc.babylonjs.com/features/featuresDeepDive/materials/using/introToPBR\r\n */\r\nexport class PBRMaterial extends PBRBaseMaterial {\r\n /**\r\n * PBRMaterialTransparencyMode: No transparency mode, Alpha channel is not use.\r\n */\r\n public static override readonly PBRMATERIAL_OPAQUE = PBRBaseMaterial.PBRMATERIAL_OPAQUE;\r\n\r\n /**\r\n * PBRMaterialTransparencyMode: Alpha Test mode, pixel are discarded below a certain threshold defined by the alpha cutoff value.\r\n */\r\n public static override readonly PBRMATERIAL_ALPHATEST = PBRBaseMaterial.PBRMATERIAL_ALPHATEST;\r\n\r\n /**\r\n * PBRMaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.\r\n */\r\n public static override readonly PBRMATERIAL_ALPHABLEND = PBRBaseMaterial.PBRMATERIAL_ALPHABLEND;\r\n\r\n /**\r\n * PBRMaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.\r\n * They are also discarded below the alpha cutoff threshold to improve performances.\r\n */\r\n public static override readonly PBRMATERIAL_ALPHATESTANDBLEND = PBRBaseMaterial.PBRMATERIAL_ALPHATESTANDBLEND;\r\n\r\n /**\r\n * Defines the default value of how much AO map is occluding the analytical lights\r\n * (point spot...).\r\n */\r\n public static override DEFAULT_AO_ON_ANALYTICAL_LIGHTS = PBRBaseMaterial.DEFAULT_AO_ON_ANALYTICAL_LIGHTS;\r\n\r\n /**\r\n * Intensity of the direct lights e.g. the four lights available in your scene.\r\n * This impacts both the direct diffuse and specular highlights.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public directIntensity: number = 1.0;\r\n\r\n /**\r\n * Intensity of the emissive part of the material.\r\n * This helps controlling the emissive effect without modifying the emissive color.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public emissiveIntensity: number = 1.0;\r\n\r\n /**\r\n * Intensity of the environment e.g. how much the environment will light the object\r\n * either through harmonics for rough material or through the reflection for shiny ones.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public environmentIntensity: number = 1.0;\r\n\r\n /**\r\n * This is a special control allowing the reduction of the specular highlights coming from the\r\n * four lights of the scene. Those highlights may not be needed in full environment lighting.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public specularIntensity: number = 1.0;\r\n\r\n /**\r\n * Debug Control allowing disabling the bump map on this material.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public disableBumpMap: boolean = false;\r\n\r\n /**\r\n * AKA Diffuse Texture in standard nomenclature.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public albedoTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * OpenPBR Base Weight (multiplier to the diffuse and metal lobes).\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public baseWeightTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * AKA Occlusion Texture in other nomenclature.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public ambientTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * AKA Occlusion Texture Intensity in other nomenclature.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public ambientTextureStrength: number = 1.0;\r\n\r\n /**\r\n * Defines how much the AO map is occluding the analytical lights (point spot...).\r\n * 1 means it completely occludes it\r\n * 0 mean it has no impact\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public ambientTextureImpactOnAnalyticalLights: number = PBRMaterial.DEFAULT_AO_ON_ANALYTICAL_LIGHTS;\r\n\r\n /**\r\n * Stores the alpha values in a texture. Use luminance if texture.getAlphaFromRGB is true.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\r\n public opacityTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Stores the reflection values in a texture.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public reflectionTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Stores the emissive values in a texture.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public emissiveTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * AKA Specular texture in other nomenclature.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public reflectivityTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Used to switch from specular/glossiness to metallic/roughness workflow.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public metallicTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Specifies the metallic scalar of the metallic/roughness workflow.\r\n * Can also be used to scale the metalness values of the metallic texture.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public metallic: Nullable<number>;\r\n\r\n /**\r\n * Specifies the roughness scalar of the metallic/roughness workflow.\r\n * Can also be used to scale the roughness values of the metallic texture.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public roughness: Nullable<number>;\r\n\r\n /**\r\n * In metallic workflow, specifies an F0 factor to help configuring the material F0.\r\n * By default the indexOfrefraction is used to compute F0;\r\n *\r\n * This is used as a factor against the default reflectance at normal incidence to tweak it.\r\n *\r\n * F0 = defaultF0 * metallicF0Factor * metallicReflectanceColor;\r\n * F90 = metallicReflectanceColor;\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public metallicF0Factor = 1;\r\n\r\n /**\r\n * In metallic workflow, specifies an F0 color.\r\n * By default the F90 is always 1;\r\n *\r\n * Please note that this factor is also used as a factor against the default reflectance at normal incidence.\r\n *\r\n * F0 = defaultF0_from_IOR * metallicF0Factor * metallicReflectanceColor\r\n * F90 = metallicF0Factor;\r\n */\r\n @serializeAsColor3()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public metallicReflectanceColor = Color3.White();\r\n\r\n /**\r\n * Specifies that only the A channel from metallicReflectanceTexture should be used.\r\n * If false, both RGB and A channels will be used\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useOnlyMetallicFromMetallicReflectanceTexture = false;\r\n\r\n /**\r\n * Defines to store metallicReflectanceColor in RGB and metallicF0Factor in A\r\n * This is multiplied against the scalar values defined in the material.\r\n * If useOnlyMetallicFromMetallicReflectanceTexture is true, don't use the RGB channels, only A\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public metallicReflectanceTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Defines to store reflectanceColor in RGB\r\n * This is multiplied against the scalar values defined in the material.\r\n * If both reflectanceTexture and metallicReflectanceTexture textures are provided and useOnlyMetallicFromMetallicReflectanceTexture\r\n * is false, metallicReflectanceTexture takes priority and reflectanceTexture is not used\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public reflectanceTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Used to enable roughness/glossiness fetch from a separate channel depending on the current mode.\r\n * Gray Scale represents roughness in metallic mode and glossiness in specular mode.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public microSurfaceTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Stores surface normal data used to displace a mesh in a texture.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public bumpTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Stores the pre-calculated light information of a mesh in a texture.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\", null)\r\n public lightmapTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Stores the refracted light information in a texture.\r\n */\r\n public get refractionTexture(): Nullable<BaseTexture> {\r\n return this.subSurface.refractionTexture;\r\n }\r\n public set refractionTexture(value: Nullable<BaseTexture>) {\r\n this.subSurface.refractionTexture = value;\r\n if (value) {\r\n this.subSurface.isRefractionEnabled = true;\r\n } else if (!this.subSurface.linkRefractionWithTransparency) {\r\n this.subSurface.isRefractionEnabled = false;\r\n }\r\n }\r\n\r\n /**\r\n * The color of a material in ambient lighting.\r\n */\r\n @serializeAsColor3(\"ambient\")\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public ambientColor = new Color3(0, 0, 0);\r\n\r\n /**\r\n * AKA Diffuse Color in other nomenclature.\r\n */\r\n @serializeAsColor3(\"albedo\")\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public albedoColor = new Color3(1, 1, 1);\r\n\r\n /**\r\n * OpenPBR Base Weight (multiplier to the diffuse and metal lobes).\r\n */\r\n @serialize(\"baseWeight\")\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public baseWeight = 1;\r\n\r\n /**\r\n * AKA Specular Color in other nomenclature.\r\n */\r\n @serializeAsColor3(\"reflectivity\")\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public reflectivityColor = new Color3(1, 1, 1);\r\n\r\n /**\r\n * The color reflected from the material.\r\n */\r\n @serializeAsColor3(\"reflection\")\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public reflectionColor = new Color3(1.0, 1.0, 1.0);\r\n\r\n /**\r\n * The color emitted from the material.\r\n */\r\n @serializeAsColor3(\"emissive\")\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public emissiveColor = new Color3(0, 0, 0);\r\n\r\n /**\r\n * AKA Glossiness in other nomenclature.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public microSurface = 1.0;\r\n\r\n /**\r\n * Index of refraction of the material base layer.\r\n * https://en.wikipedia.org/wiki/List_of_refractive_indices\r\n *\r\n * This does not only impact refraction but also the Base F0 of Dielectric Materials.\r\n *\r\n * From dielectric fresnel rules: F0 = square((iorT - iorI) / (iorT + iorI))\r\n */\r\n public get indexOfRefraction(): number {\r\n return this.subSurface.indexOfRefraction;\r\n }\r\n public set indexOfRefraction(value: number) {\r\n this.subSurface.indexOfRefraction = value;\r\n }\r\n\r\n /**\r\n * Controls if refraction needs to be inverted on Y. This could be useful for procedural texture.\r\n */\r\n public get invertRefractionY(): boolean {\r\n return this.subSurface.invertRefractionY;\r\n }\r\n public set invertRefractionY(value: boolean) {\r\n this.subSurface.invertRefractionY = value;\r\n }\r\n\r\n /**\r\n * This parameters will make the material used its opacity to control how much it is refracting against not.\r\n * Materials half opaque for instance using refraction could benefit from this control.\r\n */\r\n public get linkRefractionWithTransparency(): boolean {\r\n return this.subSurface.linkRefractionWithTransparency;\r\n }\r\n public set linkRefractionWithTransparency(value: boolean) {\r\n this.subSurface.linkRefractionWithTransparency = value;\r\n if (value) {\r\n this.subSurface.isRefractionEnabled = true;\r\n }\r\n }\r\n\r\n /**\r\n * If true, the light map contains occlusion information instead of lighting info.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useLightmapAsShadowmap = false;\r\n\r\n /**\r\n * Specifies that the alpha is coming form the albedo channel alpha channel for alpha blending.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\r\n public useAlphaFromAlbedoTexture = false;\r\n\r\n /**\r\n * Enforces alpha test in opaque or blend mode in order to improve the performances of some situations.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\r\n public forceAlphaTest = false;\r\n\r\n /**\r\n * Defines the alpha limits in alpha test mode.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\r\n public alphaCutOff = 0.4;\r\n\r\n /**\r\n * Specifies that the material will keep the specular highlights over a transparent surface (only the most luminous ones).\r\n * A car glass is a good example of that. When sun reflects on it you can not see what is behind.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useSpecularOverAlpha = true;\r\n\r\n /**\r\n * Specifies if the reflectivity texture contains the glossiness information in its alpha channel.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useMicroSurfaceFromReflectivityMapAlpha = false;\r\n\r\n /**\r\n * Specifies if the metallic texture contains the roughness information in its alpha channel.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useRoughnessFromMetallicTextureAlpha = true;\r\n\r\n /**\r\n * Specifies if the metallic texture contains the roughness information in its green channel.\r\n * Needs useRoughnessFromMetallicTextureAlpha to be false.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useRoughnessFromMetallicTextureGreen = false;\r\n\r\n /**\r\n * Specifies if the metallic texture contains the metallness information in its blue channel.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useMetallnessFromMetallicTextureBlue = false;\r\n\r\n /**\r\n * Specifies if the metallic texture contains the ambient occlusion information in its red channel.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useAmbientOcclusionFromMetallicTextureRed = false;\r\n\r\n /**\r\n * Specifies if the ambient texture contains the ambient occlusion information in its red channel only.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useAmbientInGrayScale = false;\r\n\r\n /**\r\n * In case the reflectivity map does not contain the microsurface information in its alpha channel,\r\n * The material will try to infer what glossiness each pixel should be.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useAutoMicroSurfaceFromReflectivityMap = false;\r\n\r\n /**\r\n * BJS is using an hardcoded light falloff based on a manually sets up range.\r\n * In PBR, one way to represents the falloff is to use the inverse squared root algorithm.\r\n * This parameter can help you switch back to the BJS mode in order to create scenes using both materials.\r\n */\r\n @serialize()\r\n public get usePhysicalLightFalloff(): boolean {\r\n return this._lightFalloff === PBRBaseMaterial.LIGHTFALLOFF_PHYSICAL;\r\n }\r\n\r\n /**\r\n * BJS is using an hardcoded light falloff based on a manually sets up range.\r\n * In PBR, one way to represents the falloff is to use the inverse squared root algorithm.\r\n * This parameter can help you switch back to the BJS mode in order to create scenes using both materials.\r\n */\r\n public set usePhysicalLightFalloff(value: boolean) {\r\n if (value !== this.usePhysicalLightFalloff) {\r\n // Ensure the effect will be rebuilt.\r\n this._markAllSubMeshesAsTexturesDirty();\r\n\r\n if (value) {\r\n this._lightFalloff = PBRBaseMaterial.LIGHTFALLOFF_PHYSICAL;\r\n } else {\r\n this._lightFalloff = PBRBaseMaterial.LIGHTFALLOFF_STANDARD;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * In order to support the falloff compatibility with gltf, a special mode has been added\r\n * to reproduce the gltf light falloff.\r\n */\r\n @serialize()\r\n public get useGLTFLightFalloff(): boolean {\r\n return this._lightFalloff === PBRBaseMaterial.LIGHTFALLOFF_GLTF;\r\n }\r\n\r\n /**\r\n * In order to support the falloff compatibility with gltf, a special mode has been added\r\n * to reproduce the gltf light falloff.\r\n */\r\n public set useGLTFLightFalloff(value: boolean) {\r\n if (value !== this.useGLTFLightFalloff) {\r\n // Ensure the effect will be rebuilt.\r\n this._markAllSubMeshesAsTexturesDirty();\r\n\r\n if (value) {\r\n this._lightFalloff = PBRBaseMaterial.LIGHTFALLOFF_GLTF;\r\n } else {\r\n this._lightFalloff = PBRBaseMaterial.LIGHTFALLOFF_STANDARD;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Specifies that the material will keeps the reflection highlights over a transparent surface (only the most luminous ones).\r\n * A car glass is a good example of that. When the street lights reflects on it you can not see what is behind.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useRadianceOverAlpha = true;\r\n\r\n /**\r\n * Allows using an object space normal map (instead of tangent space).\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useObjectSpaceNormalMap = false;\r\n\r\n /**\r\n * Allows using the bump map in parallax mode.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useParallax = false;\r\n\r\n /**\r\n * Allows using the bump map in parallax occlusion mode.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useParallaxOcclusion = false;\r\n\r\n /**\r\n * Controls the scale bias of the parallax mode.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public parallaxScaleBias = 0.05;\r\n\r\n /**\r\n * If sets to true, disables all the lights affecting the material.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public disableLighting = false;\r\n\r\n /**\r\n * Force the shader to compute irradiance in the fragment shader in order to take bump in account.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public forceIrradianceInFragment = false;\r\n\r\n /**\r\n * Number of Simultaneous lights allowed on the material.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public maxSimultaneousLights = 4;\r\n\r\n /**\r\n * If sets to true, x component of normal map value will invert (x = 1.0 - x).\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public invertNormalMapX = false;\r\n\r\n /**\r\n * If sets to true, y component of normal map value will invert (y = 1.0 - y).\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public invertNormalMapY = false;\r\n\r\n /**\r\n * If sets to true and backfaceCulling is false, normals will be flipped on the backside.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public twoSidedLighting = false;\r\n\r\n /**\r\n * A fresnel is applied to the alpha of the model to ensure grazing angles edges are not alpha tested.\r\n * And/Or occlude the blended part. (alpha is converted to gamma to compute the fresnel)\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useAlphaFresnel = false;\r\n\r\n /**\r\n * A fresnel is applied to the alpha of the model to ensure grazing angles edges are not alpha tested.\r\n * And/Or occlude the blended part. (alpha stays linear to compute the fresnel)\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useLinearAlphaFresnel = false;\r\n\r\n /**\r\n * Let user defines the brdf lookup texture used for IBL.\r\n * A default 8bit version is embedded but you could point at :\r\n * * Default texture: https://assets.babylonjs.com/environments/correlatedMSBRDF_RGBD.png\r\n * * Default 16bit pixel depth texture: https://assets.babylonjs.com/environments/correlatedMSBRDF.dds\r\n * * LEGACY Default None correlated https://assets.babylonjs.com/environments/uncorrelatedBRDF_RGBD.png\r\n * * LEGACY Default None correlated 16bit pixel depth https://assets.babylonjs.com/environments/uncorrelatedBRDF.dds\r\n */\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public environmentBRDFTexture: Nullable<BaseTexture> = null;\r\n\r\n /**\r\n * Force normal to face away from face.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public forceNormalForward = false;\r\n\r\n /**\r\n * Enables specular anti aliasing in the PBR shader.\r\n * It will both interacts on the Geometry for analytical and IBL lighting.\r\n * It also prefilter the roughness map based on the bump values.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public enableSpecularAntiAliasing = false;\r\n\r\n /**\r\n * This parameters will enable/disable Horizon occlusion to prevent normal maps to look shiny when the normal\r\n * makes the reflect vector face the model (under horizon).\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useHorizonOcclusion = true;\r\n\r\n /**\r\n * This parameters will enable/disable radiance occlusion by preventing the radiance to lit\r\n * too much the area relying on ambient texture to define their ambient occlusion.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useRadianceOcclusion = true;\r\n\r\n /**\r\n * If set to true, no lighting calculations will be applied.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsMiscDirty\")\r\n public unlit = false;\r\n\r\n /**\r\n * If sets to true, the decal map will be applied after the detail map. Else, it is applied before (default: false)\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsMiscDirty\")\r\n public applyDecalMapAfterDetailMap = false;\r\n\r\n /**\r\n * Gets the image processing configuration used either in this material.\r\n */\r\n public get imageProcessingConfiguration(): ImageProcessingConfiguration {\r\n return this._imageProcessingConfiguration;\r\n }\r\n\r\n /**\r\n * Sets the Default image processing configuration used either in the this material.\r\n *\r\n * If sets to null, the scene one is in use.\r\n */\r\n public set imageProcessingConfiguration(value: ImageProcessingConfiguration) {\r\n this._attachImageProcessingConfiguration(value);\r\n\r\n // Ensure the effect will be rebuilt.\r\n this._markAllSubMeshesAsTexturesDirty();\r\n }\r\n\r\n /**\r\n * Gets whether the color curves effect is enabled.\r\n */\r\n public get cameraColorCurvesEnabled(): boolean {\r\n return this.imageProcessingConfiguration.colorCurvesEnabled;\r\n }\r\n /**\r\n * Sets whether the color curves effect is enabled.\r\n */\r\n public set cameraColorCurvesEnabled(value: boolean) {\r\n this.imageProcessingConfiguration.colorCurvesEnabled = value;\r\n }\r\n\r\n /**\r\n * Gets whether the color grading effect is enabled.\r\n */\r\n public get cameraColorGradingEnabled(): boolean {\r\n return this.imageProcessingConfiguration.colorGradingEnabled;\r\n }\r\n /**\r\n * Gets whether the color grading effect is enabled.\r\n */\r\n public set cameraColorGradingEnabled(value: boolean) {\r\n this.imageProcessingConfiguration.colorGradingEnabled = value;\r\n }\r\n\r\n /**\r\n * Gets whether tonemapping is enabled or not.\r\n */\r\n public get cameraToneMappingEnabled(): boolean {\r\n return this._imageProcessingConfiguration.toneMappingEnabled;\r\n }\r\n /**\r\n * Sets whether tonemapping is enabled or not\r\n */\r\n public set cameraToneMappingEnabled(value: boolean) {\r\n this._imageProcessingConfiguration.toneMappingEnabled = value;\r\n }\r\n\r\n /**\r\n * The camera exposure used on this material.\r\n * This property is here and not in the camera to allow controlling exposure without full screen post process.\r\n * This corresponds to a photographic exposure.\r\n */\r\n public get cameraExposure(): number {\r\n return this._imageProcessingConfiguration.exposure;\r\n }\r\n /**\r\n * The camera exposure used on this material.\r\n * This property is here and not in the camera to allow controlling exposure without full screen post process.\r\n * This corresponds to a photographic exposure.\r\n */\r\n public set cameraExposure(value: number) {\r\n this._imageProcessingConfiguration.exposure = value;\r\n }\r\n\r\n /**\r\n * Gets The camera contrast used on this material.\r\n */\r\n public get cameraContrast(): number {\r\n return this._imageProcessingConfiguration.contrast;\r\n }\r\n\r\n /**\r\n * Sets The camera contrast used on this material.\r\n */\r\n public set cameraContrast(value: number) {\r\n this._imageProcessingConfiguration.contrast = value;\r\n }\r\n\r\n /**\r\n * Gets the Color Grading 2D Lookup Texture.\r\n */\r\n public get cameraColorGradingTexture(): Nullable<BaseTexture> {\r\n return this._imageProcessingConfiguration.colorGradingTexture;\r\n }\r\n /**\r\n * Sets the Color Grading 2D Lookup Texture.\r\n */\r\n public set cameraColorGradingTexture(value: Nullable<BaseTexture>) {\r\n this._imageProcessingConfiguration.colorGradingTexture = value;\r\n }\r\n\r\n /**\r\n * The color grading curves provide additional color adjustment that is applied after any color grading transform (3D LUT).\r\n * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.\r\n * 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;\r\n * corresponding to low luminance, medium luminance, and high luminance areas respectively.\r\n */\r\n public get cameraColorCurves(): Nullable<ColorCurves> {\r\n return this._imageProcessingConfiguration.colorCurves;\r\n }\r\n /**\r\n * The color grading curves provide additional color adjustment that is applied after any color grading transform (3D LUT).\r\n * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.\r\n * 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;\r\n * corresponding to low luminance, medium luminance, and high luminance areas respectively.\r\n */\r\n public set cameraColorCurves(value: Nullable<ColorCurves>) {\r\n this._imageProcessingConfiguration.colorCurves = value;\r\n }\r\n\r\n /**\r\n * Instantiates a new PBRMaterial instance.\r\n *\r\n * @param name The material name\r\n * @param scene The scene the material will be use in.\r\n * @param forceGLSL Use the GLSL code generation for the shader (even on WebGPU). Default is false\r\n */\r\n constructor(name: string, scene?: Scene, forceGLSL = false) {\r\n super(name, scene, forceGLSL);\r\n\r\n this._environmentBRDFTexture = GetEnvironmentBRDFTexture(this.getScene());\r\n }\r\n\r\n /**\r\n * @returns the name of this material class.\r\n */\r\n public override getClassName(): string {\r\n return \"PBRMaterial\";\r\n }\r\n\r\n /**\r\n * Makes a duplicate of the current material.\r\n * @param name - name to use for the new material.\r\n * @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.\r\n * @param rootUrl defines the root URL to use to load textures\r\n * @returns cloned material instance\r\n */\r\n public override clone(name: string, cloneTexturesOnlyOnce: boolean = true, rootUrl = \"\"): PBRMaterial {\r\n const clone = SerializationHelper.Clone(() => new PBRMaterial(name, this.getScene()), this, { cloneTexturesOnlyOnce });\r\n\r\n clone.id = name;\r\n clone.name = name;\r\n\r\n this.stencil.copyTo(clone.stencil);\r\n\r\n this._clonePlugins(clone, rootUrl);\r\n\r\n return clone;\r\n }\r\n\r\n /**\r\n * Serializes this PBR Material.\r\n * @returns - An object with the serialized material.\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.customType = \"BABYLON.PBRMaterial\";\r\n\r\n return serializationObject;\r\n }\r\n\r\n // Statics\r\n /**\r\n * Parses a PBR Material from a serialized object.\r\n * @param source - Serialized object.\r\n * @param scene - BJS scene instance.\r\n * @param rootUrl - url for the scene object\r\n * @returns - PBRMaterial\r\n */\r\n public static override Parse(source: any, scene: Scene, rootUrl: string): PBRMaterial {\r\n const material = SerializationHelper.Parse(() => new PBRMaterial(source.name, scene), source, scene, rootUrl);\r\n\r\n if (source.stencil) {\r\n material.stencil.parse(source.stencil, scene, rootUrl);\r\n }\r\n\r\n Material._ParsePlugins(source, material, scene, rootUrl);\r\n\r\n // The code block below ensures backward compatibility with serialized materials before plugins are automatically serialized.\r\n if (source.clearCoat) {\r\n material.clearCoat.parse(source.clearCoat, scene, rootUrl);\r\n }\r\n if (source.anisotropy) {\r\n material.anisotropy.parse(source.anisotropy, scene, rootUrl);\r\n }\r\n if (source.brdf) {\r\n material.brdf.parse(source.brdf, scene, rootUrl);\r\n }\r\n if (source.sheen) {\r\n material.sheen.parse(source.sheen, scene, rootUrl);\r\n }\r\n if (source.subSurface) {\r\n material.subSurface.parse(source.subSurface, scene, rootUrl);\r\n }\r\n if (source.iridescence) {\r\n material.iridescence.parse(source.iridescence, scene, rootUrl);\r\n }\r\n\r\n return material;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.PBRMaterial\", PBRMaterial);\r\n"]}
|
|
1
|
+
{"version":3,"file":"pbrMaterial.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/PBR/pbrMaterial.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3G,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAGxE,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAIpD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAE1E;;;;;;GAMG;AACH,MAAM,OAAO,WAAY,SAAQ,eAAe;IAkP5C;;OAEG;IACH,IAAW,iBAAiB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ACX,gBAAgB,CAAC,kCAAkC,CAAC;uDACnB;AAS3B;IAFN,SAAS,EAAE;IACX,gBAAgB,CAAC,kCAAkC,CAAC;+DACX;AAQnC;IAFN,SAAS,EAAE;IACX,gBAAgB,CAAC,kCAAkC,CAAC;wDACnB;AAQ3B;IAFN,SAAS,EAAE;IACX,gBAAgB,CAAC,kCAAkC,CAAC;yDAClB;AAO5B;IAFN,SAAS,EAAE;IACX,gBAAgB,CAAC,8BAA8B,CAAC;0CAC5B;AAOd;IAFN,SAAS,EAAE;IACX,gBAAgB,CAAC,8BAA8B,CAAC;gEACN;AAuN/C,aAAa,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC","sourcesContent":["import { serialize, serializeAsColor3, expandToProperty, serializeAsTexture } from \"../../Misc/decorators\";\r\nimport { GetEnvironmentBRDFTexture } from \"../../Misc/brdfTextureTools\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { Color3 } from \"../../Maths/math.color\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport type { ImageProcessingConfiguration } from \"../../Materials/imageProcessingConfiguration\";\r\nimport type { ColorCurves } from \"../../Materials/colorCurves\";\r\nimport type { BaseTexture } from \"../../Materials/Textures/baseTexture\";\r\nimport { PBRBaseMaterial } from \"./pbrBaseMaterial\";\r\nimport { RegisterClass } from \"../../Misc/typeStore\";\r\nimport { Material } from \"../material\";\r\nimport { SerializationHelper } from \"../../Misc/decorators.serialization\";\r\n\r\n/**\r\n * The Physically based material of BJS.\r\n *\r\n * This offers the main features of a standard PBR material.\r\n * For more information, please refer to the documentation :\r\n * https://doc.babylonjs.com/features/featuresDeepDive/materials/using/introToPBR\r\n */\r\nexport class PBRMaterial extends PBRBaseMaterial {\r\n /**\r\n * PBRMaterialTransparencyMode: No transparency mode, Alpha channel is not use.\r\n */\r\n public static override readonly PBRMATERIAL_OPAQUE = PBRBaseMaterial.PBRMATERIAL_OPAQUE;\r\n\r\n /**\r\n * PBRMaterialTransparencyMode: Alpha Test mode, pixel are discarded below a certain threshold defined by the alpha cutoff value.\r\n */\r\n public static override readonly PBRMATERIAL_ALPHATEST = PBRBaseMaterial.PBRMATERIAL_ALPHATEST;\r\n\r\n /**\r\n * PBRMaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.\r\n */\r\n public static override readonly PBRMATERIAL_ALPHABLEND = PBRBaseMaterial.PBRMATERIAL_ALPHABLEND;\r\n\r\n /**\r\n * PBRMaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.\r\n * They are also discarded below the alpha cutoff threshold to improve performances.\r\n */\r\n public static override readonly PBRMATERIAL_ALPHATESTANDBLEND = PBRBaseMaterial.PBRMATERIAL_ALPHATESTANDBLEND;\r\n\r\n /**\r\n * Defines the default value of how much AO map is occluding the analytical lights\r\n * (point spot...).\r\n */\r\n public static override DEFAULT_AO_ON_ANALYTICAL_LIGHTS = PBRBaseMaterial.DEFAULT_AO_ON_ANALYTICAL_LIGHTS;\r\n\r\n /**\r\n * Defines the default diffuse model used by the material.\r\n */\r\n public static override DEFAULT_DIFFUSE_MODEL = Constants.MATERIAL_DIFFUSE_MODEL_E_OREN_NAYAR;\r\n\r\n /**\r\n * Intensity of the direct lights e.g. the four lights available in your scene.\r\n * This impacts both the direct diffuse and specular highlights.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public directIntensity: number = 1.0;\r\n\r\n /**\r\n * Intensity of the emissive part of the material.\r\n * This helps controlling the emissive effect without modifying the emissive color.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public emissiveIntensity: number = 1.0;\r\n\r\n /**\r\n * Intensity of the environment e.g. how much the environment will light the object\r\n * either through harmonics for rough material or through the reflection for shiny ones.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public environmentIntensity: number = 1.0;\r\n\r\n /**\r\n * This is a special control allowing the reduction of the specular highlights coming from the\r\n * four lights of the scene. Those highlights may not be needed in full environment lighting.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public specularIntensity: number = 1.0;\r\n\r\n /**\r\n * Debug Control allowing disabling the bump map on this material.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public disableBumpMap: boolean = false;\r\n\r\n /**\r\n * AKA Diffuse Texture in standard nomenclature.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public albedoTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * OpenPBR Base Weight texture (multiplier to the diffuse and metal lobes).\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public baseWeightTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * OpenPBR Base Diffuse Roughness texture (roughness of the diffuse lobe).\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public baseDiffuseRoughnessTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * AKA Occlusion Texture in other nomenclature.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public ambientTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * AKA Occlusion Texture Intensity in other nomenclature.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public ambientTextureStrength: number = 1.0;\r\n\r\n /**\r\n * Defines how much the AO map is occluding the analytical lights (point spot...).\r\n * 1 means it completely occludes it\r\n * 0 mean it has no impact\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public ambientTextureImpactOnAnalyticalLights: number = PBRMaterial.DEFAULT_AO_ON_ANALYTICAL_LIGHTS;\r\n\r\n /**\r\n * Stores the alpha values in a texture. Use luminance if texture.getAlphaFromRGB is true.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\r\n public opacityTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Stores the reflection values in a texture.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public reflectionTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Stores the emissive values in a texture.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public emissiveTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * AKA Specular texture in other nomenclature.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public reflectivityTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Used to switch from specular/glossiness to metallic/roughness workflow.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public metallicTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Specifies the metallic scalar of the metallic/roughness workflow.\r\n * Can also be used to scale the metalness values of the metallic texture.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public metallic: Nullable<number>;\r\n\r\n /**\r\n * Specifies the roughness scalar of the metallic/roughness workflow.\r\n * Can also be used to scale the roughness values of the metallic texture.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public roughness: Nullable<number>;\r\n\r\n /**\r\n * In metallic workflow, specifies an F0 factor to help configuring the material F0.\r\n * By default the indexOfrefraction is used to compute F0;\r\n *\r\n * This is used as a factor against the default reflectance at normal incidence to tweak it.\r\n *\r\n * F0 = defaultF0 * metallicF0Factor * metallicReflectanceColor;\r\n * F90 = metallicReflectanceColor;\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public metallicF0Factor = 1;\r\n\r\n /**\r\n * In metallic workflow, specifies an F0 color.\r\n * By default the F90 is always 1;\r\n *\r\n * Please note that this factor is also used as a factor against the default reflectance at normal incidence.\r\n *\r\n * F0 = defaultF0_from_IOR * metallicF0Factor * metallicReflectanceColor\r\n * F90 = metallicF0Factor;\r\n */\r\n @serializeAsColor3()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public metallicReflectanceColor = Color3.White();\r\n\r\n /**\r\n * Specifies that only the A channel from metallicReflectanceTexture should be used.\r\n * If false, both RGB and A channels will be used\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useOnlyMetallicFromMetallicReflectanceTexture = false;\r\n\r\n /**\r\n * Defines to store metallicReflectanceColor in RGB and metallicF0Factor in A\r\n * This is multiplied against the scalar values defined in the material.\r\n * If useOnlyMetallicFromMetallicReflectanceTexture is true, don't use the RGB channels, only A\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public metallicReflectanceTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Defines to store reflectanceColor in RGB\r\n * This is multiplied against the scalar values defined in the material.\r\n * If both reflectanceTexture and metallicReflectanceTexture textures are provided and useOnlyMetallicFromMetallicReflectanceTexture\r\n * is false, metallicReflectanceTexture takes priority and reflectanceTexture is not used\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public reflectanceTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Used to enable roughness/glossiness fetch from a separate channel depending on the current mode.\r\n * Gray Scale represents roughness in metallic mode and glossiness in specular mode.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public microSurfaceTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Stores surface normal data used to displace a mesh in a texture.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public bumpTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Stores the pre-calculated light information of a mesh in a texture.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\", null)\r\n public lightmapTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Stores the refracted light information in a texture.\r\n */\r\n public get refractionTexture(): Nullable<BaseTexture> {\r\n return this.subSurface.refractionTexture;\r\n }\r\n public set refractionTexture(value: Nullable<BaseTexture>) {\r\n this.subSurface.refractionTexture = value;\r\n if (value) {\r\n this.subSurface.isRefractionEnabled = true;\r\n } else if (!this.subSurface.linkRefractionWithTransparency) {\r\n this.subSurface.isRefractionEnabled = false;\r\n }\r\n }\r\n\r\n /**\r\n * The color of a material in ambient lighting.\r\n */\r\n @serializeAsColor3(\"ambient\")\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public ambientColor = new Color3(0, 0, 0);\r\n\r\n /**\r\n * AKA Diffuse Color in other nomenclature.\r\n */\r\n @serializeAsColor3(\"albedo\")\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public albedoColor = new Color3(1, 1, 1);\r\n\r\n /**\r\n * OpenPBR Base Weight (multiplier to the diffuse and metal lobes).\r\n */\r\n @serialize(\"baseWeight\")\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public baseWeight = 1;\r\n\r\n /**\r\n * OpenPBR Base Diffuse Roughness (roughness of the diffuse lobe).\r\n */\r\n @serialize(\"baseDiffuseRoughness\")\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public baseDiffuseRoughness: Nullable<number>;\r\n\r\n /**\r\n * Defines the base diffuse roughness model of the material.\r\n */\r\n @serialize(\"baseDiffuseModel\")\r\n @expandToProperty(\"_markAllSubMeshesAsMiscDirty\")\r\n public baseDiffuseModel: number = PBRMaterial.DEFAULT_DIFFUSE_MODEL;\r\n\r\n /**\r\n * AKA Specular Color in other nomenclature.\r\n */\r\n @serializeAsColor3(\"reflectivity\")\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public reflectivityColor = new Color3(1, 1, 1);\r\n\r\n /**\r\n * The color reflected from the material.\r\n */\r\n @serializeAsColor3(\"reflection\")\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public reflectionColor = new Color3(1.0, 1.0, 1.0);\r\n\r\n /**\r\n * The color emitted from the material.\r\n */\r\n @serializeAsColor3(\"emissive\")\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public emissiveColor = new Color3(0, 0, 0);\r\n\r\n /**\r\n * AKA Glossiness in other nomenclature.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public microSurface = 1.0;\r\n\r\n /**\r\n * Index of refraction of the material base layer.\r\n * https://en.wikipedia.org/wiki/List_of_refractive_indices\r\n *\r\n * This does not only impact refraction but also the Base F0 of Dielectric Materials.\r\n *\r\n * From dielectric fresnel rules: F0 = square((iorT - iorI) / (iorT + iorI))\r\n */\r\n public get indexOfRefraction(): number {\r\n return this.subSurface.indexOfRefraction;\r\n }\r\n public set indexOfRefraction(value: number) {\r\n this.subSurface.indexOfRefraction = value;\r\n }\r\n\r\n /**\r\n * Controls if refraction needs to be inverted on Y. This could be useful for procedural texture.\r\n */\r\n public get invertRefractionY(): boolean {\r\n return this.subSurface.invertRefractionY;\r\n }\r\n public set invertRefractionY(value: boolean) {\r\n this.subSurface.invertRefractionY = value;\r\n }\r\n\r\n /**\r\n * This parameters will make the material used its opacity to control how much it is refracting against not.\r\n * Materials half opaque for instance using refraction could benefit from this control.\r\n */\r\n public get linkRefractionWithTransparency(): boolean {\r\n return this.subSurface.linkRefractionWithTransparency;\r\n }\r\n public set linkRefractionWithTransparency(value: boolean) {\r\n this.subSurface.linkRefractionWithTransparency = value;\r\n if (value) {\r\n this.subSurface.isRefractionEnabled = true;\r\n }\r\n }\r\n\r\n /**\r\n * If true, the light map contains occlusion information instead of lighting info.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useLightmapAsShadowmap = false;\r\n\r\n /**\r\n * Specifies that the alpha is coming form the albedo channel alpha channel for alpha blending.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\r\n public useAlphaFromAlbedoTexture = false;\r\n\r\n /**\r\n * Enforces alpha test in opaque or blend mode in order to improve the performances of some situations.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\r\n public forceAlphaTest = false;\r\n\r\n /**\r\n * Defines the alpha limits in alpha test mode.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\r\n public alphaCutOff = 0.4;\r\n\r\n /**\r\n * Specifies that the material will keep the specular highlights over a transparent surface (only the most luminous ones).\r\n * A car glass is a good example of that. When sun reflects on it you can not see what is behind.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useSpecularOverAlpha = true;\r\n\r\n /**\r\n * Specifies if the reflectivity texture contains the glossiness information in its alpha channel.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useMicroSurfaceFromReflectivityMapAlpha = false;\r\n\r\n /**\r\n * Specifies if the metallic texture contains the roughness information in its alpha channel.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useRoughnessFromMetallicTextureAlpha = true;\r\n\r\n /**\r\n * Specifies if the metallic texture contains the roughness information in its green channel.\r\n * Needs useRoughnessFromMetallicTextureAlpha to be false.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useRoughnessFromMetallicTextureGreen = false;\r\n\r\n /**\r\n * Specifies if the metallic texture contains the metallness information in its blue channel.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useMetallnessFromMetallicTextureBlue = false;\r\n\r\n /**\r\n * Specifies if the metallic texture contains the ambient occlusion information in its red channel.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useAmbientOcclusionFromMetallicTextureRed = false;\r\n\r\n /**\r\n * Specifies if the ambient texture contains the ambient occlusion information in its red channel only.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useAmbientInGrayScale = false;\r\n\r\n /**\r\n * In case the reflectivity map does not contain the microsurface information in its alpha channel,\r\n * The material will try to infer what glossiness each pixel should be.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useAutoMicroSurfaceFromReflectivityMap = false;\r\n\r\n /**\r\n * BJS is using an hardcoded light falloff based on a manually sets up range.\r\n * In PBR, one way to represents the falloff is to use the inverse squared root algorithm.\r\n * This parameter can help you switch back to the BJS mode in order to create scenes using both materials.\r\n */\r\n @serialize()\r\n public get usePhysicalLightFalloff(): boolean {\r\n return this._lightFalloff === PBRBaseMaterial.LIGHTFALLOFF_PHYSICAL;\r\n }\r\n\r\n /**\r\n * BJS is using an hardcoded light falloff based on a manually sets up range.\r\n * In PBR, one way to represents the falloff is to use the inverse squared root algorithm.\r\n * This parameter can help you switch back to the BJS mode in order to create scenes using both materials.\r\n */\r\n public set usePhysicalLightFalloff(value: boolean) {\r\n if (value !== this.usePhysicalLightFalloff) {\r\n // Ensure the effect will be rebuilt.\r\n this._markAllSubMeshesAsTexturesDirty();\r\n\r\n if (value) {\r\n this._lightFalloff = PBRBaseMaterial.LIGHTFALLOFF_PHYSICAL;\r\n } else {\r\n this._lightFalloff = PBRBaseMaterial.LIGHTFALLOFF_STANDARD;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * In order to support the falloff compatibility with gltf, a special mode has been added\r\n * to reproduce the gltf light falloff.\r\n */\r\n @serialize()\r\n public get useGLTFLightFalloff(): boolean {\r\n return this._lightFalloff === PBRBaseMaterial.LIGHTFALLOFF_GLTF;\r\n }\r\n\r\n /**\r\n * In order to support the falloff compatibility with gltf, a special mode has been added\r\n * to reproduce the gltf light falloff.\r\n */\r\n public set useGLTFLightFalloff(value: boolean) {\r\n if (value !== this.useGLTFLightFalloff) {\r\n // Ensure the effect will be rebuilt.\r\n this._markAllSubMeshesAsTexturesDirty();\r\n\r\n if (value) {\r\n this._lightFalloff = PBRBaseMaterial.LIGHTFALLOFF_GLTF;\r\n } else {\r\n this._lightFalloff = PBRBaseMaterial.LIGHTFALLOFF_STANDARD;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Specifies that the material will keeps the reflection highlights over a transparent surface (only the most luminous ones).\r\n * A car glass is a good example of that. When the street lights reflects on it you can not see what is behind.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useRadianceOverAlpha = true;\r\n\r\n /**\r\n * Allows using an object space normal map (instead of tangent space).\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useObjectSpaceNormalMap = false;\r\n\r\n /**\r\n * Allows using the bump map in parallax mode.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useParallax = false;\r\n\r\n /**\r\n * Allows using the bump map in parallax occlusion mode.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useParallaxOcclusion = false;\r\n\r\n /**\r\n * Controls the scale bias of the parallax mode.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public parallaxScaleBias = 0.05;\r\n\r\n /**\r\n * If sets to true, disables all the lights affecting the material.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public disableLighting = false;\r\n\r\n /**\r\n * Force the shader to compute irradiance in the fragment shader in order to take bump in account.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public forceIrradianceInFragment = false;\r\n\r\n /**\r\n * Number of Simultaneous lights allowed on the material.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public maxSimultaneousLights = 4;\r\n\r\n /**\r\n * If sets to true, x component of normal map value will invert (x = 1.0 - x).\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public invertNormalMapX = false;\r\n\r\n /**\r\n * If sets to true, y component of normal map value will invert (y = 1.0 - y).\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public invertNormalMapY = false;\r\n\r\n /**\r\n * If sets to true and backfaceCulling is false, normals will be flipped on the backside.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public twoSidedLighting = false;\r\n\r\n /**\r\n * A fresnel is applied to the alpha of the model to ensure grazing angles edges are not alpha tested.\r\n * And/Or occlude the blended part. (alpha is converted to gamma to compute the fresnel)\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useAlphaFresnel = false;\r\n\r\n /**\r\n * A fresnel is applied to the alpha of the model to ensure grazing angles edges are not alpha tested.\r\n * And/Or occlude the blended part. (alpha stays linear to compute the fresnel)\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useLinearAlphaFresnel = false;\r\n\r\n /**\r\n * Let user defines the brdf lookup texture used for IBL.\r\n * A default 8bit version is embedded but you could point at :\r\n * * Default texture: https://assets.babylonjs.com/environments/correlatedMSBRDF_RGBD.png\r\n * * Default 16bit pixel depth texture: https://assets.babylonjs.com/environments/correlatedMSBRDF.dds\r\n * * LEGACY Default None correlated https://assets.babylonjs.com/environments/uncorrelatedBRDF_RGBD.png\r\n * * LEGACY Default None correlated 16bit pixel depth https://assets.babylonjs.com/environments/uncorrelatedBRDF.dds\r\n */\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public environmentBRDFTexture: Nullable<BaseTexture> = null;\r\n\r\n /**\r\n * Force normal to face away from face.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public forceNormalForward = false;\r\n\r\n /**\r\n * Enables specular anti aliasing in the PBR shader.\r\n * It will both interacts on the Geometry for analytical and IBL lighting.\r\n * It also prefilter the roughness map based on the bump values.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public enableSpecularAntiAliasing = false;\r\n\r\n /**\r\n * This parameters will enable/disable Horizon occlusion to prevent normal maps to look shiny when the normal\r\n * makes the reflect vector face the model (under horizon).\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useHorizonOcclusion = true;\r\n\r\n /**\r\n * This parameters will enable/disable radiance occlusion by preventing the radiance to lit\r\n * too much the area relying on ambient texture to define their ambient occlusion.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useRadianceOcclusion = true;\r\n\r\n /**\r\n * If set to true, no lighting calculations will be applied.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsMiscDirty\")\r\n public unlit = false;\r\n\r\n /**\r\n * If sets to true, the decal map will be applied after the detail map. Else, it is applied before (default: false)\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsMiscDirty\")\r\n public applyDecalMapAfterDetailMap = false;\r\n\r\n /**\r\n * Gets the image processing configuration used either in this material.\r\n */\r\n public get imageProcessingConfiguration(): ImageProcessingConfiguration {\r\n return this._imageProcessingConfiguration;\r\n }\r\n\r\n /**\r\n * Sets the Default image processing configuration used either in the this material.\r\n *\r\n * If sets to null, the scene one is in use.\r\n */\r\n public set imageProcessingConfiguration(value: ImageProcessingConfiguration) {\r\n this._attachImageProcessingConfiguration(value);\r\n\r\n // Ensure the effect will be rebuilt.\r\n this._markAllSubMeshesAsTexturesDirty();\r\n }\r\n\r\n /**\r\n * Gets whether the color curves effect is enabled.\r\n */\r\n public get cameraColorCurvesEnabled(): boolean {\r\n return this.imageProcessingConfiguration.colorCurvesEnabled;\r\n }\r\n /**\r\n * Sets whether the color curves effect is enabled.\r\n */\r\n public set cameraColorCurvesEnabled(value: boolean) {\r\n this.imageProcessingConfiguration.colorCurvesEnabled = value;\r\n }\r\n\r\n /**\r\n * Gets whether the color grading effect is enabled.\r\n */\r\n public get cameraColorGradingEnabled(): boolean {\r\n return this.imageProcessingConfiguration.colorGradingEnabled;\r\n }\r\n /**\r\n * Gets whether the color grading effect is enabled.\r\n */\r\n public set cameraColorGradingEnabled(value: boolean) {\r\n this.imageProcessingConfiguration.colorGradingEnabled = value;\r\n }\r\n\r\n /**\r\n * Gets whether tonemapping is enabled or not.\r\n */\r\n public get cameraToneMappingEnabled(): boolean {\r\n return this._imageProcessingConfiguration.toneMappingEnabled;\r\n }\r\n /**\r\n * Sets whether tonemapping is enabled or not\r\n */\r\n public set cameraToneMappingEnabled(value: boolean) {\r\n this._imageProcessingConfiguration.toneMappingEnabled = value;\r\n }\r\n\r\n /**\r\n * The camera exposure used on this material.\r\n * This property is here and not in the camera to allow controlling exposure without full screen post process.\r\n * This corresponds to a photographic exposure.\r\n */\r\n public get cameraExposure(): number {\r\n return this._imageProcessingConfiguration.exposure;\r\n }\r\n /**\r\n * The camera exposure used on this material.\r\n * This property is here and not in the camera to allow controlling exposure without full screen post process.\r\n * This corresponds to a photographic exposure.\r\n */\r\n public set cameraExposure(value: number) {\r\n this._imageProcessingConfiguration.exposure = value;\r\n }\r\n\r\n /**\r\n * Gets The camera contrast used on this material.\r\n */\r\n public get cameraContrast(): number {\r\n return this._imageProcessingConfiguration.contrast;\r\n }\r\n\r\n /**\r\n * Sets The camera contrast used on this material.\r\n */\r\n public set cameraContrast(value: number) {\r\n this._imageProcessingConfiguration.contrast = value;\r\n }\r\n\r\n /**\r\n * Gets the Color Grading 2D Lookup Texture.\r\n */\r\n public get cameraColorGradingTexture(): Nullable<BaseTexture> {\r\n return this._imageProcessingConfiguration.colorGradingTexture;\r\n }\r\n /**\r\n * Sets the Color Grading 2D Lookup Texture.\r\n */\r\n public set cameraColorGradingTexture(value: Nullable<BaseTexture>) {\r\n this._imageProcessingConfiguration.colorGradingTexture = value;\r\n }\r\n\r\n /**\r\n * The color grading curves provide additional color adjustment that is applied after any color grading transform (3D LUT).\r\n * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.\r\n * 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;\r\n * corresponding to low luminance, medium luminance, and high luminance areas respectively.\r\n */\r\n public get cameraColorCurves(): Nullable<ColorCurves> {\r\n return this._imageProcessingConfiguration.colorCurves;\r\n }\r\n /**\r\n * The color grading curves provide additional color adjustment that is applied after any color grading transform (3D LUT).\r\n * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.\r\n * 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;\r\n * corresponding to low luminance, medium luminance, and high luminance areas respectively.\r\n */\r\n public set cameraColorCurves(value: Nullable<ColorCurves>) {\r\n this._imageProcessingConfiguration.colorCurves = value;\r\n }\r\n\r\n /**\r\n * Instantiates a new PBRMaterial instance.\r\n *\r\n * @param name The material name\r\n * @param scene The scene the material will be use in.\r\n * @param forceGLSL Use the GLSL code generation for the shader (even on WebGPU). Default is false\r\n */\r\n constructor(name: string, scene?: Scene, forceGLSL = false) {\r\n super(name, scene, forceGLSL);\r\n\r\n this._environmentBRDFTexture = GetEnvironmentBRDFTexture(this.getScene());\r\n }\r\n\r\n /**\r\n * @returns the name of this material class.\r\n */\r\n public override getClassName(): string {\r\n return \"PBRMaterial\";\r\n }\r\n\r\n /**\r\n * Makes a duplicate of the current material.\r\n * @param name - name to use for the new material.\r\n * @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.\r\n * @param rootUrl defines the root URL to use to load textures\r\n * @returns cloned material instance\r\n */\r\n public override clone(name: string, cloneTexturesOnlyOnce: boolean = true, rootUrl = \"\"): PBRMaterial {\r\n const clone = SerializationHelper.Clone(() => new PBRMaterial(name, this.getScene()), this, { cloneTexturesOnlyOnce });\r\n\r\n clone.id = name;\r\n clone.name = name;\r\n\r\n this.stencil.copyTo(clone.stencil);\r\n\r\n this._clonePlugins(clone, rootUrl);\r\n\r\n return clone;\r\n }\r\n\r\n /**\r\n * Serializes this PBR Material.\r\n * @returns - An object with the serialized material.\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.customType = \"BABYLON.PBRMaterial\";\r\n\r\n return serializationObject;\r\n }\r\n\r\n // Statics\r\n /**\r\n * Parses a PBR Material from a serialized object.\r\n * @param source - Serialized object.\r\n * @param scene - BJS scene instance.\r\n * @param rootUrl - url for the scene object\r\n * @returns - PBRMaterial\r\n */\r\n public static override Parse(source: any, scene: Scene, rootUrl: string): PBRMaterial {\r\n const material = SerializationHelper.Parse(() => new PBRMaterial(source.name, scene), source, scene, rootUrl);\r\n\r\n if (source.stencil) {\r\n material.stencil.parse(source.stencil, scene, rootUrl);\r\n }\r\n\r\n Material._ParsePlugins(source, material, scene, rootUrl);\r\n\r\n // The code block below ensures backward compatibility with serialized materials before plugins are automatically serialized.\r\n if (source.clearCoat) {\r\n material.clearCoat.parse(source.clearCoat, scene, rootUrl);\r\n }\r\n if (source.anisotropy) {\r\n material.anisotropy.parse(source.anisotropy, scene, rootUrl);\r\n }\r\n if (source.brdf) {\r\n material.brdf.parse(source.brdf, scene, rootUrl);\r\n }\r\n if (source.sheen) {\r\n material.sheen.parse(source.sheen, scene, rootUrl);\r\n }\r\n if (source.subSurface) {\r\n material.subSurface.parse(source.subSurface, scene, rootUrl);\r\n }\r\n if (source.iridescence) {\r\n material.iridescence.parse(source.iridescence, scene, rootUrl);\r\n }\r\n\r\n return material;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.PBRMaterial\", PBRMaterial);\r\n"]}
|
|
@@ -163,6 +163,11 @@ export class HDRIrradianceFiltering {
|
|
|
163
163
|
this._effectWrapper = this._createEffect(texture);
|
|
164
164
|
await this._effectWrapper.effect.whenCompiledAsync();
|
|
165
165
|
const irradianceTexture = this._prefilterInternal(texture);
|
|
166
|
+
if (this.useCdf) {
|
|
167
|
+
await this._cdfGenerator.findDominantDirection().then((dir) => {
|
|
168
|
+
irradianceTexture._dominantDirection = dir;
|
|
169
|
+
});
|
|
170
|
+
}
|
|
166
171
|
this._effectRenderer.dispose();
|
|
167
172
|
this._effectWrapper.dispose();
|
|
168
173
|
this._cdfGenerator?.dispose();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hdrIrradianceFiltering.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Materials/Textures/Filtering/hdrIrradianceFiltering.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,sCAAsC,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAKlF,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAsBrE;;GAEG;AACH,MAAM,OAAO,sBAAsB;IAsB/B;;;;;OAKG;IACH,YAAY,MAAsB,EAAE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AC;QAEH,OAAO,aAAa,CAAC;IACzB,CAAC;IAED;;;;OAIG;IACI,OAAO,CAAC,OAAoB;QAC/B,OAAO,OAAO,CAAC,OAAO,EAAE,IAAI,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;IACrE,CAAC;IAED;;;;;;;OAOG;IACH,gEAAgE;IACzD,KAAK,CAAC,SAAS,CAAC,OAAoB;QACvC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,wBAAwB,EAAE,CAAC;YACnD,MAAM,IAAI,KAAK,CAAC,yFAAyF,CAAC,CAAC;QAC/G,CAAC;QAED,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YACd,IAAI,CAAC,aAAa,GAAG,IAAI,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACvD,IAAI,CAAC,aAAa,CAAC,SAAS,GAAG,OAAO,CAAC;YAEvC,MAAM,IAAI,CAAC,aAAa,CAAC,eAAe,EAAE,CAAC;QAC/C,CAAC;QAED,IAAI,CAAC,eAAe,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxD,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QAClD,MAAM,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC;QAErD,MAAM,iBAAiB,GAAG,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;QAC3D,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,CAAC;QAC/B,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;QAC9B,IAAI,CAAC,aAAa,EAAE,OAAO,EAAE,CAAC;QAE9B,OAAO,iBAAiB,CAAC;IAC7B,CAAC;CACJ","sourcesContent":["import { Vector3 } from \"../../../Maths/math\";\r\nimport { ILog2 } from \"../../../Maths/math.scalar.functions\";\r\nimport { BaseTexture } from \"../baseTexture\";\r\nimport type { AbstractEngine } from \"../../../Engines/abstractEngine\";\r\nimport type { Effect } from \"../../../Materials/effect\";\r\nimport { Constants } from \"../../../Engines/constants\";\r\nimport { EffectWrapper, EffectRenderer } from \"../../../Materials/effectRenderer\";\r\nimport type { Nullable } from \"../../../types\";\r\nimport type { RenderTargetWrapper } from \"../../../Engines/renderTargetWrapper\";\r\n\r\nimport { ShaderLanguage } from \"core/Materials/shaderLanguage\";\r\nimport { IblCdfGenerator } from \"../../../Rendering/iblCdfGenerator\";\r\n\r\n/**\r\n * Options for texture filtering\r\n */\r\ninterface IHDRIrradianceFilteringOptions {\r\n /**\r\n * Scales pixel intensity for the input HDR map.\r\n */\r\n hdrScale?: number;\r\n\r\n /**\r\n * Quality of the filter. Should be `Constants.TEXTURE_FILTERING_QUALITY_OFFLINE` for prefiltering\r\n */\r\n quality?: number;\r\n\r\n /**\r\n * Use the Cumulative Distribution Function (CDF) for filtering\r\n */\r\n useCdf?: boolean;\r\n}\r\n\r\n/**\r\n * Filters HDR maps to get correct renderings of PBR reflections\r\n */\r\nexport class HDRIrradianceFiltering {\r\n private _engine: AbstractEngine;\r\n private _effectRenderer: EffectRenderer;\r\n private _effectWrapper: EffectWrapper;\r\n private _cdfGenerator: IblCdfGenerator;\r\n\r\n /**\r\n * Quality switch for prefiltering. Should be set to `Constants.TEXTURE_FILTERING_QUALITY_OFFLINE` unless\r\n * you care about baking speed.\r\n */\r\n public quality: number = Constants.TEXTURE_FILTERING_QUALITY_OFFLINE;\r\n\r\n /**\r\n * Scales pixel intensity for the input HDR map.\r\n */\r\n public hdrScale: number = 1;\r\n\r\n /**\r\n * Use the Cumulative Distribution Function (CDF) for filtering\r\n */\r\n public useCdf: boolean = false;\r\n\r\n /**\r\n * Instantiates HDR filter for irradiance map\r\n *\r\n * @param engine Thin engine\r\n * @param options Options\r\n */\r\n constructor(engine: AbstractEngine, options: IHDRIrradianceFilteringOptions = {}) {\r\n // pass\r\n this._engine = engine;\r\n this.hdrScale = options.hdrScale || this.hdrScale;\r\n this.quality = options.quality || this.quality;\r\n this.useCdf = options.useCdf || this.useCdf;\r\n }\r\n\r\n private _createRenderTarget(size: number): RenderTargetWrapper {\r\n let textureType = Constants.TEXTURETYPE_UNSIGNED_BYTE;\r\n if (this._engine.getCaps().textureHalfFloatRender) {\r\n textureType = Constants.TEXTURETYPE_HALF_FLOAT;\r\n } else if (this._engine.getCaps().textureFloatRender) {\r\n textureType = Constants.TEXTURETYPE_FLOAT;\r\n }\r\n\r\n const rtWrapper = this._engine.createRenderTargetCubeTexture(size, {\r\n format: Constants.TEXTUREFORMAT_RGBA,\r\n type: textureType,\r\n createMipMaps: false,\r\n generateMipMaps: false,\r\n generateDepthBuffer: false,\r\n generateStencilBuffer: false,\r\n samplingMode: Constants.TEXTURE_BILINEAR_SAMPLINGMODE,\r\n label: \"HDR_Irradiance_Filtering_Target\",\r\n });\r\n this._engine.updateTextureWrappingMode(rtWrapper.texture!, Constants.TEXTURE_CLAMP_ADDRESSMODE, Constants.TEXTURE_CLAMP_ADDRESSMODE, Constants.TEXTURE_CLAMP_ADDRESSMODE);\r\n\r\n return rtWrapper;\r\n }\r\n\r\n private _prefilterInternal(texture: BaseTexture): BaseTexture {\r\n const width = texture.getSize().width;\r\n const mipmapsCount = ILog2(width);\r\n\r\n const effect = this._effectWrapper.effect;\r\n // Choose a power of 2 size for the irradiance map.\r\n // It can be much smaller than the original texture.\r\n const irradianceSize = Math.max(32, 1 << ILog2(width >> 3));\r\n const outputTexture = this._createRenderTarget(irradianceSize);\r\n this._effectRenderer.saveStates();\r\n this._effectRenderer.setViewport();\r\n\r\n this._effectRenderer.applyEffectWrapper(this._effectWrapper);\r\n\r\n const directions = [\r\n [new Vector3(0, 0, -1), new Vector3(0, -1, 0), new Vector3(1, 0, 0)], // PositiveX\r\n [new Vector3(0, 0, 1), new Vector3(0, -1, 0), new Vector3(-1, 0, 0)], // NegativeX\r\n [new Vector3(1, 0, 0), new Vector3(0, 0, 1), new Vector3(0, 1, 0)], // PositiveY\r\n [new Vector3(1, 0, 0), new Vector3(0, 0, -1), new Vector3(0, -1, 0)], // NegativeY\r\n [new Vector3(1, 0, 0), new Vector3(0, -1, 0), new Vector3(0, 0, 1)], // PositiveZ\r\n [new Vector3(-1, 0, 0), new Vector3(0, -1, 0), new Vector3(0, 0, -1)], // NegativeZ\r\n ];\r\n\r\n effect.setFloat(\"hdrScale\", this.hdrScale);\r\n effect.setFloat2(\"vFilteringInfo\", texture.getSize().width, mipmapsCount);\r\n effect.setTexture(\"inputTexture\", texture);\r\n if (this._cdfGenerator) {\r\n effect.setTexture(\"icdfTexture\", this._cdfGenerator.getIcdfTexture());\r\n }\r\n\r\n for (let face = 0; face < 6; face++) {\r\n effect.setVector3(\"up\", directions[face][0]);\r\n effect.setVector3(\"right\", directions[face][1]);\r\n effect.setVector3(\"front\", directions[face][2]);\r\n\r\n this._engine.bindFramebuffer(outputTexture, face, undefined, undefined, true);\r\n this._effectRenderer.applyEffectWrapper(this._effectWrapper);\r\n\r\n this._effectRenderer.draw();\r\n }\r\n\r\n // Cleanup\r\n this._effectRenderer.restoreStates();\r\n this._engine.restoreDefaultFramebuffer();\r\n effect.setTexture(\"inputTexture\", null);\r\n effect.setTexture(\"icdfTexture\", null);\r\n const irradianceTexture = new BaseTexture(texture.getScene(), outputTexture.texture);\r\n irradianceTexture.name = texture.name + \"_irradiance\";\r\n irradianceTexture.displayName = texture.name + \"_irradiance\";\r\n irradianceTexture.gammaSpace = false;\r\n return irradianceTexture;\r\n }\r\n\r\n private _createEffect(texture: BaseTexture, onCompiled?: Nullable<(effect: Effect) => void>): EffectWrapper {\r\n const defines = [];\r\n if (texture.gammaSpace) {\r\n defines.push(\"#define GAMMA_INPUT\");\r\n }\r\n\r\n defines.push(\"#define NUM_SAMPLES \" + this.quality + \"u\"); // unsigned int\r\n\r\n const isWebGPU = this._engine.isWebGPU;\r\n const samplers = [\"inputTexture\"];\r\n if (this._cdfGenerator) {\r\n samplers.push(\"icdfTexture\");\r\n defines.push(\"#define IBL_CDF_FILTERING\");\r\n }\r\n const effectWrapper = new EffectWrapper({\r\n engine: this._engine,\r\n name: \"HDRIrradianceFiltering\",\r\n vertexShader: \"hdrIrradianceFiltering\",\r\n fragmentShader: \"hdrIrradianceFiltering\",\r\n samplerNames: samplers,\r\n uniformNames: [\"vSampleDirections\", \"vWeights\", \"up\", \"right\", \"front\", \"vFilteringInfo\", \"hdrScale\"],\r\n useShaderStore: true,\r\n defines,\r\n onCompiled: onCompiled,\r\n shaderLanguage: isWebGPU ? ShaderLanguage.WGSL : ShaderLanguage.GLSL,\r\n extraInitializationsAsync: async () => {\r\n if (isWebGPU) {\r\n await Promise.all([import(\"../../../ShadersWGSL/hdrIrradianceFiltering.vertex\"), import(\"../../../ShadersWGSL/hdrIrradianceFiltering.fragment\")]);\r\n } else {\r\n await Promise.all([import(\"../../../Shaders/hdrIrradianceFiltering.vertex\"), import(\"../../../Shaders/hdrIrradianceFiltering.fragment\")]);\r\n }\r\n },\r\n });\r\n\r\n return effectWrapper;\r\n }\r\n\r\n /**\r\n * Get a value indicating if the filter is ready to be used\r\n * @param texture Texture to filter\r\n * @returns true if the filter is ready\r\n */\r\n public isReady(texture: BaseTexture) {\r\n return texture.isReady() && this._effectWrapper.effect.isReady();\r\n }\r\n\r\n /**\r\n * Prefilters a cube texture to contain IBL irradiance.\r\n * Prefiltering will be invoked at the end of next rendering pass.\r\n * This has to be done once the map is loaded, and has not been prefiltered by a third party software.\r\n * See http://blog.selfshadow.com/publications/s2013-shading-course/karis/s2013_pbs_epic_notes_v2.pdf for more information\r\n * @param texture Texture to filter\r\n * @returns Promise called when prefiltering is done\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public async prefilter(texture: BaseTexture): Promise<BaseTexture> {\r\n if (!this._engine._features.allowTexturePrefiltering) {\r\n throw new Error(\"HDR prefiltering is not available in WebGL 1., you can use real time filtering instead.\");\r\n }\r\n\r\n if (this.useCdf) {\r\n this._cdfGenerator = new IblCdfGenerator(this._engine);\r\n this._cdfGenerator.iblSource = texture;\r\n\r\n await this._cdfGenerator.renderWhenReady();\r\n }\r\n\r\n this._effectRenderer = new EffectRenderer(this._engine);\r\n this._effectWrapper = this._createEffect(texture);\r\n await this._effectWrapper.effect.whenCompiledAsync();\r\n\r\n const irradianceTexture = this._prefilterInternal(texture);\r\n this._effectRenderer.dispose();\r\n this._effectWrapper.dispose();\r\n this._cdfGenerator?.dispose();\r\n\r\n return irradianceTexture;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"hdrIrradianceFiltering.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Materials/Textures/Filtering/hdrIrradianceFiltering.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,sCAAsC,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAKlF,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAsBrE;;GAEG;AACH,MAAM,OAAO,sBAAsB;IAsB/B;;;;;OAKG;IACH,YAAY,MAAsB,EAAE,UAA0C,EAAE;QAtBhF;;;WAGG;QACI,YAAO,GAAW,SAAS,CAAC,iCAAiC,CAAC;QAErE;;WAEG;QACI,aAAQ,GAAW,CAAC,CAAC;QAE5B;;WAEG;QACI,WAAM,GAAY,KAAK,CAAC;QAS3B,OAAO;QACP,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC;QAClD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC;QAC/C,IAAI,C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AAC;QAED,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YACd,IAAI,CAAC,aAAa,GAAG,IAAI,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACvD,IAAI,CAAC,aAAa,CAAC,SAAS,GAAG,OAAO,CAAC;YAEvC,MAAM,IAAI,CAAC,aAAa,CAAC,eAAe,EAAE,CAAC;QAC/C,CAAC;QAED,IAAI,CAAC,eAAe,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxD,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QAClD,MAAM,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC;QAErD,MAAM,iBAAiB,GAAG,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;QAE3D,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YACd,MAAM,IAAI,CAAC,aAAa,CAAC,qBAAqB,EAAE,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE;gBAC1D,iBAAiB,CAAC,kBAAkB,GAAG,GAAG,CAAC;YAC/C,CAAC,CAAC,CAAC;QACP,CAAC;QACD,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,CAAC;QAC/B,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;QAC9B,IAAI,CAAC,aAAa,EAAE,OAAO,EAAE,CAAC;QAE9B,OAAO,iBAAiB,CAAC;IAC7B,CAAC;CACJ","sourcesContent":["import { Vector3 } from \"../../../Maths/math\";\r\nimport { ILog2 } from \"../../../Maths/math.scalar.functions\";\r\nimport { BaseTexture } from \"../baseTexture\";\r\nimport type { AbstractEngine } from \"../../../Engines/abstractEngine\";\r\nimport type { Effect } from \"../../../Materials/effect\";\r\nimport { Constants } from \"../../../Engines/constants\";\r\nimport { EffectWrapper, EffectRenderer } from \"../../../Materials/effectRenderer\";\r\nimport type { Nullable } from \"../../../types\";\r\nimport type { RenderTargetWrapper } from \"../../../Engines/renderTargetWrapper\";\r\n\r\nimport { ShaderLanguage } from \"core/Materials/shaderLanguage\";\r\nimport { IblCdfGenerator } from \"../../../Rendering/iblCdfGenerator\";\r\n\r\n/**\r\n * Options for texture filtering\r\n */\r\ninterface IHDRIrradianceFilteringOptions {\r\n /**\r\n * Scales pixel intensity for the input HDR map.\r\n */\r\n hdrScale?: number;\r\n\r\n /**\r\n * Quality of the filter. Should be `Constants.TEXTURE_FILTERING_QUALITY_OFFLINE` for prefiltering\r\n */\r\n quality?: number;\r\n\r\n /**\r\n * Use the Cumulative Distribution Function (CDF) for filtering\r\n */\r\n useCdf?: boolean;\r\n}\r\n\r\n/**\r\n * Filters HDR maps to get correct renderings of PBR reflections\r\n */\r\nexport class HDRIrradianceFiltering {\r\n private _engine: AbstractEngine;\r\n private _effectRenderer: EffectRenderer;\r\n private _effectWrapper: EffectWrapper;\r\n private _cdfGenerator: IblCdfGenerator;\r\n\r\n /**\r\n * Quality switch for prefiltering. Should be set to `Constants.TEXTURE_FILTERING_QUALITY_OFFLINE` unless\r\n * you care about baking speed.\r\n */\r\n public quality: number = Constants.TEXTURE_FILTERING_QUALITY_OFFLINE;\r\n\r\n /**\r\n * Scales pixel intensity for the input HDR map.\r\n */\r\n public hdrScale: number = 1;\r\n\r\n /**\r\n * Use the Cumulative Distribution Function (CDF) for filtering\r\n */\r\n public useCdf: boolean = false;\r\n\r\n /**\r\n * Instantiates HDR filter for irradiance map\r\n *\r\n * @param engine Thin engine\r\n * @param options Options\r\n */\r\n constructor(engine: AbstractEngine, options: IHDRIrradianceFilteringOptions = {}) {\r\n // pass\r\n this._engine = engine;\r\n this.hdrScale = options.hdrScale || this.hdrScale;\r\n this.quality = options.quality || this.quality;\r\n this.useCdf = options.useCdf || this.useCdf;\r\n }\r\n\r\n private _createRenderTarget(size: number): RenderTargetWrapper {\r\n let textureType = Constants.TEXTURETYPE_UNSIGNED_BYTE;\r\n if (this._engine.getCaps().textureHalfFloatRender) {\r\n textureType = Constants.TEXTURETYPE_HALF_FLOAT;\r\n } else if (this._engine.getCaps().textureFloatRender) {\r\n textureType = Constants.TEXTURETYPE_FLOAT;\r\n }\r\n\r\n const rtWrapper = this._engine.createRenderTargetCubeTexture(size, {\r\n format: Constants.TEXTUREFORMAT_RGBA,\r\n type: textureType,\r\n createMipMaps: false,\r\n generateMipMaps: false,\r\n generateDepthBuffer: false,\r\n generateStencilBuffer: false,\r\n samplingMode: Constants.TEXTURE_BILINEAR_SAMPLINGMODE,\r\n label: \"HDR_Irradiance_Filtering_Target\",\r\n });\r\n this._engine.updateTextureWrappingMode(rtWrapper.texture!, Constants.TEXTURE_CLAMP_ADDRESSMODE, Constants.TEXTURE_CLAMP_ADDRESSMODE, Constants.TEXTURE_CLAMP_ADDRESSMODE);\r\n\r\n return rtWrapper;\r\n }\r\n\r\n private _prefilterInternal(texture: BaseTexture): BaseTexture {\r\n const width = texture.getSize().width;\r\n const mipmapsCount = ILog2(width);\r\n\r\n const effect = this._effectWrapper.effect;\r\n // Choose a power of 2 size for the irradiance map.\r\n // It can be much smaller than the original texture.\r\n const irradianceSize = Math.max(32, 1 << ILog2(width >> 3));\r\n const outputTexture = this._createRenderTarget(irradianceSize);\r\n this._effectRenderer.saveStates();\r\n this._effectRenderer.setViewport();\r\n\r\n this._effectRenderer.applyEffectWrapper(this._effectWrapper);\r\n\r\n const directions = [\r\n [new Vector3(0, 0, -1), new Vector3(0, -1, 0), new Vector3(1, 0, 0)], // PositiveX\r\n [new Vector3(0, 0, 1), new Vector3(0, -1, 0), new Vector3(-1, 0, 0)], // NegativeX\r\n [new Vector3(1, 0, 0), new Vector3(0, 0, 1), new Vector3(0, 1, 0)], // PositiveY\r\n [new Vector3(1, 0, 0), new Vector3(0, 0, -1), new Vector3(0, -1, 0)], // NegativeY\r\n [new Vector3(1, 0, 0), new Vector3(0, -1, 0), new Vector3(0, 0, 1)], // PositiveZ\r\n [new Vector3(-1, 0, 0), new Vector3(0, -1, 0), new Vector3(0, 0, -1)], // NegativeZ\r\n ];\r\n\r\n effect.setFloat(\"hdrScale\", this.hdrScale);\r\n effect.setFloat2(\"vFilteringInfo\", texture.getSize().width, mipmapsCount);\r\n effect.setTexture(\"inputTexture\", texture);\r\n if (this._cdfGenerator) {\r\n effect.setTexture(\"icdfTexture\", this._cdfGenerator.getIcdfTexture());\r\n }\r\n\r\n for (let face = 0; face < 6; face++) {\r\n effect.setVector3(\"up\", directions[face][0]);\r\n effect.setVector3(\"right\", directions[face][1]);\r\n effect.setVector3(\"front\", directions[face][2]);\r\n\r\n this._engine.bindFramebuffer(outputTexture, face, undefined, undefined, true);\r\n this._effectRenderer.applyEffectWrapper(this._effectWrapper);\r\n\r\n this._effectRenderer.draw();\r\n }\r\n\r\n // Cleanup\r\n this._effectRenderer.restoreStates();\r\n this._engine.restoreDefaultFramebuffer();\r\n effect.setTexture(\"inputTexture\", null);\r\n effect.setTexture(\"icdfTexture\", null);\r\n const irradianceTexture = new BaseTexture(texture.getScene(), outputTexture.texture);\r\n irradianceTexture.name = texture.name + \"_irradiance\";\r\n irradianceTexture.displayName = texture.name + \"_irradiance\";\r\n irradianceTexture.gammaSpace = false;\r\n return irradianceTexture;\r\n }\r\n\r\n private _createEffect(texture: BaseTexture, onCompiled?: Nullable<(effect: Effect) => void>): EffectWrapper {\r\n const defines = [];\r\n if (texture.gammaSpace) {\r\n defines.push(\"#define GAMMA_INPUT\");\r\n }\r\n\r\n defines.push(\"#define NUM_SAMPLES \" + this.quality + \"u\"); // unsigned int\r\n\r\n const isWebGPU = this._engine.isWebGPU;\r\n const samplers = [\"inputTexture\"];\r\n if (this._cdfGenerator) {\r\n samplers.push(\"icdfTexture\");\r\n defines.push(\"#define IBL_CDF_FILTERING\");\r\n }\r\n const effectWrapper = new EffectWrapper({\r\n engine: this._engine,\r\n name: \"HDRIrradianceFiltering\",\r\n vertexShader: \"hdrIrradianceFiltering\",\r\n fragmentShader: \"hdrIrradianceFiltering\",\r\n samplerNames: samplers,\r\n uniformNames: [\"vSampleDirections\", \"vWeights\", \"up\", \"right\", \"front\", \"vFilteringInfo\", \"hdrScale\"],\r\n useShaderStore: true,\r\n defines,\r\n onCompiled: onCompiled,\r\n shaderLanguage: isWebGPU ? ShaderLanguage.WGSL : ShaderLanguage.GLSL,\r\n extraInitializationsAsync: async () => {\r\n if (isWebGPU) {\r\n await Promise.all([import(\"../../../ShadersWGSL/hdrIrradianceFiltering.vertex\"), import(\"../../../ShadersWGSL/hdrIrradianceFiltering.fragment\")]);\r\n } else {\r\n await Promise.all([import(\"../../../Shaders/hdrIrradianceFiltering.vertex\"), import(\"../../../Shaders/hdrIrradianceFiltering.fragment\")]);\r\n }\r\n },\r\n });\r\n\r\n return effectWrapper;\r\n }\r\n\r\n /**\r\n * Get a value indicating if the filter is ready to be used\r\n * @param texture Texture to filter\r\n * @returns true if the filter is ready\r\n */\r\n public isReady(texture: BaseTexture) {\r\n return texture.isReady() && this._effectWrapper.effect.isReady();\r\n }\r\n\r\n /**\r\n * Prefilters a cube texture to contain IBL irradiance.\r\n * Prefiltering will be invoked at the end of next rendering pass.\r\n * This has to be done once the map is loaded, and has not been prefiltered by a third party software.\r\n * See http://blog.selfshadow.com/publications/s2013-shading-course/karis/s2013_pbs_epic_notes_v2.pdf for more information\r\n * @param texture Texture to filter\r\n * @returns Promise called when prefiltering is done\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public async prefilter(texture: BaseTexture): Promise<BaseTexture> {\r\n if (!this._engine._features.allowTexturePrefiltering) {\r\n throw new Error(\"HDR prefiltering is not available in WebGL 1., you can use real time filtering instead.\");\r\n }\r\n\r\n if (this.useCdf) {\r\n this._cdfGenerator = new IblCdfGenerator(this._engine);\r\n this._cdfGenerator.iblSource = texture;\r\n\r\n await this._cdfGenerator.renderWhenReady();\r\n }\r\n\r\n this._effectRenderer = new EffectRenderer(this._engine);\r\n this._effectWrapper = this._createEffect(texture);\r\n await this._effectWrapper.effect.whenCompiledAsync();\r\n\r\n const irradianceTexture = this._prefilterInternal(texture);\r\n\r\n if (this.useCdf) {\r\n await this._cdfGenerator.findDominantDirection().then((dir) => {\r\n irradianceTexture._dominantDirection = dir;\r\n });\r\n }\r\n this._effectRenderer.dispose();\r\n this._effectWrapper.dispose();\r\n this._cdfGenerator?.dispose();\r\n\r\n return irradianceTexture;\r\n }\r\n}\r\n"]}
|
|
@@ -2,6 +2,7 @@ import { Observable } from "../../Misc/observable.js";
|
|
|
2
2
|
import type { Nullable } from "../../types.js";
|
|
3
3
|
import type { Scene } from "../../scene.js";
|
|
4
4
|
import { Matrix } from "../../Maths/math.vector.js";
|
|
5
|
+
import type { Vector3 } from "../../Maths/math.vector.js";
|
|
5
6
|
import type { InternalTexture } from "../../Materials/Textures/internalTexture.js";
|
|
6
7
|
import type { IAnimatable } from "../../Animations/animatable.interface.js";
|
|
7
8
|
import "../../Misc/fileTools.js";
|
|
@@ -190,6 +191,13 @@ export declare class BaseTexture extends ThinTexture implements IAnimatable {
|
|
|
190
191
|
*/
|
|
191
192
|
get irradianceTexture(): Nullable<BaseTexture>;
|
|
192
193
|
set irradianceTexture(value: Nullable<BaseTexture>);
|
|
194
|
+
/**
|
|
195
|
+
* Indicates the average direction of light in an environment map. This
|
|
196
|
+
* can be treated as the most dominant direction but it's magnitude also
|
|
197
|
+
* tells you something about how dominant that direction is.
|
|
198
|
+
*/
|
|
199
|
+
/** @internal */
|
|
200
|
+
_dominantDirection: Nullable<Vector3>;
|
|
193
201
|
/**
|
|
194
202
|
* Define if the texture is a render target.
|
|
195
203
|
*/
|
|
@@ -399,6 +399,13 @@ export class BaseTexture extends ThinTexture {
|
|
|
399
399
|
* @internal
|
|
400
400
|
*/
|
|
401
401
|
this.lodLevelInAlpha = false;
|
|
402
|
+
/**
|
|
403
|
+
* Indicates the average direction of light in an environment map. This
|
|
404
|
+
* can be treated as the most dominant direction but it's magnitude also
|
|
405
|
+
* tells you something about how dominant that direction is.
|
|
406
|
+
*/
|
|
407
|
+
/** @internal */
|
|
408
|
+
this._dominantDirection = null;
|
|
402
409
|
/**
|
|
403
410
|
* Define if the texture is a render target.
|
|
404
411
|
*/
|