[Bf-blender-cvs] [442664e] master: SSAO: sampling coordinates go out of screen, reject the sample
Antony Riakiotakis
noreply at git.blender.org
Wed Feb 25 22:05:22 CET 2015
Commit: 442664e02ca1be5c46a5b5771599f58b0a55b1e6
Author: Antony Riakiotakis
Date: Wed Feb 25 22:05:03 2015 +0100
Branches: master
https://developer.blender.org/rB442664e02ca1be5c46a5b5771599f58b0a55b1e6
SSAO: sampling coordinates go out of screen, reject the sample
Previous behaviour would get occlusion at borders which could create
over occlusion at edges of the screen.
===================================================================
M source/blender/gpu/shaders/gpu_shader_fx_ssao_frag.glsl
===================================================================
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 86e10af..5e2512b 100644
--- a/source/blender/gpu/shaders/gpu_shader_fx_ssao_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_fx_ssao_frag.glsl
@@ -56,6 +56,9 @@ float calculate_ssao_factor(float depth)
vec2 uvcoords = uvcoordsvar.xy + dir_jittered * offset;
+ if (uvcoords.x > 1.0 || uvcoords.x < 0.0 || uvcoords.y > 1.0 || uvcoords.y < 0.0)
+ continue;
+
float depth_new = texture2D(depthbuffer, uvcoords).r;
if (depth_new != 1.0) {
vec3 pos_new = get_view_space_from_depth(uvcoords, viewvecs[0].xyz, viewvecs[1].xyz, depth_new);
More information about the Bf-blender-cvs
mailing list