Merge pull request #42056 from Yetizone/negative_lights_behavior

tonemap.glsl: Ensure color parameter of tonemap_reinhard() is positive
This commit is contained in:
Rémi Verschelde 2020-10-19 22:40:24 +02:00 committed by GitHub
commit f442dc062a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -156,6 +156,10 @@ vec3 tonemap_aces(vec3 color, float white) {
}
vec3 tonemap_reinhard(vec3 color, float white) {
// Ensure color values are positive.
// They can be negative in the case of negative lights, which leads to undesired behavior.
color = max(vec3(0.0), color);
return clamp((white * color + color) / (color * white + white), vec3(0.0f), vec3(1.0f));
}