Wiley Professional Papervision3D 978-0-470-74266-2 Benutzerhandbuch

Produktcode
978-0-470-74266-2
Seite von 30
   Under standing Flash3D       
   
 Flash programmers have always enjoyed a freedom of expression unparalleled by other 
programming platforms. And with the release of CS4, Adobe has propelled that freedom of 
expression into the 3rd dimension. 
 But 3D didn ’ t start with AS3. Flash developers were experimenting with 3D long before. And 
applications like Papervision3D formalized these endeavors into a robust object - oriented  class 
structure.  The acceptance and popularity of Papervision3D has become a driver of change in the 
Flash developer community. But underneath the 300 classes that make up Papervision3D still beats 
the original algorithms used by the early developers of Flash 3D. 
 Understanding how to create 3D in Flash is essential to fully grasping Papervision3D and 
applications like it. As you learn how 3D engines were originally constructed, you ’ ll gain both an 
insight into Papervision3D ’ s core architecture and an appreciation of its robust structure. Its 
complexity will fade into a set of fundamental 3D algorithms. 
 Papervision3D, at its core, is a perspective projection engine, where projection simply means 
transforming a 3D  “ object ”  space into 2D Flash x and y screen space. And surprisingly, the whole 
process hinges on one equation: a perspective scaling equation derived from Thales Theorem:
 
T = scale = focal length/(focal length + z) 
 
 In the equation above, T is the perspective scale, and z is the distance from the projection plane. 
The focal length (or calculated  “ screen ”  location) determines the amount of perspective provided 
in the view. You use this equation to create an illusion of depth by scaling 2D surfaces. 
 In this chapter, you use Thales Theorem to create a simple 3D engine in just 19 lines of code. Then 
using Flash CS4 you rebuild your engine in just 13 lines of code. You cover the big 3: translation, 
rotation and scaling. And applying what you ’ ve learned you create a 3D torus worm, carousel, and 
image ball. Finally, you cover the basics of making believable animation, and how to turn a 
timeline animation into pure ActionScript. 
c01.indd   3
c01.indd   3
12/14/09   3:03:21 PM
12/14/09   3:03:21 PM
COPYRIGHTED MATERIAL