revert skybox color behavior

This commit is contained in:
SamGondelman 2019-05-24 15:30:49 -07:00
parent 2bf95fe683
commit 61280214ca

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);
}