Dear Ulrich and Erik,
Yeah, I can load the model with texture now. Thanks Ulrich for your
help. I really appreciate that.
For Erik's question, I must say that I did try the VRML loader, but it
didn't compile. I had another thread to ask for the issue (you can
search in osg mails for "VRML plug in"), and there were some answers.
Some said I may use Linux instead, and some said I should be able to
compile in in Windows. Anyway, I wasn't able to compile the plug-in,
so converting to obj model is the next thing I try. It works for me
now, so I think I'm good.
Thanks,
Dat

On Tue, Oct 27, 2009 at 6:27 AM, Erik den Dekker <[email protected]> wrote:
>
> Hi Dat,
>
> Maybe I am not seeing something obvious here, but why don't you use the
> OpenSceneGraph VRML loader instead of taking a detour via 3DS Max and
> convert to .obj format?
>
>   Erik den Dekker
>
> On 26-10-2009, at 16:10, Nguyen Tien Dat 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
>>>
>> _______________________________________________
>> osg-users mailing list
>> [email protected]
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
> _______________________________________________
> 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

Reply via email to