How to load a .obj file that have .mtl ?

Software: Away3D 4.x

gohkgohk, Newbie
Posted: 31 July 2013 11:20 AM   Total Posts: 4

hi.
I am new to away3d.

The examples show in away3d tutorials that only load the vertex in obj, and then input the texture directly in coding, without the use of .mtl file.

Do there have any function that existed in away3d, which i can call to load everything from obj and mtl files directly?

please help.

Thank you

   

Avatar
theMightyAtom, Sr. Member
Posted: 31 July 2013 12:20 PM   Total Posts: 669   [ # 1 ]

This generally just *works*, i.e. the mat file is loaded automatically when the obj file is loaded. You just need to be sure the paths are right.

Another thing I noticed recently is that all the materials use the first texture in the mat file, so if you have multiple texture files you might want to do what I did, and take the file into AwayBuilder, correct the textures and save it out as an AWD. This is the native format for Away, and gives the most predictable and best performing results when importing.

http://awaytools.com/awaybuilder/live-tool/

Good Luck!

   

gohkgohk, Newbie
Posted: 01 August 2013 09:13 AM   Total Posts: 4   [ # 2 ]
theMightyAtom - 31 July 2013 12:20 PM

This generally just *works*, i.e. the mat file is loaded automatically when the obj file is loaded. You just need to be sure the paths are right.

Another thing I noticed recently is that all the materials use the first texture in the mat file, so if you have multiple texture files you might want to do what I did, and take the file into AwayBuilder, correct the textures and save it out as an AWD. This is the native format for Away, and gives the most predictable and best performing results when importing.

http://awaytools.com/awaybuilder/live-tool/

Good Luck!

Thx for your reply.

For my application, my codes will generate 3d models in OBJ format, and i want to load it into the viewer that created with away3d directly.  So i can not convert 3d model to awd manually, or where can i find the awd format, so i can output as awd directly without the use of awdbuilder.

thx.

   

gohkgohk, Newbie
Posted: 01 August 2013 09:21 AM   Total Posts: 4   [ # 3 ]

del

   

Avatar
theMightyAtom, Sr. Member
Posted: 01 August 2013 09:52 AM   Total Posts: 669   [ # 4 ]

Load in Away Builder and save out as AWD.
The obj format is not implemented the same everywhere, so I know it must be a nightmare to create a solid format reader. The obj export that comes with MAX for example is useless. Even using another exporter, I experienced the Away import working, and not working, with no apparent reason why.

Where there’s a will there’s a workaround, and the easiest is to use AWD in this case, and it will give you other benefits for free!

Good Luck!

   

Avatar
theMightyAtom, Sr. Member
Posted: 01 August 2013 09:55 AM   Total Posts: 669   [ # 5 ]

Sorry, missed your other post.
If you have to use obj, you will have to delve into the Obj importer class and find out what’s going wrong. That’s the beauty of open source.
You can also file a bug, but I’m sure obj import is not high on the priority list.

Do you have control over the code generating the obj?

   

gohkgohk, Newbie
Posted: 01 August 2013 09:55 AM   Total Posts: 4   [ # 6 ]

Haha

finally i know how to make Obj display different material on the same body.
In the obj file , you need to “group” different vertices into different groups , then you can apply different texture material on different groups.

   

Avatar
theMightyAtom, Sr. Member
Posted: 01 August 2013 09:58 AM   Total Posts: 669   [ # 7 ]

Cool, well done. Another good workaround smile

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X