World selective rendering

Hi human units… :slight_smile: Im a newbie in the field of OpenGl. Have been doing some web-research on it recently. I’ve learned to build and render some models, infact i’ve managed to import and display 3dsMax models in the program(using somebody’s code :D)… Thanks to all the tutorials and all the helping hands in web,like u guys. Now i’ve stumbled upon this matter.

I’m building a miniature city with the basic minimum looks of a city (roads,buildings,trees etc) where u can move around. I know that, rendering the whole model set in each frame doesn’t work…
So can u guys give me an insight on the standard (but easiest) procedure used in rendering only the visible parts of the world? I mean, just selectively displaying only the visible stuff (with respect to the camera position) and ignoring the rest of the world…
Thanks in advance!

well, you have stumbled upon the hardest part of 3D rendering.
There is no easy answer to this, as it depends upon how you manage your scene.
If you have 1 monolithic model which spans the entire game world, then you need to break down the model’s verticies into partition sets. There are various schemes and structures you can build, eg Axis Aligned Bounding Boxes, BSP trees, KDtrees, OctTrees, etc.
The basic idea behind each of these is that the structures hold visibility datasets, and each node can be tested against the camera to determine what to draw.
I’ll leave it to others to suggest articles and specifics and it really is an indepth subject!

What you’re asking about is called “view frustum culling”.

Google “view frustum culling tutorial” and “scene graph” for more details here.

You can roll your own, or another option is to use an existing, free scene graph (which has this built-in), like OpenSceneGraph.