Browse Source

Remove overloaded values

sevan 8 năm trước cách đây
mục cha
commit
1ea91d6b0f

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 564 - 631
dist/preview release/babylon.d.ts


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 27 - 28
dist/preview release/babylon.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 3 - 156
dist/preview release/babylon.max.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 564 - 631
dist/preview release/babylon.module.d.ts


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 42 - 43
dist/preview release/babylon.worker.js


+ 8 - 20
materialsLibrary/test/addpbr.js

@@ -154,18 +154,6 @@ window.preparePBR = function() {
 		return pbr.specularIntensity;
 	});
 	
-	registerRangeUI("pbr", "ShadowIntensity", 0, 2, function(value) {
-		pbr.overloadedShadowIntensity = value;
-	}, function() {
-		return pbr.overloadedShadowIntensity;
-	});
-	
-	registerRangeUI("pbr", "ShadeIntensity", 0, 2, function(value) {
-		pbr.overloadedShadeIntensity = value;
-	}, function() {
-		return pbr.overloadedShadeIntensity;
-	});
-	
 	registerRangeUI("pbr", "cameraExposure", 0, 2, function(value) {
 		pbr.cameraExposure = value;
 	}, function() {
@@ -203,27 +191,27 @@ window.preparePBR = function() {
 	});
 
 	registerRangeUI("pbr", "albedoColorR", 0, 1, function(value) {
-		pbr.overloadedAlbedo.r = value;
+		pbr.albedoColor.r = value;
 	}, function() {
-		return pbr.overloadedAlbedo.r;
+		return pbr.albedoColor.r;
 	});
 
 	registerRangeUI("pbr", "albedoColorG", 0, 1, function(value) {
-		pbr.overloadedAlbedo.g = value;
+		pbr.albedoColor.g = value;
 	}, function() {
-		return pbr.overloadedAlbedo.g;
+		return pbr.albedoColor.g;
 	});
 
 	registerRangeUI("pbr", "albedoColorB", 0, 1, function(value) {
-		pbr.overloadedAlbedo.b = value;
+		pbr.albedoColor.b = value;
 	}, function() {
-		return pbr.overloadedAlbedo.b;
+		return pbr.albedoColor.b;
 	});
 
 	registerRangeUI("pbr", "albedoColorLevel", 0, 1, function(value) {
-		pbr.overloadedAlbedoIntensity = value;
+		pbr.albedoTexture.level = value;
 	}, function() {
-		return pbr.overloadedAlbedoIntensity;
+		return pbr.albedoTexture.level;
 	});
     
     registerButtonUI("pbr", "Toggle Skybox", function() {

+ 1 - 152
src/Materials/babylon.pbrMaterial.ts

@@ -52,8 +52,6 @@
         public CAMERACONTRAST = false;
         public CAMERACOLORGRADING = false;
         public CAMERACOLORCURVES = false;
-        public OVERLOADEDVALUES = false;
-        public OVERLOADEDSHADOWVALUES = false;
         public USESPHERICALFROMREFLECTIONMAP = false;
         public REFRACTION = false;
         public REFRACTIONMAP_3D = false;
@@ -134,22 +132,6 @@
         public disableBumpMap: boolean = false;
 
         /**
-         * Debug Control helping enforcing or dropping the darkness of shadows.
-         * 1.0 means the shadows have their normal darkness, 0.0 means the shadows are not visible.
-         */
-        @serialize()
-        public overloadedShadowIntensity: number = 1.0;
-        
-        /**
-         * Debug Control helping dropping the shading effect coming from the diffuse lighting.
-         * 1.0 means the shade have their normal impact, 0.0 means no shading at all.
-         */
-        @serialize()
-        public overloadedShadeIntensity: number = 1.0;
-
-        private _overloadedShadowInfos: Vector4 = new Vector4(this.overloadedShadowIntensity, this.overloadedShadeIntensity, 0.0, 0.0);
-
-        /**
          * The camera exposure used on this material.
          * This property is here and not in the camera to allow controlling exposure without full screen post process.
          * This corresponds to a photographic exposure.
@@ -185,88 +167,6 @@
         private _microsurfaceTextureLods: Vector2 = new Vector2(0.0, 0.0);
 
         /**
-         * Debug Control allowing to overload the ambient color.
-         * This as to be use with the overloadedAmbientIntensity parameter.
-         */
-        @serializeAsColor3()
-        public overloadedAmbient: Color3 = BABYLON.Color3.White();
-
-        /**
-         * Debug Control indicating how much the overloaded ambient color is used against the default one.
-         */
-        @serialize()
-        public overloadedAmbientIntensity: number = 0.0;
-        
-        /**
-         * Debug Control allowing to overload the albedo color.
-         * This as to be use with the overloadedAlbedoIntensity parameter.
-         */
-        @serializeAsColor3()
-        public overloadedAlbedo: Color3 = BABYLON.Color3.White();
-        
-        /**
-         * Debug Control indicating how much the overloaded albedo color is used against the default one.
-         */
-        @serialize()
-        public overloadedAlbedoIntensity: number = 0.0;
-        
-        /**
-         * Debug Control allowing to overload the reflectivity color.
-         * This as to be use with the overloadedReflectivityIntensity parameter.
-         */
-        @serializeAsColor3()
-        public overloadedReflectivity: Color3 = new BABYLON.Color3(0.0, 0.0, 0.0);
-        
-        /**
-         * Debug Control indicating how much the overloaded reflectivity color is used against the default one.
-         */
-        @serialize()
-        public overloadedReflectivityIntensity: number = 0.0;
-        
-        /**
-         * Debug Control allowing to overload the emissive color.
-         * This as to be use with the overloadedEmissiveIntensity parameter.
-         */
-        @serializeAsColor3()
-        public overloadedEmissive: Color3 = BABYLON.Color3.White();
-        
-        /**
-         * Debug Control indicating how much the overloaded emissive color is used against the default one.
-         */
-        @serialize()
-        public overloadedEmissiveIntensity: number = 0.0;
-
-        private _overloadedIntensity: Vector4 = new Vector4(this.overloadedAmbientIntensity, this.overloadedAlbedoIntensity, this.overloadedReflectivityIntensity, this.overloadedEmissiveIntensity);
-        
-        /**
-         * Debug Control allowing to overload the reflection color.
-         * This as to be use with the overloadedReflectionIntensity parameter.
-         */
-        @serializeAsColor3()
-        public overloadedReflection: Color3 = BABYLON.Color3.White();
-        
-        /**
-         * Debug Control indicating how much the overloaded reflection color is used against the default one.
-         */
-        @serialize()
-        public overloadedReflectionIntensity: number = 0.0;
-
-        /**
-         * Debug Control allowing to overload the microsurface.
-         * This as to be use with the overloadedMicroSurfaceIntensity parameter.
-         */
-        @serialize()
-        public overloadedMicroSurface: number = 0.0;
-        
-        /**
-         * Debug Control indicating how much the overloaded microsurface is used against the default one.
-         */
-        @serialize()
-        public overloadedMicroSurfaceIntensity: number = 0.0;
-
-        private _overloadedMicroSurface: Vector3 = new Vector3(this.overloadedMicroSurface, this.overloadedMicroSurfaceIntensity, this.overloadedReflectionIntensity);
-
-        /**
          * AKA Diffuse Texture in standard nomenclature.
          */
         @serializeAsTexture()
@@ -937,20 +837,6 @@
                 this._defines.CAMERACOLORCURVES = true;
             }
 
-            if (this.overloadedShadeIntensity != 1 ||
-                this.overloadedShadowIntensity != 1) {
-                this._defines.OVERLOADEDSHADOWVALUES = true;
-            }
-
-            if (this.overloadedMicroSurfaceIntensity > 0 ||
-                this.overloadedEmissiveIntensity > 0 ||
-                this.overloadedReflectivityIntensity > 0 ||
-                this.overloadedAlbedoIntensity > 0 ||
-                this.overloadedAmbientIntensity > 0 ||
-                this.overloadedReflectionIntensity > 0) {
-                this._defines.OVERLOADEDVALUES = true;
-            }
-
             // Point size
             if (this.pointsCloud || scene.forcePointsCloud) {
                 this._defines.POINTSIZE = true;
@@ -1148,7 +1034,7 @@
                         "vClipPlane", "albedoMatrix", "ambientMatrix", "opacityMatrix", "reflectionMatrix", "emissiveMatrix", "reflectivityMatrix", "microSurfaceSamplerMatrix", "bumpMatrix", "lightmapMatrix", "refractionMatrix",
                         "depthValues",
                         "opacityParts", "emissiveLeftColor", "emissiveRightColor",
-                        "vLightingIntensity", "vOverloadedShadowIntensity", "vOverloadedIntensity", "vOverloadedAlbedo", "vOverloadedReflection", "vOverloadedReflectivity", "vOverloadedEmissive", "vOverloadedMicroSurface",
+                        "vLightingIntensity",
                         "logarithmicDepthConstant",
                         "vSphericalX", "vSphericalY", "vSphericalZ",
                         "vSphericalXX", "vSphericalYY", "vSphericalZZ",
@@ -1240,15 +1126,6 @@
             this._uniformBuffer.addUniform("emissiveLeftColor", 4);
             this._uniformBuffer.addUniform("emissiveRightColor", 4);
 
-            this._uniformBuffer.addUniform("vOverloadedIntensity", 4);
-            this._uniformBuffer.addUniform("vOverloadedAmbient", 3);
-            this._uniformBuffer.addUniform("vOverloadedAlbedo", 3);
-            this._uniformBuffer.addUniform("vOverloadedReflectivity", 3);
-            this._uniformBuffer.addUniform("vOverloadedEmissive", 3);
-            this._uniformBuffer.addUniform("vOverloadedReflection", 3);
-            this._uniformBuffer.addUniform("vOverloadedMicroSurface", 3);
-            this._uniformBuffer.addUniform("vOverloadedShadowIntensity", 4);
-
             this._uniformBuffer.addUniform("pointSize", 1);
             this._uniformBuffer.create();
         }
@@ -1441,34 +1318,6 @@
                     this._lightingInfos.w = this.specularIntensity;
 
                     this._uniformBuffer.updateVector4("vLightingIntensity", this._lightingInfos);
-
-                    // Overloaded params
-
-                    this._overloadedShadowInfos.x = this.overloadedShadowIntensity;
-                    this._overloadedShadowInfos.y = this.overloadedShadeIntensity;
-                    this._uniformBuffer.updateVector4("vOverloadedShadowIntensity", this._overloadedShadowInfos);
-
-                    this._overloadedIntensity.x = this.overloadedAmbientIntensity;
-                    this._overloadedIntensity.y = this.overloadedAlbedoIntensity;
-                    this._overloadedIntensity.z = this.overloadedReflectivityIntensity;
-                    this._overloadedIntensity.w = this.overloadedEmissiveIntensity;
-                    this._uniformBuffer.updateVector4("vOverloadedIntensity", this._overloadedIntensity);
-
-                    this._uniformBuffer.updateColor3("vOverloadedAmbient", this.overloadedAmbient);
-                    this.convertColorToLinearSpaceToRef(this.overloadedAlbedo, this._tempColor);
-                    this._uniformBuffer.updateColor3("vOverloadedAlbedo", this._tempColor);
-                    this.convertColorToLinearSpaceToRef(this.overloadedReflectivity, this._tempColor);
-                    this._uniformBuffer.updateColor3("vOverloadedReflectivity", this._tempColor);
-                    this.convertColorToLinearSpaceToRef(this.overloadedEmissive, this._tempColor);
-                    this._uniformBuffer.updateColor3("vOverloadedEmissive", this._tempColor);
-                    this.convertColorToLinearSpaceToRef(this.overloadedReflection, this._tempColor);
-                    this._uniformBuffer.updateColor3("vOverloadedReflection", this._tempColor);
-
-                    this._overloadedMicroSurface.x = this.overloadedMicroSurface;
-                    this._overloadedMicroSurface.y = this.overloadedMicroSurfaceIntensity;
-                    this._overloadedMicroSurface.z = this.overloadedReflectionIntensity;
-                    this._uniformBuffer.updateVector3("vOverloadedMicroSurface", this._overloadedMicroSurface);
-
                 }
 
                 // Textures        

+ 0 - 14
src/Shaders/ShadersInclude/pbrFragmentDeclaration.fx

@@ -4,20 +4,6 @@ uniform vec4 vAlbedoColor;
 // CUSTOM CONTROLS
 uniform vec4 vLightingIntensity;
 
-#ifdef OVERLOADEDVALUES
-uniform vec4 vOverloadedIntensity;
-uniform vec3 vOverloadedAmbient;
-uniform vec3 vOverloadedAlbedo;
-uniform vec3 vOverloadedReflectivity;
-uniform vec3 vOverloadedEmissive;
-uniform vec3 vOverloadedReflection;
-uniform vec3 vOverloadedMicroSurface;
-#endif
-
-#ifdef OVERLOADEDSHADOWVALUES
-uniform vec4 vOverloadedShadowIntensity;
-#endif
-
 #if defined(REFLECTION) || defined(REFRACTION)
 uniform vec2 vMicrosurfaceTextureLods;
 #endif

+ 0 - 8
src/Shaders/ShadersInclude/pbrLightFunctionsCall.fx

@@ -49,14 +49,6 @@
         #endif
     #else
         lightDiffuseContribution += info.diffuse * notShadowLevel;
-        
-        #ifdef OVERLOADEDSHADOWVALUES
-            if (NdotL < 0.000000000011)
-            {
-                notShadowLevel = 1.;
-            }
-            shadowedOnlyLightDiffuseContribution *= notShadowLevel;
-        #endif
 
         #ifdef SPECULARTERM
             lightSpecularContribution += info.specular * notShadowLevel;

+ 0 - 9
src/Shaders/ShadersInclude/pbrUboDeclaration.fx

@@ -34,15 +34,6 @@ uniform Material
 	uniform vec4 emissiveLeftColor;
 	uniform vec4 emissiveRightColor;
 
-	uniform vec4 vOverloadedIntensity;
-	uniform vec3 vOverloadedAmbient;
-	uniform vec3 vOverloadedAlbedo;
-	uniform vec3 vOverloadedReflectivity;
-	uniform vec3 vOverloadedEmissive;
-	uniform vec3 vOverloadedReflection;
-	uniform vec3 vOverloadedMicroSurface;
-	uniform vec4 vOverloadedShadowIntensity;
-
 	uniform float pointSize;
 };
 

