Oclusion testing in a FPS

Started by
11 comments, last by Wilhelm van Huyssteen 12 years, 2 months ago
HI.

Im working on a FPS using my own engine. I allready subdivide the map and use frustum culling to greatly reduce the amount of geometry i draw but its not enough it seems. When im standing on the outskirts of the map looking into it the frame rate drops even though im in a small little room and im staring at a wall. Im a little unsure of how to go about implementing oclusion testing in a FPS.Testing all the ojects against all the other objects that might be infront of it seems way too expensive. Im guessing I might have to do something like set up volumes and link objects to them. Like if the player is in volume X only objects a,b and c could possibly be vissible to him. (objects a,b and c being stationary. Like walls) or something like that. I could create a script to create these volumes on the maps and store it in the map files so the game doesnt need to do it. Does this sound like a feasible idea? or is there maybe a better solution that im missing.

Thnx in Advance!
Advertisement
http://http.develope...ugems_ch29.html
That's what I used and it worked great for my purposes.

I'm pretty sure there are loads of improvements you can do to it to make it work better for your particular purposes, like bunching close objects together when querying, and other tricks that take advantage of the overall designs of your maps.

However, note that I'm that sure there are plenty of data structures better suited for rough occlusion culling for FPSes than occlusion testing all objects I'm pretty sure, but it kind of depends on your ambition.


You can use portal culling. Basically, Split the world up in zones connected by portals. when rendering a zone check all portals that lead to different zones for visibility and include those zones in the rendering.
what I am experimenting with at the moment is as follows:

define a number of objects that can act as occluders (large in occlusion value, walls, boxes, simple buildings and low in poly count)

then for each frame grab the nearest 5 to 50 to ? of them depending on horse power, render those to a small buffer on the cpu.

next step is to test bounding boxes against this buffer, not the bb for every object but bb's from either a spatial structure or a custom set, you could divide your scene into a grid.

that way if you have some dense areas containing a large number of small objects or a large number of polygons, they can be culled away very quickly

it is by no means perfect occlusion culling but it is instant and gets a good ratio culled, so might work out for you.... if you have a massive open space with only small occluders it probably will not work so well.

(if you have raised terrain you can just plant in some planes that run along under any ridges and then you can really quickly (after drawing a few simple polys on the cpu) you can cull away objects on the other side of raised terrain pretty easily)

make sense?
if anyone wants I can pop a demo or two online so you can see it in action.
i.e. a simplified 3D scene with some occluders and occludees with the occlusion map rendered in a smaller window
yes please. very interested.
Right, I quickly through this together so bare with me.

http://bwhiting.co.uk/b3d/occlusion/ <-- demo app here (will need flash player 11.1 - http://get.adobe.com/flashplayer/ )

What you will see (after a small wait while it loads)... is a simple terrain model with some boxes on it.
The boxes represent areas that will contain some complex data. i.e. a high poly model or 2 or 50 or whatever
The boxes will dissapear as soon as the high poly models are loaded in (in our case a lovely t-rex model)

The boxes are then occlusion tested against some predefined geometry that mimics some sections of the terrain.

You can see this in real time in the bottom left hand side of the screen where the occlusion buffer is rendered for your convenience as well as some dots representing the success/failure of bounding box occlusion queries.

As you can see, from some angles you can cut down the number of polygons sent to the GPU massively (from 3 million polys down to a few hundred thousand)
This was a super quick test just to try out an idea, it is not optimised and could run a great deal faster but you should get the idea.

If anyone is interested in the implementation details I could do a thorough write-up explaining how it all works.

http://bwhiting.co.uk/b3d/occlusion/ <-- demo app here (will need flash player 11.1 - http://get.adobe.com/flashplayer/ )


added some statistics in there - the green stuff rolleyes.gif
thank you very much. i'll try to my post my results when i have some :)
This actually looks pretty neat for static terrain, although certain dynamic elements wouldn't be too hard to add. A more interesting thing to see would be a fast heuristic occluder calculator that would build the occlusion faces. The fastest I can think of is probably periodic sampling for the entire terrain in both directions and using regular occlusion query techniques to optimize fillrate. I can't see much use for this in a closed environment, though.

This topic is closed to new replies.

Advertisement