Sign in to follow this  
howbizarre79

Occlusion Techniques !!!

Recommended Posts

Hi, Finally I am done with ABTs, thanks to all the people at GameDev. Now the next step is to have occlusion culling. To start with I will like to know what are the techniques available for the purpose and where can i find information on those techniques. I have read the Occlusion Threads in "Greatest Hits by Yann" Section, but I will really appreciate if someone can send me links, where I can find further information on the various techniques mentioned. Regards, Hussain

Share this post


Link to post
Share on other sites
From what i've read the most useful occlusion culling techniques for real-time rendering are conservative image space techniques, if you do a google search on siggraph papers on visibility techniques, also check the one of the reference manuals on dPVS library which also describe most of visibility algorithms available to date.

I think Yann uses a modified version of the hierarchical occlusion maps (HOMs) algorithm, you can also find the original paper on google.

[Edited by - snk_kid on February 15, 2005 9:57:39 AM]

Share this post


Link to post
Share on other sites
i've coded different occlusion culling algorithm and as far as i know
they have some glithces too, one is that you should separate your rendering geometry by the occlusion geometry , i mean you will end to have two maps for the same geometrical topology , one for rendering and one with a lower level of detail for occlusion , more over the occlusion culling itslef isn't handled very wel by the video board due to bubbles in the pipeline, so Yann and others
uses a software rasterizer , in parallel with the opengl pipeline, the advantage is that you might end up with a lower resolution and a fast rasterizer, i advice you not to render every single triangle, render a polysoup made of coplanar or nearly coplanar triangles, again, detecting in real time when an occluder is a good occluder could kill the fps, heuristics are performed based on projective size of triangles, with today's trend pushing more and more triangles, on occlusion culler is overloaded with choices not always trivial , topology itslef isn't an easy topic, if you can affor to draw your level two times, go with that, i personally gave up occlusion culling one year ago , and moved towards portal , and of course i'm working an a ray tracer in my spare time waiting for gpus to do it for me in real time.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by ketek
i've coded different occlusion culling algorithm and as far as i know
they have some glithces too, one is that you should separate your rendering geometry by the occlusion geometry , i mean you will end to have two maps for the same geometrical topology , one for rendering and one with a lower level of detail for occlusion , more over the occlusion culling itslef isn't handled very wel by the video board due to bubbles in the pipeline, so Yann and others
uses a software rasterizer , in parallel with the opengl pipeline, the advantage is that you might end up with a lower resolution and a fast rasterizer, i advice you not to render every single triangle, render a polysoup made of coplanar or nearly coplanar triangles, again, detecting in real time when an occluder is a good occluder could kill the fps, heuristics are performed based on projective size of triangles, with today's trend pushing more and more triangles, on occlusion culler is overloaded with choices not always trivial , topology itslef isn't an easy topic, if you can affor to draw your level two times, go with that, i personally gave up occlusion culling one year ago , and moved towards portal , and of course i'm working an a ray tracer in my spare time waiting for gpus to do it for me in real time.


There's this thing called a period represented by a '.' that is used to separate sentences. Sentences are grammatical constructs that are used to delineate ideas. Paragraphs are used to organize sentances into relatively related subjects. Line breaks are used to separate paragraphs for easy readibility.

There, now you have no more excuses.

Share this post


Link to post
Share on other sites
Thanks anonimous poster, since now i will be more carefull about my grammar
and thanks not lowering my user rate like someone of you did just because i gave a rude answer.

Share this post


Link to post
Share on other sites
[quote]

I use directx9 occlusing query with a dynamic algorithm. Do you think it s a good way compare with method quoted here ?

/[quote]

Well from my findings, so far, the software based methods are much better than the hardware based methods. Reason being, in hardware based methods there is a continuous communication going on between CPU and GPU. In software based methods you can execute your Occlusion Queries parallel to your Rendering i-e, during the time, GPU is busy rendering the current frame, you can do your Occlusion Calcualtions on your CPU.
Please correct me if I am wrong.

Regards,
Hussain.

Share this post


Link to post
Share on other sites
Quote:
Original post by howbizarre79

Well from my findings, so far, the software based methods are much better than the hardware based methods...
... Please correct me if I am wrong.

Regards,
Hussain.


