Chapter 17: Backface Culling and 3D Lighting

Overview

What well cover in this chapter:

  • Backface culling

  • Depth sorting

  • 3D lighting

In Chapter 16, I covered all the basics of modeling 3D solids: how to create the points, lines, and polygons that make up a form, even how to give each polygon a color. But if you recall, you just left that color with a 50% transparency, so you could see right through it. So while it was cool to be able to model complex 3D solids, youre still lacking a lot in terms of realism .

In this chapter, Im going to remedy that by introducing you to backface culling (not drawing the polygons facing away from you), depth sorting (I covered this a bit in Chapter 15, but well take a new look at it in terms of polygons), and 3D lighting.

I think you will be amazed at the results on your 3D models once these three techniques are applied. After the first two, you will be able to create 3D solids that actually look solid. With 3D lighting, they will really come alive .

Before we begin, I want to give credit where it is due. Almost all of the code in this chapter was derived from techniques introduced by Todd Yard in Chapter 10 of Macromedia Flash MX Studio ( friends of ED, 2002). (Todd is also the technical reviewer on this book, so its not like I was going to sneak anything past him!) That particular chapter of Macromedia Flash MX Studio is probably the best single resource Ive found anywhere on these subjects, and Ive referred to it every time Ive needed to apply any of these advanced 3D techniques. As that book is now more than three years old (ancient in terms of technical books) and two versions of Flash behind, Im really happy to be able to pull the information forward and keep it available and current.

For the examples in this chapter, I am going to build on file ch16_11.fla , which, as you may recall, features a rotating, extruded, 3D letter A. This serves as a sufficiently complex model that it will be pretty obvious if you do something wrong, and look pretty darn cool when you do everything right!



Foundation ActionScript. Animation. Making Things Move
Foundation Actionscript 3.0 Animation: Making Things Move!
ISBN: 1590597915
EAN: 2147483647
Year: 2005
Pages: 137
Authors: Keith Peters

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