# Thread: question related to frustum culling

1. ## question related to frustum culling

Hi all, I have one question related to frustum culling. I know that in order to implement the frustum culling on the generation of terrain, it is better if we use bounding box / sphere for testing if it is in the viewing frustum. What my question is for the bounding box / sphere, we do probrbly need to specify the center and the radius, but how do we calculate the center? Add up all the vertices and find out their average?

Thx all

2. ## Re: question related to frustum culling

You need the median, not the average. Find the highest and lowest x, y, and z values. Then average those to get the center.

3. ## Re: question related to frustum culling

Sorry, you mean that I just need to find the average between the highest point of coordinate and the lowest point of coordinate is ok?

4. ## Re: question related to frustum culling

I just wonder, in the game world, the terrain suppose to be very large, let say 50000 x 50000 for instance, if we need to loop and go through all the vertices to find out the largest and the smallest and then average them, it will probably slow down the process i think, is that i have something misunderstood?

Thanks a lot

5. ## Re: question related to frustum culling

Yes, you want to find the center of the vertices, not their average position. As
mogumbo says, average the highest and lowest values for each axis.

And yes, if you have a large number of points this is going to take a certain amount of time, if you need to keep recalculating it - but that's your call. There are many ways to deal with this kind of problem - maybe you could change the data structure of your points such that you always know which are the furthest along each axis?

6. ## Re: question related to frustum culling

Oh, and another consideration:

If your engine is designed to run at a decent speed with this terrain in view, maybe there's no point in frustum culling it... Maybe the time you'll save will just be sucked up in a vsync anyway?

Again, this is your call - you know your requirements better than anyone else.

7. ## Re: question related to frustum culling

Hi, Thanks a lot for your help! I think I get what you mean. But would you mind listening to me once more so that I won't misunderstand you guys meaning? Thanks.

Is that I should for instance, store the x, z (as y-axis for the height of the terrain) dimension (say x=50000, z=50000 in my previous example) Then I should average then ie. x = z = (0+50000)/2 here. And it is the center of the bounding box, right?
And that's it?

And is that people usually would use quad tree instead of octree here?

Thx a lot

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•