OpenGL and Geometry Generation

Today I was thinking about 3D rendering (in part because of the recent work I’ve been doing with ray tracing). I worked out all the math for drawing a polygon based on a list of vertices and a camera. I was considering coding it up, but then I realized that I was very unfamiliar in working with Windows (because I sure as hell wasn’t going to do this in Java). So I spent the greater portion of the afternoon reading a tutorial on Windows programming and using OpenGL, at which point I abandoned my original. I was just going to finally figure out how to use OpenGL.

I had worked with GLUT before when working on a Parallel Computing lab. However, I only used pixel control in that case; I was rendering subsections of a Mandelbrot set. However, that was easier because all the requisite libraries were already installed in the major lab at school (which has workstations with Gentoo installed). Working at home, I have been confounded. I just can’t get the linker to use all the requisite libraries.

The whole thing that got me thinking about 3D engines was my working on a HL2 level. Often I will import brushwork (pieces of the level) from the game’s campaign levels; it saves time and adds a nice level of detail to the environment. However, I was thinking about common elements such as stairs, doors, windows, and grates. It’s a multi-step process to cut a hole in a brush, unless you use carve (but nobody uses carve because it doesn’t give you control over how the geometry cuts). Doors are tedious to cut out and then line up with the texture. Non-solid stairs are the most painful to make, however. You have to arrange the steps and make sure the sidings match up, and for each new type of turn you have to rework the geometry. The whole idea of hand-making all the geometry in a level is ridiculous. I haven’t seen a single FPS level editor than lets you define procedures for geometry generation.

A screenshot of the Hammer UI

A screenshot of the Hammer UI


I feel like it would be relatively simple to define a generation process for buildings, for example. Each building is spaced a certain distance in from the sidewalk. There are maybe two or three justifications for things like planters and doors. Then windows are spaced evenly apart, with buffer spaces on either side of the building. You could attach balconies or planters on to every windows, awnings above doors, and even outdoor area layouts for cafes. After meticulously defining a couple of building styles, you could almost instantly generate entire blocks. Then come the nested procedures. A street, for example, would have periodic drains and manholes, distributions of building types based on the neighborhood type, and junctions to more streets. Signs, traffic lights, road markings, and crosswalks would all be placed correctly at street corners. Coul-de-sacs could fill up empty space. Interiors could be set as well for buildings. Floor plans could be modular. Rooms with distributions of room types and different layout permutations would combine into floors. A building type could have a sequence of floor types defined, such as bottom level stores and top level apartments. Central structures like stairwells would only need to be made once.

Although the procedural parameter definitions might take a while longer than making regular geometry, it would be a huge time saver. Not only could full geometries be generated, but intricate, custom-designed battle areas could be laid out faster. Common terrain pieces like walls, fortifications, stairs, railings, gates, and hedges could be created with the use of a single spline. Suddenly a task like designing the maps for my strategy game becomes less daunting. The pipeline for map production is shortened. General map layouts can be quickly sketched out and then directly generated. Beta testing would be infinitely easier, as map adjustments could be made in hours, rather than days.

Advertisements

One Response to OpenGL and Geometry Generation

  1. Pingback: Portal 2 Element-Based Level Generation « Mind Outlet

Say something! Do it!

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: