diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2019-03-24 00:13:57 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2019-03-24 00:13:57 +0300 |
commit | e77dc3e7ffda4ca6bcc96e6a4753fee3b04db803 (patch) | |
tree | e2e89190be4549b61dbdd1bf8e8e762370ba4967 /source | |
parent | 13832988add506a3c2dca4964e8a9d1216aef80c (diff) |
Fix T62869 Transparent background not working in Xray Mode / Wireframe
This was due to the forward part of the engine not supporting rendered
alpha channel.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/draw/engines/workbench/shaders/workbench_forward_composite_frag.glsl | 7 | ||||
-rw-r--r-- | source/blender/draw/engines/workbench/workbench_forward.c | 3 |
2 files changed, 6 insertions, 4 deletions
diff --git a/source/blender/draw/engines/workbench/shaders/workbench_forward_composite_frag.glsl b/source/blender/draw/engines/workbench/shaders/workbench_forward_composite_frag.glsl index b1f08cfef15..576a5e81c0d 100644 --- a/source/blender/draw/engines/workbench/shaders/workbench_forward_composite_frag.glsl +++ b/source/blender/draw/engines/workbench/shaders/workbench_forward_composite_frag.glsl @@ -27,15 +27,16 @@ void main() #ifndef ALPHA_COMPOSITE vec3 bg_color = background_color(world_data, uv_viewport.y); - vec3 color = mix(trans_color, bg_color, trans_revealage); + bg_color = (world_data.background_alpha == 0.0) ? trans_color : bg_color; + vec4 color = mix(vec4(trans_color, 1.0), vec4(bg_color, world_data.background_alpha), trans_revealage); # ifdef V3D_SHADING_OBJECT_OUTLINE uint object_id = texelFetch(objectId, texel, 0).r; float outline = calculate_object_outline(objectId, texel, object_id); - color = mix(world_data.object_outline_color.rgb, color, outline); + color = mix(vec4(world_data.object_outline_color.rgb, 1.0), color, outline); # endif - fragColor = vec4(color, 1.0); + fragColor = color; #else fragColor = vec4(trans_color, 1.0 - trans_revealage); #endif diff --git a/source/blender/draw/engines/workbench/workbench_forward.c b/source/blender/draw/engines/workbench/workbench_forward.c index eb9164f6943..b640f306806 100644 --- a/source/blender/draw/engines/workbench/workbench_forward.c +++ b/source/blender/draw/engines/workbench/workbench_forward.c @@ -325,6 +325,7 @@ void workbench_forward_engine_init(WORKBENCH_Data *vedata) const float *viewport_size = DRW_viewport_size_get(); const int size[2] = {(int)viewport_size[0], (int)viewport_size[1]}; + const eGPUTextureFormat comp_tex_format = DRW_state_is_image_render() ? GPU_RGBA16F : GPU_R11F_G11F_B10F; e_data.object_id_tx = DRW_texture_pool_query_2d( size[0], size[1], GPU_R32UI, &draw_engine_workbench_transparent); @@ -333,7 +334,7 @@ void workbench_forward_engine_init(WORKBENCH_Data *vedata) e_data.transparent_revealage_tx = DRW_texture_pool_query_2d( size[0], size[1], GPU_R16F, &draw_engine_workbench_transparent); e_data.composite_buffer_tx = DRW_texture_pool_query_2d( - size[0], size[1], GPU_R11F_G11F_B10F, &draw_engine_workbench_transparent); + size[0], size[1], comp_tex_format, &draw_engine_workbench_transparent); GPU_framebuffer_ensure_config(&fbl->object_outline_fb, { GPU_ATTACHMENT_TEXTURE(dtxl->depth), |