5 min read

Away3D 3.6 Cookbook

Away3D 3.6 Cookbook

Over 80 practical recipes for creating stunning graphics and effects with the fascinating Away3D engine

Introduction

The Away3D library contains a large set of 3D geometric primitives such as Cube, Sphere, Plane, and many more. Nevertheless, when we think of developing breathtaking and cutting edge 3D applications, there is really no way to get it done without using more sophisticated models than just basic primitives. Therefore, we need to use external 3D modeling programs such as Autodesk 3DsMax and Maya, or Blender to create complex models. The Power of Away3D is that it allows us to import a wide range of 3D formats for static meshes as well as for animations.

Besides the models, the not less important part of the 3D world is textures. They are critical in making the model look cool and influencing the ultimate user experience.

In this article, you will learn essential techniques to import different 3D formats into Away3D.

Exporting models from 3DsMax/Maya/Blender

You can export the following modeling formats from 3D programs: (Wavefront), Obj, DAE (Collada), 3ds, Ase (ASCII), MD2, Kmz, 3DsMax, and Maya can export natively Obj, DAE, 3ds, and ASCII. One of the favorite 3D formats of Away3D developers is DAE (Collada), although it is not the best in terms of performance because the file is basically an XML which becomes slow to parse when containing a lot of data. The problem is that although 3DsMax and Maya have got a built-in Collada exporter, the models from the output do not work in Away3D. The work around is to use open source Collada exporters such as ColladaMax/ColladaMaya, OpenCollada. The only difference between these two is the software versions support.

Away3D 3.6 Cookbook

Getting ready

Go to http://opencollada.org/download.html and download the OpenCollada plugin for the appropriate software (3DsMax or Maya).

Go to http://sourceforge.net/projects/colladamaya/files/ and download the ColladaMax or colladamaya plugin.

Follow the instructions of the installation dialog of the plugin. The plugin will get installed automatically in the 3dsMax/Maya plugins directory (taking into account that the software was installed into the default path).

How to do it…

  • 3DsMax:

Here is how to export Collada using OpenCollada plugin in 3DsMax2011.

In order to export Collada (DAE) from 3DsMax, you should do the following:

  1. In 3DsMax, go to File and click on Export or Export Selected (target model selected).
  2. Select the OpenCOLLADA(*.DAE) format from the formats drop-down list.

    Away3D 3.6 Cookbook

  • ColladaMax export settings: (Currently 3DsMax 2009 and lower)

ColladaMax export settings are almost the same as those of OpenCollada. The only difference you can see in the exporting interface is the lack of Copy Images and Export user defined properties checkboxes.

Away3D 3.6 Cookbook

Select the checkboxes as is shown in the previous screenshot.

Relative paths: Makes sure the texture paths are relative.

Normals: Exporting object’s normals.

Copy Images: Is optional. If we select this option, the exporter outputs a folder with related textures into the same directory as the exported object.

Triangulate: In case some parts of the mesh consist of more than three angled polygons, they get triangulated.

Animation settings:

Away3D supports bones animations from external assets. If you set bones animation and wish to export it, then check the Sample animation and set the begin and end frame for animation span that you want to export from the 3DsMax animation timeline.

Maya:

For showcase purposes, you can download a 30-day trial version of Autodesk Maya 2011. The installation process in Maya is slightly different:

  1. Open Maya.
  2. Go to top menu bar and select Window.
  3. In the drop-down list, select Settings/Preferences, in the new drop-down list, select Plug-in manager. Now you should see the Plug-in Manager interface:

    Away3D 3.6 Cookbook

  4. Now click on the Browse button and navigate to the directory where you extracted the OpenCollada ZIP archive. Select the COLLADAMaya.mll file and open it.

    Away3D 3.6 Cookbook

  5. Now you should see the OpenCollada plugin under the Other Registered Plugins category.
  6. Check the AutoLoad checkbox if you wish for the plugin to be loaded automatically the next time you start the program.
  7. After your model is ready for export, click on File | Export All or Export selected. The export settings for ColladaMaya are the same as for 3DsMax.

How it works…

The Collada file is just another XML but with a different format name (.dae). When exporting a model in a Collada format, the exporter writes into the XML nodes tree all essential data describing the model structure as well as animation data when one exports bone-based animated models.

When deploying your DAE models to the web hosting directory, don’t forget to change the .DAE extension to .XML. Forgetting will result in the file not being able to load because .DAE extension is ignored by most servers by default.

There’s more…

Besides the Collada, you can also export OBJ, 3Ds, and ASE. Fortunately, for exporting these formats, you don’t need any third party plugins but only those already located in the software.

Free programs such as Blender also serve as an alternative to expansive commercial software such as Maya, or 3DsMax Blender comes with already built-in Collada exporter. Actually, it has two such exporters. At the time of this writing, these are 1.3 and 1.4. You should use 1.4 as 1.3 seems to output corrupted files that are not parsed in Away3D. The export process looks exactly like the one for 3dsMax.

Select your model. Go to File, then Export. In the drop-down list of different formats, select Collada 1.4. The following interface opens:

Away3D 3.6 Cookbook

Select Triangles, Only Export Selection (if you wish to export only selected object), and Sample Animation. Set exporting destination path and click on Export and close.

You are done.

LEAVE A REPLY

Please enter your comment!
Please enter your name here