Fix: Overlay: Broken outline detection for faces perpedicular to the view

Apply the same fix used for Armatures.

Partially fixes #139555.
For correct flat object detection, #145227 is also needed.

(4.5 backport candidate)

Pull Request: https://projects.blender.org/blender/blender/pulls/147722
This commit is contained in:
Miguel Pozo
2025-10-09 16:58:58 +02:00
parent 83a1bd4e1d
commit f7ef7eff5e
2 changed files with 9 additions and 5 deletions

View File

@@ -107,7 +107,7 @@ void geometry_main(VertOut geom_in[4],
float fac3 = dot(view_vec, n3);
/* If one of the face is perpendicular to the view,
* consider it and outline edge. */
* consider it an outline edge. */
if (abs(fac0) > 1e-5f && abs(fac3) > 1e-5f) {
/* If both adjacent verts are facing the camera the same way,
* then it isn't an outline edge. */

View File

@@ -91,10 +91,14 @@ void geometry_main(VertOut geom_in[4],
float fac0 = dot(view_vec, n0);
float fac3 = dot(view_vec, n3);
/* If both adjacent verts are facing the camera the same way,
* then it isn't an outline edge. */
if (sign(fac0) == sign(fac3)) {
return;
/* If one of the face is perpendicular to the view,
* consider it an outline edge. */
if (abs(fac0) > 1e-5f && abs(fac3) > 1e-5f) {
/* If both adjacent verts are facing the camera the same way,
* then it isn't an outline edge. */
if (sign(fac0) == sign(fac3)) {
return;
}
}
VertOut export_vert = (out_vertex_id == 0) ? geom_in[1] : geom_in[2];