why it's very very slow when i do the walk through(Perspective view)?

Hi, everyone, i got a big problem now, my project is for architecture, and i’m asked to show everything of the building like doors, windows, walls even pipes and so on. for a building it have large numbers of these kinds objs, could be more than 10 thousand. some of them are box but some could be brep obj. so even when i show them with the glOrtho mode it’s quite slow already but when i show them under the Perspective view mode(need to walk through in the building), then it’ll be much more slowly, even can not move, how can i solve it?should i directly write something to graphic card? if need how to do? and my algorithm of walk through is the move the reference value of the gluLookAt function. thanks!! BTW, my walk through mode can work fine with less objs.

[This message has been edited by jack2k_pan (edited 10-03-2002).]

Hi Jack. It sounds like you’re just trying to draw too much stuff for your current hardware.

You’ll either have to improve your software in some way or upgrade your hardware, whichever makes most sense as far as cost goes.

On the software side:

Are you using any structures for scene management and culling, or do you just try to draw everything every frame?

Are you using any OpenGL extensions to improve performance or does all your geometry go through glVertex**() calls?

– Zeno

You need to pre-process your data into a form where you can quickly discard geometry that’s not currently visible, so that the card doesn’t have to actually rasterize it. Look up “PVS” or “BSP trees” on the web; there’s lots of it available. If there’s lots of walls and not too much glass, then a portal-based scene graph may also help you discard stuff that’s not actually visible.

You might consider extracting the perspective view frustum and seeing if bounding boxes/spheres which enclose each of your geometry objects fall within the view frustum.

Early knowledge that an object is invisible will allow you to avoid drawing it altogether, which is usually more efficient than having OpenGL try to perform the view frustum culling automatically.

I use this technique in my Beerware product called SpaceTime where I have hundreds of stars in an animated starfield and performance is important.

Check out this excellent article by Mark Morley which should help.