diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-10-19 23:50:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-19 23:50:49 +0200 |
commit | 7d4921db1acb81a03e49321e289bdc9d7a79249d (patch) | |
tree | 29d6dbc10c65eae5efcc1d12d659bf066154cf62 /servers/rendering/rasterizer_rd | |
parent | cf3a4cb09132f151a046da3ae827f7c9fbcbf69c (diff) | |
parent | ffc4151f29b21d7e11bb6d1b14171b466bcbe752 (diff) |
Merge pull request #42915 from Yetizone/negative_lights_behavior
tonemap.glsl: Ensure color parameter of tonemap_reinhard() is positive
Diffstat (limited to 'servers/rendering/rasterizer_rd')
-rw-r--r-- | servers/rendering/rasterizer_rd/shaders/tonemap.glsl | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/servers/rendering/rasterizer_rd/shaders/tonemap.glsl b/servers/rendering/rasterizer_rd/shaders/tonemap.glsl index 2a13db4cd1..ee66de4192 100644 --- a/servers/rendering/rasterizer_rd/shaders/tonemap.glsl +++ b/servers/rendering/rasterizer_rd/shaders/tonemap.glsl @@ -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); } |