Chapter 9. Creating Three-Dimensional Graphs

In this chapter, we will cover:

  • Drawing in 3D: a 3D starter project
  • Creating a 3D column chart
  • Moving around the chart
  • Beyond the cube, drawing different shapes
  • Graphing tabular data in 3D
  • Styling the graph with different materials
  • Graphing a function in three dimensions

Introduction

If this is your very first time programming 3D, this chapter is going to be a challenge. There's no way around it, but programming 3D involves a lot more than drawing in two dimensions.

Not only do you have an additional coordinate, but you also need to convert the 3D drawing into a 2D image that can be shown on the screen.

There are models, cameras, scenes, views, and much more that you usually don't need to understand for 2D programming. But even the smallest 3D program requires you to at least understand the basic concepts and know how they fit in the larger picture.

Luckily, there are many tutorials online to get started with 3D and ActionScript. For instance, the following link provides a good overview of the basics: http://www.flashmagazine.com/Tutorials/detail/flash_3d_basics/

In this chapter and the next, we will focus solely on Away3D (http://away3d.com/). This is one of the most popular and open source 3D libraries for ActionScript. We use only this library to keep the explanation as simple as possible, but you can perfectly apply the same techniques using any other 3D library available.

We have chosen to opt for Away3D Version 4. Although still in beta, we are convinced this is the future of 3D in ActionScript. This has a few implications: you will need Flash 11 or newer to create and view the programs. Flash 11 added Stage3D, a hardware-accelerated way of drawing in 3D. The major advantage is that the 3D display will be much faster and will allow for many more elements on the screen.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.134.77.195