Hello all,
I was wondering if anyone could help me out with some ideas, tips,
pointers, etc.
I am beginning development of a fairly simple 3D racing game, using
OpenGL. Each track in the game is a static world consisting of a
closed, polygonal, branching tunnel system (no realtime LOD or
anything). Id like the tunnels to have an organic look to them, so
they wont have just vertical walls, level floors/ceilings, etc., and
wont consist of simple convex polyhedra. The tunnels will be modeled
as meshes in 3DS Max.
I need an occlusion culling/PVS/portal (or whatever) algorithm for the
rendering that will be reasonably simple to implement. Its okay if it
isnt ultra-efficient, as long as it quickly culls out the majority of
polygons that wont be visible (Ill model the tracks with fairly low
poly density, but the tracks could be quite large, and have a high total
poly count). Ill use a z-buffer, and require a hardware 3D
accelerator. It wont hurt if a few non-visible polys are sent to the
rendering pipeline.
My thoughts so far are to hand-build a 3D lattice of simple connected
sections enclosing the tunnel system (in 3DS Max), and export it as a
separate object. Look at http://www.rabens.com/lattice.jpg for a
picture of what I mean. At runtime, I could determine which sections
were visible (using a portal-like or Descent-like algorithm on the
sections), and render the contents of those sections. This would
include a number of polys it wouldnt need to, but it should bring it
down to a reasonable set (depending on how well I design the sections).
I was thinking the section visibility determination would be simpler if
I constrained the overall layout of each track to a fairly horizontal
shape (limit how far the track rises and drops). This way, the section
lattice could be essentially 2D, with two parallel planes for the floor
and ceiling of the entire lattice, and strictly vertical walls and
portals. (I dont know if youd call it a portal, since it wouldnt
be a narrow opening on a wall, but rather the entire area where one
section adjoins another.) I could then do the visibility determination
in 2D. The problem is, I do need to pitch the camera up and down (but I
dont need to roll side to side). When the cameras looking slightly
down, for example, the portals are a little narrower towards the
bottom and wider towards the top (from the cameras POV), so I dont
think I can just use simple 2D portal clipping. So, would there be any
advantage to constraining the section lattice to a 2D layout? If so,
how do I exploit this advantage?
Id appreciate any and all feedback on this. Is my section-lattice idea
completely insane/stupid/na?ve? What would be a better way to do this?
Remember, the tunnel system will be an organic-looking mesh, and the
algorithm should be something that can be understood and implemented in
a reasonable amount of time.
TIA,
Marty Rabens