Sign in to follow this  
Dark_Light

Culling advice.

Recommended Posts

Dark_Light    100
Hi People, I am looking for advice on culling. As you all know each of us are always looking for the best way of doing things. Now this is the situation. I have a landscape (very large) A camera (this moves around like it was a space ship) The landscape is split into zones. Each zone being 1 mesh. All the zones are held in a 2 dimensional array. Now I know about the far plane and a near plan but I don’t really know details about what this really means to me as a programmer. How can I get the best culling for my landscape!?!? I have a few solutions but I am after the best! Thanks

Share this post


Link to post
Share on other sites
steg    390
Seems to me you are in need of a technique called Geomipmapping to put your landscape into patches, these patches have differing level of details ( different amount of vertices ), so say you have a patch of 16x16, you could have say 4 level of detalis for this patch and dependent on where your camera/ship is you could change the patches level of detail, the closer the ship to the patch, the higher the detail. Ok, so what about culling, well for this once you get the geomipmapping to work you could then work on your culling. There are plenty of culling tutorials on the net about this and how to get the planes from the viewing frustum. Of course, checking all your objects in your game to cull is very expensive, especially checking the landscape, a good technique to use here is a quad tree, again, there is a very good tutorial on game dev about this, sorry I don't know the link but if you do a search you will find it.

Regards,
Steve

Share this post


Link to post
Share on other sites
Dark_Light    100
Thanks

You have hit the nail on the head, I have chopped the world up just so I can have details levels etc, I wanted to keep the question short so I left that bit out.

Let me try and explain what I am doing, its not to hard but may sound complex at first.

Ok the world is in a grid.
First I take the camera position and work out what grid it is in.
Then using that I can very quickly know what zones are local to the camera.

So at this point any zone outside the local area ie camGrid – 4 to camGrid + 4 etc is not drawn.

The local zones are then check from centre point to see if they are close enough to be drawn using sqr(power a-b,2 + blar blar blar

Then for each corner of each zone that is local and within a radius of n I check its angle against the camera look position. If any point is between 0 and 180 degrees then the zone is in front of the camera and so it’s drawn. Anything else is not.

Hope that clear.
Ok so knowing all that, would you say that is the best way to do it?

Share this post


Link to post
Share on other sites
steg    390
Sounds ok to me, I take it each 'zone' has a bounding coordinate so you don't have to check each quad within it ?
Does sound like the same principle a quad tree works on.

Your project sounds interesting, do you have any screen shots ?

Regards,
Steve

Share this post


Link to post
Share on other sites
Dark_Light    100
Steg.
Each zone is a square ad I do a check on each corner of the square to see if any are in the viewable area. If ANY are then the whole zone is processed. If none are then I just forget about it.

Before doing that I check the distance of the zone from the centre of the square to the centre of the camera.

I don’t have any screen shots as yet. I am having other issues with lights at the moment so I would like to wait for the full effect before showing anyone.

Thanks

Share this post


Link to post
Share on other sites
steg    390
Ok, sounds like you are kind of using bounding coordinates, although you may be drawing too many quads if you only check if the camera is anywhere within this zone. Quad trees work on parent node, child node principle, where a parent node would have child nodes, a child node may have other nodes, this way, you can elimate many quads/vertices you don't need to draw.

Out of interest, how big are your patches ?

Regards,
Steve

Share this post


Link to post
Share on other sites
steg    390
BTW, here is the link for quad trees :

http://www.gamedev.net/reference/articles/article1303.asp

Regards,
Steve

Share this post


Link to post
Share on other sites
DrGUI    402
Quote:
Original post by Dark_Light
...sqr(power a-b,2 + blar blar blar...

Answers already given are good, and you have probably already realised this, but if you are just comparing distances, you can compare the squares and save on the sqr. That is why people say sphere tests are really trivial:

Inequality 5 > sqr(x*x + y*y + z*z)
Square both sides 25 > x*x + y*y + z*z

Share this post


Link to post
Share on other sites
Dark_Light    100
Steg:
I’m just about to go and read that link you posted, but I believe I understand the principle of the quad tree. It simply subdivides over and over. This is good but I would think my method is faster as…

To find out what grid you are in all you do is X \ 128 Y \ 128 and you know the x y grid you are in, then all you need to do is loop thro X-5 to X +5 and Y – 5 to Y + 5. NOTE The numbers are arbitrary. This means i only ever look at zones that have a remote chance of being in use.

From what you know would you say this is better than the quad tree?

Also the zones are 1024 + 1 in size, the + 1 is where they overlap. This is a reason for this but I don’t want to discuss the geo mapping in this thread.

Dr GUI:
I must say I had never thort of that but now you have suggested it it is blindingly obvious. Should save a few clock ticks.

Thanks.

Share this post


Link to post
Share on other sites
steg    390
Did you manage to read the link ? What do you think ?

Your method sounds very similar to quad trees or some type of partioning technique. I take it your zones are also split into varying patches with different LODs ? You don't actually draw a full zone do you ?

Regards,
Steve

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Yes each zone has 3 different details levels. High, Normal and Low. This included both vertex info for the geometry plus some fancy texture layer.

Depending how close the zone is depends on the level of detail, except if we have a higher level loaded already then we use that, if it’s a lower level then we need to get hold of the correct level of details.

There is a slight twist to that as based on the texture thing but we don’t need to discuss that.

I have read that document and it is very interesting. I have done some quick maths and at this time I believe my method to be faster. This method boils down to the following facts.

Zones are large you can only ever see a MAX or around 8-12 and normally only 4-6.
All the maths in my method are simplistic. No tree management etc.
I never have to consult the viewable area as I logically know its < n distance and between Da and Db degrees.

I plan to make a document much like the one you sent me and ask people to give me their opinions on the two methods. I think a document would make the comparisons ease for people to see.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this