Hi, So I have read about .mtl and .obj files and understood what you meant. I created a program to optimize the model (http://cs.uiowa.edu/~tinguyen/OptimizeMtlFiles.rar) But the new one that I created doesn't look the same as the old one when I don't use texture. Please click this link to download both versions, and use osgviewer.exe to view them. http://cs.uiowa.edu/~tinguyen/supermarket_3ds.rar The old one has some color (again, without texture), but the new one doesn't. So I'm wondering what's wrong. Could any of you give me a hand? Thanks, Dat
On Mon, Oct 26, 2009 at 10:10 AM, Nguyen Tien Dat <[email protected]> wrote: > Dear Ulrich, > Sorry for my stupidity, but I don't know anything about modifying > models. The model is actually created in VRML, and I use 3DS Max to > export it to obj format. So if you can, please tell me a bit more > about how to optimize the model: > - How can you remove duplicate materials (if you can tell me how to do > it by hand, that helps too) > - What else can I do to load the model in an efficient way? > Thank you very much, > Dat > > On Mon, Oct 26, 2009 at 7:33 AM, Ulrich Hertlein <[email protected]> > wrote: >> Hi Dat, >> >> On 23/10/09 5:26 PM, tien dat wrote: >>> >>> Dear Ulrich, >>> Could you tell me more about how to specify that option? Can I specify >>> it while using osgviewer.exe or I have to rebuild osgviewer.exe with >>> the option? >> >> Unfortunately you can't (at the moment) set this option externally or >> internally, because the .obj loader doesn't pass the options object along. >> >> Even if you could it would only avoid loading the same image over and over >> again. It will not solve the massively duplicated state/material that the >> model has. >> >> Either the modelling is done very inefficiently in the 3D application or >> whatever exporter is used messes things up. >> >> If you absolutely have to use osgviewer (rather than your own app) I'd >> actually write a script to optimise the .obj and .mtl files by removing >> duplicate materials. >> >> What you might also want to do is to remove the 'map_Ka' (ambient texture >> map) statements since they are not used with the standard OpenGL paths (but >> are still loaded). >> >> Cheers, >> /ulrich >> >>> On Fri, Oct 23, 2009 at 5:02 AM, Ulrich Hertlein<[email protected]> >>> wrote: >>>> >>>> On 23/10/09 10:58 AM, Ulrich Hertlein wrote: >>>>> >>>>> On 22/10/09 9:40 PM, tien dat wrote: >>>>>> >>>>>> I have a model in obj format and want to load the model into >>>>>> OpenSceneGraph. When there is no texture, OpenSceneGraph can load the >>>>>> model fine. But when I use the model with texture, OpenSceneGraph >>>>>> allocates a huge amount of memory and crashes. I think it's a runtime >>>>>> bug and would like to know how to fix it. Please find some pictures >>>>> >>>>> Not really a bug, I'd say you're running out of memory. >>>>> >>>>> - try to reduce the image sizes. >>>>> - a lot of materials reference the same image. I don't think the obj >>>>> loader caches this which means you're loading that image over and over >>>>> again. Use osgDB::Options to specify caching of images. >>>> >>>> Oh, and you seem to have pretty much one material per drawable. This >>>> will >>>> absolutely kill your performance. Have a look at the .mtl file, you'll >>>> notice that there are heaps of materials that have identical properties. >> >> _______________________________________________ >> osg-users mailing list >> [email protected] >> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >> > -- Dat Tien Nguyen PhD student, Computer Science Department The University of Iowa, IA 52242 http://cs.uiowa.edu/~tinguyen _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

