Away3D: Loading & exporting data

Flash, News, Tutorials Add comments

Hi All, I'm new to Away3D, what is best way to load models into my project?
I often read messages like this on our Google User Group. Many new features for this have been added in the past few months, so it's time for a closer look at what possibilities Away3D offers at the moment.

Away3D supports 3 kinds of data files:

  • Models from other (3D) applications
  • Models encoded as pure AS3 classes
  • Away3D AWD format
  •  

    Supported 3D model formats
    The Away3D engine is able to load, parse and display these 3D/exchange formats:

  • Wavefront Obj *
  • Metasequoia MQO *
  • Md2still and Md2 animated
  • Max3DS
  • Kmz
  • Collada
  • Ase
  • Other formats such as LWO, ACD3 will be soon added to this list

    If you work with 3D applications, chances are that you have either used or heard of one of the above formats. They all hold 3D data and you can load them into another 3D application if it supports the given format.

    Away3D also supports some quite unique formats:

  • Swf
  • AWData (.awd)
  • Fonts
  •  

    Swf is not as the name might suggest a loader for swf's. It is rather a parser allowing you to extract vector information directly from movieclips in a swf and display the extracted vector content in 3D. Here's an example.

    AWData (away data files .awd) is an entirely new format. This format is the first version of the Away3D native format. It will be a compact, featured and backward compatible format. More on this further down in this post.

    Away3D  Data only v1
    Same data in various formats. awd data is not compressed yet :)

    Fonts can be used with the Textfield3D class and extrusions derivated from font information, making it possible to embed font outlines in Away3D.

    The exporters
    Getting a model into your project is one thing, but what if you want to go the other way? If you create a tool that creates 3D models - how do you get it back out? Away3D has multiple exporters.

  • 4 different AS3 outputs
  • Wavefront obj
  • Away data (.awd)
  • The AS3 exporters
    Currently you can output to 4 different kinds of AS3 classes. The 2 first ones are the AS3Exporter and the AS3LiteExporter. As the obvious names are suggesting, their output is compatible for Away3D or Away3DLite. These are able to export a whole scene (up to 100k polys whithout having memory issues at compile time). The export is written as a single AS3 class that you can then use directly in your project using standard syntax, for example: new MyExportedClass().

    The third method (a Mesh method) allows you to export a single Mesh description to AS3.  If the source was an animated md2 model, this method will export the mesh animation information as well. This class also features export of single Mesh as xml if you should need that. Note that this methods will probably be removed in futures versions when the AWD format and the other AS3 class exporters get animation support.

    The last is the Elevation2AS3 exporter that exports not only the elevation information, but also creates the bitmap generation data you need for surface tracking.

    Use Wavefront obj to exchange models
    For some projects, it is handy to export the content of your scene to an external 3D editor such as Maya, 3DS MAX, Blender or others. You can use the ObjExporter for this. It allows you to perfectly match your scene in your editor, but also to export dynamically generated objects.

    Away data format
    The new comer into the Away3D arsenal is the AWD file. This format is currently a data only export for static object(s). Like all the other AS3 exporters, you can export a whole scene, but the file doesn't need to be compiled. It can be embedded, it can be read from remote locations such as databases or simply loaded runtime. Next to a huge size gain compared to standard formats, the format is also compatible with the F9 Away3D (2.4 and higher), F10 Away3D and F10 Away3DLite. It will be extended and developed with this "cross engine" idea for upcoming updates. Mesh animation support for this format is currently under development.

    PreFab3D
    Away3D is open source, this means that all the classes to import and export are available to you in our google code repository. You also can find additional features for these exports such as material embedding in our AwayAIR package. So you can create your own tools in AIR as well.

    In case you choose to go the easy way and just want to improve your workflow, the latest version of PreFab3D is supporting all these with an extra for the awd format: you can drag&drop the awd files on the app to load them back for further editing or viewing. Of course you can embed your prebaked textures from PreFab3D into your AS3 and awd files.

    Best practices
    Many swear by collada, others by 3ds or obj. The point is that most of these formats are ideal for development purposes but most of them are not very suitable for web because of the extra verbose they hold or like the kmz format, even adding extra cpu/ram costs to decompress the zipped files.

    So if your project is not asking for md2 mesh animation or collada bones animation.
    The best way to avoid loading blues and have much smaller project footprint is to export to AS3 or awd format.

    I hope this little post adresses a few of the questions you might have and will help you to make a (better) choice for a format in your next Away3D project.

    If you need technical support or if you have questions, please register on our our dev group or read our documentation/example section on the main Away3D site.

    5 Responses to “Away3D: Loading & exporting data”

    1. makc Says:

      To quote Rob Batman from 3/28/08 “i thinnk that right now, the last thing the 3d flash community needs is another 3d file format. I can’t speak for the other engines out there, but Away3d is contently refining it’s importers to be conpatible with as many files as possible - and both the 3ds and md2 format provide ample scope for binary data interchange.” I guess times have changed :)

    2. Fabrice Says:

      A typical Makc comment :)
      You take this out of context and you do mix purposes.

      It’s not about external/exchange data from third apps, the new awd format is designed for Away3D internals only. It’s made to enhance and ease processes for away devs, avoid version problems and reduce file size.
      It’s not just another variation of something existing, there is no “away_dev_friendly” format right now and since we are trying to make Away more accessible to more devs and designers via tools such as PreFab3D, like any app, we need to be able to save/export/load the generated data. Since I’m not planning to make another xml monster, I’ve tried with this first version to store only what is required for an Away3D project.

      Even if Rob would have said something that may sound a bit conflicting now, that doesn’t mean that two year later, he wouldn’t think differently.

      Keep in mind that our flash world evolves at lightspeed.

      Just look at next CS5 IPhone export for instance… what if you need low kb, no externally loaded files except from remote DB. And ideally you want be able to use same data for both web and IPhone project right?

      Now you might realize that you’re not gonna fix this problem with your collada…

    3. Jalava Says:

      Is AWD/AS3 really more compact than MD2?

      Loading of MD2 seems easier compared to loading AS3 classes and instantiating the symbols dynamically from there. Of course, if your project size is so small that you can embed everything, it might be better.

    4. Fabrice Says:

      For now md2 and some other binary formats are still lower than as3 once compiled, but in lots of cases the difference is not big, except as said in post when large frame information is stored. Its partly due to the way the “old” mesh animation to as3 is done.
      But its not just all about size, ease and handyness are also important factors. many sites for games for instance accept only 1 standalone swf. Plus, your models are pretty safe. If someone want to steal your models, he will have to work to get them out of your classes, and even more if its awd.
      The next update of awd outputs should be enhanced… but like with PreFab3D, there must be v1 before v2.

    5. Sharedtut Says:

      I am giving this a try, thank you for the sample link.

    Leave a Reply

    Entries RSS Comments RSS Log in