Sign in to follow this  
reuomi

Applying shadow mapping method to culling

Recommended Posts

reuomi    139
I've been looking into different shadowing methods for my project, and had settled on Shadow maps. From a technical stand point a shadow map is a comparison of depth information to determine if a object is visible to the light source (illuminated) or invisible to the light source (Shadowed). It was at this point I started wondering, has anyone ever tried applying this same method to object culling in a form of scene management? To do a shadow map test from the user's point of view, all objects that would be illuminated would also be visible and thus allowed to render, while objects in darkness from the Point of view would be invisible and then Culled. [Edited by - reuomi on November 23, 2007 5:26:52 PM]

Share this post


Link to post
Share on other sites
yahastu    154
I was expecting a much different topic under the heading of "scene management", but anyway, view frustum culling is not uncommon but is typically done on the CPU.

Your method really does not make any sense. For one thing, being in darkness does not necessarily mean an object is not visible (ambient light, other lights, etc), secondly, being in lightness has nothing to do with being visible (unless you have a single flashlight camera, which is never the case).

Next, the whole point of culling is to reduce the number of primitives that you have to send to the hardware...if you used this, you would have to render everything once just to see which things dont need to be rendered...huh? Doesn't that defeat the purpose? Ok, maybe still useful if youre doing 100 passes, but still...

Finally, even if you were to render an initial pass from the camera perspective simply for the purpose of object culling, I don't see that there would be a direct way to get the list of visible objects from that. All I can think of is that you could set a global variable of object_ID each time you render an object, render that ID into the buffer, and then afterwards iterate over each pixel in the image and check if that ID has been added to the list yet...which would be a lot less efficienct than simply doing a frustum test for each object to begin with

Share this post


Link to post
Share on other sites
Cypher19    768
Quote:
if you used this, you would have to render everything once just to see which things dont need to be rendered...huh? Doesn't that defeat the purpose?

It would. That's why it would be better to use large bounding boxes of the objects to do that, and issue occlusion queries for those bounding boxes to determine if an object is visible or not.

To the OP: I'm finding it difficult to imagine what you're trying to suggest, but it really doesn't sound that practical. Occlusion Queries sound kind of like what you want, and those are quite useful, as many advanced graphics engines take advantage of them as a form of aggressive and not ridiculously expensive object culling.

Share this post


Link to post
Share on other sites
MJP    19755
Quote:
Original post by Cypher19

To the OP: I'm finding it difficult to imagine what you're trying to suggest, but it really doesn't sound that practical. Occlusion Queries sound kind of like what you want, and those are quite useful, as many advanced graphics engines take advantage of them as a form of aggressive and not ridiculously expensive object culling.


Yeah I was having some difficulty understanding what they OP is proposing as well. At first I thought he was suggesting some sort of occlusion culling based on whether or not an object is receiving light from a light source, then after reading again it seemed as though he was proposing using the shadow-map principle to perform visibility culling. That sort of approach does sounds a lot like Occlusion Queries when applied at a per-object level.

Share this post


Link to post
Share on other sites
reuomi    139
it was more or less a idea that occurred to me that i have been unable to test yet.

In a next gen shader heavy scene, rendering only a simple bounding box structure around all objects then uses the shadow map method from the viewpoint of the camera to determine what is actually visible. If i recall correctly a shadow map is rendered from the light source, and if the light can see the object, it's illuminated, and if not, it's in shadow. if the map were projected from the camera on a simple non-hlsl shaded environment to determine what objects could actually be seen from the player's perspective, then i thought maybe those objects could be excluded from a final render. Probably not a practical method, but it was something i wanted to gain an opinion on.

Share this post


Link to post
Share on other sites
Jerax    126
If you've got a lot of heavy shading do a Z pre-pass - render all the stuff you would normally render with colour writes off and a trivial shader. This sets up the z buffer which then trivially rejects anything invisible so you don't have to run expensive shaders on it.

For object based culling you're not going to get anything sensible out of the GPU though, the latency is way too high.

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