Advertisement

Help with Visual Surface Determination

Started by February 17, 2000 09:51 PM
3 comments, last by RPGElite 25 years ago
I am just starting to learn 3D stuff. I am using OpenGL, and what little I know of it has come from NeHe''s tutorials (I have gone through and understood tutorials 1-10). Based on that code I now have and understand the code for a single-sector engine. However, I know I will need a BSP or Octree or some other VSD method before I go much further. If I were to change the engine to be multi-sector, there would quickly be so many polygons that without a VSD the game''s FPS would drop like a rock. I looked in gamedev''s articles section, and was a bit disappointed. I can''t find any articles that describe, in relatively simple terms, the basics behind what a BSP or Octree or any of those are. I have a general idea of how they work, but I really want a good description of what the algorithm does. Of course, code with the article would be appreciated, espescially if it''s in OGL, but whether it is or not, it would at least give me some help. If you know of any articles anywhere that have a description (that starts assuming you know very little about 3D graphics), that describes the basics of this, I would be very grateful. Also, I will soon need some collision detection code, once I get the multi-sector thing working. If you have any tips on where to find some articles on this as well, I would appreciate it. Thanks for the help. gameguru4@yahoo.com
BSP stands for Binary Space Partition. What that means is that sprouting from any given sector there can be two more.
An octree merely takes that to the next level, where there can be eight sprouting from each sector.
In the industry, however, BSP actually reffers to the general method of potentially visable surfaces. Basicly, you make a list of visable areas for each sector. Visable sectors always include the sector your in, and any sectors sprouting off of it.
When you compile a map, you divide the level up based upon what you can see at any given area. A good way of doing that is by taking a point in space (usually the starting point) and calculating all areas that are visible from that point. You then figure out what things go no where, but that can''t be seen anyway (i.e. looking into a room through a doorway, and you can''t see the hidden corners of the room). Then, once you have all that, you have your first sector. I''m not sure exactly how the sector division algorithm works, but I think that''s the basic idea. Once you have the sectors seperated, you then make a list of what sectors can be seen from any other sector. Then, when your in one of the sectors, you merely look at it''s list of other visible sectors, and you render anything on that list.
Advertisement
You can found a complete tutorial on building software portal 3d engine (easily translate in hard engine) @ :
http://www.flipcode.com/portal/

It''s very good and easy to understand, it talk about BSP tree, Octree, and ... portals :o)


-* Sounds, music and story makes the difference between good and great games *-
-* So many things to do, so little time to spend. *-
OK, I''ve looked up a bit about both space-partitioning stuff, and a bit about portals.

Either seems fine, since this is my first engine and I am mainly worried with getting it working at all.

What I want to know is, which do you think would be easier to implement for a newbie like myself?

Now let me quantify what I mean by "newbie" - I know C and C++ pretty well, and have been using them for a couple years pretty steadily. I know DirectX well enough for what I want to do (except D3D...I intend to leave that well alone for a long time). I know OpenGL minimally, but I have links to the red book and blue book, so I can always look stuff up if I need to.

What I want is to know - are portals or BSPs or Octrees the easiest to implement? Once I get it basically working I can worry about optimization. I do not care which one is fastest, which one is most expandable, which one is most flexible. None of that matters to me on my first engine. Just the easiest to implement, so I can get a bit more used to 3D graphics.

Thanks a lot for the link to flipCode. I go there all the time, but never looked at the "columns" section

gameguru4@yahoo.com
I''m building a very basic 3D engine, and I''ve chosen to use the octree method.
It''s an easy and efficient way to make a little engine work fine.
For a more advanced one, I''ll probably choose Octree AND protals.
However, BSP is well known and Quake use it, so you might find many tutorials and code (even quake source) to help you if you choose BSP instead.
Hope it helps :o)

-* Sounds, music and story makes the difference between good and great games *-
-* So many things to do, so little time to spend. *-

This topic is closed to new replies.

Advertisement