Quads display


#1

Hi guys,

I just noticed a problem with the quads in Rhino 5 so I did try to reproduce it in Rhino WIP. Sometimes when displaying quads into the viewport and the quad has an “inside” vertex, it is displayed incorrectly (seems the triangulation to draw the quad is wrong). As “inside” vertex I mean that the angle between his 2 adjacent edges is greater than 180 degrees. You can follow this steps to reproduce it:

  1. Create a MeshPlane

  2. Rotate the bottom right edge of the mesh plane around the Z axis (blue handler)


  3. When the edge makes the corner vertex to pass the “imaginary” line between his adjacents, the face looks like this

Regards,


(Brian James) #2

Thanks… filed as https://mcneel.myjetbrains.com/youtrack/issue/RH-36072


(Steve Baer) #3

This is standard Z-fighting with overlapping faces and has been in Rhino for a long time. I’m not exactly sure what we should change to improve things.


(Willem Derks) #4

Hi Steve and @BrianJ

This is not about overlap shading, but the incorrect triangulation of a quad face after editing.

-Willem


#5

Hi @Willem @stevebaer @BrianJ,

I agree with you Willem, the edges of the face are displayed correctly but seems the triangulation to paint that quad fails in some cases. In fact, if you do the same with the upper right edge of the mesh plane, it works nicely (maybe depends on the order of the vertices of the quad?)

Regards

EDIT: It happens always if you move the bottom right or the top left vertex inwards of each face of the MeshPlane . If you move any of the other 2 vertices it works fine. I attach the 3dm. It happens whatever the number faces of the plane are (even with only 1 face) QuadTest.3dm (23.0 KB)


#6

Hi again guys,

@stevebaer, @BrianJ, @Willem I just reviewed the issue and I don’t agree with Steve since I tested to add a mesh hardcoding the points of his face with this command (using latest Rhino WIP- Work In Progress(6.0.16314.1241, 09/11/2016) -):

protected override Result RunCommand(RhinoDoc doc, RunMode mode)
    {
        Point3d pt0 = new Point3d(-1, 1, 0),
                pt1 = new Point3d(-0.7, -0.7, 0),
                pt2 = new Point3d(1, -1, 0),
                pt3 = new Point3d(-1, -1, 0);
        Mesh newMesh = new Mesh();
        int v0 = newMesh.Vertices.Add(pt0);
        int v1 = newMesh.Vertices.Add(pt1);
        int v2 = newMesh.Vertices.Add(pt2);
        int v3 = newMesh.Vertices.Add(pt3);
        newMesh.Faces.AddFace(v0, v1, v2, v3);
        doc.Objects.AddMesh(newMesh);
        doc.Views.Redraw();
        return Result.Success;
    }

As you see, this quad has this visualization glitch into the second point (pt1) of the face

I upload the test project here, you can download and check it!
Quads.zip (36.2 KB)

If you modify the points position in order to check this problem with the all of them it only happens with the second and fourth point of the face.

Regards


(Steve Baer) #7

Quads in OpenGL aren’t really quads… Everything that the OpenGL driver actually sees are triangles which means every quads have to be split into two triangles. The latest versions of OpenGL actually removed the drawing code for quads because aren’t really necessary for getting the job done of drawing.

Since every quad gets converted into two triangles, you can guess that this happens by drawing triangles at vertices (v0,v1,v2) and (v0, v2, v3). In this case only v1 and v2 will cause an overlap.


(Steve Baer) #8

Something I am curious about is if this is causing a problem for what it is you are working on or if you have simply stumbled on a bug. If this is causing problems for something you are working on then maybe we can help find a solution to your specific issue.


#9

Hi Steve,

Thanks for your response. I pointed before that for me seemed a “problem” with the triangulation of the faces because OpenGL is painting triangles. Since this is only happening in visualization my interest in solving this glitch is because is not right for the customer as they don’t see what they expect. I know the underlying mesh is ok, but the visualization doesn’t look good.

Regards,


(Steve Baer) #10

Thinking about this a bit more, I agree this can be fixed. I’ve moved this issue back into an open state, but probably won’t be able to get to it soon since it is not as high a priority as other issues on my list.