Corrected object shader's specularFactor calculation, which would result in NaN values that may propagate on some GPU's to the rest of the color calculation. This resulted in blocks of black pixels on some GPU's including the iPhone 6.

This commit is contained in:
2014-10-05 23:20:34 -07:00
parent 2ea641c28c
commit 187b87bdae
2 changed files with 8 additions and 2 deletions

View File

@@ -252,7 +252,10 @@ void main()
#if GBUFFER_PASS == 3 #if GBUFFER_PASS == 3
specularFactor = gbuffer_specular_factor; specularFactor = gbuffer_specular_factor;
#else #else
specularFactor = max(0.0,pow(dot(halfVec,normal), material_shininess)); mediump float halfVecDot = dot(halfVec,normal);
if(halfVecDot > 0.0) {
specularFactor = max(0.0,pow(halfVecDot, material_shininess));
}
#endif #endif
} }

View File

@@ -252,7 +252,10 @@ void main()
#if GBUFFER_PASS == 3 #if GBUFFER_PASS == 3
specularFactor = gbuffer_specular_factor; specularFactor = gbuffer_specular_factor;
#else #else
specularFactor = max(0.0,pow(dot(halfVec,normal), material_shininess)); mediump float halfVecDot = dot(halfVec,normal);
if(halfVecDot > 0.0) {
specularFactor = max(0.0,pow(halfVecDot, material_shininess));
}
#endif #endif
} }