Forráskód Böngészése

PBR parametes renaming

David Catuhe 9 éve
szülő
commit
a37cc79ec4

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 2 - 2
materialsLibrary/dist/babylon.fireMaterial.js


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 1 - 1
materialsLibrary/dist/babylon.fireMaterial.min.js


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 2 - 2
materialsLibrary/dist/babylon.normalMaterial.js


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 1 - 1
materialsLibrary/dist/babylon.normalMaterial.min.js


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 139 - 136
materialsLibrary/dist/babylon.pbrMaterial.js


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 3 - 3
materialsLibrary/dist/babylon.pbrMaterial.min.js


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 2 - 2
materialsLibrary/dist/babylon.simpleMaterial.js


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 1 - 1
materialsLibrary/dist/babylon.simpleMaterial.min.js


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 2 - 2
materialsLibrary/dist/babylon.terrainMaterial.js


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 1 - 1
materialsLibrary/dist/babylon.terrainMaterial.min.js


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 1 - 1
materialsLibrary/dist/babylon.waterMaterial.js


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 1 - 1
materialsLibrary/dist/babylon.waterMaterial.min.js


+ 19 - 18
materialsLibrary/dist/dts/babylon.pbrMaterial.d.ts

@@ -4,6 +4,7 @@ declare module BABYLON {
         directIntensity: number;
         emissiveIntensity: number;
         environmentIntensity: number;
+        specularIntensity: number;
         private _lightingInfos;
         overloadedShadowIntensity: number;
         overloadedShadeIntensity: number;
@@ -12,43 +13,43 @@ declare module BABYLON {
         cameraContrast: number;
         private _cameraInfos;
         overloadedAmbientIntensity: number;
-        overloadedDiffuseIntensity: number;
-        overloadedSpecularIntensity: number;
+        overloadedAlbedoIntensity: number;
+        overloadedReflectivityIntensity: number;
         overloadedEmissiveIntensity: number;
         private _overloadedIntensity;
         overloadedAmbient: Color3;
-        overloadedDiffuse: Color3;
-        overloadedSpecular: Color3;
+        overloadedAlbedo: Color3;
+        overloadedReflectivity: Color3;
         overloadedEmissive: Color3;
         overloadedReflection: Color3;
-        overloadedGlossiness: number;
-        overloadedGlossinessIntensity: number;
+        overloadedMicroSurface: number;
+        overloadedMicroSurfaceIntensity: number;
         overloadedReflectionIntensity: number;
-        private _overloadedGlossiness;
+        private _overloadedMicroSurface;
         disableBumpMap: boolean;
-        diffuseTexture: BaseTexture;
+        albedoTexture: BaseTexture;
         ambientTexture: BaseTexture;
         opacityTexture: BaseTexture;
         reflectionTexture: BaseTexture;
         emissiveTexture: BaseTexture;
-        specularTexture: BaseTexture;
+        reflectivityTexture: BaseTexture;
         bumpTexture: BaseTexture;
         lightmapTexture: BaseTexture;
         ambientColor: Color3;
-        diffuseColor: Color3;
-        specularColor: Color3;
+        albedoColor: Color3;
+        reflectivityColor: Color3;
         reflectionColor: Color3;
-        glossiness: number;
+        microSurface: number;
         emissiveColor: Color3;
-        useAlphaFromDiffuseTexture: boolean;
+        useAlphaFromAlbedoTexture: boolean;
         useEmissiveAsIllumination: boolean;
-        linkEmissiveWithDiffuse: boolean;
+        linkEmissiveWithAlbedo: boolean;
         useSpecularOverAlpha: boolean;
         disableLighting: boolean;
         useLightmapAsShadowmap: boolean;
         opacityFresnelParameters: FresnelParameters;
         emissiveFresnelParameters: FresnelParameters;
-        useGlossinessFromSpecularMapAlpha: boolean;
+        useMicroSurfaceFromReflectivityMapAlpha: boolean;
         private _renderTargets;
         private _worldViewProjectionMatrix;
         private _globalAmbientColor;
@@ -61,12 +62,12 @@ declare module BABYLON {
         useLogarithmicDepth: boolean;
         needAlphaBlending(): boolean;
         needAlphaTesting(): boolean;
-        private _shouldUseAlphaFromDiffuseTexture();
+        private _shouldUseAlphaFromAlbedoTexture();
         getAlphaTestTexture(): BaseTexture;
         private _checkCache(scene, mesh?, useInstances?);
         static PrepareDefinesForLights(scene: Scene, mesh: AbstractMesh, defines: MaterialDefines): boolean;
-        private static _scaledDiffuse;
-        private static _scaledSpecular;
+        private static _scaledAlbedo;
+        private static _scaledReflectivity;
         private static _scaledEmissive;
         private static _scaledReflection;
         static BindLights(scene: Scene, mesh: AbstractMesh, effect: Effect, defines: MaterialDefines): void;

+ 139 - 135
materialsLibrary/materials/pbr/babylon.pbrMaterial.ts

@@ -4,18 +4,18 @@ module BABYLON {
     var maxSimultaneousLights = 4;
 
     class PBRMaterialDefines extends MaterialDefines {
-        public DIFFUSE = false;
+        public ALBEDO = false;
         public AMBIENT = false;
         public OPACITY = false;
         public OPACITYRGB = false;
         public REFLECTION = false;
         public EMISSIVE = false;
-        public SPECULAR = false;
+        public REFLECTIVITY = false;
         public BUMP = false;
         public SPECULAROVERALPHA = false;
         public CLIPPLANE = false;
         public ALPHATEST = false;
-        public ALPHAFROMDIFFUSE = false;
+        public ALPHAFROMALBEDO = false;
         public POINTSIZE = false;
         public FOG = false;
         public LIGHT0 = false;
@@ -63,9 +63,9 @@ module BABYLON {
         public NUM_BONE_INFLUENCERS = 0;
         public BonesPerMesh = 0;
         public INSTANCES = false;
-        public GLOSSINESSFROMSPECULARMAP = false;
+        public MICROSURFACEFROMREFLECTIVITYMAP = false;
         public EMISSIVEASILLUMINATION = false;
-        public LINKEMISSIVEWITHDIFFUSE = false;
+        public LINKEMISSIVEWITHALBEDO = false;
         public LIGHTMAP = false;
         public USELIGHTMAPASSHADOWMAP = false;
         public REFLECTIONMAP_3D = false;
@@ -94,7 +94,9 @@ module BABYLON {
         public directIntensity: number = 1.0;
         public emissiveIntensity: number = 1.0;
         public environmentIntensity: number = 1.0;
-        private _lightingInfos: Vector4 = new Vector4(this.directIntensity, this.emissiveIntensity, this.environmentIntensity, 0.0);
+        public specularIntensity: number = 1.0;
+
+        private _lightingInfos: Vector4 = new Vector4(this.directIntensity, this.emissiveIntensity, this.environmentIntensity, this.specularIntensity);
 
         public overloadedShadowIntensity: number = 1.0;
         public overloadedShadeIntensity: number = 1.0;
@@ -105,42 +107,42 @@ module BABYLON {
         private _cameraInfos: Vector4 = new Vector4(1.0, 1.0, 0.0, 0.0);
 
         public overloadedAmbientIntensity: number = 0.0;
-        public overloadedDiffuseIntensity: number = 0.0;
-        public overloadedSpecularIntensity: number = 0.0;
+        public overloadedAlbedoIntensity: number = 0.0;
+        public overloadedReflectivityIntensity: number = 0.0;
         public overloadedEmissiveIntensity: number = 0.0;
-        private _overloadedIntensity: Vector4 = new Vector4(this.overloadedAmbientIntensity, this.overloadedDiffuseIntensity, this.overloadedSpecularIntensity, this.overloadedEmissiveIntensity);
+        private _overloadedIntensity: Vector4 = new Vector4(this.overloadedAmbientIntensity, this.overloadedAlbedoIntensity, this.overloadedReflectivityIntensity, this.overloadedEmissiveIntensity);
 
         public overloadedAmbient: Color3 = BABYLON.Color3.White();
-        public overloadedDiffuse: Color3 = BABYLON.Color3.White();
-        public overloadedSpecular: Color3 = BABYLON.Color3.White();
+        public overloadedAlbedo: Color3 = BABYLON.Color3.White();
+        public overloadedReflectivity: Color3 = BABYLON.Color3.White();
         public overloadedEmissive: Color3 = BABYLON.Color3.White();
         public overloadedReflection: Color3 = BABYLON.Color3.White();
 
-        public overloadedGlossiness: number = 0.0;
-        public overloadedGlossinessIntensity: number = 0.0;
+        public overloadedMicroSurface: number = 0.0;
+        public overloadedMicroSurfaceIntensity: number = 0.0;
         public overloadedReflectionIntensity: number = 0.0;
-        private _overloadedGlossiness: Vector3 = new Vector3(this.overloadedGlossiness, this.overloadedGlossinessIntensity, this.overloadedReflectionIntensity);
+        private _overloadedMicroSurface: Vector3 = new Vector3(this.overloadedMicroSurface, this.overloadedMicroSurfaceIntensity, this.overloadedReflectionIntensity);
        
         public disableBumpMap: boolean = false;
 
-        public diffuseTexture: BaseTexture;
+        public albedoTexture: BaseTexture;
         public ambientTexture: BaseTexture;
         public opacityTexture: BaseTexture;
         public reflectionTexture: BaseTexture;
         public emissiveTexture: BaseTexture;
-        public specularTexture: BaseTexture;
+        public reflectivityTexture: BaseTexture;
         public bumpTexture: BaseTexture;
         public lightmapTexture: BaseTexture;
 
         public ambientColor = new Color3(0, 0, 0);
-        public diffuseColor = new Color3(1, 1, 1);
-        public specularColor = new Color3(1, 1, 1);
+        public albedoColor = new Color3(1, 1, 1);
+        public reflectivityColor = new Color3(1, 1, 1);
         public reflectionColor = new Color3(0.5, 0.5, 0.5);
-        public glossiness = 0.5;
+        public microSurface = 0.5;
         public emissiveColor = new Color3(0, 0, 0);
-        public useAlphaFromDiffuseTexture = false;
+        public useAlphaFromAlbedoTexture = false;
         public useEmissiveAsIllumination = false;
-        public linkEmissiveWithDiffuse = false;
+        public linkEmissiveWithAlbedo = false;
         public useSpecularOverAlpha = true;
         public disableLighting = false;
 
@@ -149,7 +151,7 @@ module BABYLON {
         public opacityFresnelParameters: FresnelParameters;
         public emissiveFresnelParameters: FresnelParameters;
 
-        public useGlossinessFromSpecularMapAlpha = false;
+        public useMicroSurfaceFromReflectivityMapAlpha = false;
 
         private _renderTargets = new SmartArray<RenderTargetTexture>(16);
         private _worldViewProjectionMatrix = Matrix.Zero();
@@ -188,19 +190,19 @@ module BABYLON {
         }
 
         public needAlphaBlending(): boolean {
-            return (this.alpha < 1.0) || (this.opacityTexture != null) || this._shouldUseAlphaFromDiffuseTexture() || this.opacityFresnelParameters && this.opacityFresnelParameters.isEnabled;
+            return (this.alpha < 1.0) || (this.opacityTexture != null) || this._shouldUseAlphaFromAlbedoTexture() || this.opacityFresnelParameters && this.opacityFresnelParameters.isEnabled;
         }
 
         public needAlphaTesting(): boolean {
-            return this.diffuseTexture != null && this.diffuseTexture.hasAlpha;
+            return this.albedoTexture != null && this.albedoTexture.hasAlpha;
         }
 
-        private _shouldUseAlphaFromDiffuseTexture(): boolean {
-            return this.diffuseTexture != null && this.diffuseTexture.hasAlpha && this.useAlphaFromDiffuseTexture;
+        private _shouldUseAlphaFromAlbedoTexture(): boolean {
+            return this.albedoTexture != null && this.albedoTexture.hasAlpha && this.useAlphaFromAlbedoTexture;
         }
 
         public getAlphaTestTexture(): BaseTexture {
-            return this.diffuseTexture;
+            return this.albedoTexture;
         }
 
         private _checkCache(scene: Scene, mesh?: AbstractMesh, useInstances?: boolean): boolean {
@@ -305,8 +307,8 @@ module BABYLON {
             return needNormals;
         }
 
-        private static _scaledDiffuse = new Color3();
-        private static _scaledSpecular = new Color3();
+        private static _scaledAlbedo = new Color3();
+        private static _scaledReflectivity = new Color3();
         private static _scaledEmissive = new Color3();
         private static _scaledReflection = new Color3();
 
@@ -338,15 +340,15 @@ module BABYLON {
                 }
 
                 // GAMMA CORRECTION.
-                light.diffuse.toLinearSpaceToRef(PBRMaterial._scaledDiffuse);
-                PBRMaterial._scaledDiffuse.scaleToRef(light.intensity, PBRMaterial._scaledDiffuse);
+                light.diffuse.toLinearSpaceToRef(PBRMaterial._scaledAlbedo);
+                PBRMaterial._scaledAlbedo.scaleToRef(light.intensity, PBRMaterial._scaledAlbedo);
 
-                light.diffuse.scaleToRef(light.intensity, PBRMaterial._scaledDiffuse);
-                effect.setColor4("vLightDiffuse" + lightIndex, PBRMaterial._scaledDiffuse, light.range);
+                light.diffuse.scaleToRef(light.intensity, PBRMaterial._scaledAlbedo);
+                effect.setColor4("vLightDiffuse" + lightIndex, PBRMaterial._scaledAlbedo, light.range);
                 if (defines["SPECULARTERM"]) {
-                    light.specular.toLinearSpaceToRef(PBRMaterial._scaledSpecular);
-                    PBRMaterial._scaledSpecular.scaleToRef(light.intensity, PBRMaterial._scaledSpecular);
-                    effect.setColor3("vLightSpecular" + lightIndex, PBRMaterial._scaledSpecular);
+                    light.specular.toLinearSpaceToRef(PBRMaterial._scaledReflectivity);
+                    PBRMaterial._scaledReflectivity.scaleToRef(light.intensity, PBRMaterial._scaledReflectivity);
+                    effect.setColor3("vLightSpecular" + lightIndex, PBRMaterial._scaledReflectivity);
                 }
 
                 // Shadows
@@ -394,12 +396,12 @@ module BABYLON {
 
             // Textures
             if (scene.texturesEnabled) {
-                if (this.diffuseTexture && StandardMaterial.DiffuseTextureEnabled) {
-                    if (!this.diffuseTexture.isReady()) {
+                if (this.albedoTexture && StandardMaterial.DiffuseTextureEnabled) {
+                    if (!this.albedoTexture.isReady()) {
                         return false;
                     } else {
                         needUVs = true;
-                        this._defines.DIFFUSE = true;
+                        this._defines.ALBEDO = true;
                     }
                 }
 
@@ -484,13 +486,13 @@ module BABYLON {
                     }
                 }
 
-                if (this.specularTexture && StandardMaterial.SpecularTextureEnabled) {
-                    if (!this.specularTexture.isReady()) {
+                if (this.reflectivityTexture && StandardMaterial.SpecularTextureEnabled) {
+                    if (!this.reflectivityTexture.isReady()) {
                         return false;
                     } else {
                         needUVs = true;
-                        this._defines.SPECULAR = true;
-                        this._defines.GLOSSINESSFROMSPECULARMAP = this.useGlossinessFromSpecularMapAlpha;
+                        this._defines.REFLECTIVITY = true;
+                        this._defines.MICROSURFACEFROMREFLECTIVITYMAP = this.useMicroSurfaceFromReflectivityMapAlpha;
                     }
                 }
             }
@@ -513,16 +515,16 @@ module BABYLON {
                 this._defines.ALPHATEST = true;
             }
 
-            if (this._shouldUseAlphaFromDiffuseTexture()) {
-                this._defines.ALPHAFROMDIFFUSE = true;
+            if (this._shouldUseAlphaFromAlbedoTexture()) {
+                this._defines.ALPHAFROMALBEDO = true;
             }
 
             if (this.useEmissiveAsIllumination) {
                 this._defines.EMISSIVEASILLUMINATION = true;
             }
 
-            if (this.linkEmissiveWithDiffuse) {
-                this._defines.LINKEMISSIVEWITHDIFFUSE = true;
+            if (this.linkEmissiveWithAlbedo) {
+                this._defines.LINKEMISSIVEWITHALBEDO = true;
             }
 
             if (this.useLogarithmicDepth) {
@@ -542,10 +544,10 @@ module BABYLON {
                 this._defines.OVERLOADEDSHADOWVALUES = true;
             }
 
-            if (this.overloadedGlossinessIntensity > 0 ||
+            if (this.overloadedMicroSurfaceIntensity > 0 ||
                 this.overloadedEmissiveIntensity > 0 ||
-                this.overloadedSpecularIntensity > 0 ||
-                this.overloadedDiffuseIntensity > 0 ||
+                this.overloadedReflectivityIntensity > 0 ||
+                this.overloadedAlbedoIntensity > 0 ||
                 this.overloadedAmbientIntensity > 0 ||
                 this.overloadedReflectionIntensity > 0) {
                 this._defines.OVERLOADEDVALUES = true;
@@ -630,8 +632,8 @@ module BABYLON {
                     fallbacks.addFallback(0, "REFLECTION");
                 }
 
-                if (this._defines.SPECULAR) {
-                    fallbacks.addFallback(0, "SPECULAR");
+                if (this._defines.REFLECTIVITY) {
+                    fallbacks.addFallback(0, "REFLECTIVITY");
                 }
 
                 if (this._defines.BUMP) {
@@ -739,21 +741,21 @@ module BABYLON {
                 var join = this._defines.toString();
                 this._effect = scene.getEngine().createEffect(shaderName,
                     attribs,
-                    ["world", "view", "viewProjection", "vEyePosition", "vLightsType", "vAmbientColor", "vDiffuseColor", "vSpecularColor", "vEmissiveColor", "vReflectionColor",
+                    ["world", "view", "viewProjection", "vEyePosition", "vLightsType", "vAmbientColor", "vAlbedoColor", "vReflectivityColor", "vEmissiveColor", "vReflectionColor",
                         "vLightData0", "vLightDiffuse0", "vLightSpecular0", "vLightDirection0", "vLightGround0", "lightMatrix0",
                         "vLightData1", "vLightDiffuse1", "vLightSpecular1", "vLightDirection1", "vLightGround1", "lightMatrix1",
                         "vLightData2", "vLightDiffuse2", "vLightSpecular2", "vLightDirection2", "vLightGround2", "lightMatrix2",
                         "vLightData3", "vLightDiffuse3", "vLightSpecular3", "vLightDirection3", "vLightGround3", "lightMatrix3",
                         "vFogInfos", "vFogColor", "pointSize",
-                        "vDiffuseInfos", "vAmbientInfos", "vOpacityInfos", "vReflectionInfos", "vEmissiveInfos", "vSpecularInfos", "vBumpInfos", "vLightmapInfos",
+                        "vAlbedoInfos", "vAmbientInfos", "vOpacityInfos", "vReflectionInfos", "vEmissiveInfos", "vReflectivityInfos", "vBumpInfos", "vLightmapInfos",
                         "mBones",
-                        "vClipPlane", "diffuseMatrix", "ambientMatrix", "opacityMatrix", "reflectionMatrix", "emissiveMatrix", "specularMatrix", "bumpMatrix", "lightmapMatrix",
+                        "vClipPlane", "albedoMatrix", "ambientMatrix", "opacityMatrix", "reflectionMatrix", "emissiveMatrix", "reflectivityMatrix", "bumpMatrix", "lightmapMatrix",
                         "shadowsInfo0", "shadowsInfo1", "shadowsInfo2", "shadowsInfo3",
                         "opacityParts", "emissiveLeftColor", "emissiveRightColor",
-                        "vLightingIntensity", "vOverloadedShadowIntensity", "vOverloadedIntensity", "vCameraInfos", "vOverloadedDiffuse", "vOverloadedReflection", "vOverloadedSpecular", "vOverloadedEmissive", "vOverloadedGlossiness",
+                        "vLightingIntensity", "vOverloadedShadowIntensity", "vOverloadedIntensity", "vCameraInfos", "vOverloadedAlbedo", "vOverloadedReflection", "vOverloadedReflectivity", "vOverloadedEmissive", "vOverloadedMicroSurface",
                         "logarithmicDepthConstant"
                     ],
-                    ["diffuseSampler", "ambientSampler", "opacitySampler", "reflectionCubeSampler", "reflection2DSampler", "emissiveSampler", "specularSampler", "bumpSampler", "lightmapSampler",
+                    ["albedoSampler", "ambientSampler", "opacitySampler", "reflectionCubeSampler", "reflection2DSampler", "emissiveSampler", "reflectivitySampler", "bumpSampler", "lightmapSampler",
                         "shadowSampler0", "shadowSampler1", "shadowSampler2", "shadowSampler3"
                     ],
                     join, fallbacks, this.onCompiled, this.onError);
@@ -818,11 +820,11 @@ module BABYLON {
                 }
 
                 // Textures        
-                if (this.diffuseTexture && StandardMaterial.DiffuseTextureEnabled) {
-                    this._effect.setTexture("diffuseSampler", this.diffuseTexture);
+                if (this.albedoTexture && StandardMaterial.DiffuseTextureEnabled) {
+                    this._effect.setTexture("albedoSampler", this.albedoTexture);
 
-                    this._effect.setFloat2("vDiffuseInfos", this.diffuseTexture.coordinatesIndex, this.diffuseTexture.level);
-                    this._effect.setMatrix("diffuseMatrix", this.diffuseTexture.getTextureMatrix());
+                    this._effect.setFloat2("vAlbedoInfos", this.albedoTexture.coordinatesIndex, this.albedoTexture.level);
+                    this._effect.setMatrix("albedoMatrix", this.albedoTexture.getTextureMatrix());
                 }
 
                 if (this.ambientTexture && StandardMaterial.AmbientTextureEnabled) {
@@ -864,11 +866,11 @@ module BABYLON {
                     this._effect.setMatrix("lightmapMatrix", this.lightmapTexture.getTextureMatrix());
                 }
 
-                if (this.specularTexture && StandardMaterial.SpecularTextureEnabled) {
-                    this._effect.setTexture("specularSampler", this.specularTexture);
+                if (this.reflectivityTexture && StandardMaterial.SpecularTextureEnabled) {
+                    this._effect.setTexture("reflectivitySampler", this.reflectivityTexture);
 
-                    this._effect.setFloat2("vSpecularInfos", this.specularTexture.coordinatesIndex, this.specularTexture.level);
-                    this._effect.setMatrix("specularMatrix", this.specularTexture.getTextureMatrix());
+                    this._effect.setFloat2("vReflectivityInfos", this.reflectivityTexture.coordinatesIndex, this.reflectivityTexture.level);
+                    this._effect.setMatrix("reflectivityMatrix", this.reflectivityTexture.getTextureMatrix());
                 }
 
                 if (this.bumpTexture && this._myScene.getEngine().getCaps().standardDerivatives && StandardMaterial.BumpTextureEnabled && !this.disableBumpMap) {
@@ -895,14 +897,11 @@ module BABYLON {
                 this._myScene.ambientColor.multiplyToRef(this.ambientColor, this._globalAmbientColor);
                 
                 // GAMMA CORRECTION.
-                this.specularColor.toLinearSpaceToRef(PBRMaterial._scaledSpecular);
+                this.reflectivityColor.toLinearSpaceToRef(PBRMaterial._scaledReflectivity);
 
                 this._effect.setVector3("vEyePosition", this._myScene._mirroredCameraPosition ? this._myScene._mirroredCameraPosition : this._myScene.activeCamera.position);
                 this._effect.setColor3("vAmbientColor", this._globalAmbientColor);
-
-                if (this._defines.SPECULARTERM) {
-                    this._effect.setColor4("vSpecularColor", PBRMaterial._scaledSpecular, this.glossiness);
-                }
+                this._effect.setColor4("vReflectivityColor", PBRMaterial._scaledReflectivity, this.microSurface);
 
                 // GAMMA CORRECTION.
                 this.emissiveColor.toLinearSpaceToRef(PBRMaterial._scaledEmissive); 
@@ -914,8 +913,8 @@ module BABYLON {
             }
 
             // GAMMA CORRECTION.
-            this.diffuseColor.toLinearSpaceToRef(PBRMaterial._scaledDiffuse);
-            this._effect.setColor4("vDiffuseColor", PBRMaterial._scaledDiffuse, this.alpha * mesh.visibility);
+            this.albedoColor.toLinearSpaceToRef(PBRMaterial._scaledAlbedo);
+            this._effect.setColor4("vAlbedoColor", PBRMaterial._scaledAlbedo, this.alpha * mesh.visibility);
 
             // Lights
             if (this._myScene.lightsEnabled && !this.disableLighting) {
@@ -936,6 +935,8 @@ module BABYLON {
             this._lightingInfos.x = this.directIntensity;
             this._lightingInfos.y = this.emissiveIntensity;
             this._lightingInfos.z = this.environmentIntensity;
+            this._lightingInfos.w = this.specularIntensity;
+
             this._effect.setVector4("vLightingIntensity", this._lightingInfos);
 
             this._overloadedShadowInfos.x = this.overloadedShadowIntensity;
@@ -947,26 +948,26 @@ module BABYLON {
             this._effect.setVector4("vCameraInfos", this._cameraInfos);
 
             this._overloadedIntensity.x = this.overloadedAmbientIntensity;
-            this._overloadedIntensity.y = this.overloadedDiffuseIntensity;
-            this._overloadedIntensity.z = this.overloadedSpecularIntensity;
+            this._overloadedIntensity.y = this.overloadedAlbedoIntensity;
+            this._overloadedIntensity.z = this.overloadedReflectivityIntensity;
             this._overloadedIntensity.w = this.overloadedEmissiveIntensity;
             this._effect.setVector4("vOverloadedIntensity", this._overloadedIntensity);
 
             this.overloadedAmbient.toLinearSpaceToRef(this._tempColor);
             this._effect.setColor3("vOverloadedAmbient", this._tempColor);
-            this.overloadedDiffuse.toLinearSpaceToRef(this._tempColor);
-            this._effect.setColor3("vOverloadedDiffuse", this._tempColor);
-            this.overloadedSpecular.toLinearSpaceToRef(this._tempColor);
-            this._effect.setColor3("vOverloadedSpecular", this._tempColor);
+            this.overloadedAlbedo.toLinearSpaceToRef(this._tempColor);
+            this._effect.setColor3("vOverloadedAlbedo", this._tempColor);
+            this.overloadedReflectivity.toLinearSpaceToRef(this._tempColor);
+            this._effect.setColor3("vOverloadedReflectivity", this._tempColor);
             this.overloadedEmissive.toLinearSpaceToRef(this._tempColor);
             this._effect.setColor3("vOverloadedEmissive", this._tempColor);
             this.overloadedReflection.toLinearSpaceToRef(this._tempColor);
             this._effect.setColor3("vOverloadedReflection", this._tempColor);
 
-            this._overloadedGlossiness.x = this.overloadedGlossiness;
-            this._overloadedGlossiness.y = this.overloadedGlossinessIntensity;
-            this._overloadedGlossiness.z = this.overloadedReflectionIntensity;
-            this._effect.setVector3("vOverloadedGlossiness", this._overloadedGlossiness);
+            this._overloadedMicroSurface.x = this.overloadedMicroSurface;
+            this._overloadedMicroSurface.y = this.overloadedMicroSurfaceIntensity;
+            this._overloadedMicroSurface.z = this.overloadedReflectionIntensity;
+            this._effect.setVector3("vOverloadedMicroSurface", this._overloadedMicroSurface);
 
             // Log. depth
             if (this._defines.LOGARITHMICDEPTH) {
@@ -981,8 +982,8 @@ module BABYLON {
         public getAnimatables(): IAnimatable[] {
             var results = [];
 
-            if (this.diffuseTexture && this.diffuseTexture.animations && this.diffuseTexture.animations.length > 0) {
-                results.push(this.diffuseTexture);
+            if (this.albedoTexture && this.albedoTexture.animations && this.albedoTexture.animations.length > 0) {
+                results.push(this.albedoTexture);
             }
 
             if (this.ambientTexture && this.ambientTexture.animations && this.ambientTexture.animations.length > 0) {
@@ -1001,8 +1002,8 @@ module BABYLON {
                 results.push(this.emissiveTexture);
             }
 
-            if (this.specularTexture && this.specularTexture.animations && this.specularTexture.animations.length > 0) {
-                results.push(this.specularTexture);
+            if (this.reflectivityTexture && this.reflectivityTexture.animations && this.reflectivityTexture.animations.length > 0) {
+                results.push(this.reflectivityTexture);
             }
 
             if (this.bumpTexture && this.bumpTexture.animations && this.bumpTexture.animations.length > 0) {
@@ -1013,8 +1014,8 @@ module BABYLON {
         }
 
         public dispose(forceDisposeEffect?: boolean): void {
-            if (this.diffuseTexture) {
-                this.diffuseTexture.dispose();
+            if (this.albedoTexture) {
+                this.albedoTexture.dispose();
             }
 
             if (this.ambientTexture) {
@@ -1033,8 +1034,8 @@ module BABYLON {
                 this.emissiveTexture.dispose();
             }
 
-            if (this.specularTexture) {
-                this.specularTexture.dispose();
+            if (this.reflectivityTexture) {
+                this.reflectivityTexture.dispose();
             }
 
             if (this.bumpTexture) {
@@ -1053,6 +1054,7 @@ module BABYLON {
             newPBRMaterial.directIntensity = this.directIntensity;
             newPBRMaterial.emissiveIntensity = this.emissiveIntensity;
             newPBRMaterial.environmentIntensity = this.environmentIntensity;
+            newPBRMaterial.specularIntensity = this.specularIntensity;
         
             newPBRMaterial.cameraExposure = this.cameraExposure;
             newPBRMaterial.cameraContrast = this.cameraContrast;
@@ -1061,24 +1063,24 @@ module BABYLON {
             newPBRMaterial.overloadedShadeIntensity = this.overloadedShadeIntensity;
         
             newPBRMaterial.overloadedAmbientIntensity = this.overloadedAmbientIntensity;
-            newPBRMaterial.overloadedDiffuseIntensity = this.overloadedDiffuseIntensity;
-            newPBRMaterial.overloadedSpecularIntensity = this.overloadedSpecularIntensity;
+            newPBRMaterial.overloadedAlbedoIntensity = this.overloadedAlbedoIntensity;
+            newPBRMaterial.overloadedReflectivityIntensity = this.overloadedReflectivityIntensity;
             newPBRMaterial.overloadedEmissiveIntensity = this.overloadedEmissiveIntensity;
             newPBRMaterial.overloadedAmbient = this.overloadedAmbient;
-            newPBRMaterial.overloadedDiffuse = this.overloadedDiffuse;
-            newPBRMaterial.overloadedSpecular = this.overloadedSpecular;
+            newPBRMaterial.overloadedAlbedo = this.overloadedAlbedo;
+            newPBRMaterial.overloadedReflectivity = this.overloadedReflectivity;
             newPBRMaterial.overloadedEmissive = this.overloadedEmissive;
             newPBRMaterial.overloadedReflection = this.overloadedReflection;
 
-            newPBRMaterial.overloadedGlossiness = this.overloadedGlossiness;
-            newPBRMaterial.overloadedGlossinessIntensity = this.overloadedGlossinessIntensity;
+            newPBRMaterial.overloadedMicroSurface = this.overloadedMicroSurface;
+            newPBRMaterial.overloadedMicroSurfaceIntensity = this.overloadedMicroSurfaceIntensity;
             newPBRMaterial.overloadedReflectionIntensity = this.overloadedReflectionIntensity;
         
             newPBRMaterial.disableBumpMap = this.disableBumpMap;
 
             // Standard material
-            if (this.diffuseTexture && this.diffuseTexture.clone) {
-                newPBRMaterial.diffuseTexture = this.diffuseTexture.clone();
+            if (this.albedoTexture && this.albedoTexture.clone) {
+                newPBRMaterial.albedoTexture = this.albedoTexture.clone();
             }
             if (this.ambientTexture && this.ambientTexture.clone) {
                 newPBRMaterial.ambientTexture = this.ambientTexture.clone();
@@ -1092,8 +1094,8 @@ module BABYLON {
             if (this.emissiveTexture && this.emissiveTexture.clone) {
                 newPBRMaterial.emissiveTexture = this.emissiveTexture.clone();
             }
-            if (this.specularTexture && this.specularTexture.clone) {
-                newPBRMaterial.specularTexture = this.specularTexture.clone();
+            if (this.reflectivityTexture && this.reflectivityTexture.clone) {
+                newPBRMaterial.reflectivityTexture = this.reflectivityTexture.clone();
             }
             if (this.bumpTexture && this.bumpTexture.clone) {
                 newPBRMaterial.bumpTexture = this.bumpTexture.clone();
@@ -1104,14 +1106,14 @@ module BABYLON {
             }
 
             newPBRMaterial.ambientColor = this.ambientColor.clone();
-            newPBRMaterial.diffuseColor = this.diffuseColor.clone();
-            newPBRMaterial.specularColor = this.specularColor.clone();
+            newPBRMaterial.albedoColor = this.albedoColor.clone();
+            newPBRMaterial.reflectivityColor = this.reflectivityColor.clone();
             newPBRMaterial.reflectionColor = this.reflectionColor.clone();
-            newPBRMaterial.glossiness = this.glossiness;
+            newPBRMaterial.microSurface = this.microSurface;
             newPBRMaterial.emissiveColor = this.emissiveColor.clone();
-            newPBRMaterial.useAlphaFromDiffuseTexture = this.useAlphaFromDiffuseTexture;
+            newPBRMaterial.useAlphaFromAlbedoTexture = this.useAlphaFromAlbedoTexture;
             newPBRMaterial.useEmissiveAsIllumination = this.useEmissiveAsIllumination;
-            newPBRMaterial.useGlossinessFromSpecularMapAlpha = this.useGlossinessFromSpecularMapAlpha;
+            newPBRMaterial.useMicroSurfaceFromReflectivityMapAlpha = this.useMicroSurfaceFromReflectivityMapAlpha;
             newPBRMaterial.useSpecularOverAlpha = this.useSpecularOverAlpha;
             
             newPBRMaterial.emissiveFresnelParameters = this.emissiveFresnelParameters.clone();
@@ -1128,6 +1130,7 @@ module BABYLON {
             serializationObject.directIntensity = this.directIntensity;
             serializationObject.emissiveIntensity = this.emissiveIntensity;
             serializationObject.environmentIntensity = this.environmentIntensity;
+            serializationObject.specularIntensity = this.specularIntensity;
         
             serializationObject.cameraExposure = this.cameraExposure;
             serializationObject.cameraContrast = this.cameraContrast;
@@ -1136,24 +1139,24 @@ module BABYLON {
             serializationObject.overloadedShadeIntensity = this.overloadedShadeIntensity;
         
             serializationObject.overloadedAmbientIntensity = this.overloadedAmbientIntensity;
-            serializationObject.overloadedDiffuseIntensity = this.overloadedDiffuseIntensity;
-            serializationObject.overloadedSpecularIntensity = this.overloadedSpecularIntensity;
+            serializationObject.overloadedAlbedoIntensity = this.overloadedAlbedoIntensity;
+            serializationObject.overloadedReflectivityIntensity = this.overloadedReflectivityIntensity;
             serializationObject.overloadedEmissiveIntensity = this.overloadedEmissiveIntensity;
             serializationObject.overloadedAmbient = this.overloadedAmbient.asArray();
-            serializationObject.overloadedDiffuse = this.overloadedDiffuse.asArray();
-            serializationObject.overloadedSpecular = this.overloadedSpecular.asArray();
+            serializationObject.overloadedAlbedo = this.overloadedAlbedo.asArray();
+            serializationObject.overloadedReflectivity = this.overloadedReflectivity.asArray();
             serializationObject.overloadedEmissive = this.overloadedEmissive.asArray();
             serializationObject.overloadedReflection = this.overloadedReflection.asArray();
 
-            serializationObject.overloadedGlossiness = this.overloadedGlossiness;
-            serializationObject.overloadedGlossinessIntensity = this.overloadedGlossinessIntensity;
+            serializationObject.overloadedMicroSurface = this.overloadedMicroSurface;
+            serializationObject.overloadedMicroSurfaceIntensity = this.overloadedMicroSurfaceIntensity;
             serializationObject.overloadedReflectionIntensity = this.overloadedReflectionIntensity;
         
             serializationObject.disableBumpMap = this.disableBumpMap;
 
             // Standard material
-            if (this.diffuseTexture) {
-                serializationObject.diffuseTexture = this.diffuseTexture.serialize();
+            if (this.albedoTexture) {
+                serializationObject.albedoTexture = this.albedoTexture.serialize();
             }
             if (this.ambientTexture) {
                 serializationObject.ambientTexture = this.ambientTexture.serialize();
@@ -1167,8 +1170,8 @@ module BABYLON {
             if (this.emissiveTexture) {
                 serializationObject.emissiveTexture = this.emissiveTexture.serialize();
             }
-            if (this.specularTexture) {
-                serializationObject.specularTexture = this.specularTexture.serialize();
+            if (this.reflectivityTexture) {
+                serializationObject.reflectivityTexture = this.reflectivityTexture.serialize();
             }
             if (this.bumpTexture) {
                 serializationObject.bumpTexture = this.bumpTexture.serialize();
@@ -1179,14 +1182,14 @@ module BABYLON {
             }
 
             serializationObject.ambientColor = this.ambientColor.asArray();
-            serializationObject.diffuseColor = this.diffuseColor.asArray();
-            serializationObject.specularColor = this.specularColor.asArray();
+            serializationObject.albedoColor = this.albedoColor.asArray();
+            serializationObject.reflectivityColor = this.reflectivityColor.asArray();
             serializationObject.reflectionColor = this.reflectionColor.asArray();
-            serializationObject.glossiness = this.glossiness;
+            serializationObject.microSurface = this.microSurface;
             serializationObject.emissiveColor = this.emissiveColor.asArray();
-            serializationObject.useAlphaFromDiffuseTexture = this.useAlphaFromDiffuseTexture;
+            serializationObject.useAlphaFromAlbedoTexture = this.useAlphaFromAlbedoTexture;
             serializationObject.useEmissiveAsIllumination = this.useEmissiveAsIllumination;
-            serializationObject.useGlossinessFromSpecularMapAlpha = this.useGlossinessFromSpecularMapAlpha;
+            serializationObject.useMicroSurfaceFromReflectivityMapAlpha = this.useMicroSurfaceFromReflectivityMapAlpha;
             serializationObject.useSpecularOverAlpha = this.useSpecularOverAlpha;
             
             serializationObject.emissiveFresnelParameters = this.emissiveFresnelParameters.serialize();
@@ -1216,6 +1219,7 @@ module BABYLON {
             material.directIntensity = source.directIntensity;
             material.emissiveIntensity = source.emissiveIntensity;
             material.environmentIntensity = source.environmentIntensity;
+            material.specularIntensity = source.specularIntensity;
         
             material.cameraExposure = source.cameraExposure;
             material.cameraContrast = source.cameraContrast;
@@ -1224,24 +1228,24 @@ module BABYLON {
             material.overloadedShadeIntensity = source.overloadedShadeIntensity;
         
             material.overloadedAmbientIntensity = source.overloadedAmbientIntensity;
-            material.overloadedDiffuseIntensity = source.overloadedDiffuseIntensity;
-            material.overloadedSpecularIntensity = source.overloadedSpecularIntensity;
+            material.overloadedAlbedoIntensity = source.overloadedAlbedoIntensity;
+            material.overloadedReflectivityIntensity = source.overloadedReflectivityIntensity;
             material.overloadedEmissiveIntensity = source.overloadedEmissiveIntensity;
             material.overloadedAmbient = Color3.FromArray(source.overloadedAmbient);
-            material.overloadedDiffuse = Color3.FromArray(source.overloadedDiffuse);
-            material.overloadedSpecular = Color3.FromArray(source.overloadedSpecular);
+            material.overloadedAlbedo = Color3.FromArray(source.overloadedAlbedo);
+            material.overloadedReflectivity = Color3.FromArray(source.overloadedReflectivity);
             material.overloadedEmissive = Color3.FromArray(source.overloadedEmissive);
             material.overloadedReflection = Color3.FromArray(source.overloadedReflection);
 
-            material.overloadedGlossiness = source.overloadedGlossiness;
-            material.overloadedGlossinessIntensity = source.overloadedGlossinessIntensity;
+            material.overloadedMicroSurface = source.overloadedMicroSurface;
+            material.overloadedMicroSurfaceIntensity = source.overloadedMicroSurfaceIntensity;
             material.overloadedReflectionIntensity = source.overloadedReflectionIntensity;
         
             material.disableBumpMap = source.disableBumpMap;
 
             // Standard material
-            if (source.diffuseTexture) {
-                material.diffuseTexture = Texture.Parse(source.diffuseTexture, scene, rootUrl);
+            if (source.albedoTexture) {
+                material.albedoTexture = Texture.Parse(source.albedoTexture, scene, rootUrl);
             }
             if (source.ambientTexture) {
                 material.ambientTexture = Texture.Parse(source.ambientTexture, scene, rootUrl);
@@ -1255,8 +1259,8 @@ module BABYLON {
             if (source.emissiveTexture) {
                 material.emissiveTexture = Texture.Parse(source.emissiveTexture, scene, rootUrl);
             }
-            if (source.specularTexture) {
-                material.specularTexture = Texture.Parse(source.specularTexture, scene, rootUrl);
+            if (source.reflectivityTexture) {
+                material.reflectivityTexture = Texture.Parse(source.reflectivityTexture, scene, rootUrl);
             }
             if (source.bumpTexture) {
                 material.bumpTexture = Texture.Parse(source.bumpTexture, scene, rootUrl);
@@ -1267,14 +1271,14 @@ module BABYLON {
             }
 
             material.ambientColor = Color3.FromArray(source.ambient);
-            material.diffuseColor = Color3.FromArray(source.diffuse);
-            material.specularColor = Color3.FromArray(source.specular);
+            material.albedoColor = Color3.FromArray(source.albedo);
+            material.reflectivityColor = Color3.FromArray(source.reflectivity);
             material.reflectionColor = Color3.FromArray(source.reflectionColor);
-            material.glossiness = source.glossiness;
+            material.microSurface = source.microSurface;
             material.emissiveColor = Color3.FromArray(source.emissive);
-            material.useAlphaFromDiffuseTexture = source.useAlphaFromDiffuseTexture;
+            material.useAlphaFromAlbedoTexture = source.useAlphaFromAlbedoTexture;
             material.useEmissiveAsIllumination = source.useEmissiveAsIllumination;
-            material.useGlossinessFromSpecularMapAlpha = source.useGlossinessFromSpecularMapAlpha;
+            material.useMicroSurfaceFromReflectivityMapAlpha = source.useMicroSurfaceFromReflectivityMapAlpha;
             material.useSpecularOverAlpha = source.useSpecularOverAlpha;
             
             material.emissiveFresnelParameters = FresnelParameters.Parse(source.emissiveFresnelParameters);

+ 59 - 73
materialsLibrary/materials/pbr/legacypbr.fragment.fx

@@ -6,7 +6,7 @@
 
 uniform vec3 vEyePosition;
 uniform vec3 vAmbientColor;
-uniform vec4 vDiffuseColor;
+uniform vec4 vAlbedoColor;
 uniform vec3 vReflectionColor;
 
 // CUSTOM CONTROLS
@@ -16,11 +16,11 @@ uniform vec4 vCameraInfos;
 #ifdef OVERLOADEDVALUES
 uniform vec4 vOverloadedIntensity;
 uniform vec3 vOverloadedAmbient;
-uniform vec3 vOverloadedDiffuse;
-uniform vec3 vOverloadedSpecular;
+uniform vec3 vOverloadedAlbedo;
+uniform vec3 vOverloadedReflectivity;
 uniform vec3 vOverloadedEmissive;
 uniform vec3 vOverloadedReflection;
-uniform vec3 vOverloadedGlossiness;
+uniform vec3 vOverloadedMicroSurface;
 #endif
 
 #ifdef OVERLOADEDSHADOWVALUES
@@ -113,17 +113,17 @@ float computeDiffuseTerm(float NdotL, float NdotV, float VdotH, float roughness)
     return diffuseFresnelTerm * NdotL;
 }
 
-float computeDefaultGlossiness(float glossiness, vec3 specularColor)
+float computeDefaultMicroSurface(float microSurface, vec3 reflectivityColor)
 {
-    if (glossiness == 0.)
+    if (microSurface == 0.)
     {
-        float kSpecularNoAlphaWorkflow_SmoothnessMax = 0.95;
+        float kReflectivityNoAlphaWorkflow_SmoothnessMax = 0.95;
 
-        float specularLuminance = getLuminance(specularColor);
-        float specularLuma = sqrt(specularLuminance);
-        glossiness = specularLuma * kSpecularNoAlphaWorkflow_SmoothnessMax;
+        float reflectivityLuminance = getLuminance(reflectivityColor);
+        float reflectivityLuma = sqrt(reflectivityLuminance);
+        microSurface = reflectivityLuma * kReflectivityNoAlphaWorkflow_SmoothnessMax;
     }
-    return glossiness;
+    return microSurface;
 }
 
 vec3 toLinearSpace(vec3 color)
@@ -174,9 +174,7 @@ vec3 toGammaSpace(vec3 color)
 #endif
 // END PBR HELPER METHODS
 
-#ifdef SPECULARTERM
-uniform vec4 vSpecularColor;
-#endif
+uniform vec4 vReflectivityColor;
 uniform vec3 vEmissiveColor;
 
 // Input
@@ -284,10 +282,10 @@ uniform vec3 vLightGround3;
 #endif
 
 // Samplers
-#ifdef DIFFUSE
-varying vec2 vDiffuseUV;
-uniform sampler2D diffuseSampler;
-uniform vec2 vDiffuseInfos;
+#ifdef ALBEDO
+varying vec2 vAlbedoUV;
+uniform sampler2D albedoSampler;
+uniform vec2 vAlbedoInfos;
 #endif
 
 #ifdef AMBIENT
@@ -314,10 +312,10 @@ uniform vec2 vLightmapInfos;
 uniform sampler2D lightmapSampler;
 #endif
 
-#if defined(SPECULAR) && defined(SPECULARTERM)
-varying vec2 vSpecularUV;
-uniform vec2 vSpecularInfos;
-uniform sampler2D specularSampler;
+#if defined(REFLECTIVITY)
+varying vec2 vReflectivityUV;
+uniform vec2 vReflectivityInfos;
+uniform sampler2D reflectivitySampler;
 #endif
 
 #ifdef CLIPPLANE
@@ -446,13 +444,13 @@ void main(void) {
 
     // Base color
     vec4 baseColor = vec4(1., 1., 1., 1.);
-    vec3 diffuseColor = vDiffuseColor.rgb;
+    vec3 diffuseColor = vAlbedoColor.rgb;
     
     // Alpha
-    float alpha = vDiffuseColor.a;
+    float alpha = vAlbedoColor.a;
 
-#ifdef DIFFUSE
-    baseColor = texture2D(diffuseSampler, vDiffuseUV);
+#ifdef ALBEDO
+    baseColor = texture2D(diffuseSampler, vAlbedoUV);
     baseColor = vec4(toLinearSpace(baseColor.rgb), baseColor.a);
 
 #ifdef ALPHATEST
@@ -460,11 +458,11 @@ void main(void) {
         discard;
 #endif
 
-#ifdef ALPHAFROMDIFFUSE
+#ifdef ALPHAFROMALBEDO
     alpha *= baseColor.a;
 #endif
 
-    baseColor.rgb *= vDiffuseInfos.y;
+    baseColor.rgb *= vAlbedoInfos.y;
 #endif
 
 #ifdef VERTEXCOLOR
@@ -472,8 +470,8 @@ void main(void) {
 #endif
 
 #ifdef OVERLOADEDVALUES
-    baseColor.rgb = mix(baseColor.rgb, vOverloadedDiffuse, vOverloadedIntensity.y);
-    diffuseColor.rgb = mix(diffuseColor.rgb, vOverloadedDiffuse, vOverloadedIntensity.y);
+    baseColor.rgb = mix(baseColor.rgb, vOverloadedAlbedo, vOverloadedIntensity.y);
+    albedoColor.rgb = mix(albedoColor.rgb, vOverloadedAlbedo, vOverloadedIntensity.y);
 #endif
 
     // Bump
@@ -493,57 +491,45 @@ void main(void) {
     #endif
 #endif
 
-    // Specular map
-#ifdef SPECULARTERM
-    float glossiness = vSpecularColor.a;
-    vec3 specularColor = vSpecularColor.rgb;
+    // Reflectivity map
+    float microSurface = vReflectivityColor.a;
+    vec3 reflectivityColor = vReflectivityColor.rgb;
 
     #ifdef OVERLOADEDVALUES
-        specularColor.rgb = mix(specularColor.rgb, vOverloadedSpecular, vOverloadedIntensity.z);
+        reflectivityColor.rgb = mix(reflectivityColor.rgb, vOverloadedReflectivity, vOverloadedIntensity.z);
     #endif
 
-    #ifdef SPECULAR
-            vec4 specularMapColor = texture2D(specularSampler, vSpecularUV);
-            specularColor = toLinearSpace(specularMapColor.rgb);
+    #ifdef REFLECTIVITY
+            vec4 reflectivityMapColor = texture2D(reflectivitySampler, vReflectivityUV);
+            reflectivityColor = toLinearSpace(reflectivityMapColor.rgb);
 
         #ifdef OVERLOADEDVALUES
-                specularColor.rgb = mix(specularColor.rgb, vOverloadedSpecular, vOverloadedIntensity.z);
+                reflectivityColor.rgb = mix(reflectivityColor.rgb, vOverloadedReflectivity, vOverloadedIntensity.z);
         #endif
 
-        #ifdef GLOSSINESSFROMSPECULARMAP
-            glossiness = specularMapColor.a;
+        #ifdef MICROSURFACEFROMREFLECTIVITYMAP
+            microSurface = reflectivityMapColor.a;
         #else
-            glossiness = computeDefaultGlossiness(glossiness, specularColor);
+            microSurface = computeDefaultMicroSurface(microSurface, reflectivityColor);
         #endif
     #endif
 
     #ifdef OVERLOADEDVALUES
-        glossiness = mix(glossiness, vOverloadedGlossiness.x, vOverloadedGlossiness.y);
-    #endif
-#else
-    float glossiness = 0.;
-    #ifdef OVERLOADEDVALUES
-        glossiness = mix(glossiness, vOverloadedGlossiness.x, vOverloadedGlossiness.y);
-    #endif
-
-    vec3 specularColor = vec3(0., 0., 0);
-    #ifdef OVERLOADEDVALUES
-            specularColor.rgb = mix(specularColor.rgb, vOverloadedSpecular, vOverloadedIntensity.z);
+        microSurface = mix(microSurface, vOverloadedMicroSurface.x, vOverloadedMicroSurface.y);
     #endif
-#endif
 
     // Apply Energy Conservation taking in account the environment level only if the environment is present.
-    float reflectance = max(max(specularColor.r, specularColor.g), specularColor.b);
+    float reflectance = max(max(reflectivityColor.r, reflectivityColor.g), reflectivityColor.b);
     baseColor.rgb = (1. - reflectance) * baseColor.rgb;
 
     // Compute Specular Fresnel + Reflectance.
     float NdotV = max(0.00000000001, dot(normalW, viewDirectionW));
 
-    // Adapt glossiness.
-    glossiness = clamp(glossiness, 0., 1.) * 0.98;
+    // Adapt microSurface.
+    microSurface = clamp(microSurface, 0., 1.) * 0.98;
 
     // Call rough to not conflict with previous one.
-    float rough = clamp(1. - glossiness, 0.000001, 1.0);
+    float rough = clamp(1. - microSurface, 0.000001, 1.0);
 
     // Lighting
     vec3 diffuseBase = vec3(0., 0., 0.);
@@ -664,15 +650,15 @@ vec3 ambientReflectionColor = vReflectionColor.rgb;
 reflectionColor *= vLightingIntensity.z;
 ambientReflectionColor *= vLightingIntensity.z;
 
-// Compute reflection specular fresnel
-vec3 specularEnvironmentR0 = specularColor.rgb;
-vec3 specularEnvironmentR90 = vec3(1.0, 1.0, 1.0);
-vec3 specularEnvironmentReflectanceViewer = FresnelSchlickEnvironmentGGX(clamp(NdotV, 0., 1.), specularEnvironmentR0, specularEnvironmentR90, sqrt(glossiness));
-reflectionColor *= specularEnvironmentReflectanceViewer;
+// Compute reflection reflectivity fresnel
+vec3 reflectivityEnvironmentR0 = reflectivityColor.rgb;
+vec3 reflectivityEnvironmentR90 = vec3(1.0, 1.0, 1.0);
+vec3 reflectivityEnvironmentReflectanceViewer = FresnelSchlickEnvironmentGGX(clamp(NdotV, 0., 1.), reflectivityEnvironmentR0, reflectivityEnvironmentR90, sqrt(microSurface));
+reflectionColor *= reflectivityEnvironmentReflectanceViewer;
 
 #ifdef OVERLOADEDVALUES
-    ambientReflectionColor = mix(ambientReflectionColor, vOverloadedReflection, vOverloadedGlossiness.z);
-    reflectionColor = mix(reflectionColor, vOverloadedReflection, vOverloadedGlossiness.z);
+    ambientReflectionColor = mix(ambientReflectionColor, vOverloadedReflection, vOverloadedMicroSurface.z);
+    reflectionColor = mix(reflectionColor, vOverloadedReflection, vOverloadedMicroSurface.z);
 #endif
 
 #ifdef OPACITY
@@ -704,21 +690,21 @@ reflectionColor *= specularEnvironmentReflectanceViewer;
 
     // Composition
 #ifdef EMISSIVEASILLUMINATION
-    vec3 finalDiffuse = max(diffuseBase * diffuseColor + vAmbientColor, 0.0) * baseColor.rgb;
+    vec3 finalDiffuse = max(diffuseBase * albedoColor + vAmbientColor, 0.0) * baseColor.rgb;
 
     #ifdef OVERLOADEDSHADOWVALUES
-        shadowedOnlyDiffuseBase = max(shadowedOnlyDiffuseBase * diffuseColor + vAmbientColor, 0.0) * baseColor.rgb;
+        shadowedOnlyDiffuseBase = max(shadowedOnlyDiffuseBase * albedoColor + vAmbientColor, 0.0) * baseColor.rgb;
     #endif
 #else
-    #ifdef LINKEMISSIVEWITHDIFFUSE
-        vec3 finalDiffuse = max((diffuseBase + emissiveColor) * diffuseColor + vAmbientColor, 0.0) * baseColor.rgb;
+    #ifdef LINKEMISSIVEWITHALBEDO
+        vec3 finalDiffuse = max((diffuseBase + emissiveColor) * albedoColor + vAmbientColor, 0.0) * baseColor.rgb;
         #ifdef OVERLOADEDSHADOWVALUES
-                shadowedOnlyDiffuseBase = max((shadowedOnlyDiffuseBase + emissiveColor) * diffuseColor + vAmbientColor, 0.0) * baseColor.rgb;
+                shadowedOnlyDiffuseBase = max((shadowedOnlyDiffuseBase + emissiveColor) * albedoColor + vAmbientColor, 0.0) * baseColor.rgb;
         #endif
     #else
-        vec3 finalDiffuse = max(diffuseBase * diffuseColor + emissiveColor + vAmbientColor, 0.0) * baseColor.rgb;
+        vec3 finalDiffuse = max(diffuseBase * albedoColor + emissiveColor + vAmbientColor, 0.0) * baseColor.rgb;
         #ifdef OVERLOADEDSHADOWVALUES
-            shadowedOnlyDiffuseBase = max(shadowedOnlyDiffuseBase * diffuseColor + emissiveColor + vAmbientColor, 0.0) * baseColor.rgb;
+            shadowedOnlyDiffuseBase = max(shadowedOnlyDiffuseBase * albedoColor + emissiveColor + vAmbientColor, 0.0) * baseColor.rgb;
         #endif
     #endif
 #endif
@@ -732,7 +718,7 @@ reflectionColor *= specularEnvironmentReflectanceViewer;
 finalDiffuse += baseColor.rgb * ambientReflectionColor * 0.2;
 
 #ifdef SPECULARTERM
-    vec3 finalSpecular = specularBase * specularColor;
+    vec3 finalSpecular = specularBase * reflectivityColor * vLightingIntensity.w;
 #else
     vec3 finalSpecular = vec3(0.0);
 #endif

+ 16 - 16
materialsLibrary/materials/pbr/legacypbr.vertex.fx

@@ -29,10 +29,10 @@ uniform mat4 world;
 uniform mat4 view;
 uniform mat4 viewProjection;
 
-#ifdef DIFFUSE
-varying vec2 vDiffuseUV;
-uniform mat4 diffuseMatrix;
-uniform vec2 vDiffuseInfos;
+#ifdef ALBEDO
+varying vec2 vAlbedoUV;
+uniform mat4 albedoMatrix;
+uniform vec2 vAlbedoInfos;
 #endif
 
 #ifdef AMBIENT
@@ -53,10 +53,10 @@ uniform vec2 vEmissiveInfos;
 uniform mat4 emissiveMatrix;
 #endif
 
-#if defined(SPECULAR) && defined(SPECULARTERM)
-varying vec2 vSpecularUV;
-uniform vec2 vSpecularInfos;
-uniform mat4 specularMatrix;
+#if defined(REFLECTIVITY)
+varying vec2 vReflectivityUV;
+uniform vec2 vReflectivityInfos;
+uniform mat4 reflectivityMatrix;
 #endif
 
 // Output
@@ -119,14 +119,14 @@ void main(void) {
 	vec2 uv2 = vec2(0., 0.);
 #endif
 
-#ifdef DIFFUSE
-	if (vDiffuseInfos.x == 0.)
+#ifdef ALBEDO
+	if (vAlbedoInfos.x == 0.)
 	{
-		vDiffuseUV = vec2(diffuseMatrix * vec4(uv, 1.0, 0.0));
+		vAlbedoUV = vec2(albedoMatrix * vec4(uv, 1.0, 0.0));
 	}
 	else
 	{
-		vDiffuseUV = vec2(diffuseMatrix * vec4(uv2, 1.0, 0.0));
+		vAlbedoUV = vec2(albedoMatrix * vec4(uv2, 1.0, 0.0));
 	}
 #endif
 
@@ -163,14 +163,14 @@ void main(void) {
 	}
 #endif
 
-#if defined(SPECULAR) && defined(SPECULARTERM)
-	if (vSpecularInfos.x == 0.)
+#if defined(REFLECTIVITY)
+	if (vReflectivityInfos.x == 0.)
 	{
-		vSpecularUV = vec2(specularMatrix * vec4(uv, 1.0, 0.0));
+		vReflectivityUV = vec2(reflectivityMatrix * vec4(uv, 1.0, 0.0));
 	}
 	else
 	{
-		vSpecularUV = vec2(specularMatrix * vec4(uv2, 1.0, 0.0));
+		vReflectivityUV = vec2(reflectivityMatrix * vec4(uv2, 1.0, 0.0));
 	}
 #endif
 

+ 61 - 79
materialsLibrary/materials/pbr/pbr.fragment.fx

@@ -15,7 +15,7 @@ precision highp float;
 uniform vec3 vEyePosition;
 uniform vec3 vAmbientColor;
 uniform vec3 vReflectionColor;
-uniform vec4 vDiffuseColor;
+uniform vec4 vAlbedoColor;
 
 // CUSTOM CONTROLS
 uniform vec4 vLightingIntensity;
@@ -24,11 +24,11 @@ uniform vec4 vCameraInfos;
 #ifdef OVERLOADEDVALUES
     uniform vec4 vOverloadedIntensity;
     uniform vec3 vOverloadedAmbient;
-    uniform vec3 vOverloadedDiffuse;
-    uniform vec3 vOverloadedSpecular;
+    uniform vec3 vOverloadedAlbedo;
+    uniform vec3 vOverloadedReflectivity;
     uniform vec3 vOverloadedEmissive;
     uniform vec3 vOverloadedReflection;
-    uniform vec3 vOverloadedGlossiness;
+    uniform vec3 vOverloadedMicroSurface;
 #endif
 
 #ifdef OVERLOADEDSHADOWVALUES
@@ -124,15 +124,15 @@ float computeDiffuseTerm(float NdotL, float NdotV, float VdotH, float roughness)
     // diffuseFresnelTerm /= kPi;
 }
 
-float computeDefaultGlossiness(float glossiness, vec3 specularColor)
+float computeDefaultMicroSurface(float microSurface, vec3 reflectivityColor)
 {
-    float kSpecularNoAlphaWorkflow_SmoothnessMax = 0.95;
+    float kReflectivityNoAlphaWorkflow_SmoothnessMax = 0.95;
 
-    float specularLuminance = getLuminance(specularColor);
-    float specularLuma = sqrt(specularLuminance);
-    glossiness = specularLuma * kSpecularNoAlphaWorkflow_SmoothnessMax;
+    float reflectivityLuminance = getLuminance(reflectivityColor);
+    float reflectivityLuma = sqrt(reflectivityLuminance);
+    microSurface = reflectivityLuma * kReflectivityNoAlphaWorkflow_SmoothnessMax;
 
-    return glossiness;
+    return microSurface;
 }
 
 vec3 toLinearSpace(vec3 color)
@@ -185,10 +185,8 @@ vec3 toGammaSpace(vec3 color)
 #endif
 // END PBR HELPER METHODS
 
-#ifdef SPECULARTERM
-uniform vec4 vSpecularColor;
-#endif
-uniform vec3 vEmissiveColor;
+    uniform vec4 vReflectivityColor;
+    uniform vec3 vEmissiveColor;
 
 // Input
 varying vec3 vPositionW;
@@ -295,10 +293,10 @@ uniform vec3 vLightGround3;
 #endif
 
 // Samplers
-#ifdef DIFFUSE
-varying vec2 vDiffuseUV;
-uniform sampler2D diffuseSampler;
-uniform vec2 vDiffuseInfos;
+#ifdef ALBEDO
+varying vec2 vAlbedoUV;
+uniform sampler2D albedoSampler;
+uniform vec2 vAlbedoInfos;
 #endif
 
 #ifdef AMBIENT
@@ -325,10 +323,10 @@ uniform vec2 vLightmapInfos;
 uniform sampler2D lightmapSampler;
 #endif
 
-#if defined(SPECULAR) && defined(SPECULARTERM)
-varying vec2 vSpecularUV;
-uniform vec2 vSpecularInfos;
-uniform sampler2D specularSampler;
+#if defined(REFLECTIVITY)
+varying vec2 vReflectivityUV;
+uniform vec2 vReflectivityInfos;
+uniform sampler2D reflectivitySampler;
 #endif
 
 // Fresnel
@@ -800,13 +798,13 @@ void main(void) {
 
     // Base color
     vec4 baseColor = vec4(1., 1., 1., 1.);
-    vec3 diffuseColor = vDiffuseColor.rgb;
+    vec3 albedoColor = vAlbedoColor.rgb;
     
     // Alpha
-    float alpha = vDiffuseColor.a;
+    float alpha = vAlbedoColor.a;
 
-#ifdef DIFFUSE
-    baseColor = texture2D(diffuseSampler, vDiffuseUV);
+#ifdef ALBEDO
+    baseColor = texture2D(albedoSampler, vAlbedoUV);
     baseColor = vec4(toLinearSpace(baseColor.rgb), baseColor.a);
 
 #ifdef ALPHATEST
@@ -814,11 +812,11 @@ void main(void) {
         discard;
 #endif
 
-#ifdef ALPHAFROMDIFFUSE
+#ifdef ALPHAFROMALBEDO
     alpha *= baseColor.a;
 #endif
 
-    baseColor.rgb *= vDiffuseInfos.y;
+    baseColor.rgb *= vAlbedoInfos.y;
 #endif
 
 #ifdef VERTEXCOLOR
@@ -826,8 +824,8 @@ void main(void) {
 #endif
 
 #ifdef OVERLOADEDVALUES
-    baseColor.rgb = mix(baseColor.rgb, vOverloadedDiffuse, vOverloadedIntensity.y);
-    diffuseColor.rgb = mix(diffuseColor.rgb, vOverloadedDiffuse, vOverloadedIntensity.y);
+    baseColor.rgb = mix(baseColor.rgb, vOverloadedAlbedo, vOverloadedIntensity.y);
+    albedoColor.rgb = mix(albedoColor.rgb, vOverloadedAlbedo, vOverloadedIntensity.y);
 #endif
 
     // Bump
@@ -854,56 +852,44 @@ void main(void) {
 #endif
 
     // Specular map
-#ifdef SPECULARTERM
-    float glossiness = vSpecularColor.a;
-    vec3 specularColor = vSpecularColor.rgb;
+    float microSurface = vReflectivityColor.a;
+    vec3 reflectivityColor = vReflectivityColor.rgb;
     
     #ifdef OVERLOADEDVALUES
-        specularColor.rgb = mix(specularColor.rgb, vOverloadedSpecular, vOverloadedIntensity.z);
+        reflectivityColor.rgb = mix(reflectivityColor.rgb, vOverloadedReflectivity, vOverloadedIntensity.z);
     #endif
 
-    #ifdef SPECULAR
-        vec4 specularMapColor = texture2D(specularSampler, vSpecularUV);
-        specularColor = toLinearSpace(specularMapColor.rgb);
+    #ifdef REFLECTIVITY
+        vec4 reflectivityMapColor = texture2D(reflectivitySampler, vReflectivityUV);
+        reflectivityColor = toLinearSpace(reflectivityMapColor.rgb);
 
         #ifdef OVERLOADEDVALUES
-                specularColor.rgb = mix(specularColor.rgb, vOverloadedSpecular, vOverloadedIntensity.z);
+                reflectivityColor.rgb = mix(reflectivityColor.rgb, vOverloadedReflectivity, vOverloadedIntensity.z);
         #endif
 
-        #ifdef GLOSSINESSFROMSPECULARMAP
-            glossiness = specularMapColor.a;
+        #ifdef MICROSURFACEFROMREFLECTIVITYMAP
+            microSurface = reflectivityMapColor.a;
         #else
-            glossiness = computeDefaultGlossiness(glossiness, specularColor);
+            microSurface = computeDefaultMicroSurface(microSurface, reflectivityColor);
         #endif
     #endif
 
     #ifdef OVERLOADEDVALUES
-        glossiness = mix(glossiness, vOverloadedGlossiness.x, vOverloadedGlossiness.y);
-    #endif
-#else
-    float glossiness = 0.;
-    #ifdef OVERLOADEDVALUES
-        glossiness = mix(glossiness, vOverloadedGlossiness.x, vOverloadedGlossiness.y);
+        microSurface = mix(microSurface, vOverloadedMicroSurface.x, vOverloadedMicroSurface.y);
     #endif
-    
-    vec3 specularColor = vec3(0., 0., 0);
-    #ifdef OVERLOADEDVALUES
-        specularColor.rgb = mix(specularColor.rgb, vOverloadedSpecular, vOverloadedIntensity.z);
-    #endif
-#endif
 
     // Apply Energy Conservation taking in account the environment level only if the environment is present.
-    float reflectance = max(max(specularColor.r, specularColor.g), specularColor.b);
+    float reflectance = max(max(reflectivityColor.r, reflectivityColor.g), reflectivityColor.b);
     baseColor.rgb = (1. - reflectance) * baseColor.rgb;
 
     // Compute Specular Fresnel + Reflectance.
     float NdotV = max(0.00000000001, dot(normalW, viewDirectionW));
 
-    // Adapt glossiness.
-    glossiness = clamp(glossiness, 0., 1.) * 0.98;
+    // Adapt microSurface.
+    microSurface = clamp(microSurface, 0., 1.) * 0.98;
 
     // Call rough to not conflict with previous one.
-    float rough = clamp(1. - glossiness, 0.000001, 1.0);
+    float rough = clamp(1. - microSurface, 0.000001, 1.0);
 
     // Lighting
     vec3 diffuseBase = vec3(0., 0., 0.);
@@ -1104,12 +1090,8 @@ vec3 ambientReflectionColor = vReflectionColor.rgb;
     vec3 vReflectionUVW = computeReflectionCoords(vec4(vPositionW, 1.0), normalW);
 
     #ifdef REFLECTIONMAP_3D
-        float bias = 0.;
-
-        #ifdef SPECULARTERM
-            // Go mat -> blurry reflexion according to glossiness
-            bias = 20. * (1.0 - glossiness);
-        #endif
+        // Go mat -> blurry reflexion according to microSurface
+        float bias = 20. * (1.0 - microSurface);
 
         reflectionColor = textureCube(reflectionCubeSampler, vReflectionUVW, bias).rgb * vReflectionInfos.x;
         reflectionColor = toLinearSpace(reflectionColor.rgb);
@@ -1134,17 +1116,17 @@ vec3 ambientReflectionColor = vReflectionColor.rgb;
 #endif
 
 #ifdef OVERLOADEDVALUES
-    ambientReflectionColor = mix(ambientReflectionColor, vOverloadedReflection, vOverloadedGlossiness.z);
-    reflectionColor = mix(reflectionColor, vOverloadedReflection, vOverloadedGlossiness.z);
+    ambientReflectionColor = mix(ambientReflectionColor, vOverloadedReflection, vOverloadedMicroSurface.z);
+    reflectionColor = mix(reflectionColor, vOverloadedReflection, vOverloadedMicroSurface.z);
 #endif
 
 reflectionColor *= vLightingIntensity.z;
 ambientReflectionColor *= vLightingIntensity.z;
 
 // Compute reflection specular fresnel
-vec3 specularEnvironmentR0 = specularColor.rgb;
+vec3 specularEnvironmentR0 = reflectivityColor.rgb;
 vec3 specularEnvironmentR90 = vec3(1.0, 1.0, 1.0);
-vec3 specularEnvironmentReflectanceViewer = FresnelSchlickEnvironmentGGX(clamp(NdotV, 0., 1.), specularEnvironmentR0, specularEnvironmentR90, sqrt(glossiness));
+vec3 specularEnvironmentReflectanceViewer = FresnelSchlickEnvironmentGGX(clamp(NdotV, 0., 1.), specularEnvironmentR0, specularEnvironmentR90, sqrt(microSurface));
 reflectionColor *= specularEnvironmentReflectanceViewer;
 
 #ifdef OPACITY
@@ -1188,23 +1170,23 @@ reflectionColor *= specularEnvironmentReflectanceViewer;
 
     // Composition
 #ifdef EMISSIVEASILLUMINATION
-    vec3 finalDiffuse = max(diffuseBase * diffuseColor + vAmbientColor, 0.0) * baseColor.rgb;
+    vec3 finalDiffuse = max(diffuseBase * albedoColor + vAmbientColor, 0.0) * baseColor.rgb;
     
     #ifdef OVERLOADEDSHADOWVALUES
-        shadowedOnlyDiffuseBase = max(shadowedOnlyDiffuseBase * diffuseColor + vAmbientColor, 0.0) * baseColor.rgb;
+        shadowedOnlyDiffuseBase = max(shadowedOnlyDiffuseBase * albedoColor + vAmbientColor, 0.0) * baseColor.rgb;
     #endif
 #else
-    #ifdef LINKEMISSIVEWITHDIFFUSE
-        vec3 finalDiffuse = max((diffuseBase + emissiveColor) * diffuseColor + vAmbientColor, 0.0) * baseColor.rgb;
+    #ifdef LINKEMISSIVEWITHALBEDO
+        vec3 finalDiffuse = max((diffuseBase + emissiveColor) * albedoColor + vAmbientColor, 0.0) * baseColor.rgb;
 
         #ifdef OVERLOADEDSHADOWVALUES
-            shadowedOnlyDiffuseBase = max((shadowedOnlyDiffuseBase + emissiveColor) * diffuseColor + vAmbientColor, 0.0) * baseColor.rgb;
+            shadowedOnlyDiffuseBase = max((shadowedOnlyDiffuseBase + emissiveColor) * albedoColor + vAmbientColor, 0.0) * baseColor.rgb;
         #endif
     #else
-        vec3 finalDiffuse = max(diffuseBase * diffuseColor + emissiveColor + vAmbientColor, 0.0) * baseColor.rgb;
+        vec3 finalDiffuse = max(diffuseBase * albedoColor + emissiveColor + vAmbientColor, 0.0) * baseColor.rgb;
 
         #ifdef OVERLOADEDSHADOWVALUES
-            shadowedOnlyDiffuseBase = max(shadowedOnlyDiffuseBase * diffuseColor + emissiveColor + vAmbientColor, 0.0) * baseColor.rgb;
+            shadowedOnlyDiffuseBase = max(shadowedOnlyDiffuseBase * albedoColor + emissiveColor + vAmbientColor, 0.0) * baseColor.rgb;
         #endif
     #endif
 #endif
@@ -1218,7 +1200,7 @@ reflectionColor *= specularEnvironmentReflectanceViewer;
 finalDiffuse += baseColor.rgb * ambientReflectionColor * 0.2;
 
 #ifdef SPECULARTERM
-    vec3 finalSpecular = specularBase * specularColor;
+    vec3 finalSpecular = specularBase * reflectivityColor * vLightingIntensity.w;
 #else
     vec3 finalSpecular = vec3(0.0);
 #endif
@@ -1279,13 +1261,13 @@ finalDiffuse += baseColor.rgb * ambientReflectionColor * 0.2;
     // gl_FragColor = vec4(baseColor.rgb, 1.0);
 
     // Specular color.
-    // gl_FragColor = vec4(specularColor.rgb, 1.0);
+    // gl_FragColor = vec4(reflectivityColor.rgb, 1.0);
 
-    // Glossiness color.
-    // gl_FragColor = vec4(glossiness, glossiness, glossiness, 1.0);
+    // MicroSurface color.
+    // gl_FragColor = vec4(microSurface, microSurface, microSurface, 1.0);
 
     // Specular Map
-    // gl_FragColor = vec4(specularMapColor.rgb, 1.0);
+    // gl_FragColor = vec4(reflectivityMapColor.rgb, 1.0);
 
     //// Emissive Color
     //vec2 test = vEmissiveUV * 0.5 + 0.5;

+ 16 - 16
materialsLibrary/materials/pbr/pbr.vertex.fx

@@ -39,10 +39,10 @@ uniform mat4 world;
 uniform mat4 view;
 uniform mat4 viewProjection;
 
-#ifdef DIFFUSE
-varying vec2 vDiffuseUV;
-uniform mat4 diffuseMatrix;
-uniform vec2 vDiffuseInfos;
+#ifdef ALBEDO
+varying vec2 vAlbedoUV;
+uniform mat4 albedoMatrix;
+uniform vec2 vAlbedoInfos;
 #endif
 
 #ifdef AMBIENT
@@ -69,10 +69,10 @@ uniform vec2 vLightmapInfos;
 uniform mat4 lightmapMatrix;
 #endif
 
-#if defined(SPECULAR) && defined(SPECULARTERM)
-varying vec2 vSpecularUV;
-uniform vec2 vSpecularInfos;
-uniform mat4 specularMatrix;
+#if defined(REFLECTIVITY)
+varying vec2 vReflectivityUV;
+uniform vec2 vReflectivityInfos;
+uniform mat4 reflectivityMatrix;
 #endif
 
 #ifdef BUMP
@@ -199,14 +199,14 @@ void main(void) {
     vec2 uv2 = vec2(0., 0.);
 #endif
 
-#ifdef DIFFUSE
-    if (vDiffuseInfos.x == 0.)
+#ifdef ALBEDO
+    if (vAlbedoInfos.x == 0.)
     {
-        vDiffuseUV = vec2(diffuseMatrix * vec4(uv, 1.0, 0.0));
+        vAlbedoUV = vec2(albedoMatrix * vec4(uv, 1.0, 0.0));
     }
     else
     {
-        vDiffuseUV = vec2(diffuseMatrix * vec4(uv2, 1.0, 0.0));
+        vAlbedoUV = vec2(albedoMatrix * vec4(uv2, 1.0, 0.0));
     }
 #endif
 
@@ -254,14 +254,14 @@ void main(void) {
     }
 #endif
 
-#if defined(SPECULAR) && defined(SPECULARTERM)
-    if (vSpecularInfos.x == 0.)
+#if defined(REFLECTIVITY)
+    if (vReflectivityInfos.x == 0.)
     {
-        vSpecularUV = vec2(specularMatrix * vec4(uv, 1.0, 0.0));
+        vReflectivityUV = vec2(reflectivityMatrix * vec4(uv, 1.0, 0.0));
     }
     else
     {
-        vSpecularUV = vec2(specularMatrix * vec4(uv2, 1.0, 0.0));
+        vReflectivityUV = vec2(reflectivityMatrix * vec4(uv2, 1.0, 0.0));
     }
 #endif
 

+ 71 - 61
materialsLibrary/test/add/addpbr.js

@@ -1,29 +1,30 @@
 window.preparePBR = function() {
 	var pbr = new BABYLON.PBRMaterial("pbr", scene);
-	pbr.diffuseTexture = new BABYLON.Texture("textures/amiga.jpg", scene);
-	pbr.diffuseTexture.uScale = 5;
-	pbr.diffuseTexture.vScale = 5;
+	pbr.albedoTexture = new BABYLON.Texture("textures/amiga.jpg", scene);
+	pbr.albedoTexture.uScale = 5;
+	pbr.albedoTexture.vScale = 5;
 	pbr.reflectionTexture = new BABYLON.CubeTexture("textures/skybox/TropicalSunnyDay", scene);	
-	pbr.specularColor = new BABYLON.Color3(0.3, 0.3, 0.3);
-	pbr.glossiness = 0.9;
+	pbr.reflectivityColor = new BABYLON.Color3(0.3, 0.3, 0.3);
+	pbr.microSurface = 0.9;
 	
 	registerButtonUI("pbr", "Default", function() {
 		setRangeValues({
 		  "directIntensity": 1,
 		  "emissiveIntensity": 1,
 		  "environmentIntensity": 1,
+		  "specularIntensity": 1,
 		  "ShadowIntensity": 1,
 		  "ShadeIntensity": 1,
 		  "cameraExposure": 1,
 		  "cameraContrast": 1,
-		  "glossiness": 0.9,
-		  "specularColorR": 0.3,
-		  "specularColorG": 0.3,
-		  "specularColorB": 0.3,
-		  "diffuseColorR": 1,
-		  "diffuseColorG": 1,
-		  "diffuseColorB": 1,
-		  "diffuseColorLevel": 0
+		  "microSurface": 0.9,
+		  "reflectivityColorR": 0.3,
+		  "reflectivityColorG": 0.3,
+		  "reflectivityColorB": 0.3,
+		  "albedoColorR": 1,
+		  "albedoColorG": 1,
+		  "albedoColorB": 1,
+		  "albedoColorLevel": 0
 		});
 	});
 	registerButtonUI("pbr", "Rough Gold", function() {
@@ -31,18 +32,19 @@ window.preparePBR = function() {
 		  "directIntensity": 1.3439461727881254,
 		  "emissiveIntensity": 1,
 		  "environmentIntensity": 0.3685013699580344,
+		  "specularIntensity": 1,
 		  "ShadowIntensity": 1,
 		  "ShadeIntensity": 1,
 		  "cameraExposure": 0.7153261887420668,
 		  "cameraContrast": 1.6474178892241538,
-		  "glossiness": 0.42269274789303946,
-		  "specularColorR": 1,
-		  "specularColorG": 0.8453854957860789,
-		  "specularColorB": 0.5093989525890475,
-		  "diffuseColorR": 0,
-		  "diffuseColorG": 0,
-		  "diffuseColorB": 0,
-		  "diffuseColorLevel": 1
+		  "microSurface": 0.42269274789303946,
+		  "reflectivityColorR": 1,
+		  "reflectivityColorG": 0.8453854957860789,
+		  "reflectivityColorB": 0.5093989525890475,
+		  "albedoColorR": 0,
+		  "albedoColorG": 0,
+		  "albedoColorB": 0,
+		  "albedoColorLevel": 1
 		});
 	});
 	registerButtonUI("pbr", "Plastic", function() {
@@ -50,18 +52,19 @@ window.preparePBR = function() {
 		  "directIntensity": 0.9971213540040931,
 		  "emissiveIntensity": 1,
 		  "environmentIntensity": 0.3685013699580344,
+		  "specularIntensity": 1,
 		  "ShadowIntensity": 0.975444802830091,
 		  "ShadeIntensity": 0.8020323934380749,
 		  "cameraExposure": 0.7586792910900708,
 		  "cameraContrast": 1.5823882357021477,
-		  "glossiness": 0.8562237713730799,
-		  "specularColorR": 0.05,
-		  "specularColorG": 0.05,
-		  "specularColorB": 0.05,
-		  "diffuseColorR": 0.20592723615301922,
-		  "diffuseColorG": 0.942929976069088,
-		  "diffuseColorB": 1,
-		  "diffuseColorLevel": 1
+		  "microSurface": 0.8562237713730799,
+		  "reflectivityColorR": 0.05,
+		  "reflectivityColorG": 0.05,
+		  "reflectivityColorB": 0.05,
+		  "albedoColorR": 0.20592723615301922,
+		  "albedoColorG": 0.942929976069088,
+		  "albedoColorB": 1,
+		  "albedoColorLevel": 1
 		});
 	});
 	registerButtonUI("pbr", "Shiny Copper", function() {
@@ -69,18 +72,19 @@ window.preparePBR = function() {
 		  "directIntensity": 1.2355634169181153,
 		  "emissiveIntensity": 0.910415149308085,
 		  "environmentIntensity": 0.21676551174002023,
+		  "specularIntensity": 1,
 		  "ShadowIntensity": 1.018797905178095,
 		  "ShadeIntensity": 0.975444802830091,
 		  "cameraExposure": 1.0621510075260991,
 		  "cameraContrast": 1.0404744563520971,
-		  "glossiness": 0.888738598134083,
-		  "specularColorR": 0.98,
-		  "specularColorG": 0.78,
-		  "specularColorB": 0.706,
-		  "diffuseColorR": 0.1,
-		  "diffuseColorG": 0.1,
-		  "diffuseColorB": 0.1,
-		  "diffuseColorLevel": 1
+		  "microSurface": 0.888738598134083,
+		  "reflectivityColorR": 0.98,
+		  "reflectivityColorG": 0.78,
+		  "reflectivityColorB": 0.706,
+		  "albedoColorR": 0.1,
+		  "albedoColorG": 0.1,
+		  "albedoColorB": 0.1,
+		  "albedoColorLevel": 1
 		});
 	});
 
@@ -101,6 +105,12 @@ window.preparePBR = function() {
 	}, function() {
 		return pbr.environmentIntensity;
 	});
+
+	registerRangeUI("pbr", "specularIntensity", 0, 2, function(value) {
+		pbr.specularIntensity = value;
+	}, function() {
+		return pbr.specularIntensity;
+	});
 	
 	registerRangeUI("pbr", "ShadowIntensity", 0, 2, function(value) {
 		pbr.overloadedShadowIntensity = value;
@@ -126,52 +136,52 @@ window.preparePBR = function() {
 		return pbr.cameraContrast;
 	});
 	
-	registerRangeUI("pbr", "glossiness", 0, 1, function(value) {
-		pbr.glossiness = value;
+	registerRangeUI("pbr", "microSurface", 0, 1, function(value) {
+		pbr.microSurface = value;
 	}, function() {
-		return pbr.glossiness;
+		return pbr.microSurface;
 	});
 
-	registerRangeUI("pbr", "specularColorR", 0, 1, function(value) {
-		pbr.specularColor.r = value;
+	registerRangeUI("pbr", "reflectivityColorR", 0, 1, function(value) {
+		pbr.reflectivityColor.r = value;
 	}, function() {
-		return pbr.specularColor.r;
+		return pbr.reflectivityColor.r;
 	});
 
-	registerRangeUI("pbr", "specularColorG", 0, 1, function(value) {
-		pbr.specularColor.g = value;
+	registerRangeUI("pbr", "reflectivityColorG", 0, 1, function(value) {
+		pbr.reflectivityColor.g = value;
 	}, function() {
-		return pbr.specularColor.g;
+		return pbr.reflectivityColor.g;
 	});
 
-	registerRangeUI("pbr", "specularColorB", 0, 1, function(value) {
-		pbr.specularColor.b = value;
+	registerRangeUI("pbr", "reflectivityColorB", 0, 1, function(value) {
+		pbr.reflectivityColor.b = value;
 	}, function() {
-		return pbr.specularColor.b;
+		return pbr.reflectivityColor.b;
 	});
 
-	registerRangeUI("pbr", "diffuseColorR", 0, 1, function(value) {
-		pbr.overloadedDiffuse.r = value;
+	registerRangeUI("pbr", "albedoColorR", 0, 1, function(value) {
+		pbr.overloadedAlbedo.r = value;
 	}, function() {
-		return pbr.overloadedDiffuse.r;
+		return pbr.overloadedAlbedo.r;
 	});
 
-	registerRangeUI("pbr", "diffuseColorG", 0, 1, function(value) {
-		pbr.overloadedDiffuse.g = value;
+	registerRangeUI("pbr", "albedoColorG", 0, 1, function(value) {
+		pbr.overloadedAlbedo.g = value;
 	}, function() {
-		return pbr.overloadedDiffuse.g;
+		return pbr.overloadedAlbedo.g;
 	});
 
-	registerRangeUI("pbr", "diffuseColorB", 0, 1, function(value) {
-		pbr.overloadedDiffuse.b = value;
+	registerRangeUI("pbr", "albedoColorB", 0, 1, function(value) {
+		pbr.overloadedAlbedo.b = value;
 	}, function() {
-		return pbr.overloadedDiffuse.b;
+		return pbr.overloadedAlbedo.b;
 	});
 
-	registerRangeUI("pbr", "diffuseColorLevel", 0, 1, function(value) {
-		pbr.overloadedDiffuseIntensity = value;
+	registerRangeUI("pbr", "albedoColorLevel", 0, 1, function(value) {
+		pbr.overloadedAlbedoIntensity = value;
 	}, function() {
-		return pbr.overloadedDiffuseIntensity;
+		return pbr.overloadedAlbedoIntensity;
 	});
 
 	return pbr;

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 229 - 141
materialsLibrary/test/babylon.max.js