+ 7 - 31
src/Shaders/ShadersInclude/shadowsFragmentFunctions.fx

@@ -27,11 +27,7 @@
 
 		if (depth > shadow)
 		{
-			#ifdef OVERLOADEDSHADOWVALUES
-                return mix(1.0, darkness, vOverloadedShadowIntensity.x);
-            #else
-                return darkness;
-            #endif
+			return darkness;
 		}
 		return 1.0;
 	}
@@ -69,11 +65,7 @@
 			if (textureCube(shadowSampler, directionToLight + poissonDisk[3] * mapSize).x < depth) visibility -= 0.25;
 		#endif
 
-		#ifdef OVERLOADEDSHADOWVALUES
-            return  min(1.0, mix(1.0, visibility + darkness, vOverloadedShadowIntensity.x));
-        #else
-            return  min(1.0, visibility + darkness);
-        #endif
+		return  min(1.0, visibility + darkness);
 	}
 
 	float computeShadowWithESMCube(vec3 lightPosition, samplerCube shadowSampler, float darkness, float depthScale)
@@ -93,11 +85,7 @@
 		#endif
 
 		float esm = 1.0 - clamp(exp(min(87., depthScale * shadowPixelDepth)) * shadowMapSample - darkness, 0., 1.);	
-		#ifdef OVERLOADEDSHADOWVALUES
-			return mix(1.0, esm, vOverloadedShadowIntensity.x);
-		#else
-			return esm;
-		#endif
+		return esm;
 	}
 
 	float computeShadow(vec4 vPositionFromLight, sampler2D shadowSampler, float darkness)
