Line of Sight

Started by
1 comment, last by creed1 20 years, 5 months ago
Assume this very basic diagram represents one of the 3d levels in a game like the original Wolfenstein from a top-down view. The x's and y's represent the walls and the numbers represent where the player is standing.

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
y                2                   x
y           x                        x
y           x                        x
y           x                        x
y    3      x                        x
y           x                        x
y           x                        x
y           x  1                     x
yyyyyyyyyyyyxxxxxxxxxxxxxxxxxxxxxxxxxx
If the player is standing at position 1, there isn't any reason to draw any of the y walls. At position 3, many of the x walls do not need to be drawn. At position 2, most of the walls would need to be drawn. Of course, it changes depending on which direction the player is facing. Using Direct3d, how do you determine which walls (or trees, objects, etc.) within a level are within the players line of sight? Would you draw all of the x's and y's and let Direct3d determine which ones are visible based on the z-buffer? Seems inefficient. [edited by - creed1 on November 11, 2003 11:52:45 AM]
Advertisement
Hey,
I''m pretty sure thats accomplished by a BSP, however, your example is far over simplified because you''re not include a significant number of objects in your example nor any complex architectural geometry. Once your levels begin to get more complex, the benefits of a BSP usually decrease and it becomes mor advantageous to use something like an Octree or ABT to do rougher culling and let the video card deal with a few extra polygons and save your CPU time for other things like physics.

tj963
tj963
creed1 you just discovered what all this talking about culling is about.

Try seraching some stuff about Octree and fustrum (or is it frustrum?) culling.

[edited by - Coincoin on November 11, 2003 6:50:47 PM]
Editor42 ...builds worlds

This topic is closed to new replies.

Advertisement