diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2015-03-30 15:14:32 +0300 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2015-03-30 15:14:52 +0300 |
commit | 590efaacb862aa4352b11e77d37805df5445a90f (patch) | |
tree | 5549fbbe7877cde99213b9c5b181dee4b0d49e45 /source/blender/gpu/shaders | |
parent | 4aeb34dc82e904660a1df06617406028b5331ff1 (diff) |
Potential fix for T43987, ambient occlusion different between offscreen
and on screen rendering.
Aaaaah, the beauty of driver implementations of OpenGL!
Turns out the problem here is that drivers calculate df/dy differently
in some cases (probably because OpenGL counts y reverse to how the
window system does, so drivers can get confused).
Fixed this for the ATI case based on info we have so far, there's also
the Intel case which will be handled separately (missing info on Intel's
renderer string etc).
Unfortunately we can't really fix this for the general case so we'll
have to haldle cases as they come in our tracker and by adding silly
string comparisons in our GPU initialization module <sigh>.
Diffstat (limited to 'source/blender/gpu/shaders')
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_fx_lib.glsl | 8 | ||||
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_fx_ssao_frag.glsl | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_fx_lib.glsl b/source/blender/gpu/shaders/gpu_shader_fx_lib.glsl index 6c4bf3bb7a0..1dc49b52be1 100644 --- a/source/blender/gpu/shaders/gpu_shader_fx_lib.glsl +++ b/source/blender/gpu/shaders/gpu_shader_fx_lib.glsl @@ -1,11 +1,3 @@ -vec3 calculate_view_space_normal(in vec3 viewposition) -{ - vec3 normal = cross(normalize(dFdx(viewposition)), - normalize(dFdy(viewposition))); - normalize(normal); - return normal; -} - /* simple depth reconstruction, see http://www.derschmale.com/2014/01/26/reconstructing-positions-from-the-depth-buffer * we change the factors from the article to fit the OpennGL model. */ #ifdef PERSP_MATRIX 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 5e2512b6a46..783bce75fbd 100644 --- a/source/blender/gpu/shaders/gpu_shader_fx_ssao_frag.glsl +++ b/source/blender/gpu/shaders/gpu_shader_fx_ssao_frag.glsl @@ -23,6 +23,14 @@ uniform vec4 ssao_color; * see http://www.derschmale.com/2014/01/26/reconstructing-positions-from-the-depth-buffer */ uniform vec4 viewvecs[3]; +vec3 calculate_view_space_normal(in vec3 viewposition) +{ + vec3 normal = cross(normalize(dFdx(viewposition)), + ssao_params.w * normalize(dFdy(viewposition))); + normalize(normal); + return normal; +} + float calculate_ssao_factor(float depth) { /* take the normalized ray direction here */ |