I'm going to write my first 3D engine. I think that I have read enough the last few months to
be able to make something useful for a game. It will use Direct3D and will be written in C++.
It won't be heavy optimized or super fancy, just a basic one. The working title will be "engine".
Started with it coding a Direct3D template, a renderable line class and AABB-frustum intersection
Checking AABB-frustum intersection in 2D
Checking accuracy of frustum intersection with random little AABBs
Polygon based 3D line
Wrote code to extract the frustum planes from the view/projection matrices, made an octree and a
Frustum, based on its matrices
Octree spatial data structure to store polygons in
Tested the octree and frustum culling with some level data. Works great.
Rendering only the polyongs of the level that are
visible for the viewing frustum
Decided to code a lightmap renderer. First I made an algorithm based on this article to
store the sub lightmaps in an efficient way in a larger texture.
random generated sub-textures stored in a larger texture
Made some basic light map renderer code that allocates texels and such. Did some first tests by shooting
a hemisphere of random distributed rays around and coloring the texels according the ratio of intersecting
versus non-intersecting rays.
more advanced scene. imperfect, several glitches
lightmap corresponding to the lego car
Continued with the lightmapper. Tried to fix the glitches, but failed. Hard to debug.
note the strange glitches on the wheel-rims and
the flag. click to enlarge.
Rendered my name.
my name (click)
Found out what the reason of the glitch was: to avoid problems with sampling and interpolation
of lightmap texels during runtime, I rendered a little outside the polygons for safety border.
This worked fine, until two polygons were touching each other in a concave way, then this border
would always result in blackness, since the rays shot from there would always touch the other poly.
Very stupid, but hard to find out and debug. To celebrate this, I added colors.
and made this cool looking mistake :) (click)
Rendered more colors. Total physical incorrect algorithm, looks nice though.
Cubes, click to see them together with their corresponding lightmap
Checked how a game related model would like like. This cool model was made by Jaap
for a game we were going to write.. but never finished.
cool house for an rpg or something
Added direct lighting.
standard cube scene, direct lighting
Jaap's rpg house, rendering took 130 seconds
Future (as of 6/04/2005)
Don't know yet, the lightmapper has still problems and I'm getting bored,
probably I'll code something else in the meanwhile and continue this later.