diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2022-09-02 19:13:54 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2022-09-02 19:13:54 +0300 |
commit | 07cf3ce92fa257a0cac5565ca1ff857834ce67ce (patch) | |
tree | 3d73216d1c2a12497423c62902815b0e775f0ea7 /source/blender/draw/engines/eevee | |
parent | 874e9cbab9fbd65220794cebc195e5e28786ad78 (diff) |
Fix T100377: EEVEE: Regression 3.2 normalmap node broken
This was caused by un-wanted normalization. This is a requirement of
the MikkTspace. The issue is that g_data.N is expected to be normalized
by many other functions and overriden by bump displacement.
Adding a new global variable containing the interpolated normal fixes the
issue AND make it match cycles behavior better (mix between bump and
interpolated normal).
Diffstat (limited to 'source/blender/draw/engines/eevee')
-rw-r--r-- | source/blender/draw/engines/eevee/shaders/surface_lib.glsl | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/surface_lib.glsl b/source/blender/draw/engines/eevee/shaders/surface_lib.glsl index 488e229bff7..b984a6df7b3 100644 --- a/source/blender/draw/engines/eevee/shaders/surface_lib.glsl +++ b/source/blender/draw/engines/eevee/shaders/surface_lib.glsl @@ -98,10 +98,11 @@ GlobalData init_globals(void) # if defined(WORLD_BACKGROUND) || defined(PROBE_CAPTURE) surf.P = transform_direction(ViewMatrixInverse, -viewCameraVec(viewPosition)); - surf.N = surf.Ng = -surf.P; + surf.N = surf.Ng = surf.Ni = -surf.P; surf.ray_length = 0.0; # else surf.P = worldPosition; + surf.Ni = worldNormal; surf.N = safe_normalize(worldNormal); surf.Ng = safe_normalize(cross(dFdx(surf.P), dFdy(surf.P))); surf.ray_length = distance(surf.P, cameraPos); @@ -123,7 +124,7 @@ GlobalData init_globals(void) cos_theta = hairThickTime / hairThickness; } float sin_theta = sqrt(max(0.0, 1.0 - cos_theta * cos_theta)); - surf.N = safe_normalize(worldNormal * sin_theta + B * cos_theta); + surf.N = surf.Ni = safe_normalize(worldNormal * sin_theta + B * cos_theta); surf.curve_T = -hairTangent; /* Costly, but follows cycles per pixel tangent space (not following curve shape). */ surf.curve_B = cross(V, surf.curve_T); |