Browse Source

Fix Sky Shader on Android/S6 (#8382) (#8614)

* Fix Sky Shader on Android/S6 (#8382)

`exp(n)` does not return the correct value, so I replaced it with `pow(e, n)`.

* Editor: Include VRControls/VREffect when needed.

* Editor: Workaround for Storage not being ready in time.

* Editor: Fixed edit button.

* Added comment explaining change in shader function #8382, #8614
Brian Chirls 9 years ago
parent
commit
e62a212bcd
1 changed files with 4 additions and 1 deletions
  1. 4 1
      examples/js/SkyShader.js

+ 4 - 1
examples/js/SkyShader.js

@@ -126,7 +126,10 @@ THREE.ShaderLib[ 'sky' ] = {
 
 		"float sunIntensity(float zenithAngleCos)",
 		"{",
-			"return EE * max(0.0, 1.0 - exp(-((cutoffAngle - acos(zenithAngleCos))/steepness)));",
+		// This function originally used `exp(n)`, but it returns an incorrect value
+		// on Samsung S6 phones. So it has been replaced with the equivalent `pow(e, n)`.
+		// See https://github.com/mrdoob/three.js/issues/8382
+			"return EE * max(0.0, 1.0 - pow(e, -((cutoffAngle - acos(zenithAngleCos))/steepness)));",
 		"}",
 
 		"// float logLuminance(vec3 c)",