diff options
Diffstat (limited to 'source/blender/draw/engines/eevee_next/shaders/eevee_surf_lib.glsl')
-rw-r--r-- | source/blender/draw/engines/eevee_next/shaders/eevee_surf_lib.glsl | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/source/blender/draw/engines/eevee_next/shaders/eevee_surf_lib.glsl b/source/blender/draw/engines/eevee_next/shaders/eevee_surf_lib.glsl index 30b48edaa78..6c1fc818f41 100644 --- a/source/blender/draw/engines/eevee_next/shaders/eevee_surf_lib.glsl +++ b/source/blender/draw/engines/eevee_next/shaders/eevee_surf_lib.glsl @@ -40,7 +40,7 @@ void init_globals_curves() /* Shade as a cylinder. */ float cos_theta = interp.curves_time_width / interp.curves_thickness; float sin_theta = sqrt(max(0.0, 1.0 - cos_theta * cos_theta)); - g_data.N = normalize(interp.N * sin_theta + interp.curves_binormal * cos_theta); + g_data.N = g_data.Ni = normalize(interp.N * sin_theta + interp.curves_binormal * cos_theta); /* Costly, but follows cycles per pixel tangent space (not following curve shape). */ vec3 V = cameraVec(g_data.P); @@ -60,13 +60,14 @@ void init_globals_curves() void init_globals_gpencil() { /* Undo backface flip as the gpencil normal is already pointing towards the camera. */ - g_data.N = interp.N; + g_data.N = g_data.Ni = interp.N; } void init_globals() { /* Default values. */ g_data.P = interp.P; + g_data.Ni = interp.N; g_data.N = safe_normalize(interp.N); g_data.Ng = g_data.N; g_data.is_strand = false; @@ -81,6 +82,7 @@ void init_globals() #ifdef GPU_FRAGMENT_SHADER g_data.N = (FrontFacing) ? g_data.N : -g_data.N; + g_data.Ni = (FrontFacing) ? g_data.Ni : -g_data.Ni; g_data.Ng = safe_normalize(cross(dFdx(g_data.P), dFdy(g_data.P))); #endif |