Merge pull request #15634 from SamGondelman/skyboxColor

BUGZ-380: Revert skybox color behavior
This commit is contained in:
Sam Gateau 2019-05-26 10:43:54 -07:00 committed by GitHub
commit bd3881ef14
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -26,6 +26,14 @@ layout(location=0) in vec3 _normal;
layout(location=0) out vec4 _fragColor;
void main(void) {
vec3 skyboxColor = texture(cubeMap, normalize(_normal)).rgb;
_fragColor = vec4(mix(skybox.color.rgb, skyboxColor, skybox.color.a), 1.0);
// FIXME: For legacy reasons, when skybox.color.a is 0.5, this is equivalent to:
// skyboxColor * skyboxTexel
// It should actually be:
// mix(skyboxColor, skyboxTexel, skybox.color.a)
// and the blend factor should be user controlled
vec3 skyboxTexel = texture(cubeMap, normalize(_normal)).rgb;
vec3 skyboxColor = skybox.color.rgb;
_fragColor = vec4(mix(vec3(1.0), skyboxTexel, float(skybox.color.a > 0.0)) *
mix(vec3(1.0), skyboxColor, float(skybox.color.a < 1.0)), 1.0);
}