Rendering problem of triangles

Asked by burak er

Dear Yade-Dev,

I have problems with rendering of faces of my deformable tetrahedron class that I defined within yade. Within deformable tetrahedrons, each vertex is defined in a list and each face of the deformable tetrahedron also defined in another list including it's connected vertex indices. I create tetrahedrons by importing mesh from a gmsh file where its node numbering order is given in gmsh's manual.

When I try to give opengl the normal of each face with the calculating method given here[1] or even calculating it with the node numbering as given in the user manual of gmsh , I see the coloring difference of the tetrahedrons faces. My drawing function of the deformable elements can be found here[2].

So I want to ask; What may cause the difference of the colors of the faces of tetrahedron with the code given at[2]? Do you suggest a better way to draw a tetrahedron?

[1]http://math.stackexchange.com/questions/183030/given-a-tetrahedron-how-to-find-the-outward-surface-normals-for-each-side
[2]https://github.com/burak-er/trunk/blob/master/pkg/dem/deformablecohesive/Gl1_DeformableElement.cpp

Question information

Language:
English Edit question
Status:
Answered
For:
Yade Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Jan Stránský (honzik) said :
#1

Hi Burak,

could you please attach some pictures to give us better idea?

Anyway, check how this function is defined for non-deformable tatrahedron
[1]

cheers
Jan

[1]
http://bazaar.launchpad.net/~yade-pkg/yade/git-trunk/view/head:/pkg/dem/Tetra.cpp#L995

2013/12/9 burak er <email address hidden>

> New question #240509 on Yade:
> https://answers.launchpad.net/yade/+question/240509
>
> Dear Yade-Dev,
>
> I have problems with rendering of faces of my deformable tetrahedron class
> that I defined within yade. Within deformable tetrahedrons, each vertex is
> defined in a list and each face of the deformable tetrahedron also defined
> in another list including it's connected vertex indices. I create
> tetrahedrons by importing mesh from a gmsh file where its node numbering
> order is given in gmsh's manual.
>
> When I try to give opengl the normal of each face with the calculating
> method given here[1] or even calculating it with the node numbering as
> given in the user manual of gmsh , I see the coloring difference of the
> tetrahedrons faces. My drawing function of the deformable elements can be
> found here[2].
>
> So I want to ask; What may cause the difference of the colors of the faces
> of tetrahedron with the code given at[2]? Do you suggest a better way to
> draw a tetrahedron?
>
> [1]
> http://math.stackexchange.com/questions/183030/given-a-tetrahedron-how-to-find-the-outward-surface-normals-for-each-side
> [2]
> https://github.com/burak-er/trunk/blob/master/pkg/dem/deformablecohesive/Gl1_DeformableElement.cpp
>
> --
> You received this question notification because you are a member of
> yade-users, which is an answer contact for Yade.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-users
> More help : https://help.launchpad.net/ListHelp
>

Revision history for this message
burak er (burak-er) said :
#2

Hi Jan,

You can see an example capsule mesh that I have created[1]. The color for the whole tetrahedrons should be red, but you can see brown, grey and the nearly the black ones. The problem exist for the internal faces of the tetrahedrons[2].

I could not identify the problem.

[1]http://i.imgur.com/Fts3MGY.png
[2]http://i.imgur.com/ljlEYy7.png

Revision history for this message
Anton Gladky (gladky-anton) said :
#3

Hi,

I guess the problem is in the direction of facet's normal. It depends on the
node numbering: clockwise or counterclockwise.

Anton

2013/12/9 burak er <email address hidden>:
> [1]http://i.imgur.com/Fts3MGY.png
> [2]http://i.imgur.com/ljlEYy7.png

Revision history for this message
burak er (burak-er) said :
#4

Hi Anton,

Do you suggest a way for the calculation of the normals for the faces of a tetrahedron? I think the method that I gave at the first message has some problematic situations. But, I also used the node numbering sequence at the gmsh manual[1]. Still had the problem.

Thank you in advance.

[1]http://www.geuz.org/gmsh/doc/texinfo/#MSH-ASCII-file-format

Revision history for this message
Bruno Chareyre (bruno-chareyre) said :
#5

To get rid of the (anti/)clockwise numbering question, you can display both faces (GL_FRONT_AND_BACK*).

*https://www.opengl.org/sdk/docs/man/xhtml/glPolygonMode.xml

Can you help with this problem?

Provide an answer of your own, or ask burak er for more information if necessary.

To post a message you must log in.