Away3D: Loading & exporting data

Flash, News, Tutorials

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.Transformers: The Last Knight live streaming film

    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.

    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.