[Bf-blender-cvs] [b71693b5f0e] sculpt-dev: Sculpt-dev: fix exploding vertices bug
Joseph Eagar
noreply at git.blender.org
Mon Mar 14 06:11:48 CET 2022
Commit: b71693b5f0effc3cca04169dcb8e01a3324ea0aa
Author: Joseph Eagar
Date: Sun Mar 13 22:10:58 2022 -0700
Branches: sculpt-dev
https://developer.blender.org/rBb71693b5f0effc3cca04169dcb8e01a3324ea0aa
Sculpt-dev: fix exploding vertices bug
Added code to detect and fix unnormalized normals,
still need to track down where exactly they are
coming from.
===================================================================
M source/blender/editors/sculpt_paint/sculpt_smooth.c
===================================================================
diff --git a/source/blender/editors/sculpt_paint/sculpt_smooth.c b/source/blender/editors/sculpt_paint/sculpt_smooth.c
index e70825a5a68..f5e965b466e 100644
--- a/source/blender/editors/sculpt_paint/sculpt_smooth.c
+++ b/source/blender/editors/sculpt_paint/sculpt_smooth.c
@@ -1908,6 +1908,11 @@ static void do_smooth_brush_task_cb_ex(void *__restrict userdata,
copy_v3_v3(startco, vd.co);
SCULPT_vertex_normal_get(ss, vd.vertex, startno);
+ /* Ensure we have a valid normal. */
+ if (fabsf(dot_v3v3(startno, startno) - 1.0f) > 0.001) {
+ normalize_v3(startno);
+ }
+
int steps = data->do_origco ? 2 : 1;
for (int step = 0; step < steps; step++) {
@@ -1953,16 +1958,14 @@ static void do_smooth_brush_task_cb_ex(void *__restrict userdata,
float veltmp[3];
copy_v3_v3(veltmp, vel);
- /* remove tangental component */
+ /* Remove tangental component. */
float fac = dot_v3v3(vel, startno);
mul_v3_v3fl(vel, startno, fac);
- /* note that "off" is interpreted here
- as a force to update vel */
madd_v3_v3fl(vel, off, 0.2f);
mul_v3_fl(vel, 0.8f);
- /* apply velocity */
+ /* Apply velocity. */
add_v3_v3(off, veltmp);
}
More information about the Bf-blender-cvs
mailing list