You got that right. Actually while your GPU is busy in rendering you have ample of time to do occlusion culling, play some songs, watch a DVD and wash your clothes :D. Which GPU are you using anyway? TNT 1 :D.

Share this post


Link to post
Share on other sites
btw. I dont know about anyone else... but I personally dont think that occlusion culling will help you out that much in your game since you already have optimized your drawing by using ABTs.

I seriously think that the overhead of discarding the few faces would be way more than just simply drawing them. I would suggest that you look at some other techniques out there to optimize your drawing.

Correct me guys if Im wrong...

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
It completely depends on the scene he's rendering. For example in an indoor game you can be standing in front of a wall and without occlusion culling you'll render the entire city on the other side of a wall. Its all in the view frustum so the ABT doesn't reject it; but its occluded...

Share this post


Link to post
Share on other sites
Hi!

You can easily use hardware-based occlusing queries. Just don't stop and wait for the query to return... Instead delay the culling by one frame, that way you ensure that the query has returned and you can cull away!

Best regards
Roquqkie

Share this post


Link to post
Share on other sites
Quote:
Instead delay the culling by one frame, that way you ensure that the query has returned and you can cull away!


I read about this technique in GPU Gems. Have anyone compared this with a software based method like Yann's version of HOM?

Share this post


Link to post
Share on other sites
Hi,

Roquqkie:
You mentioned that we don't wait for the Occlusion Query and continue. My Questions are :

1) It suggests that the Occlusion Query is not a blocking call. Right or Wrong.

2) What do you mean by "delay the culling by one frame". Will we not need to recalculate the Culling data for the next frame. Please elaborate on the point. I am totally Lost :(.

3) I have heard that during Occlusion Query the CPU and GPU do keep communicating. Is that true and if it is, then how can we use both simultaneously for different purposes. Like we can use GPU for say Rendering or Shading etc and CPU at same time may work on Occlusion.

Dark_Nebula:

Please can you mention which Game Programming Gems (i-e 1,2 or 3) did you read about this technique.

Share this post


Link to post
Share on other sites
Quote:
Original post by howbizarre79
1) It suggests that the Occlusion Query is not a blocking call. Right or Wrong.
Correct. In fact, it never could be. To use an occlusion query, you issue the query to the hardware, render the stuff you want to test with (the bounding box of your character or somesuch), and when the hardware's done rendering it you'll be able to retrieve the results of the query (number of pixels that passed the test). Because it involves rendering, though - and because the hardware may in fact be busy rendering something else when you issue the query - it's asynchronous.

Quote:
2) What do you mean by "delay the culling by one frame". Will we not need to recalculate the Culling data for the next frame. Please elaborate on the point. I am totally Lost :(.
Use the results of the previous frame's query to determine culling for the current frame.

Quote:
3) I have heard that during Occlusion Query the CPU and GPU do keep communicating. Is that true and if it is, then how can we use both simultaneously for different purposes. Like we can use GPU for say Rendering or Shading etc and CPU at same time may work on Occlusion.
The communication is not automatic. I'm guessing that what you've heard refers to the CPU repeatedly asking the GPU, "Are you done yet? Are you done yet?" If you're doing that you can stall the CPU while it waits for the GPU to finish, which is generally not good. By contrast, the more conversative approach I've heard of is issueing the query now, requesting results the next frame, and if they're not available you forget about the query and assume it was > 0.

Share this post


Link to post
Share on other sites
Superpig :
Please forgive my lack of knowledge on the topic. But as you say

Quote:

"Use the results of the previous frame's query to determine culling for the current frame."


Well is it not that the results of the two frames will be different. I mean what if in the previous frame I was looking EastWards and in the current frame I am looking Westwards.
Also as you said that the CPU is not stalled and we can utilize CPU for some other functionality, so can we do something like this :

( SORT_NODES_FRONT_TO_BACK );

for (each VISIBLE_NODE_IN_ABT )
{
RUN_OCCLUSION_QUERY ( CURRENT_NODE );
DO_SOME_PHYSICS();
DO_SOME_AI();
if ( CURRENT_NODE_IS_NOT_OCCLUDED )
ADD_CURRENT_NODE_TO_VISIBILITY_LIST;
}
RENDER_VISIBILITY_LIST;

Also please if you can comment a little bit more on pros and cons of Software based Occlusion and Hardware based Occlusion.

Regards,
Hussain

Share this post


