Load .obj with more than two materials

Software: Away3D 4.x

Interesting, Newbie
Posted: 26 October 2012 08:09 AM   Total Posts: 4

i have a 3D model in .obj file and .mtl file
i have 19 meshes and 2 material
everytime i load my model i think there’s only one material on my model
so i traced the source code and found this in OBJParser::translate()

bmMaterial DefaultMaterialManager.getDefaultMaterial();
.
.
.
if(
groups[g].materialID != ""){
    bmMaterial
.name groups[g].materialID+"~"+mesh.name;
else {
    bmMaterial
.name _lastMtlID+"~"+mesh.name;

and since the DefaultMaterialManager has a static member

private static var _defaultMaterial:TextureMaterial

so i got only just one material each time?

   

Avatar
Fabrice Closier, Administrator
Posted: 26 October 2012 01:10 PM   Total Posts: 1265   [ # 1 ]

This issue has been fixed. Use the ObjParser from dev branch.

   

My Wireframe Shoe, Newbie
Posted: 28 October 2012 12:32 PM   Total Posts: 6   [ # 2 ]
Fabrice Closier - 26 October 2012 01:10 PM

This issue has been fixed. Use the ObjParser from dev branch.

Hi! If i am on the correct branch - dev,
then you have small mistake on line 242.

src/away3d/loaders/parsers/OBJParser.as

Line 242:

Current:  if(!trunk[1]) trunk[1]) = “def000”;

Must be fixed like this: if(!trunk[1]) trunk[1]= “def000”;

There was extra “)”.

After fix, it works, tested, obj + mtl with multiple materials.

Thanks.

Dev branch link:

https://github.com/away3d/away3d-core-fp11/commit/2c32043fe0b06b985a855f038cf29647c14a8e91

   

Avatar
Fabrice Closier, Administrator
Posted: 28 October 2012 01:40 PM   Total Posts: 1265   [ # 3 ]

Fixed. Sorry for that.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X