Jump to content
  • Advertisement
Sign in to follow this  

the pipeline, polygon lists, culling

This topic is 4865 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

Here’s where I am currently: I created a game based on the board game stratego…it’s 3d, I used openGL and the CSopenGL library to code in c#. I create the 10x10 board surface and I place (1) 3d model replicated enough times for the pieces on each side of the board (40 pieces each). The thing is…I know I’m missing crucial parts of a good ‘pipeline’. I have my GLdraw() method and every frame I’m drawing every point/triangle/poly. To simulate camera movement I floated between translating every point in the opposite direction of the movement or moving the position&lookat of the camera. I know every poly is drawn even if I’m not looking at it. I’ve heard and read some about culling, but the topic is still not too clear.. So I study other games, mainly the game I play (WoW). Obviously, they are not drawing every object in the ‘zone’ if you are not looking at it and they must have some massive way to store all the drawing points? Is this the process……store all possible terrain points in a list, store all object’s local coordinate points in a list along with their locations in the world, use the ‘view pyramid’ of the camera to determine which objects/terrain are within ‘view’(what is this called? Object culling?)….then create a master polygon list and throw only the polys that need to be drawn into the GLDraw() method? I know my game would run a zillion times faster (I’m amazed I get 30fps, probably cause the game is small) if I managed my polys better. ##edit::bump [Edited by - TallyWack on November 29, 2005 9:56:18 AM]

Share this post

Link to post
Share on other sites
Firstly you wont get a good response cause your posting in the wrong section.

Yes it is called Frustum culling and it is the practice to not render polygons which arent going to be in the viewport.

Game Tutorials had a nice tutorial on frustum culling and you could nicely see the speed gain.

Here is the way you will be doing frustum culling so that it is optimal.

Find the Bounding Radius of your 3d Model (the one you use for the pieces) as 1 piece probably wont take more than 1 tile/square on the world im going to assume that the Radius = 1tile

Now you need to get the View Frustum, this can be done in custom ways but the easiest is to grab the View Matrix from OpenGL and to construct 6 planes from this.

/// Here is the easy part
If a 3d-Point is on the front side of all 6 planes then it is in view, other wise not.

A simple test for you would be (assuming you already have these function which you can get in a basic 3d math book)

for (i := 0;i < 6;i++)
if (PlaneDistance(Point ,Plane) > 0 - Radius) inside = true;

now if inside is true u know that this particular model is inside the frustum.

Point as montioned above is simple the center of the model
Hope that explains things better, however if all of the models are in the viewport when playing the game you wont need frustum culling.

There is more complicated methods but since you only want to Frustum check 40 points you dont need anything complicated..

Consider quake 3, imagine having to frustum check 12 000 polygons?
Well they used a binary division tree to solve this problem, you might want to look into that :-)

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!