Recipe 5.8. Using 3D Models in Flash Not Originally Created in Swift 3D


Problem

You want to use previously created 3D models in Flash that were not created in Swift 3D.

Solution

Take advantage of Swift's capability to import common 3D file formats.

Discussion

Swift 3D can import 3DS (3D Studio) and DXF (Drawing Exchange Format) files, which are both standard file formats for exchanging data between 3D applications. Because the majority of 3D modeling and CAD programs can export to one or both of these formats, the available resource for models is exhaustive. A quick online search will return links to numerous model repositories, both free and commercial. In fact, the sheer volume of model materials available means that you could complete a project without doing any modeling on your own, if you are so inclined. A few excellent online resources for 3D models compatible with Swift 3D include:

  • 3D Caféhttp://www.3dcafe.com

  • Turbo Squidhttp://www.turbosquid.com

The support for these formats can be particularly useful when working with clients whose products are intended for online, interactive display. Many manufactured goods have had a 3D model created at some point in the stages of product design and development. Thus it is often possible to obtain model data directly from the manufacturer, which not only assures accuracy in representation, but can also save valuable modeling time in the case of complex objects.

Working with each format is different from working with the others. Not only are they brought into Swift 3D by different means, but also the type of data contained in each format can vary. Although DXF, which is most often associated with AutoCAD, will only ever contain model mesh data, 3DS files may include model mesh, materials, animation, lighting, and cameras. The amount of data supported in a 3DS file is dependent upon the program in which it was created. A 3DS document from any program other than Autodesk 3ds Max (previously Discreet 3ds Max) will include only model mesh and materials, while those from 3ds Max may also include animation, camera data and lighting.

Bringing files into Swift 3D

No matter which file format you need to import, it is a simple two-step process. For DXF files, go to File Import and select the desired document. 3DS "import is slightly different, in that you do not actually import at all, but rather create a new Swift document based on a 3DS file. The reason that a 3DS document cannot simply be imported into an existing document is that 3DS files can contain cameras and lighting, which are scene elements and not tied directly to a model, but to the scene itself. We again return to the File menu, but this time select "New from 3DS" and select the file to be imported.

Working with imported models

Once it is imported, you can go about making changes to a model if necessary. This includes applying or modifying existing materials, adding animation, and even editing the model on the mesh level using the Advanced Modeler.

Troubleshooting files

There are times when files will not successfully import. This problem most commonly occurs with CAD DXF files, as they can vary a good deal in the type of data they contain, and not all programs write the files in the same way. If this happens, the best course of action is to see whether the model can be made available in 3DS format. If the program of origin lacks the ability to export to 3DS, a conversion program or service can also be used. At times, just opening a DXF with a different CAD program and resaving can remedy import problems.

Other problems that can happen include when objects do not import in their correct positions or have damaged polygons. In these types of situations, your only option is to reposition elements manually or repair the mesh in the Advanced Modeler.

It is possible for a DXF file to contain only a 2D CAD drawing. If this is the case, the import process will fail, as Swift 3D supports only those files containing 3D model mesh data.





Flash 8 Cookbook
Flash 8 Cookbook (Cookbooks (OReilly))
ISBN: 0596102402
EAN: 2147483647
Year: 2007
Pages: 336
Authors: Joey Lott

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net