BIOGENS
Programming a real time engine from the ground up.

PROGRAMMING • DESIGN

THE APPROACH

Biogens started as an idea to teach ecology to high school students and ended up being a 2 year labor of love. I focused on teaching 9th – 12th grade students' the chemical, biological, and physical principles that underlie ecology. It borrows the experimental process and motivational aspects of games like ‘sim-city’ and integrates them into an online collaborative environment. Players were encouraged to use their creativity to solve complex problems through the construction of creatures and environments that determine the outcome of their game.

PRODUCTION

At the time I started working on the game there weren't any out of the box 3D engines that displayed large outdoor environments let allow facilitating the creation and sharing of unique content. As a result I needed up spending most of my time building a 3D engine from the ground up in C++ using OpenGL. The engines sat on top of an extensive plug-in architecture that allowed easy generation of new media types, compression formats, animations and simulations.  It also include an entire system for generating procedural media that gave players the ability to create new and fun items that where easy to build and compressed to very small files so they could be easily shared with other players.

ROAM

The implementation of the ROAM algorithm uses a ‘chunk lod’ approach to solve some of the problems associated with view dependent LODing. In this approach the error metric is applied evenly over tiles of 32x32 vertexes. For each tile a face index array is created that indexes into a vertex array that is stored in VAR.

The terrain was textured using a splattering technique. The different textures were composite together on the fly using texture combines. The lighting was implemented thought a lightmap.

TERRAIN TEXTURE MAPPER

The terrain texture mapper allowed artists to texture map terrains using the terrain height, angle and relative angle as criteria’s for compositing textures. In addition to this the user could use different types of procedural noise to composite multiple textures in the same area. All texture were done on the sub pixel/sub polygon level to preserve maximum quality and provide scalability.

The interface was broken down into a number of layers that were composited together based on the physical characteristics of the terrain. Additional Gaussian blur could be added to each layer to create smooth blending.

The utility displayed the texture mapped terrain in the viewer and provided the user with feed back as to where the next texture layer would be placed in the terrain by coloring them red.

The user could use Purlin, Fractal, and Marbleized procedural textures to composite multiple textures in one layer.

TEXTURE MAP PAINTER

This utility facilitated the texturing process of complex objects. The utility allowed artist to composite multiple texture layers onto a single object. The user could also paint directly onto the object using masks, or procedural noise to composite against. The painting process supported sub-polygon accuracy thought the use of barycentring coordinates.

There were different kinds of layers that allow users to paint onto the object, paint through a mask, composite images and composite with noise.

When masks were used, the areas selected by the masks turn red to let the user know which areas in the layer will be affected.

The user could use Perlin, Fractal, and Marbleized procedural textures to composite multiple textures in one layer.

L SYSTEMS

This utility allowed artists to create a wide variety of l-systems. It supported Tree OL-Systems, Bracketed OL-Systems, Parametric OL/2L Systems and partial L-systems

Users could load pre-defined l-systems in the engine or they could create their own in the editor. In addition to this they could adjust angles, thickness, color, and recursive elements of the system.

BUMP MAPPING

A simple tangent space Dot3 bump mapper. The bump maps themselves were calculated using a subey kernal. All calculations were stored in floating point values up until they are encoded into rgb colors to maintain accuracy. During rendering time all lighting was rotated into tangent space and specular values were added using a normalized cube map.

MATRIX PALLETE SKINING

All vertex information was stored in bone space. The geometry was read in from a studio Max Ice file and each vertex was a binned according to the number of bone influence it has. At render time this information was fed into a vertex program that calculates the new vertex location, it’s normal, bi-normal, and tangent for bump mapping. The system also contained an optimized software fallback. It also contain an internal logic that allowed skins to be swapped out on the fly.

RAY OCTREE PICKING

All geometry was broken down into a polygon soup and sorted out into an octree. A ray was then projected from the screen coordinates into the occtree. Woo’s method for bbox ray intersection was used to determine which nodes in the occtree were intersected. The barycentric coordinates for the intersection with the triangle were determined and interpolated uv, normals, xyz coordinates, binormals, and tangents were returned.

FRACTAL TERRAIN

This utility used fractal Brownian noise to generate terrains. A mid-point displacement technique was used to calculate the terrain geometry. The geometry could be saved out as a set of parameters from which the train could be reconstructed or as a png hieghtmap.

The interface allowed the user to set the random seed for the algorithm as well as add fractal noise to the terrain. They could adjust the height of the terrain, round off the edges, lower the terrains floor and add Gaussian noise to the result.

The user was presented with a grayscale height map that they can paint on or alter to manipulate the final terrain.

VIPM

The engine hand a vanilla View Independent Progressive Mesh implantation to help reduce the polygon count at render time. The error metric that was used to determine the edge collapses was designed to preserve detail in the model as well as its volume. It handled multiple materials correctly, and provided a vertex program that performed geomporphing from one lod to the next.

The interface allowed the user to select the number of lods that were generated for each object. In addition to this they could set the distance at which each LOD was activated and switch geomporphing on or off.

Users could select the level of detail for each LOD by sliding a bar. They are provided with a visual indication of the model at the specified lod as well as the number of polygons in the lod.

FILE FORMATS

A series of file format readers that can read ASE, ICE, MD3, and OBJ file formats. In each of these cases vertex were flattened to remove any multiple use and face indexs are tristriped. Calculations for smooth normals, binormals and tangents were made. All vertexes were grouped by similar materials.