Link to post
Share on other sites
Quote:
Original post by howbizarre79
Superpig :
Please forgive my lack of knowledge on the topic. But as you say

Quote:

"Use the results of the previous frame's query to determine culling for the current frame."


Well is it not that the results of the two frames will be different. I mean what if in the previous frame I was looking EastWards and in the current frame I am looking Westwards.
Yes, that's exactly correct [smile] It relies on a certain amount of temporal coherence between frames - e.g. that you would not be able to turn more than 20 degrees in one frame. If you know those conditions are broken and your query results are not going to be valid for the current frame (a more common example is camera teleporting) then you have to do something else (like draw everything, reissuing queries so maybe the next frame will be OK).

Quote:

Also as you said that the CPU is not stalled and we can utilize CPU for some other functionality, so can we do something like this :

( SORT_NODES_FRONT_TO_BACK );

for (each VISIBLE_NODE_IN_ABT )
{
RUN_OCCLUSION_QUERY ( CURRENT_NODE );
DO_SOME_PHYSICS();
DO_SOME_AI();
if ( CURRENT_NODE_IS_NOT_OCCLUDED )
ADD_CURRENT_NODE_TO_VISIBILITY_LIST;
}
RENDER_VISIBILITY_LIST;

Yes, precisely. Though by the time you get to CURRENT_NODE_IS_NOT_OCCLUDED you need to have a backup plan ready in case the query hasn't finished running yet.

Quote:
Also please if you can comment a little bit more on pros and cons of Software based Occlusion and Hardware based Occlusion.
I'm afraid I've not worked with software occlusion techniques so I'm not the person to answer that...

Regards,
Hussain[/quote]

Share this post


Link to post
Share on other sites
you cant have enought physics and ai code for 10000 ABT nodes isn't it ? Even you have it, you can't partionned it into 10000 calls.

Moreover, i think that vertex projections can be a serious bottleneck of software occlusions assuming you can deaden the software render.

Share this post


Link to post
Share on other sites
i posted about a software culling algorithm a while back but didnt get any feedback... probably because i didn't explain it well enough or my terrible html skills turned people away. at any rate, here it is if anyone would like to check it out.

Share this post


Link to post
Share on other sites
I really don't undestand your method. Is the bouding box the node's bounding box ? What is the other two dimensions of the node side ?
This seem odd, you talk about the node's triangles to perform occlusion to .. the node itself !(?) It's really not clear...

Share this post


Link to post
Share on other sites
yes, by 'node' i meant axis-aligned bounding box. i should have been more clear about that.

about the 'other' dimensions:

if you imagine an axis-aligned bounding box sitting in the air, and a point somewhere outside the box that represents the eye, then there at most 3 sides of the box that the eye can see at one time. these sides will be the aabb min/max in the x, y, and/or z axes (obviously, the eye cannot see both the min and max in any one dimension). since the box is axis-aligned, each one of the possibly 3 visible aabb sides will be aligned in a dimesion. so if the x min/max is visible, the 'other' dimensions are the y and z, and if the y min/max is visible, the 'other' are x and z, and so on.

anyway, the main point of the algo was to project potential occluding triangles onto these visible node sides to see if they completely covered it. the calculations reduce to 2d math due to the axis-alignment, and the dimensions that the 2d math is performed in are the 'other' dimensions of the side.

Share this post


Link to post
Share on other sites
by "classic" are you referring to things like octree/abt/etc. trees? the algo i described works on top of those methods. in fact, it requires that triangles are sorted such as in an octtree. it is only after a node has passed all other visibility tests that it would be subject to this one.

like the ap said, if you are looking at a wall, and behind the wall is a lot of geometry, it will all get rendered if u just use the 'node-in-frustum' method (again, is this what u mean by "classic"?). this requires artists to be more careful about the environments, or the developers to detect and handle special cases, etc.

even if the algo i mentioned is anywhere mear ideal (which i'm not sure it is) there are faster ways of doing it such as those already mentioned. however, those all involve using the hardware, and i was simply trying to find an ideal *software* solution to the problem.

Share this post


Link to post
Share on other sites
I mean by classic occlusion methods, methods that use an() occlusion map(s) or portals etc.
The problem with your method is you do not reuse the informations you compute for a node process. I advise you to look after beam tree. It is similar to your method but you do not project a triangle n times. And you have the hierarchie you mention...

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