3D file formats?

Software: Away3D 4.x

veclock, Newbie
Posted: 03 April 2013 01:03 PM   Total Posts: 5

Hi, just wondering which file formats are supported in Away3D 4 right now?
Also depending on which format you choose, do you have to include them in another way or is it always the same?

Cheers!

   

Avatar
theMightyAtom, Sr. Member
Posted: 03 April 2013 05:28 PM   Total Posts: 669   [ # 1 ]

You can see the parsers available in the Away3D standard library here.
https://github.com/away3d/away3d-core-fp11/tree/master/src/away3d/loaders/parsers

You can specify a single parser,

Loader3D.enableParser(Max3DSParser);

or a Vector of parsers.

Loader3D.enableParsers(Max3DSParser, OBJParser);

Hope that helps :O)

Good Luck!

 

   

Avatar
80prozent, Sr. Member
Posted: 03 April 2013 06:09 PM   Total Posts: 430   [ # 2 ]

Hi

The AWD2 Format is by far the best file-format to use with Away3d.

Since most of the other formats are not dedicated to online/realtime applications, they are not that good regarding filesize and parsing speed.

One downside of awd2 is the lack of vertexAnimations, but skeletonAnimations are supported.

You can use Prefab to test/prepare your models, and than export them as AWD2-files.

 

 

 

 Signature 

sorry…i hope my actionscript is better than my english…

   

veclock, Newbie
Posted: 04 April 2013 07:37 AM   Total Posts: 5   [ # 3 ]

That helpes, thank you very much! smile
I’ll return with new questions later after diving in more into Away3D!

   

CyrilM, Newbie
Posted: 08 April 2013 08:24 PM   Total Posts: 15   [ # 4 ]

Any chance that the SEA file format will be supported? I’ve been using it and it’s been working great for me, but it would be great if it was natively supported to make it easier to keep the different code versions up to date.

   

veclock, Newbie
Posted: 09 April 2013 09:01 AM   Total Posts: 5   [ # 5 ]

Help!

I have serious problems with finding tutorials about importing 3D model files into Away3D.
I followed this one: http://www.adobe.com/devnet/flashplayer/articles/creating-games-away3d.html
And basically copied the code and the file, still doesn’t work.

I’ve tried with two files: monster.obj & vase.awd. They’re both in the bin folder.

When trying the obj file I get “Error #3671: Buffer has zero size.”
When trying the awd file I get “Error #2030: End of file was encountered.”

So annoying that many tutorials cover earlier versions that doesn’t work any more. If there isn’t an updated tutorial series somewhere
I’ll have to rely on this forums for help. :/

Can you help me get it working with the Loader please? And also if you know, show me how it’s done when Embedding the file.

Here’s some of my code:

package {
 import away3d
.containers.View3D;
 
import away3d.core.base.Geometry;
 
import away3d.entities.Mesh;
 
import away3d.loaders.parsers.OBJParser;
 
import away3d.materials.*;
 
import away3d.primitives.*;
 
import away3d.containers.ObjectContainer3D;
 
import away3d.loaders.Loader3D;
 
import away3d.events.LoaderEvent;
 
import away3d.loaders.parsers.Parsers;
 
 
import flash.display.Sprite;
 
import flash.events.Event;
 
import flash.geom.Vector3D;
 
import flash.net.URLRequest;
 
 
[SWF(width=800height=600frameRate=60)]
 
 
public class Main extends Sprite {
  
private var view:View3D;
  private var 
model:Mesh;
  private var 
cube:Mesh;
  private var 
loader:Loader3D;
  
  public function 
Main():void {
   
if (stageinit();
   else 
addEventListener(Event.ADDED_TO_STAGEinit);
  
}
  
  
private function init(e:Event null):void {
   removeEventListener
(Event.ADDED_TO_STAGEinit);
   
   
view = new View3D();
   
addChild(view);
   
   
Parsers.enableAllBundled();
   
loader = new Loader3D();
   
loader.addEventListener(LoaderEvent.RESOURCE_COMPLETEonResourceComplete);
   
loader.addEventListener(LoaderEvent.LOAD_ERRORonLoadError);
   
loader.load( new URLRequest('monster.obj') );
   
   
addEventListener(Event.ENTER_FRAMEupdate);
  
}
  
  
private function onResourceComplete(e:LoaderEvent):void {
   loader
.removeEventListener(LoaderEvent.RESOURCE_COMPLETEonResourceComplete);
   
loader.removeEventListener(LoaderEvent.LOAD_ERRORonLoadError);
   
view.scene.addChild(loader);
  
}
  
  
private function onLoadError(e:LoaderEvent):void {
   trace
('Could not find'e.url);
   
loader.removeEventListener(LoaderEvent.RESOURCE_COMPLETEonResourceComplete);
   
loader.removeEventListener(LoaderEvent.LOAD_ERRORonLoadError);
   
loader null;
  
}
 }

 

   

veclock, Newbie
Posted: 09 April 2013 10:01 AM   Total Posts: 5   [ # 6 ]

Now I tried this, loading the obj a few frames after the onAssetComplete, then it worked? What’s going on here…

[Embed(source="/../monster.obj"mimeType="application/octet-stream")]
  
private var MonsterModel:Class; 

  private var 
a:int 0;
  private function 
init(e:Event null):void {
   removeEventListener
(Event.ADDED_TO_STAGEinit);
   
   
view = new View3D();
   
addChild(view);
   
   
Parsers.enableAllBundled();
   
   
AssetLibrary.addEventListener(AssetEvent.ASSET_COMPLETEonAssetComplete);
   
AssetLibrary.loadData(new MonsterModel());
   
   
addEventListener(Event.ENTER_FRAMEupdate);
  
}
  
  
private function onAssetComplete(event:AssetEvent):void {
   
if (event.asset.assetType == AssetType.MESH{
    model 
event.asset as Mesh;
    
model.geometry.scale(100);
    
model.= -50;
    
model.rotationY 180;
    
    
1;
    
// view.scene.addChild(model); // <--- does NOT work. Frame buffer zero
   
}
  }

  
private function update(e:Event):void {
   view
.render();
   if (
aa++;
   if (
a==2view.scene.addChild(model); // <---
  
   

CyrilM, Newbie
Posted: 09 April 2013 02:11 PM   Total Posts: 15   [ # 7 ]

Hey,

I’m not certain why you are getting errors in your first example, but in your second example it is because when the MESH has finished loading it doesn’t mean the rest of the file is complete yet.

I’m not sure how OBJs are loaded but with other formats there are textures, shaders, materials, etc. that are also loaded, sometimes after that is done. I know OBJ files are just vertex and index lists but who knows what is going on in the background. So waiting a few frames gives the loader time to actually complete the load of the model before you can use it.

I believe you can check the isLoaded flag to see when the load has been completed successfully.

also add this to the end of your second onAssetComplete function to see what else is going on.

else {
trace
(event.asset.assetType.toString());
   

veclock, Newbie
Posted: 10 April 2013 06:13 AM   Total Posts: 5   [ # 8 ]

Yes thank you, when adding that I got this traced:

geometry
geometry
material
material
material
texture

and therefore I tried this:

if (event.asset.assetType == AssetType.MESH{
 
// ...
else if (event.asset.assetType == AssetType.TEXTURE{
 view
.scene.addChild(model);

Which worked fine! I didn’t find any isLoaded flag but I also found that I can write:

if (modelview.scene.addChild(model); 

...inside of the enterFrame. I think it’s ugly to load stuff in the enterFrame but it seems like the best choice. I can’t be sure about if “texture” is the last thing loaded for every file a try, haven’t even tried animations yet.

There should be an event which tells you when you can load stuff.
Are these my only choices, or are there better ways?

Thanks again!

   

Sean72, Newbie
Posted: 10 April 2013 05:17 PM   Total Posts: 28   [ # 9 ]

Whatever you do, forget the vase.awd and related tutorial.  I spent hours trying and trying to get that to work but they’ve changed the specification of the awd files since then and vase.awd in the tutorial I used never loaded.  If you are in Cinema 4D by any chance, there is an exporter plugin in development here http://away3d.com/forum/viewthread/4009/.

Alternatively, you can use PreFab3D to load other models and convert them to AWD format (always choose format 2 I believe).  But from what I last heard, don’t trust the material/texture handling of PreFab3D itself, as it may not display them.  I believe there is a 3DSMax and/or Maya AWD exporter somewhere as well.

I’m still reasonably new at this, but would happily compare notes if you like.  You are right, there is a lot of confusion regarding which tutorials to follow and which are no longer valid.  And there is no central resource for them, they are all over the place.  Here are a few links I have found:

This coder is greatly skilled, but the examples are too complex for me:
http://www.allforthecode.co.uk/aftc/forum/user/modules/forum/away3d.php?index=4

This helps a bit:
http://www.youtube.com/watch?v=VSiI4FYYuoc

PreFab home page
http://www.closier.nl/prefab/

Another forum:
http://stackoverflow.com/questions/tagged/away3d

   

Avatar
Fabrice Closier, Administrator
Posted: 11 April 2013 10:17 AM   Total Posts: 1260   [ # 10 ]

@sean72. “But from what I last heard, don’t trust the material/texture handling of PreFab3D itself,”

The reason why an awd once reloaded into your Away may not hold all the information that you can define in Prefab, is simply because the awd format in its spec 2.0 doesn’t support much of a material (diffuse only). If you would export the same to AS3, you would have a full restitution of the original definition.

“(always choose format 2 I believe).”
Yes, awd format 1.0 was dev during flash 9 area with Prefab 1.0. The reason why it’s in Prefab 2.0, is simply to allow to convert f9/f10 project to f11 and vice versa. As Away3D 4.x is able to handle more information than Away 3.6 and lower, we needed a better format: awd 2.0.
We are currently working on update 2.1.

   

SuperSam, Sr. Member
Posted: 17 April 2013 11:02 PM   Total Posts: 102   [ # 11 ]

Holy shit, I spent 2 hours just trying to understand why in the nine hells that ugly vase didn’t want to load. I thought it was a bug in Away 3D 4.1 Alpha so there was a lot of code to look into.

Please for the love of all that is turtles, either put a correct AWD file (anything except a vase), or take down the whole tutorial or something, whether you ask Adobe or just update away3d.com tutorials list.

A bunch of people are going to waste a stupid amount of time like Sean, vclock and I.

The reason why an awd once reloaded into your Away may not hold all the information that you can define in Prefab, is simply because the awd format in its spec 2.0 doesn’t support much of a material (diffuse only). If you would export the same to AS3, you would have a full restitution of the original definition.

1. The lastest publicly available AWD format only supports diffuse maps. Should I understand that Away3D is not quite ready for production level and commercial indie games more complex than wack a 3D mole ? Okay there’s Tanki online but they have had a lot of experience with Away3D and a lot of time and the means to modify the framework for their own use; I’m not sure they can be pointed out as an example to small indie teams.

An honest answer would really help here. If it’s not ready and you have a rough idea when it will be (3 months, 6 months, a year), I’m still interested to know smile


2. What’s the fastest way to load assets with normal maps into Away3D, if AWD only takes diffuse ? If assets are embedded, I understand that Prefab’s export to AS3 is best. But if they’re loaded at runtime ? 3DS is best then ? OBJ ? DAE ? What about the (I think upcoming) FBX support ?

 

Thanks for enlightening me smile

   

Sean72, Newbie
Posted: 18 April 2013 06:29 AM   Total Posts: 28   [ # 12 ]

I understand your pain, I was also more than a little upset to learn that that old lamp won’t load, not because of a code mistake I may have made, but because the definition of the AWD format changed and is no longer supported.  Being prominently on the adobe site, someone should either update the Away3D tutorial/files or maybe replace it.

I certainly want to help others learn, Away3D has awesome capabilities and after much effort, I can at least walk people through the basics of setting up the 3d stage, loading external files, handling asset complete events, traversing the asset library to access mesh and materials, creating the two kinds of lights and working with shadows, getting the hover camera to work properly including setting limits, getting the mouse wheel to zoom in and out of a model and getting keyboard events to work.  My next area to learn is animation, and I am studying and asking questions to figure that out.

I have been commenting my code heavily (my AS3 novel!) and just need to break it into sections. I guess I also want to be sure I don’t interfere with other plans the Away3D developers and coders may have for tutorials before I jump in and post it.

I would actually be interested in some sort of a role that would help forward the Away3D goals e.g. moderating and assisting in certain beginner/intermediate forums if they existed, and I would love to comment others tutorial code to explain very deliberately how it works.

   

starforce, Newbie
Posted: 19 April 2013 05:09 PM   Total Posts: 4   [ # 13 ]

I too have struggled to get anything accomplished with away 3d. I wasted a few days trying to get the vase.awd file to work in the GettingStartedWithAway3d tutorial on the Adobe website to only find out that the standards have changed. Seems to be no effort to update the tutorials at all. Which can make it impossible to learn. I will look some of the links posted in this thread. Seems away3d would want as many users as possible using their technology.

   

Dreko, Newbie
Posted: 12 December 2013 04:41 PM   Total Posts: 3   [ # 14 ]

I would have to agree, I am struggling to get a simple project completed. All of the tutorials don’t apply any more. I have managed to have looked at so many examples that things are finally making sense. My biggest problem right now is Away Builder. It treats different objects different ways each time I load a new one. Downloaded Cinema 4D because it had the most up-to-date .awd exporter and it hangs at 49%. I can’t seem to get any reliable or consistent results from importing 3d objects into away3d. If there is a preffered format (like .awd) and what is the best way to get that file created? what tools? each program has its own version of each file type and away builder doesn’t like any of em lol.

   

Avatar
GoroMatsumoto, Sr. Member
Posted: 12 December 2013 07:31 PM   Total Posts: 166   [ # 15 ]

Hi Dreko,

How about the vase model which is used in the tutorial?
Can you see it in your exported swf?
If so, your monster.obj is not good.
Can you see correctly in other 3d file viewer?

Anyway, there are many example sources and tutorials which
fits to latest Away3d.

Official tutorials:
http://away3d.com/tutorials/

Examples:
https://github.com/away3d/away3d-examples-fp11
http://linktale.net/dev/away3d-examples-fp11_4_1_1_Beta/src/

I think that this example is the best for your starting.
http://linktale.net/dev/away3d-examples-fp11_4_1_1_Beta/src/?code=Basic_Load3DS&size=1200_800
This uses 3DS file format.
But you can replace the 3ds file with your obj file.

//solider ant texture
[Embed(source="/../embeds/soldier_ant.jpg")]
public static var AntTexture:Class;

//solider ant model
[Embed(source="/../embeds/soldier_ant.3ds",mimeType="application/octet-stream")]
public static var AntModel:Class; 

Rewrite these embed assets.
And compile it.

If you can see your model,
try to tinker your light, material, cameras.

Good luck!

 

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X