true occlusion culling
You can still make use of scene partitioning even if not the entire scene is static. If you know, given a part of the map, what other parts are visible, you can check if the dynamic object is outside the visible parts, and if so, cull it.
Just to let you guys know:
I need to know if a view specific objects are visible for the viewer or not, hence the idea of checking with occluders. This doesn't need to be 100% pixel perfect, I need to know if an object is visible enough, so there is room for error (thus I can use a primitive object like a box in replacement of the actual objects in the scene)
I thought about using a software rasterizer (idea1, extension) in case of no hardware occlusion support.
Also i thought about using hardware occlusion when possible, either hardware occlusion queries or the method I described in my fipo.
It is not important that the check is done every frame from the game, but it does need to be checked periodically (let's say at least twice each second) so in case of software rasterizing / occlusion check this could be threaded in a second thread, away from the main thread.
Please keep spoofing me with idea's, critism and suggestions, since I am very curious on how to solve this.
Oh and p.s. as in any case, it needs to be as fast as possible :-P
I need to know if a view specific objects are visible for the viewer or not, hence the idea of checking with occluders. This doesn't need to be 100% pixel perfect, I need to know if an object is visible enough, so there is room for error (thus I can use a primitive object like a box in replacement of the actual objects in the scene)
I thought about using a software rasterizer (idea1, extension) in case of no hardware occlusion support.
Also i thought about using hardware occlusion when possible, either hardware occlusion queries or the method I described in my fipo.
It is not important that the check is done every frame from the game, but it does need to be checked periodically (let's say at least twice each second) so in case of software rasterizing / occlusion check this could be threaded in a second thread, away from the main thread.
Please keep spoofing me with idea's, critism and suggestions, since I am very curious on how to solve this.
Oh and p.s. as in any case, it needs to be as fast as possible :-P
How is your scene structured? I.e., Is there a good amount of occlusion from just culling dynamic objects behind static objects, or do you really need dynamic objects to cull dynamic objects?
If there are good static occluders (indoor scenes, outdoor scenes with occluding obstacles?), then I suggest looking for a visibility preprocessing algorithm or tool, which will allow you to make very quick decisions using simple queries at run-time.
If you really need to test for occlusion behind dynamic objects, then as another poster said, you should really consider where your bottleneck is, and see if either a z-pass or front-to-back sorting will get you what you need (removing pixel shaded overdraw). If you are geometry limited, then you should probably consider hardware occlusion culling (be careful with this, if you query to frequently, you will sync gpu to cpu and perf will suffer, if you batch too much, then by the definition of your scene type you may not get enough occlusion).
A SW rasterizer is good and all, but it is really difficult to build one with the flexibility of the API geometry pipe (VS and all). Perhaps if you were only using a some simple transforms (single matrices, pass through, etc.)
Something that you haven't really mentioned is if you intend to use this for rendering or for some other purpose (e.g., AI). Is it the former or latter? If the latter, then definitely use occlusion queries, and read back the results after a few frames.
As for the original idea. Just don't do it. :-) Reading back the frame data is a terrible idea (a huge stall, at least in DX9).
If there are good static occluders (indoor scenes, outdoor scenes with occluding obstacles?), then I suggest looking for a visibility preprocessing algorithm or tool, which will allow you to make very quick decisions using simple queries at run-time.
If you really need to test for occlusion behind dynamic objects, then as another poster said, you should really consider where your bottleneck is, and see if either a z-pass or front-to-back sorting will get you what you need (removing pixel shaded overdraw). If you are geometry limited, then you should probably consider hardware occlusion culling (be careful with this, if you query to frequently, you will sync gpu to cpu and perf will suffer, if you batch too much, then by the definition of your scene type you may not get enough occlusion).
A SW rasterizer is good and all, but it is really difficult to build one with the flexibility of the API geometry pipe (VS and all). Perhaps if you were only using a some simple transforms (single matrices, pass through, etc.)
Something that you haven't really mentioned is if you intend to use this for rendering or for some other purpose (e.g., AI). Is it the former or latter? If the latter, then definitely use occlusion queries, and read back the results after a few frames.
As for the original idea. Just don't do it. :-) Reading back the frame data is a terrible idea (a huge stall, at least in DX9).
You could render all occluders in the scene without texture mapping, lighting etc. (This could be done in one draw call).
Then get the z buffer and build mip-maps, each mip-map is one fourth the size of the previous. When building a mip map you combine four z values into one by using the maximum z value of the four. At the highest level you would have just one pixel (z value) which is the furthest z value in the scene for this view point.
You could then take your objects 3d bounding box, project all vertices to the screen and build a 2d bounding box around those vertices. You then would use the closest z value of the bounding box and rasterize a simple rectangle to the highest level mip-map. If at any point the rectangles z value is < the z-value in the z buffer you move to a lower level mip until you reach the lowest level, if however no z-values in the buffer are < the rectangles z value you know that the box is not visible and can be culled away.
This is an idea I am going to implement soon, its just a slightly modified HOM's algorithm. I don't know how expensive it would be to lock the z buffer and build mip-maps each frame.
Then get the z buffer and build mip-maps, each mip-map is one fourth the size of the previous. When building a mip map you combine four z values into one by using the maximum z value of the four. At the highest level you would have just one pixel (z value) which is the furthest z value in the scene for this view point.
You could then take your objects 3d bounding box, project all vertices to the screen and build a 2d bounding box around those vertices. You then would use the closest z value of the bounding box and rasterize a simple rectangle to the highest level mip-map. If at any point the rectangles z value is < the z-value in the z buffer you move to a lower level mip until you reach the lowest level, if however no z-values in the buffer are < the rectangles z value you know that the box is not visible and can be culled away.
This is an idea I am going to implement soon, its just a slightly modified HOM's algorithm. I don't know how expensive it would be to lock the z buffer and build mip-maps each frame.
Quote:Original post by crowley9
How is your scene structured? I.e., Is there a good amount of occlusion from just culling dynamic objects behind static objects, or do you really need dynamic objects to cull dynamic objects?
If there are good static occluders (indoor scenes, outdoor scenes with occluding obstacles?), then I suggest looking for a visibility preprocessing algorithm or tool, which will allow you to make very quick decisions using simple queries at run-time.
If you really need to test for occlusion behind dynamic objects, then as another poster said, you should really consider where your bottleneck is, and see if either a z-pass or front-to-back sorting will get you what you need (removing pixel shaded overdraw). If you are geometry limited, then you should probably consider hardware occlusion culling (be careful with this, if you query to frequently, you will sync gpu to cpu and perf will suffer, if you batch too much, then by the definition of your scene type you may not get enough occlusion).
A SW rasterizer is good and all, but it is really difficult to build one with the flexibility of the API geometry pipe (VS and all). Perhaps if you were only using a some simple transforms (single matrices, pass through, etc.)
Something that you haven't really mentioned is if you intend to use this for rendering or for some other purpose (e.g., AI). Is it the former or latter? If the latter, then definitely use occlusion queries, and read back the results after a few frames.
As for the original idea. Just don't do it. :-) Reading back the frame data is a terrible idea (a huge stall, at least in DX9).
Hi,
to remove some confusion, we trying to make different setups for different engines plugin-wise, to check if certain objects were seen by the user, for testing purpose in research. The scene's are dynamic and not persé static, but it would be for lower profile games that do not take the extreme out of your pc just yet ;-)
I read some articles but i forgot to bookmark them since it was a while ago that a lot of engines now days create CPU occlusion maps to optimize scenes, which would be a good idea the other way around, to test if something was visible rather then if something is invisible.
To react on your idea about software rasterizers: nothing fancy is needed, it is just pure for testing occlusion, on a non 100% accurate basis but accurate enough for us to tell that the person beeing tested saw the object good enough. Imagine us hanging a plane with a bord saying "did u see this?" in a room. The whole idea of the plugin probably has some different output later on, that's why i want to try a software solution rather then standing behind it. So nothing fancy, just transformation of the view/projection and draw of an id or something.
I do know about all other techniques to pre process a lot (frustum culling, octtree's etc) and I also even thought about the idea that we can have a maximum radius where visibilty comes in to action. Since we have about 5 objects per scene/level to test, we can make a routine that first checks if those objects are in range, and if so, if they are visible.
And to note: I have no intention to think I can make a plugin that works on any engine that is out there, but I do want to try and make a few fallback theories to support things that are there (hardware occlusion queries, my idea was an idea but as we can see it was crushed and shot down ;) ) and based on that try to make plugins for different engines.
Thanks so much for all your help guys, you are really giving me some idea's and thoughts. I hope I answer any unclear questions/idea's with this post, and I hope you have some energy left ;-)
Quote:Original post by staticVoid2
You could render all occluders in the scene without texture mapping, lighting etc. (This could be done in one draw call).
Then get the z buffer and build mip-maps, each mip-map is one fourth the size of the previous. When building a mip map you combine four z values into one by using the maximum z value of the four. At the highest level you would have just one pixel (z value) which is the furthest z value in the scene for this view point.
You could then take your objects 3d bounding box, project all vertices to the screen and build a 2d bounding box around those vertices. You then would use the closest z value of the bounding box and rasterize a simple rectangle to the highest level mip-map. If at any point the rectangles z value is < the z-value in the z buffer you move to a lower level mip until you reach the lowest level, if however no z-values in the buffer are < the rectangles z value you know that the box is not visible and can be culled away.
This is an idea I am going to implement soon, its just a slightly modified HOM's algorithm. I don't know how expensive it would be to lock the z buffer and build mip-maps each frame.
To me, this sounds very expensive and a lot of work. How would this improve against rendering 3D bounding volumes to an occluder buffer and do a read-back on that? Wether this occluder buffer is through hardware occlusion queries of an offscreen plane or a smart software rasterizer thing, I think making mipmaps and locking the depth buffer would stall a lot, but I am not sure about this?
Quote:
To me, this sounds very expensive and a lot of work. How would this improve against rendering 3D bounding volumes to an occluder buffer and do a read-back on that?
it is essentially the same thing although with using mip-maps you avoid expensive fill rates.
you also render a simple rectangle around the bounding box rather than up to a possible 6 triangles.
Quote:
Then get the z buffer and build mip-maps, each mip-map is one fourth the size of the previous.
from VMem to system mem? that's probably more expensive than anything you can gain from it. if you want to rely on the hardware, you need to work asynchronously and for that occlusion queries are the way to go.
Quote:this approauch would be very view dependend. in lot of cases object would be market visible behind walls, just because their rect in screenspace, using nearest-z stick through walls. it would work great with occluders that are coplanar with the nearplane, but you just need to turn the came slightly and you might get an dramatic increase in drawcalls.
You could then take your objects 3d bounding box, project all vertices to the screen and build a 2d bounding box around those vertices. You then would use the closest z value of the bounding box and rasterize a simple rectangle to the highest level mip-map.
maybe that'll be good as an first-pass approach.
Quote:This is an idea I am going to implement soon, its just a slightly modified HOM's algorithm. I don't know how expensive it would be to lock the z buffer and build mip-maps each frame.building mipmaps on gpu would probably be fairly simple, but getting the buffer might be damn expensive.
you could maybe experiment with staging buffers from d3d10/11 and map them like 5frames later to be sure u dont stall anything. but then again, occlusion queries would deliver the same result with the same latency.
@FeverGames
so you're making a culling middleware like dPVS by umbra? what exactly do you mean by "we have about 5 objects per scene/level to test"? just 5objects? is it worth to implement culling for 5objects?
but yeah, distance based "culling" is quite common, it's usually combined with LOD systems, so the lowest LOD is just an empty mesh.
Quote:Original post by Krypt0nQuote:
Then get the z buffer and build mip-maps, each mip-map is one fourth the size of the previous.
from VMem to system mem? that's probably more expensive than anything you can gain from it. if you want to rely on the hardware, you need to work asynchronously and for that occlusion queries are the way to go.Quote:this approauch would be very view dependend. in lot of cases object would be market visible behind walls, just because their rect in screenspace, using nearest-z stick through walls. it would work great with occluders that are coplanar with the nearplane, but you just need to turn the came slightly and you might get an dramatic increase in drawcalls.
You could then take your objects 3d bounding box, project all vertices to the screen and build a 2d bounding box around those vertices. You then would use the closest z value of the bounding box and rasterize a simple rectangle to the highest level mip-map.
maybe that'll be good as an first-pass approach.Quote:This is an idea I am going to implement soon, its just a slightly modified HOM's algorithm. I don't know how expensive it would be to lock the z buffer and build mip-maps each frame.building mipmaps on gpu would probably be fairly simple, but getting the buffer might be damn expensive.
you could maybe experiment with staging buffers from d3d10/11 and map them like 5frames later to be sure u dont stall anything. but then again, occlusion queries would deliver the same result with the same latency.
@FeverGames
so you're making a culling middleware like dPVS by umbra? what exactly do you mean by "we have about 5 objects per scene/level to test"? just 5objects? is it worth to implement culling for 5objects?
but yeah, distance based "culling" is quite common, it's usually combined with LOD systems, so the lowest LOD is just an empty mesh.
Well yeah, "just 5". These objects are important to be marked as seen once they have been seen, so yeah, a fair small share of the CPU or GPU can be given away for this. To come to a fair trade of cost against speed, I already said it doesn't need to check every game frame, it can be done in a fixed once in a while time step.
Why would a threaded CPU occlusion rasterizer be not done? With Bounding boxes?
Quote:
from VMem to system mem? that's probably more expensive than anything you can gain from it. if you want to rely on the hardware, you need to work asynchronously and for that occlusion queries are the way to go.
you could implement a basic software rasterizer to render the occlusion geometry to a low-resolution z buffer and then build the mip-maps but then it becomes of a problem of determining the set of occluders that are visible as the software rasterizer will likely be to slow to render them all.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement