diff options
author | Jeroen Bakker <jeroen@blender.org> | 2022-01-31 13:59:16 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2022-01-31 13:59:16 +0300 |
commit | 869180548c9066009c7f22e98ae717e78a571129 (patch) | |
tree | 623ed05d5880fa86157ced37611ae9b922cd7da5 /source/blender/draw/engines/image/shaders | |
parent | dfc959eed607070a0e996911e689f029ae4b4861 (diff) |
Image editor: Fix drawing artifacts with render results.
Use the input depth texture to determine if the color of the texture
should be shown.
Diffstat (limited to 'source/blender/draw/engines/image/shaders')
-rw-r--r-- | source/blender/draw/engines/image/shaders/image_engine_color_frag.glsl | 5 | ||||
-rw-r--r-- | source/blender/draw/engines/image/shaders/infos/engine_image_info.hh | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/source/blender/draw/engines/image/shaders/image_engine_color_frag.glsl b/source/blender/draw/engines/image/shaders/image_engine_color_frag.glsl index fbb624e54ba..0edc18836f0 100644 --- a/source/blender/draw/engines/image/shaders/image_engine_color_frag.glsl +++ b/source/blender/draw/engines/image/shaders/image_engine_color_frag.glsl @@ -12,6 +12,11 @@ void main() { ivec2 uvs_clamped = ivec2(uv_screen); + float depth = texelFetch(depth_texture, uvs_clamped, 0).r; + if (depth == 1.0) { + discard; + } + vec4 tex_color = texelFetch(imageTexture, uvs_clamped, 0); if ((drawFlags & IMAGE_DRAW_FLAG_APPLY_ALPHA) != 0) { diff --git a/source/blender/draw/engines/image/shaders/infos/engine_image_info.hh b/source/blender/draw/engines/image/shaders/infos/engine_image_info.hh index 86a79d13e40..8b671686a5c 100644 --- a/source/blender/draw/engines/image/shaders/infos/engine_image_info.hh +++ b/source/blender/draw/engines/image/shaders/infos/engine_image_info.hh @@ -11,6 +11,7 @@ GPU_SHADER_CREATE_INFO(image_engine_color_shader) .push_constant(Type::INT, "drawFlags") .push_constant(Type::BOOL, "imgPremultiplied") .sampler(0, ImageType::FLOAT_2D, "imageTexture") + .sampler(1, ImageType::DEPTH_2D, "depth_texture") .vertex_source("image_engine_color_vert.glsl") .fragment_source("image_engine_color_frag.glsl") .additional_info("draw_modelmat") |