Home

Projects

BitBucket

About

Links



My First 3D-Engine

5/06/2005

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 code.


Checking AABB-frustum intersection in 2D


Checking accuracy of frustum intersection with
random little AABBs



Polygon based 3D line

5/07/2005

Wrote code to extract the frustum planes from the view/projection matrices, made an octree and a loose-octree.


Frustum, based on its matrices


Octree spatial data structure to store polygons in

5/08/2005

Octree worked, octree didn't work, problems, bugs, fixed things, damaged thigs (probably). Nothing special though.

5/10/2005

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


5/15/2005

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

5/16/2005

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.


simple testscene


more advanced scene. imperfect, several glitches


lightmap corresponding to the lego car

5/17/2005

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.


5/19/2005

Rendered my name.


my name (click)

5/21/2005

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)

5/08/2005

Rendered more colors. Total physical incorrect algorithm, looks nice though.


Cubes, click to see them together with their
corresponding lightmap


5/23/2005

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

5/24/2005

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.


home