@@ -119,11 +107,7 @@
 
 		if (depth.z > shadow)
 		{
-			#ifdef OVERLOADEDSHADOWVALUES
-                return mix(1.0, darkness, vOverloadedShadowIntensity.x);
-            #else
-                return darkness;
-            #endif
+			return darkness;
 		}
 		return 1.;
 	}
@@ -160,12 +144,8 @@
 			if (texture2D(shadowSampler, uv + poissonDisk[2] * mapSize).x < depth.z) visibility -= 0.25;
 			if (texture2D(shadowSampler, uv + poissonDisk[3] * mapSize).x < depth.z) visibility -= 0.25;
 		#endif
-		
-        #ifdef OVERLOADEDSHADOWVALUES
-            return  mix(1.0, min(1.0, visibility + darkness), vOverloadedShadowIntensity.x);
-        #else
-            return  min(1.0, visibility + darkness);
-        #endif
+
+		return  min(1.0, visibility + darkness);
 	}
 
 	float computeShadowWithESM(vec4 vPositionFromLight, sampler2D shadowSampler, float darkness, float depthScale)
@@ -195,10 +175,6 @@
 
 		// esm = mix(1.0, esm, mask);
 
-		#ifdef OVERLOADEDSHADOWVALUES
-            return mix(1.0, esm, vOverloadedShadowIntensity.x);
-        #else
-            return esm;
-        #endif
+		return esm;
 	}
 #endif

