David Oyarzun wrote:

Dear all,

 

                I am developing an application that allows to apply geometry deformations vertex by vertex. For doing this, I manage a list with the vertex indices of a geometry node. That is, for example I translate the vertex 5th independently of the rest of vertices (but maintaining the geometry faces connectivity and the colors and materials).

                I am working with obj files which I load using the OSG obj loader, and manage the indices through the VertexArray of the Geometry node.

I have seen if I have a obj file linked to a mtl file with different materials (using usemtl commands in the obj file), OSG breaks the geometry in different nodes, one per material, even if it is a unique mesh. Is there any possibility for avoiding it? That is, having an unique and complete mesh for all the closed geometry in the file?

 

Thank you in advance!

 

Best,

 

David.


It should be possible to have your entire mesh in a single Vec3Array. But to render different portions of that mesh with different material values, you would need to share the single Vec3Array by different Geometry objects. Certainly having different Geodes per material is not necessary; different Geometry objects under the same Geode would suffice.

If you think this will work for you, you have two ways to achieve it:
 * Modify the OBJ loader directly (probably not recommended, as you wouldn't want to break existing OSG apps).
 * Write a NodeVisitor to walk your loaded OBJ file and make the necessary changes to the organization of the scene graph (possibly difficult to do, as this code would need to automatically detect and join disparate sections of the original mesh).
   -Paul


_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to