Jump to content
  • Advertisement
Sign in to follow this  
EternityZA

Oclusion testing in a FPS

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

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!

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

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!