diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2017-08-13 15:30:24 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2017-08-13 15:30:47 +0300 |
commit | e3468d7ec2ce4be2ffc3e22bf86a6ace143c2f16 (patch) | |
tree | f0b9bbb048e62f9257e2cd7623667f40905a7ef5 /source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl | |
parent | 82e0419cc0592ad833ecab07532f50906be7a0b6 (diff) |
Eevee: Optimize and improve GTAO Horizon search
This fix a bug when occluder are on the edge of the screen and occludes more than they should.
Grouped the texture fetches together and clamp the ray at the border of the screen.
Also add a few util functions.
Diffstat (limited to 'source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl')
-rw-r--r-- | source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl b/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl index 4d2f92c6955..ee2bc08a38a 100644 --- a/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl +++ b/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl @@ -111,6 +111,7 @@ vec3 project_point(mat4 m, vec3 v) { return tmp.xyz / tmp.w; } +float min_v2(vec2 v) { return min(v.x, v.y); } float min_v3(vec3 v) { return min(v.x, min(v.y, v.z)); } float max_v2(vec2 v) { return max(v.x, v.y); } @@ -125,6 +126,10 @@ float len_squared(vec3 a) { return dot(a, a); } float inverse_distance(vec3 V) { return max( 1 / length(V), 1e-8); } +vec2 mip_ratio_interp(float mip) { + float low_mip = floor(mip); + return mix(mipRatio[int(low_mip)], mipRatio[int(low_mip + 1.0)], mip - low_mip); +} /* ------- Fast Math ------- */ /* [Drobot2014a] Low Level Optimizations for GCN */ |