Dirty way for discart not-in-frustum objects. Help plz

Started by
3 comments, last by Unreal 19 years, 4 months ago
Hello!!! In a level loaded in my 3dengine i have some hi-poly count static objects. I have that objects in a object manager class that renders that objects. But I also render objects that is not in the camera frustum!This is waste of fps. My Engine has a BSP Tree but the only optimization I have in it is Bounding Box optmimization and I can't discart all the objects that are not in the camera frustum using the BSP Tree. Is there any other way to do this? I was thinking this: before render the actual object render the bounding box or sphere of the object using an occlusion query to see if the object is visible at camera frustum. if yes then draw it. if not then dont draw it. but to do all this stuff i must render the bounding box/sphere first. and the bounding box will appear to the screen! how can I erase that? well I know that you can not just erase something. but there must be some trick to "hide" it. thanks in advance;
Advertisement
Disable colour and z writes (or use an alpha blend of SRCBLEND_ZERO).

Be warned that the occlusion query probably won't execute quickly enough to give you results the same frame (at least, not without having you sit around for a while and wait). You'll likely want to use the results of the query you made the previous frame, sort of thing.

Richard "Superpig" Fine - saving pigs from untimely fates - Microsoft DirectX MVP 2006/2007/2008/2009
"Shaders are not meant to do everything. Of course you can try to use it for everything, but it's like playing football using cabbage." - MickeyMouse

thanks for your reply!
well.. about occlusion query speed now...
Am I gonna lose a lot of fps when testing with queries?
is it better from drawing 2000 polygons?
It depends on a lot of things (such as the heavyness of your vertex shader). You'll have to profile, but my gut feeling is that yes, trying to get the results of the query back the same frame will cause you slowdown.

Richard "Superpig" Fine - saving pigs from untimely fates - Microsoft DirectX MVP 2006/2007/2008/2009
"Shaders are not meant to do everything. Of course you can try to use it for everything, but it's like playing football using cabbage." - MickeyMouse

i use them and i have some extra fps because now i dont draw the objects that are behind the walls. :)
In a simple level with some complex geometry I can discart 30.000 - 40.000 vertices whitch is behind the walls. :)

This topic is closed to new replies.

Advertisement