Showcase and discover digital art at yex

Follow Design Stacks

Subscribe to our free newsletter to get all our latest tutorials and articles delivered directly to your inbox!

Creating real-time 3D objects with Macromedia Flash MX dynamic drawing tools

Creating real-time 3D objects with Macromedia Flash MX dynamic drawing tools

For several years, many users have tried to create 3D effects in Macromedia Flash with varying degrees of success. The demand for 3D Flash projects has been so great tht third-party applications have been written to pre-render 3D objects from 3D modeling applications. However, these applications merely create the illusion of 3D by generating key frames for each position of the 3D object, requiring many layers, frames, scenes, and transitions to create the very basic level of 3D interactions. For complex interactions and 3D environments, this method becomes too unwieldy.

The solution involves using a method for creating real-time 3D so that rendering may happen on the fly—allowing complex interactions to be programmed for more realistic and engaging Flash movies.

In the following article, we will cover methods for creating real-time 3D in Macromedia Flash and build a 3D engine based on matrix mathematics and Macromedia Flash MX dynamic drawing tools. An overview of matrix mathematics is presented to illustrate the theory behind the 3D engine. If you are interested in the mathematical mechanics of the 3D engine, I encourage you to read this section. If you only want to see the code, feel free to skip the section on matrices and dive right in to the ActionScript.

Sample files

Before we begin, download the sample files to follow along with this tutorial.

Windows

Macintosh

How these methods are different from other 3D engines

Many of the 3D engines floating around the web today rely on code that modifies the coordinate information of the 3D object with respect to the global coordinate system each time the code is executed, performing what I call a destructive transformation. The fact that destructive transformations operate this way may not seem like a big deal because they can create very good 3D effects. However, in certain situations, it is necessary to retain the original coordinate information of the objects.

Better methods exist that retain the original coordinate information of the 3D objects, called non-destructive transformations. These transformations are the corner stone around which many professional 3D modeling programs are based. They allow us to create 3D objects that we can scale, move and animate in the global coordinate system while being able to view the object from any angle. To perform these transformations, we have to use matrix mathematics, representing a significant break from the 3D Flash code that is out there.

To learn more about matrix mathematics, go to the next section of this tutorial.

Comments