Skip to content

Commit e62a212

Browse files
brianchirlsmrdoob
authored andcommitted
Fix Sky Shader on Android/S6 (mrdoob#8382) (mrdoob#8614)
* Fix Sky Shader on Android/S6 (mrdoob#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 mrdoob#8382, mrdoob#8614
1 parent 23404d4 commit e62a212

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

examples/js/SkyShader.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,10 @@ THREE.ShaderLib[ 'sky' ] = {
126126

127127
"float sunIntensity(float zenithAngleCos)",
128128
"{",
129-
"return EE * max(0.0, 1.0 - exp(-((cutoffAngle - acos(zenithAngleCos))/steepness)));",
129+
// This function originally used `exp(n)`, but it returns an incorrect value
130+
// on Samsung S6 phones. So it has been replaced with the equivalent `pow(e, n)`.
131+
// See https://github.com/mrdoob/three.js/issues/8382
132+
"return EE * max(0.0, 1.0 - pow(e, -((cutoffAngle - acos(zenithAngleCos))/steepness)));",
130133
"}",
131134

132135
"// float logLuminance(vec3 c)",

0 commit comments

Comments
 (0)