Commit: f450d39ada1f8629f2050288f413eceb2d173005 Author: Chris Blackbourn Date: Tue Dec 6 13:48:23 2022 +1300 Branches: master https://developer.blender.org/rBf450d39ada1f8629f2050288f413eceb2d173005
Fix T84078: improve UV unwrapping for quads with an internal reflex angle When triangulating meshes, the UV unwrapper was previously using a heuristic to split quads into triangles. If one of the internal angles is greater than 180degrees, a so-called "reflex angle", the heuristic was giving a poor choice of split. Instead of using a special case for quads, this change routes everything through the generic n-gon `BLI_polyfill_beautify` method instead. Reviewed By: Brecht Van Lommel Differential Revision: https://developer.blender.org/D16505 =================================================================== M source/blender/geometry/intern/uv_parametrizer.cc =================================================================== diff --git a/source/blender/geometry/intern/uv_parametrizer.cc b/source/blender/geometry/intern/uv_parametrizer.cc index 5a363b4bf17..4236872f057 100644 --- a/source/blender/geometry/intern/uv_parametrizer.cc +++ b/source/blender/geometry/intern/uv_parametrizer.cc @@ -1124,16 +1124,6 @@ static PFace *p_face_add_fill(ParamHandle *handle, PChart *chart, PVert *v1, PVe return f; } -static bool p_quad_split_direction(ParamHandle *handle, const float **co, const ParamKey *vkeys) -{ - /* Slight bias to prefer one edge over the other in case they are equal, so - * that in symmetric models we choose the same split direction instead of - * depending on floating point errors to decide. */ - float bias = 1.0f + 1e-6f; - float fac = len_v3v3(co[0], co[2]) * bias - len_v3v3(co[1], co[3]); - return fac <= 0.0f; -} - /* Construction: boundary filling */ static void p_chart_boundaries(PChart *chart, PEdge **r_outer) @@ -3946,21 +3936,10 @@ void GEO_uv_parametrizer_face_add(ParamHandle *phandle, } /* No "ears" have previously been inserted. Continue as normal. */ } - if (nverts > 4) { + if (nverts > 3) { /* ngon */ p_add_ngon(phandle, key, nverts, vkeys, co, uv, pin, select); } - else if (nverts == 4) { - /* quad */ - if (p_quad_split_direction(phandle, co, vkeys)) { - p_face_add_construct(phandle, key, vkeys, co, uv, 0, 1, 2, pin, select); - p_face_add_construct(phandle, key, vkeys, co, uv, 0, 2, 3, pin, select); - } - else { - p_face_add_construct(phandle, key, vkeys, co, uv, 0, 1, 3, pin, select); - p_face_add_construct(phandle, key, vkeys, co, uv, 1, 2, 3, pin, select); - } - } else if (!p_face_exists(phandle, vkeys, 0, 1, 2)) { /* triangle */ p_face_add_construct(phandle, key, vkeys, co, uv, 0, 1, 2, pin, select); _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs