[Bf-blender-cvs] [19c9b054419] temp-T95933-object-mode-curve-selection: Removed hack where thick_time was in world space (shading artifacts).

Jeroen Bakker noreply at git.blender.org
Fri Jul 1 12:15:30 CEST 2022


Commit: 19c9b054419e8db0e2474edc2a93f73c081b555f
Author: Jeroen Bakker
Date:   Fri Jul 1 09:22:49 2022 +0200
Branches: temp-T95933-object-mode-curve-selection
https://developer.blender.org/rB19c9b054419e8db0e2474edc2a93f73c081b555f

Removed hack where thick_time was in world space (shading artifacts).

===================================================================

M	source/blender/draw/intern/shaders/common_hair_lib.glsl

===================================================================

diff --git a/source/blender/draw/intern/shaders/common_hair_lib.glsl b/source/blender/draw/intern/shaders/common_hair_lib.glsl
index 097a1af0fea..3ffd15b32e7 100644
--- a/source/blender/draw/intern/shaders/common_hair_lib.glsl
+++ b/source/blender/draw/intern/shaders/common_hair_lib.glsl
@@ -203,22 +203,22 @@ void hair_get_pos_tan_binor_time_ex(bool is_persp,
   wbinor = normalize(cross(camera_vec, wtan));
 
   thickness = hair_shaperadius(hairRadShape, hairRadRoot, hairRadTip, time);
-
+  float scale;
   if (hairThicknessRes > 1) {
     thick_time = float(gl_VertexID % hairThicknessRes) / float(hairThicknessRes - 1);
     thick_time = thickness * (thick_time * 2.0 - 1.0);
 
     /* Take object scale into account.
      * NOTE: This only works fine with uniform scaling. */
-    float scale = 1.0 / length(mat3(invmodel_mat) * wbinor);
-    thick_time *= scale;  // HACK: thick_time is now in world space...
+    scale = 1.0 / length(mat3(invmodel_mat) * wbinor);
   }
   else {
     /* NOTE: Ensures 'hairThickTime' is initialized -
      * avoids undefined behavior on certain macOS configurations. */
     thick_time = 0.0;
+    scale = 1.0;
   }
-  wpos = orig_wpos + wbinor * thick_time;
+  wpos = orig_wpos + wbinor * thick_time * scale;
 }
 
 void hair_get_pos_tan_binor_time(bool is_persp,



More information about the Bf-blender-cvs mailing list