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-26 00:05:03 +0300
committerAntony Riakiotakis <kalast@gmail.com>2015-02-26 00:05:03 +0300
commit442664e02ca1be5c46a5b5771599f58b0a55b1e6 (patch)
treedaca6eb0ac6c0ab72b9b68cbf1b971c726558773 /source/blender/gpu
parent6a65bc91e2d01a5d2981333201873103a578354c (diff)
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.
Diffstat (limited to 'source/blender/gpu')
-rw-r--r--source/blender/gpu/shaders/gpu_shader_fx_ssao_frag.glsl3
1 files changed, 3 insertions, 0 deletions
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 86e10af8c0d..5e2512b6a46 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);