diff options
author | Jeroen Bakker <jeroen@blender.org> | 2020-09-15 13:28:58 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2020-09-15 13:33:49 +0300 |
commit | f492c8d488b7eb2166ca894e10a8128a1678a885 (patch) | |
tree | f340d2d10b7b7f8863c8334d9cbeb6b2f6c4a723 /source/blender/draw/engines/image/shaders | |
parent | 60fee7832342195ddeb7c7b712b5a080bfd80f21 (diff) |
Image Editor: Make Rendering of Pure Emissive Colors Optional
There are some areas that don't handle pure emissive colors well. For
example erasing alpha using 2d or 3d painting. Or blurring an image in
the compositor.
This patch makes the rendering of pure emissive colors optional. In the
side panel of the Image editor it can still be enabled when needed.
There currently isn't a better place to store it as it is related on how
the image (or a layer of the image) is created. A future design needs to
make sure that the full workflow is supported.
Diffstat (limited to 'source/blender/draw/engines/image/shaders')
-rw-r--r-- | source/blender/draw/engines/image/shaders/engine_image_frag.glsl | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/draw/engines/image/shaders/engine_image_frag.glsl b/source/blender/draw/engines/image/shaders/engine_image_frag.glsl index a79f4915c4d..d4eebb37ccb 100644 --- a/source/blender/draw/engines/image/shaders/engine_image_frag.glsl +++ b/source/blender/draw/engines/image/shaders/engine_image_frag.glsl @@ -6,6 +6,7 @@ #define SIMA_DRAW_FLAG_SHUFFLING (1 << 2) #define SIMA_DRAW_FLAG_DEPTH (1 << 3) #define SIMA_DRAW_FLAG_DO_REPEAT (1 << 4) +#define SIMA_DRAW_FLAG_PURE_EMISSIVE (1 << 5) #ifdef TILED_IMAGE uniform sampler2DArray imageTileArray; @@ -74,6 +75,12 @@ void main() tex_color = texture(imageTexture, uvs_clamped); #endif + if ((drawFlags & SIMA_DRAW_FLAG_PURE_EMISSIVE) == 0) { + if (imgPremultiplied && tex_color.a == 0.0) { + tex_color.rgb = vec3(0.0); + } + } + if ((drawFlags & SIMA_DRAW_FLAG_APPLY_ALPHA) != 0) { if (!imgPremultiplied && tex_color.a != 0.0 && tex_color.a != 1.0) { tex_color.rgb *= tex_color.a; |