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:
authorClément Foucault <foucault.clem@gmail.com>2019-03-12 17:45:44 +0300
committerClément Foucault <foucault.clem@gmail.com>2019-03-12 18:01:23 +0300
commitaaeca5d87244bca2832b86d60457f0568acf1427 (patch)
tree1a06cfe4459de9077ba82c941eeaa712f58d593f /source/blender/draw/engines/eevee/shaders/effect_ssr_frag.glsl
parentccb4484ea346d640fcd583ced9137313382390ad (diff)
Eevee: Planar Ref.: Invert view matrix to remove triangle front face flip
This was the cause of some issue with normal mapping. This way is cleaner since it does not modify the state of the drawcalls and other ad-hoc solutions to fix the problems down the road. Unfortunately, it does require to fix every sampling coordinate for this texture. Fix T62215: flipped normals in reflection plane
Diffstat (limited to 'source/blender/draw/engines/eevee/shaders/effect_ssr_frag.glsl')
-rw-r--r--source/blender/draw/engines/eevee/shaders/effect_ssr_frag.glsl9
1 files changed, 8 insertions, 1 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/effect_ssr_frag.glsl b/source/blender/draw/engines/eevee/shaders/effect_ssr_frag.glsl
index d44cf5e3518..2178b15a753 100644
--- a/source/blender/draw/engines/eevee/shaders/effect_ssr_frag.glsl
+++ b/source/blender/draw/engines/eevee/shaders/effect_ssr_frag.glsl
@@ -18,7 +18,11 @@ vec2 decode_hit_data(vec2 hit_data, out bool has_hit, out bool is_planar)
{
is_planar = (hit_data.x < 0);
has_hit = (hit_data.y > 0);
- return vec2(abs(hit_data)) / 32767.0; /* 16bit signed int limit */
+ vec2 hit_co = vec2(abs(hit_data)) / 32767.0; /* 16bit signed int limit */
+ if (is_planar) {
+ hit_co.x = 1.0 - hit_co.x;
+ }
+ return hit_co;
}
#ifdef STEP_RAYTRACE
@@ -219,6 +223,7 @@ vec2 get_reprojected_reflection(vec3 hit, vec3 pos, vec3 N)
float get_sample_depth(vec2 hit_co, bool is_planar, float planar_index)
{
if (is_planar) {
+ hit_co.x = 1.0 - hit_co.x;
return textureLod(planarDepth, vec3(hit_co, planar_index), 0.0).r;
}
else {
@@ -237,6 +242,8 @@ vec3 get_hit_vector(
vec3 trace_pos = line_plane_intersect(worldPosition, V, pd.pl_plane_eq);
hit_vec = hit_pos - trace_pos;
hit_vec = reflect(hit_vec, pd.pl_normal);
+ /* Modify here so mip texel alignment is correct. */
+ hit_co.x = 1.0 - hit_co.x;
}
else {
/* Find hit position in previous frame. */