Alright, some more details.

I'm converting some constructive geometry models from BRL-CAD into faceted 
models in OBJ format.  I'm converting them "region" by "region" in a 
constructive geometry sense.  Each "region" becomes a "group" in an OBJ file 
sense.

Now, each region has a material value associated with it, typically an integer 
value that could represent things like: concrete, glass, tile, etc... to me 
it's just an integer.

The important thing is that this material value be maintained as part of the 
usemtl label for the converted group.  A list of these material values in 
maintained in a material .mtl file.

The process I'm using (that unfortunately I can't change) dumps out a material 
file and obj file for each region converted.  That part is just peachy the 
material file looks right, the obj file looks right as far as the mtllib and 
usemtl labels go they match the .mtl file. Great.

Now the goal is to merge all these .obj files together into ONE .obj file and 
maintain the respective usemtl labels because in the analysis tool I've built 
(in Delta3D using OSG) I have the ability to change the color scheme or shading 
of the input OBJ model based on these usemtl or material values.  I.e. the 
converted model might be a car and I might want to shade all the glass 
components "black" or all the plastic components "brown" etc....  I've already 
got the ability to do all of this as long as the OBJ file has proper usemtl 
labels (i.e. I edit the converted OBJ file by hand).  

So my question is there a way to merge these .obj files and maintain the group 
names, usemtl labels?  I hoped to avoid writing my own OBJ parser just to 
accomplish this, but if I have no choice I'll guess I'll have to.


I want to be able to take that correctly merged .obj file and use it in other 
analysis tools that read in this .obj file and the tool knows, based on the 
usemtl statements what kinds of materials this model is made of and then does 
some calculations that are not important to this issue...

I'm mainly wondering are there other, specific arguments to readNode or 
writeNode  (osgDB for the OBJ Plugin) that allow the maintaining of these 
labels?  Like I said before the resultant, merged obj file had the correctly 
defined vertices and facets but the group names, usemtl labels are all auto 
generated, I think based on the input file name.

Please let me know if you need any more information. 

Thanks in advance!

Rob

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=12104#12104





_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to