tonemap.glsl: Ensure color parameter of tonemap_reinhard() is positive
Color values can become negative in the case of negative lights which leads to undesired behaviour.
This commit is contained in:
parent
2393fb43c3
commit
ffc4151f29
1 changed files with 4 additions and 0 deletions
|
@ -157,6 +157,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 (white * color + color) / (color * white + white);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue