Archived

This topic is now archived and is closed to further replies.

Representing 3D Worlds

This topic is 5378 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey guys, I was just wondering how 3D worlds are usually represented in computer games? What kinds of data structures / formats are most commonly used to detail what the world should look like and how they should render? - Jon

Share this post


Link to post
Share on other sites
Well, you have the basic polygon soup, this is just a big list of polygons, each polygon having some vertices, texture coords, a normal and what have you.
To get some structure in a representation it is usually a good idea to split the soup into small soups for different objects.
These objects can be represented in a more structured way by keeping a list of vertices, a list of edges that point to the vertices (since vertices will be shared by edges), and a list of polygons that point to the edges (since edges will be shared by polygons). Further, it is usually a good idea to have your objects be closed meshes (a piece of space completely enclosed by the polygons) so you do not have to draw the polygons that face backwards. To give polygons a ''front'' and ''back'' you have to make sure their edge or vertex list is clockwise (or counterclockwise) for all polygons.
This is the simple way - if you want to be able to find polygons (or other more complicated parts of the world, like curved surfaces) quickly based on their position (that is useful for deciding whether they should be drawn or not and for a whole lot of other reasons) there are a bunch of tree structures (quad-, oct- and BSP-trees), but i''m not even going to try explaining those, look them up.

Marijn

Share this post


Link to post
Share on other sites
As far as I know (open to correction here) BSP trees are the most common. They''re used in all of the id games. Anyway, onwards with the linkage . . .

BSP Trees by Carl Shimer

Game Tutorials (down at the bottom)

The first one is largely theoretical, while the Game Tutorials link is mostly source using OpenGL. There''s octrees on that page too, BTW.

Share this post


Link to post
Share on other sites