Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Oclusion testing in a FPS


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
12 replies to this topic

#1 Wilhelm van Huyssteen   Members   -  Reputation: 1003

Like
0Likes
Like

Posted 24 January 2012 - 02:30 AM

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!

Sponsor:

#2 Syranide   Members   -  Reputation: 375

Like
0Likes
Like

Posted 24 January 2012 - 03:22 AM

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.



#3 Madhed   Crossbones+   -  Reputation: 3098

Like
0Likes
Like

Posted 24 January 2012 - 03:35 AM

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.

#4 bwhiting   Members   -  Reputation: 790

Like
0Likes
Like

Posted 24 January 2012 - 03:56 AM

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?

#5 bwhiting   Members   -  Reputation: 790

Like
0Likes
Like

Posted 25 January 2012 - 04:33 AM

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

#6 bzroom   Members   -  Reputation: 647

Like
0Likes
Like

Posted 25 January 2012 - 03:58 PM

yes please. very interested.

#7 bwhiting   Members   -  Reputation: 790

Like
0Likes
Like

Posted 26 January 2012 - 10:55 AM

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.

#8 bwhiting   Members   -  Reputation: 790

Like
0Likes
Like

Posted 26 January 2012 - 11:04 AM

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 Posted Image

#9 bzroom   Members   -  Reputation: 647

Like
0Likes
Like

Posted 26 January 2012 - 02:18 PM

thank you very much. i'll try to my post my results when i have some :)

#10 irreversible   Crossbones+   -  Reputation: 1383

Like
0Likes
Like

Posted 26 January 2012 - 05:15 PM

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.

#11 bzroom   Members   -  Reputation: 647

Like
0Likes
Like

Posted 26 January 2012 - 07:10 PM

Outside your terrain is rarely this largely varying. There may be some large hills but they are often in the distance and you are in a large open area with very expensive things to draw. :(

Areas with tall occlusions of interior walls or buildings would be the best place to apply this technology.
It really all depends on your scene. Unfortunately our game has equal of both.

#12 bwhiting   Members   -  Reputation: 790

Like
0Likes
Like

Posted 28 January 2012 - 04:04 PM

I agree my terrain was perhaps not the best example but even very small hills could hide anything from a tank to a whole city depending on the view so could save some serious rendering time, especially if the occluder is only rendered when the player is near enough to it (i.e. if no occluders nearby then non are rendered and 0 time is lost)

With regards to generating a low poly occlusion mesh, when i threw that terrain together in max, a plane with a much lower resolution (10x10 as opposed to 50x50) was used with the same displacement map and slightly tweaked values...and it generated a really good mesh! BUT! because it was an organic mesh, not a plane or box, it either needed to be z sorted or drawn with a z-buffer... which would slow things down considerably. At the moment no z-buffer is used when drawing the occluders.

The same thing should also be able to work just fine indoors too, just grad the nearest few walls and use them. that way if you indoor level could be divided into chunks, whole segments could be disregarded pretty quickly..

Have put together a few other scenes, and will make 2 more demos on Monday and upload them, this time there will be some dynamic objects and a better test environment (I hope... two hills, a tunnel, a room*, and a building**)

** a box
* an open box
:)

#13 Wilhelm van Huyssteen   Members   -  Reputation: 1003

Like
0Likes
Like

Posted 29 January 2012 - 01:17 AM

Thnx for all the resources!




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS