Fix potential bug when using multiple lights. (#1055)

This commit is contained in:
Patrik Buhring 2020-12-31 17:51:21 -05:00 committed by GitHub
parent d91117d6e7
commit f71dc5daeb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -53,6 +53,10 @@ void main() {
// add light contribution // add light contribution
color += diffuse * light.color.xyz; color += diffuse * light.color.xyz;
} }
// average the lights so that we will never get something with > 1.0
color /= max(float(NumLights.x), 1.0);
output_color.xyz *= color; output_color.xyz *= color;
# endif # endif