spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / 3d / lesson110

Lesson 110 - Getting Under the Hood - Part 2

Developer News
Google Chrome Playing Catch-Up on Extensions
Open Solutions Alliance Gets New Leadership
Red Hat Spacewalk Expands Linux Management

There are eight vertices in the cube-shaped mesh, connected up to create 6 polygons, all of which are quads (four-sided polygons). To describe this mesh to a renderer, the scene description must provide the locations of all of the vertices and instructions for connecting them into polygons. Thus the geometry might be described as follows for a 10x10x10 cube:

Vertices:
  -5 -5  5
   5 -5  5
  -5 -5 -5
   5 -5 -5
  -5  5  5
   5  5  5
  -5  5 -5 
   5  5 -5

Polygons:
  0 2 3 1
  4 5 7 6
  0 1 5 4
  1 3 7 5
  3 2 6 7
  2 0 4 6

The eight vertices are specified as locations in 3D space, with (x,y,z) coordinates. Assume that (0,0,0) is the very center of the cube. Take a moment to visualize how these eight values represent the corners of the box. Can you see how the first vertex in the list is at the left lower front (in the conventional - not MAX - system in which y is vertical and z is depth)?

The six quads are created by "connecting the dots." The first quad (0, 2, 3, 1) uses the first, third, fourth and second vertices in the vertex list. Anyone with a programming background will be familiar with the convention of counting from 0, rather than from 1, and this explains why the vertices are referenced 0-7, rather than 1-8. Using these references, instead of the coordinate values themselves, saves space. It's shorter to write 0 than (-5, -5, 5).

The order in which we connect the vertices also determines the direction of the normal – the renderable side of the polygon. For example, a quad specified as (0 2 3 1) will render on one side, but a quad specified as (1 3 2 0) will render on the opposite side.

The vertex coordinates are used to define the shape of the object by specifying distances from some common origin (in this case, in the center of the cube). But this doesn't tell us where the cube is located in the scene. To do this, we need to "transform" the vertices from their local coordinate system to the world coordinate system of the entire scene. The idea here is actually quite simple if you take a moment to think it through.

We want to specify where the center of the cube is in the space of the entire scene. This is achieved by a transformation matrix. A transformation matrix is set of 16 numbers that can be used to convert coordinates in one coordinate system into equivalent values in another coordinate system. Assume that we want the center of the cube to be at (2,0,0) in the world coordinate system. A transformation matrix is applied to the all of the vertices of the cube. If the (0,0,0) coordinate of local space (the center of the cube) is transformed to (2,0,0) in world space, the first vertex in the vertex list will necessarily transform to (–3,-5,5) in world space.

Take a moment to visualize (and I mean visualize) this. Once you have done so, you'll have made a big step forward.

To Continue to Part 3, or Return to Part 1, Use Arrow Buttons


internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Whitepapers and eBooks

Symantec Whitepaper: Converging System and Data Protection for Complete Disaster Recovery
Intel Whitepaper: Comparing Two- and Four-Socket Platforms for Server Virtualization
IBM Solutions Brief: Go Green With IBM System xTM And Intel
HP eBook: Simplifying SQL Server Management
IBM Contest: Are You the Next Superstar? Join the "Search for the XML Superstar" Contest to Find Out
Intel PDF: Quad-Core Impacts More Than the Data Center
Intel PDF: Virtualization Delivers Data Center Efficiency
Go Parallel Article: PDC 2008 in Review
Avaya Article: Communication-Enabled Mashups: Empowering Both Business Owners and IT
Intel Whitepaper: Building a Real-World Model to Assess Virtualization Platforms
PDF: Intel Centrino Duo Processor Technology with Intel Core2 Duo Processor
Microsoft Article: Build and Run Virtual Machines with Hyper-V Server 2008
  Go Parallel Article: Q&A with a TBB Junkie
IBM Whitepaper: Innovative Collaboration to Advance Your Business
Internet.com eBook: Real Life Rails
IBM eBook: The Pros and Cons of Outsourcing
Internet.com eBook: Best Practices for Developing a Web Site
IBM CXO Whitepaper: The 2008 Global CEO Study "The Enterprise of the Future"
Avaya Article: Call Control XML in Action - A CCXML Auto Attendant
IBM CXO Whitepaper: Unlocking the DNA of the Adaptable Workforce--The Global Human Capital Study 2008
Adobe Acrobat Connect Pro: Web Conferencing and eLearning Whitepapers
Symantec Whitepaper: Comprehensive Backup and Recovery of VMware Virtual Infrastructure
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
webref The latest from WebReference.com Browse >
Popular JavaScript Framework Libraries: An Overview - Part 3 · Accessing Your MySQL Database from the Web with PHP · Working with the DOM Stylesheets Collection
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Review: Lenovo ThinkPad SL300 · OCZ PC3-10666 Gold 2x1GB Review · Apple Recommends Antivirus for Macs

Created: January 16, 2001
Revised: January 16, 2001

URL: http://webreference.com/3d/lesson110/2.html