Sebastien Vandenberghe 8 年之前
父節點
當前提交
e2152401d5

File diff suppressed because it is too large
+ 7288 - 7288
dist/preview release/babylon.d.ts


File diff suppressed because it is too large
+ 11 - 11
dist/preview release/babylon.js


File diff suppressed because it is too large
+ 16 - 11
dist/preview release/babylon.max.js


File diff suppressed because it is too large
+ 7288 - 7288
dist/preview release/babylon.module.d.ts


File diff suppressed because it is too large
+ 11 - 11
dist/preview release/babylon.worker.js


File diff suppressed because it is too large
+ 3028 - 3028
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts


File diff suppressed because it is too large
+ 9 - 9
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js


File diff suppressed because it is too large
+ 16 - 11
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js


File diff suppressed because it is too large
+ 3028 - 3028
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.module.d.ts


File diff suppressed because it is too large
+ 0 - 18132
dist/preview release/customConfigurations/minimalViewer/babylon.d.ts


File diff suppressed because it is too large
+ 0 - 33
dist/preview release/customConfigurations/minimalViewer/babylon.js


File diff suppressed because it is too large
+ 0 - 48784
dist/preview release/customConfigurations/minimalViewer/babylon.max.js


File diff suppressed because it is too large
+ 0 - 18134
dist/preview release/customConfigurations/minimalViewer/babylon.module.d.ts


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/loaders/babylon.objFileLoader.min.js


+ 5 - 9
src/Materials/PBR/babylon.pbrBaseMaterial.ts

@@ -724,18 +724,14 @@
 
                         if (this._useParallax && this._albedoTexture && StandardMaterial.DiffuseTextureEnabled) {
                             defines.PARALLAX = true;
-                            if (this._useParallaxOcclusion) {
-                                defines.PARALLAXOCCLUSION = true;
-                            }
+                            defines.PARALLAXOCCLUSION = !!this._useParallaxOcclusion;
                         }
-
-                        if (this._invertNormalMapX) {
-                            defines.INVERTNORMALMAPX = true;
+                        else {
+                            defines.PARALLAX = false;
                         }
 
-                        if (this._invertNormalMapY) {
-                            defines.INVERTNORMALMAPY = true;
-                        }
+                        defines.INVERTNORMALMAPX = !!this._invertNormalMapX;
+                        defines.INVERTNORMALMAPY = !!this._invertNormalMapY;
 
                         if (scene._mirroredCameraPosition) {
                             defines.INVERTNORMALMAPX = !defines.INVERTNORMALMAPX;

+ 20 - 18
src/Shaders/pbr.fragment.fx

@@ -380,25 +380,27 @@ void main(void) {
 
 // _____________________________ Alpha Fresnel ___________________________________
 #ifdef ALPHAFRESNEL
-	// Convert approximate perceptual opacity (gamma-encoded opacity) to linear opacity (absorptance, or inverse transmission)
-	// for use with the linear HDR render target. The final composition will be converted back to gamma encoded values for eventual display.
-	// Uses power 2.0 rather than 2.2 for simplicity/efficiency, and because the mapping does not need to map the gamma applied to RGB.
-	float opacityPerceptual = alpha;
-	float opacity0 = opacityPerceptual * opacityPerceptual;
-	float opacity90 = fresnelGrazingReflectance(opacity0);
-
-	vec3 normalForward = faceforward(normalW, -viewDirectionW, normalW);
-
-	// Calculate the appropriate linear opacity for the current viewing angle (formally, this quantity is the "directional absorptance").
-	alpha = fresnelSchlickEnvironmentGGX(clamp(dot(V, normalForward), 0.0, 1.0), vec3(opacity0), vec3(opacity90), sqrt(microSurface)).x;
-	
-	#ifdef ALPHATEST
-		if (alpha <= ALPHATESTVALUE)
-			discard;
+	#if defined(ALPHATEST) || defined(ALPHABLEND)
+		// Convert approximate perceptual opacity (gamma-encoded opacity) to linear opacity (absorptance, or inverse transmission)
+		// for use with the linear HDR render target. The final composition will be converted back to gamma encoded values for eventual display.
+		// Uses power 2.0 rather than 2.2 for simplicity/efficiency, and because the mapping does not need to map the gamma applied to RGB.
+		float opacityPerceptual = alpha;
+		float opacity0 = opacityPerceptual * opacityPerceptual;
+		float opacity90 = fresnelGrazingReflectance(opacity0);
+
+		vec3 normalForward = faceforward(normalW, -viewDirectionW, normalW);
+
+		// Calculate the appropriate linear opacity for the current viewing angle (formally, this quantity is the "directional absorptance").
+		alpha = fresnelSchlickEnvironmentGGX(clamp(dot(viewDirectionW, normalForward), 0.0, 1.0), vec3(opacity0), vec3(opacity90), sqrt(microSurface)).x;
+		
+		#ifdef ALPHATEST
+			if (alpha <= ALPHATESTVALUE)
+				discard;
 
-		#ifndef ALPHABLEND
-			// Prevent to blend with the canvas.
-			alpha = 1.0;
+			#ifndef ALPHABLEND
+				// Prevent to blend with the canvas.
+				alpha = 1.0;
+			#endif
 		#endif
 	#endif
 #endif

+ 12 - 2
src/Tools/HDR/babylon.cubemapToSphericalPolynomial.ts

@@ -45,8 +45,18 @@ module BABYLON.Internals {
             var size = texture.getSize().width;
             var right = texture.readPixels(0);
             var left = texture.readPixels(1);
-            var up = texture.readPixels(2);
-            var down = texture.readPixels(3);
+
+            var up: ArrayBufferView;
+            var down: ArrayBufferView;
+            if (texture.isRenderTarget) {
+                up = texture.readPixels(3);
+                down = texture.readPixels(2);
+            }
+            else {
+                up = texture.readPixels(2);
+                down = texture.readPixels(3);
+            }
+
             var front = texture.readPixels(4);
             var back = texture.readPixels(5);