How to add a mesh with material and texture?

Software: Away3D 4.x

Albert, Newbie
Posted: 27 November 2011 02:02 PM   Total Posts: 16

Hello!

I have just started using Away 3d (4.0) and it is really nice, even beautiful. But I don’t understand how to use the ObjectContainer3d.

I have read this tutorial: http://www.adobe.com/devnet/flashplayer/articles/creating-games-away3d.html, but where should I go from here? Looking at the examples doesn’t tell me so much about how Away 3d works.

Are there any tutorials on how to load a model and add material and texture to it? Loading models is quite fundamental for a 3d engine, but it seems so hard!

Thanks in advance,
Albert

   

davy, Newbie
Posted: 28 November 2011 07:18 AM   Total Posts: 15   [ # 1 ]

yep, I got same question as you when I enter this project. But as you said it’s fundmental and should be a easier way.

I found the way by looking at the src code of the official example here:
https://github.com/away3d/away3d-examples-fp11

currently use obj as mesh and use baked uv texture is my best bet.

3ds cause some strange url problem.

my current workflow is using blender to export obj file, and load with away3d.

Works fine, but a little bit tricky. two things should know
1.must export normal
2.must uv unwrap if you wanna texture it later

Wish this could help

BTW: I don’t really know if the team has some recommended pipeline for the game dev using away3d

and I guess awd2 and exporter for blender will be a longgggggg waiting.

so for now I go for obj

   

Albert, Newbie
Posted: 28 November 2011 12:10 PM   Total Posts: 16   [ # 2 ]

Thanks for the link, really good examples! I figured that there was something to do with the AssetLibrary class, so after some googling I found this pearl: http://markmail.org/download.xqy?id=ts3i6hsnusqsrnb6&number=1 It’s .funny that many tutorials (and even the examples) doesn’t use this way that seems to be the right way.

   

davy, Newbie
Posted: 28 November 2011 01:42 PM   Total Posts: 15   [ # 3 ]

hmm, thanks for the detailed document, looks very informative. It’s from very early demo version, but I guess it’s ok for now. away3d didn’t enter beta stage, so the api didn’t stable. I just use what ever it works and wait for the final version :D

happy hacking~

   

Calipe, Newbie
Posted: 28 November 2011 04:37 PM   Total Posts: 2   [ # 4 ]

In Away3D there are many ways in which you can load a model and add a material to it. One way of doing this is by embedding the source files of the model and use the loader3D’s parseData method.

private function initMesh():void
{
 
// Set the material for the mesh
 
var crateMaterial:BitmapMaterial = new BitmapMaterial(Bitmap(new CrateSkin()).bitmapData);
 
crateMaterial.normalMap Bitmap(new CrateMap()).bitmapData;
 
crateMaterial.lights [light0light1];
 
crateMaterial.specular 0.4;
 
 
Loader3D.enableParser(Max3DSParser);
 
loader = new Loader3D();
 
loader.parseData(CrateMeshnull, new AssetLoaderContext(false));
 for (var 
i:int 0loader.numChildreni++)
 
{
  
var mesh:Mesh Mesh(loader.getChildAt(i));
  
mesh.scale(20);
  
mesh.material crateMaterial;
 
}
 
 view
.scene.addChild(loader);
 

Here is a link to a more detailed explanation: http://cperea.com/programming/3d/away3d/loading-a-model-in-away3d-4-0/

   


Albert, Newbie
Posted: 28 November 2011 09:56 PM   Total Posts: 16   [ # 6 ]

The loader3d class is only good for loading 3d objects without many lines of code. It’s actually bad because it’s slower and you don’t have that much control over it. And what’s bad is that most tutorials for Away 3d 4 uses this method and doesn’t explain other options.

But when it comes to the AssetLoader class I use these lines:

AssetLibrary.addEventListener(AssetEvent.ASSET_COMPLETEonAssetComplete);
AssetLibrary.load(new URLRequest("monkey.obj")); 

But if I would like to load more than one model, wouldn’t it use the same event listener and then how should the onAssetComplete funtion look in order to load all the models? Or when is the onAssetComplete function actually called?

   

Mar, Newbie
Posted: 10 June 2013 03:52 PM   Total Posts: 29   [ # 7 ]

Hi there,

I was wondering how did you finally loaded in Away3d more than one model. I know there are many ways of loading a model, but which is the best for loading more than one model, to be able to texture each one of them separately later on. Should I use AssetLibrary? I’m trying to load them as AWD files.

Thanks

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X