瀏覽代碼

Fix Occlusion

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

+ 1 - 1
src/Materials/PBR/babylon.pbrBaseMaterial.ts

@@ -215,7 +215,7 @@
          */
         protected _reflectivityColor = new Color3(1, 1, 1);
 
-        protected _reflectionColor = new Color3(0.0, 0.0, 0.0);
+        protected _reflectionColor = new Color3(1, 1, 1);
 
         protected _emissiveColor = new Color3(0, 0, 0);
         

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

@@ -182,7 +182,7 @@
 
         @serializeAsColor3("reflection")
         @expandToProperty("_markAllSubMeshesAsTexturesDirty")
-        public reflectionColor = new Color3(0.0, 0.0, 0.0);
+        public reflectionColor = new Color3(1.0, 1.0, 1.0);
 
         @serializeAsColor3("emissive")
         @expandToProperty("_markAllSubMeshesAsTexturesDirty")

+ 1 - 1
src/Shaders/ShadersInclude/pbrFunctions.fx

@@ -137,6 +137,6 @@ float environmentRadianceOcclusion(float ambientOcclusion, float NdotVUnclamped)
 
 float environmentHorizonOcclusion(vec3 reflection, vec3 normal) {
 	// http://marmosetco.tumblr.com/post/81245981087
-    float temp = clamp( 1.0 + 0.3 * dot(reflection, normal), 0.0, 1.0);
+    float temp = clamp( 1.0 + 1.1 * dot(reflection, normal), 0.0, 1.0);
     return square(temp);
 }

+ 10 - 1
src/Shaders/pbr.fragment.fx

@@ -505,7 +505,8 @@ void main(void) {
 
 	// _____________________________ Levels _____________________________________
 	environmentRadiance *= vReflectionInfos.x;
-	//environmentIrradiance *= vReflectionColor.rgb;
+	environmentRadiance *= vReflectionColor.rgb;
+	environmentIrradiance *= vReflectionColor.rgb;
 #endif
 
 // ____________________________________________________________________________________
@@ -754,4 +755,12 @@ void main(void) {
 	//// Emissive Color
 	//vec2 test = vEmissiveUV * 0.5 + 0.5;
 	//gl_FragColor = vec4(test.x, test.y, 1.0, 1.0);
+
+	// Specular Environment Occlusion
+	//gl_FragColor = vec4(seo, seo, seo, 1.0);
+
+	//// Horizon Environment Occlusion
+	//gl_FragColor = vec4(eho, eho, eho, 1.0);
+
+	//gl_FragColor = vec4(seo * eho, seo * eho, seo * eho, 1.0);
 }