Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen Bakker <jeroen@blender.org>2021-01-26 16:05:50 +0300
committerJeroen Bakker <jeroen@blender.org>2021-01-26 16:25:18 +0300
commited809866b17262b1eaa24765aaf711e44f62d862 (patch)
treeb50344480b1bdebbf74c0b263477e2a5858864c1 /source/blender/gpu/shaders
parente6aece32a0499fb50648ad6249c38af9fffc8d24 (diff)
Viewport Rendering: Don't clamp when overlays are disabled.
During viewport rendering the color values were clamped in order to apply the overlay on top of it. This clamping would show the scene colors washed out. This patch adds a work around to skip the clamping when the overlays are turned off. Parial fix for {T77909}
Diffstat (limited to 'source/blender/gpu/shaders')
-rw-r--r--source/blender/gpu/shaders/gpu_shader_image_overlays_merge_frag.glsl10
1 files changed, 6 insertions, 4 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_image_overlays_merge_frag.glsl b/source/blender/gpu/shaders/gpu_shader_image_overlays_merge_frag.glsl
index 73f40c693ae..7f3fe2f5252 100644
--- a/source/blender/gpu/shaders/gpu_shader_image_overlays_merge_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_image_overlays_merge_frag.glsl
@@ -4,6 +4,7 @@
uniform sampler2D image_texture;
uniform sampler2D overlays_texture;
uniform bool display_transform;
+uniform bool overlay;
in vec2 texCoord_interp;
@@ -30,12 +31,13 @@ void linearrgb_to_srgb(vec4 col_from, out vec4 col_to)
void main()
{
fragColor = texture(image_texture, texCoord_interp.st);
-
vec4 overlay_col = texture(overlays_texture, texCoord_interp.st);
- fragColor = clamp(fragColor, 0.0, 1.0);
- fragColor *= 1.0 - overlay_col.a;
- fragColor += overlay_col;
+ if (overlay) {
+ fragColor = clamp(fragColor, 0.0, 1.0);
+ fragColor *= 1.0 - overlay_col.a;
+ fragColor += overlay_col;
+ }
if (display_transform) {
linearrgb_to_srgb(fragColor, fragColor);