I have been programming using the OpenGL API for a while now, following the great tutorials online and from books. I have reached the point where I can draw models, manipulate lights, textures etc.
My question is, where do I go from here? I’ve heard of things such as BSP trees and portal culling etc, - is this the way forward after learning the basic functions of OpenGL? If so, what is the best way to learn? (if not, what do I do now??)
Well, BSP trees and portals have nothing to do with OpenGL rendering. However, if you are interested in learning CG’s then this is not a problem, because you should not be limited to an API. I would recommend looking at a book like Foley et al, Computer Graphics: Principles and Practice. This will cover a lot of the theory behind graphics.
It will all depend on what you want to do with OpenGL. If you are interested in learning how to make games, then BSP’s and protals are going to be important background knowledge. If you want to mearly make a model viewer however, then they are probably not all that important.
If you can fill me in on what you are interested in doing, then I may be able to point you in a better direction or atleast a more specific direction.
There are general 3D graphics things like BSP, meshes, multipass special effects,
and then there are the GL extensions like vertex programs, combiners, memory management.
You can read and learn by heart the opengl spec sheet
Many thanks for your speedy replies!
I was thinking of developing:
A complex model viewer - the model having several thousands (50,000 - 100,000?) polygons (texture mapped and maybe some alpha blending), perhaps not all from the same model (several all put together!). I made a simple viewer of a dolphin (which had about 1000ish polygons in the model, all loaded into a vertex array), which ran ok until I textured it and the frame rate dropped to about 10 fps. What kind of techniques would I need to use here? If a 1000 polygon model runs at 10fps, then a 100,000 polygon model would run at 0.1fps!!!
I’m also thinking of creating a simple game, which uses a small surface (kind of like MonkeyBall or Marble Madness). I was hoping to create my viewer first, and ‘port’ over all the techniques I used there into this game (is this wishful thinking???).
Many thanks again for all your help!
BSP, PVS culling, Etc, are ALL very important parts of a game (if thats what your going for).
But there are other ways to improve geometry rendering. BSP simply devide up the world into seperate pieces, so you can cull entire parts of them out, so they dont get sent to the Vid Card if there not even visable. I do this another way, (because BSP confuses me).
What i do is, say i have a map, each room of my map, is considered a zone. I simply keep track of each zone I am currently in ( can be more than one if standing in a door way) by a simple what room is next to what room algorithm. Then I simply use another algorithm to tell me what other rooms are visable, and what ones are not, then i simply draw ONLY what i can see. Basicaly a BSP trees job, but more on a line that i can understand.
I think there are 2 factor which makes one an “Advanced” graphics programmer.
The first is knowing how to make your app run fast. This requires an understanding of what the OpenGL implementation (i.e. the hardware) can and can’t do well. BSP, Octrees, and other culling methods are basic (and essential) techniques that’ll make your app run faster by minimizing the amount of geometry that the hardware has to process. Other techniques include using some of newer vertex array extensions and programming so that sure that you’re not turning on anything you don’t need (like lights, clipping, etc.)
The second factor that makes you an “advanced” graphics programmer is you’re ability to render special effects. Understanding many openGL extensions will help you to this end. Knowledge of the pixel shading extensions, for instance, will let you use advance lighting techniques. Knowledge of vertex shading extension can let you do some cool water effects. Renderable texture will let you render realisitic reflections.
The 2 factors really depend on each other: you program isn’t going to impress anyone if it runs slow, nor will it impress if it looks crappy.
You’re on the right track with writing a more advanced model viewer… the poor performance should lead you to learn some more advanced OpenGL coding practices. Here are a few pointers:
minimize state changes such as turning lights on and off, binding textures, enabling depth testing… try to do these all in one place at the beginning of your program
use a vertex array to store your model geometry, this reduces the amount of info transfered over your graphics bus
use a display list to encapsulate your actual primitive rendering routine. this works well if the model is static.
use texture compression, try mipmapping
use automatic texture coord generation (glTexGen…)
still not getting enough performance? try looking up an algorithm to ‘strip’ your model (i.e. to transform it from a collection of individual triangles into a series of tri_strips).
enable backface culling
disable automatic normalization, do it yourself
And starting with a model viewer and working your way up to a game isn’t a bad way to learn OpenGL, that’s just what I did. Actually it went like this: modeler, basic graphics engine, multiple graphics APIs, fix graphics engine, physics and sound code, fix graphics enginer again, menu interface code, fix graphics engine yet again (noticing a pattern here? :P) and so on.