Away3D Gold : all .obj got the same texture

Software: Away3D 4.x

Abracad, Newbie
Posted: 27 July 2012 01:02 PM   Total Posts: 17

Hi all,

I’m loading in a loop a bunch of separate .obj files, all of them with different textures but each time a new obj is loaded all the previous ones get it’s texture. So at the end of the loading process the texture of the last object is applied on each object.

Every thing was fine with away3d 4.0.

If i trace the mat.texture.name in the applyMaterial() function of the OBJParser class i’ve got the right name. If i do the same in the loaded scene (loop through all scene’s children) i’ve always got the same name (and it is confirmed by what i see : same texture everywere).

Any clue on how can i correct that?

   

Richard Olsson, Administrator
Posted: 28 July 2012 09:25 AM   Total Posts: 1192   [ # 1 ]

This sounds like a bug in OBJParser. Can you please file a bug report at http://github.com/away3d/away3d-core-fp11/issues? Thanks!

   

Raj, Newbie
Posted: 06 August 2012 01:05 PM   Total Posts: 9   [ # 2 ]

eagerly waiting for a fix. This is causing serious problems for me. I tried reverting to older version of Away3d but this version has even more serious fix (stage3d proxy dispose).

   

Richard Olsson, Administrator
Posted: 06 August 2012 02:38 PM   Total Posts: 1192   [ # 3 ]

Raj: Just use an older version of OBJParser. No need to revert the entire engine, since the parser API hasn’t really changed much for a long time, so older parsers should still work with the newer engine.

   

Qbrain, Member
Posted: 06 August 2012 10:12 PM   Total Posts: 92   [ # 4 ]

I used prefab to convert all my files to .awd2. Works perfectly if you clear your cache.

Takes up a little bit of time, but your good to go afterwards + you use the file format which is specially designed for Away3D.

-Q

   

Raj, Newbie
Posted: 07 August 2012 04:59 AM   Total Posts: 9   [ # 5 ]

Thanks guys..i will try both the solution and post my experience in a moment…

Regards

   

Raj, Newbie
Posted: 07 August 2012 09:02 AM   Total Posts: 9   [ # 6 ]

I tried learning prefab (only to level to import and export, till now smile ) and what i found:

prefab awd2 formal not loading in away3d gold release with awd1loader or awd2loader. (giving loading errors)

loading with awd1loader using awd1 prefab exported file works. But it has some issues:
All the colorMaterials are converted to textureMaterials it seems, and shows as while mesh (color is lost).

loading the exported file back to prefab also shows all white meshes.
Am i exporting wrongly? or need to change my code for awd import?

Please help…


Thanks in advance

Edit:
AssetLibrary.loadData(new OBJModel(),null,“4”, new AWDParser());

this is the error i get if using awdparser to parse awd2 exported from prefab:

Error: Error #2030: End of file was encountered.
at flash.utils::ByteArray/readUTFBytes()
at away3d.loaders.parsers::AWD2Parser/parseVarStr()[C:\Users\raj.roy\Adobe Flash Builder 4.6\Barebones2\away4\src\away3d\loaders\parsers\AWD2Parser.as:995]
at away3d.loaders.parsers::AWD2Parser/parseUserAttributes()[C:\Users\raj.roy\Adobe Flash Builder 4.6\Barebones2\away4\src\away3d\loaders\parsers\AWD2Parser.as:1054]
at away3d.loaders.parsers::AWD2Parser/parseMaterial()[C:\Users\raj.roy\Adobe Flash Builder 4.6\Barebones2\away4\src\away3d\loaders\parsers\AWD2Parser.as:376]
at away3d.loaders.parsers::AWD2Parser/parseNextBlock()[C:\Users\raj.roy\Adobe Flash Builder 4.6\Barebones2\away4\src\away3d\loaders\parsers\AWD2Parser.as:267]
at away3d.loaders.parsers::AWD2Parser/proceedParsing()[C:\Users\raj.roy\Adobe Flash Builder 4.6\Barebones2\away4\src\away3d\loaders\parsers\AWD2Parser.as:206]
at away3d.loaders.parsers::ParserBase/onInterval()[C:\Users\raj.roy\Adobe Flash Builder 4.6\Barebones2\away4\src\away3d\loaders\parsers\ParserBase.as:309]
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()

   

Qbrain, Member
Posted: 07 August 2012 09:06 AM   Total Posts: 92   [ # 7 ]

use this code to load the awd2 format:

var loaderLoader3D = new Loader3D();

init function:
loader.addEventListener(LoaderEvent.RESOURCE_COMPLETELoadComplete);
loader.load(new URLRequest('yoururl.awd'));

function 
LoadComplete(event:LoaderEvent){
view
.scene.addChild(loader);
//loader.scale(7);

hope this helps!

-Q

   

Raj, Newbie
Posted: 07 August 2012 10:38 AM   Total Posts: 9   [ # 8 ]

Using old OBJParser working..!!

This is what I did:
1. Copy older working version of OBJParser.as to the latest gold release ‘loaders’ package.
2. Copy package ‘loaders\data’ and its content to the new away3d package.
3. Add this function in ParserBase.as:

public function get defaultBitmapData() : BitmapData
{
  return DefaultBitmapData.bitmapData;
}

You are good to go smile

P.S. awd2 export option did’nt work for me…will appreciate the help as i think prefab will give me an edge for sure.

   

Avatar
Fabrice Closier, Administrator
Posted: 07 August 2012 11:12 AM   Total Posts: 1265   [ # 9 ]

Instead of doing this, just make sure that the resources are located where they are expected to be. Of course you need to set an error listener and read the event data to know a bit more about what’s going on.
There are different loading examples on git…

I do use dayly the exports awd1 & 2 from prefab 2.121. All works as expected using master.

   

Raj, Newbie
Posted: 07 August 2012 11:22 AM   Total Posts: 9   [ # 10 ]

Thanks…
Now since i have my whole system working, i can take some breath and try prefab exports from scratch and try to make it work. will let you know.
By the way, what do u mean by saying ‘using master’ at the end of your comment? what am i missing?
and, i just used export to awd2 and it created the folder of the same name with all assets in the same folder. hope the awd file takes relative path of the assets? or is there some option for it?

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X