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:
authorAntony Riakiotakis <kalast@gmail.com>2015-02-16 16:42:36 +0300
committerAntony Riakiotakis <kalast@gmail.com>2015-02-16 16:42:36 +0300
commitbbe1b54818d7bb349ddf63efbcb18347a78cf714 (patch)
treece8402c9af3fa2588c1bb3a7edf16e6d2d2549bb /source/blender/gpu/shaders
parent6e08aa0a9e1cb8f781807274ca4b33212af9c035 (diff)
Fix T43689, viewport compositing does not respect alpha settings for
background. For SSAO supporting this is no problem, for DOF we would ideally do blurred alpha, but alpha channel in blurred buffers is occupied by coc field, so use original color alpha instead. It's not entirely correct but it's better than nothing.
Diffstat (limited to 'source/blender/gpu/shaders')
-rw-r--r--source/blender/gpu/shaders/gpu_shader_fx_dof_frag.glsl4
-rw-r--r--source/blender/gpu/shaders/gpu_shader_fx_ssao_frag.glsl5
2 files changed, 6 insertions, 3 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_fx_dof_frag.glsl b/source/blender/gpu/shaders/gpu_shader_fx_dof_frag.glsl
index d52ab2243fe..e9dab04de5d 100644
--- a/source/blender/gpu/shaders/gpu_shader_fx_dof_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_fx_dof_frag.glsl
@@ -186,7 +186,9 @@ void fifth_pass()
vec4 color = factors.x * color_orig + factors.y * smallblurred + factors.z * mediumblurred + factors.w * highblurred;
color /= dot(factors, vec4(1.0));
- gl_FragColor = vec4(color.rgb, 1.0);
+ /* using original color is not correct, but use that for now because alpha of
+ * blurred buffers uses CoC instead */
+ gl_FragColor = vec4(color.rgb, color_orig.a);
}
diff --git a/source/blender/gpu/shaders/gpu_shader_fx_ssao_frag.glsl b/source/blender/gpu/shaders/gpu_shader_fx_ssao_frag.glsl
index b33fda92a46..86e10af8c0d 100644
--- a/source/blender/gpu/shaders/gpu_shader_fx_ssao_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_fx_ssao_frag.glsl
@@ -77,6 +77,7 @@ float calculate_ssao_factor(float depth)
void main()
{
float depth = texture2D(depthbuffer, uvcoordsvar.xy).r;
- vec4 color = mix(texture2D(colorbuffer, uvcoordsvar.xy), ssao_color, calculate_ssao_factor(depth));
- gl_FragColor = vec4(color.rgb, 1.0);
+ vec4 scene_col = texture2D(colorbuffer, uvcoordsvar.xy);
+ vec3 final_color = mix(scene_col.rgb, ssao_color.rgb, calculate_ssao_factor(depth));
+ gl_FragColor = vec4(final_color.rgb, scene_col.a);
}