+ 3 - 60
src/Shaders/pbr.fragment.fx

@@ -186,23 +186,15 @@ void main(void) {
 	surfaceAlbedo.rgb *= vColor.rgb;
 #endif
 
-#ifdef OVERLOADEDVALUES
-	surfaceAlbedo.rgb = mix(surfaceAlbedo.rgb, vOverloadedAlbedo, vOverloadedIntensity.y);
-#endif
-
 	// Ambient color
 	vec3 ambientOcclusionColor = vec3(1., 1., 1.);
 
 #ifdef AMBIENT
 	vec3 ambientOcclusionColorMap = texture2D(ambientSampler, vAmbientUV + uvOffset).rgb * vAmbientInfos.y;
-	#ifdef AMBIENTINGRAYSCALE			
+	#ifdef AMBIENTINGRAYSCALE
 		ambientOcclusionColorMap = vec3(ambientOcclusionColorMap.r, ambientOcclusionColorMap.r, ambientOcclusionColorMap.r);
 	#endif
 	ambientOcclusionColor = mix(ambientOcclusionColor, ambientOcclusionColorMap, vAmbientInfos.z);
-
-	#ifdef OVERLOADEDVALUES
-		ambientOcclusionColor.rgb = mix(ambientOcclusionColor.rgb, vOverloadedAmbient, vOverloadedIntensity.x);
-	#endif
 #endif
 
 	// Reflectivity map
@@ -215,10 +207,6 @@ void main(void) {
 	surfaceReflectivityColor = toLinearSpace(surfaceReflectivityColor);
 	surfaceReflectivityColor *= vReflectivityInfos.y;
 
-	#ifdef OVERLOADEDVALUES
-		surfaceReflectivityColor = mix(surfaceReflectivityColor, vOverloadedReflectivity, vOverloadedIntensity.z);
-	#endif
-
 	#ifdef MICROSURFACEFROMREFLECTIVITYMAP
 		microSurface = surfaceReflectivityColorMap.a * vReflectivityInfos.z;
 	#else
@@ -226,10 +214,6 @@ void main(void) {
 			microSurface = computeDefaultMicroSurface(microSurface, surfaceReflectivityColor);
 		#endif
 	#endif
-#else
-	#ifdef OVERLOADEDVALUES
-		surfaceReflectivityColor = mix(surfaceReflectivityColor, vOverloadedReflectivity, vOverloadedIntensity.z);
-	#endif
 #endif
 
 #ifdef METALLICWORKFLOW
@@ -278,10 +262,6 @@ void main(void) {
 
 	// Compute the converted reflectivity.
 	surfaceReflectivityColor = mix(DefaultSpecularReflectanceDielectric, baseColor, metallicRoughness.r);
-
-	#ifdef OVERLOADEDVALUES
-		surfaceReflectivityColor = mix(surfaceReflectivityColor, vOverloadedReflectivity, vOverloadedIntensity.z);
-	#endif
 #else
 	#ifdef MICROSURFACEMAP
 		vec4 microSurfaceTexel = texture2D(microSurfaceSampler, vMicroSurfaceSamplerUV + uvOffset) * vMicroSurfaceSamplerInfos.y;
@@ -289,10 +269,6 @@ void main(void) {
 	#endif
 #endif
 
-#ifdef OVERLOADEDVALUES
-	microSurface = mix(microSurface, vOverloadedMicroSurface.x, vOverloadedMicroSurface.y);
-#endif
-
 	// Compute N dot V.
 	float NdotV = max(0.00000000001, dot(normalW, viewDirectionW));
 
@@ -305,10 +281,6 @@ void main(void) {
 	// Lighting
 	vec3 lightDiffuseContribution = vec3(0., 0., 0.);
 
-#ifdef OVERLOADEDSHADOWVALUES
-	vec3 shadowedOnlyLightDiffuseContribution = vec3(1., 1., 1.);
-#endif
-
 #ifdef SPECULARTERM
 	vec3 lightSpecularContribution = vec3(0., 0., 0.);
 #endif
@@ -495,11 +467,6 @@ void main(void) {
 	#endif
 #endif
 
-#ifdef OVERLOADEDVALUES
-	environmentIrradiance = mix(environmentIrradiance, vOverloadedReflection, vOverloadedMicroSurface.z);
-	environmentRadiance = mix(environmentRadiance, vOverloadedReflection, vOverloadedMicroSurface.z);
-#endif
-
 	environmentRadiance *= vLightingIntensity.z;
 	environmentIrradiance *= vLightingIntensity.z;
 
@@ -558,10 +525,6 @@ void main(void) {
 	surfaceEmissiveColor = toLinearSpace(emissiveColorTex.rgb) * surfaceEmissiveColor * vEmissiveInfos.y;
 #endif
 
-#ifdef OVERLOADEDVALUES
-	surfaceEmissiveColor = mix(surfaceEmissiveColor, vOverloadedEmissive, vOverloadedIntensity.w);
-#endif
-
 #ifdef EMISSIVEFRESNEL
 	float emissiveFresnelTerm = computeFresnelTerm(viewDirectionW, normalW, emissiveRightColor.a, emissiveLeftColor.a);
 
@@ -571,37 +534,17 @@ void main(void) {
 	// Composition
 #ifdef EMISSIVEASILLUMINATION
 	vec3 finalDiffuse = lightDiffuseContribution * surfaceAlbedoContribution;
-
-	#ifdef OVERLOADEDSHADOWVALUES
-		shadowedOnlyLightDiffuseContribution = shadowedOnlyLightDiffuseContribution * surfaceAlbedoContribution;
-	#endif
 #else
 	#ifdef LINKEMISSIVEWITHALBEDO
 		vec3 finalDiffuse = (lightDiffuseContribution + surfaceEmissiveColor) * surfaceAlbedoContribution;
-
-		#ifdef OVERLOADEDSHADOWVALUES
-			shadowedOnlyLightDiffuseContribution = (shadowedOnlyLightDiffuseContribution + surfaceEmissiveColor) * surfaceAlbedoContribution;
-		#endif
 	#else
 		vec3 finalDiffuse = lightDiffuseContribution * surfaceAlbedoContribution + surfaceEmissiveColor;
-
-		#ifdef OVERLOADEDSHADOWVALUES
-			shadowedOnlyLightDiffuseContribution = shadowedOnlyLightDiffuseContribution * surfaceAlbedoContribution + surfaceEmissiveColor;
-		#endif
 	#endif
 #endif
 
 finalDiffuse.rgb += vAmbientColor;
 finalDiffuse *= surfaceAlbedo.rgb;
 finalDiffuse = max(finalDiffuse, 0.0);
-
-#ifdef OVERLOADEDSHADOWVALUES
-	shadowedOnlyLightDiffuseContribution += vAmbientColor;
-	shadowedOnlyLightDiffuseContribution *= surfaceAlbedo.rgb;
-	shadowedOnlyLightDiffuseContribution = max(shadowedOnlyLightDiffuseContribution, 0.0);
-	finalDiffuse = mix(finalDiffuse, shadowedOnlyLightDiffuseContribution, (1.0 - vOverloadedShadowIntensity.y));
-#endif
-
 finalDiffuse = (finalDiffuse * vLightingIntensity.x + surfaceAlbedo.rgb * environmentIrradiance) * ambientOcclusionColor;
 
 #ifdef SPECULARTERM
@@ -660,6 +603,8 @@ vec4 finalColor = vec4(finalDiffuse + finalSpecular * vLightingIntensity.x + env
 	finalColor.rgb = applyColorCurves(finalColor.rgb);
 #endif
 
+	gl_FragColor = finalColor;
+
 	// Normal Display.
 	// gl_FragColor = vec4(normalW * 0.5 + 0.5, 1.0);
 
@@ -687,6 +632,4 @@ vec4 finalColor = vec4(finalDiffuse + finalSpecular * vLightingIntensity.x + env
 	//// Emissive Color
 	//vec2 test = vEmissiveUV * 0.5 + 0.5;
 	//gl_FragColor = vec4(test.x, test.y, 1.0, 1.0);
-
-	gl_FragColor = finalColor;
 }