CHAI3DCHAI3D

normal Number of vertices

More
13 Mar 2016 10:08 #1

Hello,

The 3d model teeth in your resources folder has a total of 109.291 vertices counted in 3d Studio Max.
But, when I load it as a MultiMesh in chai3d with the loadFromFile function and then print its number of vertices (with getNumVertices()) I get 576.000 vertices.
Any idea why is that ?

Thank you.

Please Log in or Create an account to join the conversation.

More
15 Mar 2016 00:23 #2

For optimization reasons related to the way objects are rendered in OpenGL, each vertex in CHAI3D is defined by a position, surface normal, texture coordinate, color, etc...

With 3DS files, vertices are typically shared among neighbor triangles and therefore different surface normals can be defined for a single vertex when shared among different triangles. For these reasons, the number of vertices created in CHAI3D will typically correspond to three times the number of triangles of the model, and not to the number of vertices defined in the original 3DS file.

Please Log in or Create an account to join the conversation.

More
15 Mar 2016 07:58 #3

All right, thank you for explaining.
A quick follow-up question:
We have 3x the number of the vertices, but the number of the triangles/faces is exactly the same (getNumTriangles()) as in the 3ds max.
So is there any performance decrease in chai3d because of importing a .3ds file compared to an .obj ?

Please Log in or Create an account to join the conversation.

More
16 Mar 2016 08:51 #4

Since graphic cards offer large amounts of memory these days, the increased number of vertices has a limited impact on the overall performance.

Make sure however to enable display lists so that the entire mesh object is uploaded in GPU memory once and not at every frame. See example 21-object for more information.

    // enable display list for faster graphic rendering
    object->setUseDisplayList(true);

Please Log in or Create an account to join the conversation.

More
16 Mar 2016 09:03 #5

All right, thank you very much.

Please Log in or Create an account to join the conversation.

More
17 Mar 2016 07:16 #6

I have two more questions and I don't want to spam your forum by creating new threads.
So here goes :
I was looking into the documentation looking for ways to get the contact/intersection points from 2 colliding objects and I read that the parent class cGenericCollision does not support collision detection between objects themselves.

1. Is the line segment the only shape I can use to detect collisions ? If yes, I would have to call the computeCollision function three times (once per triangle edge) to get the contacts points of a specific triangle and then repeat that for all the triangles of a mesh ?

2. Is there an example that uses CollisionRecorders ?

Thank you

Please Log in or Create an account to join the conversation.