World Cup and MD2 Model Loader

So, France lost again Senegal, not quite what I had expected and I’m not sure It’s a good thing for Denmark, which is facing the Uruguay in a few hours in a game we simply _must_ win.
I passed my belt-test, wee! I climbed two degrees and earned the right to wear the orange belt!
I might upload some new source one of these days, I’ve had a MD2 model loader finished for quite some time now it does interpolated keyframe animation and loads them with textures and all. I’m not quite sure how much of the code I’m ready to release at this stage since it uses my new (and very untested) scene-graph engine which is quite heavy on code and not ready for you guys yet. But I’ll definetly upload the code to the loader itself and the actual render, which is seperated from the loader since the scene-graph uses a visitor-pattern approach to rendering.
Well, the match starts in an hour or so and I’ haven’t had breakfast yet, see ya. AND CROSS YOU FINGERS FOR DENMARK!

Exams

Exams are coming up in a few weeks so programming is going really slowly these days since I have to do alot of reading. The closest I’ve been to coding these last weeks is a project in a course about algorithms and datastructures, we’re developing an algorithm to find the maximum matching in a bipartite graph and when we have proven it correct we have to implement it in Java. Not much gfx related in writing boring algo’s in Java but atleast I get to type a bit :)

The Quake 2 BSP loader

My time is sparse these days since I have to do a lot of math stuff for uni and I’m working on two projects at the moment, the first project is a demo which I’ll be making with a finnish guy (and perhaps some outside help for gfx and sound), we’ve just finished drafting the most important parts of out soon-to-be demoengine, the “script ” to the demo is nearly finished as well so it’s time to start coding soon :) The deadline for the design stuff is set at the 11th november so time is getting sparse.

My other project is the q2loader I posted a screenshot from in my last newspost. I’ve now coded functions that successfully loads all the required textures from the .wal files (an easy task really, it’s a simple fileformat), now I just have to implement the actualy BSP/PVS instead of the method I’m currently using (which is just throwing the edges at opengl as lines). But I’ve decided to do this BSP thingy right since it’s a new technique for me (quite different from the octrees I used in my landscape engine), so I’ll build a simple 2d bsp tree compiler/renderer and expand it to 3d using a very simple world. I could most likely had implemented the BSP stuff in the q2loader anyways but I would like to be 100% sure of what I’m doing, I’m sure you can follow me here, too many ppl implement algorithms nowadays without knowing how they work. (I’m guilty as well, but it’s time to change it.

Oh, and I would like to say thanks to NeHe for adding a link to this site on his homepage. Although he states that it’s my “new” site I would like to point out to new visitors that it has been up for well over a year now.

AaB Victory

I have vacation this week, that’s just what I needed. I spent the first weekend partying, then I went home Sunday to Tuesday where I did virtually nothing except watching football Sunday afternoon, AaB was soo close to beating Brøndby but striker Zelinsky failed to score on a 99% percents chance :(. Other than that, I wrote last time that I was looking forward to Denmarks last group match in the preliminaries to the World Cup against Iceland. That match was incredible! We won six to nothing and downtown Ã…rhus exploded in football songs, soo fun :).


The Quake 2 BSP Level LoaderI’ve finally started coding my own quake2 level loader, I’ve been wanting to do that for quite some time now. The screenshot shows the progress so far. As you can see I’ve only extracted the vertex and edge data so far, but as soon as I finish the rest of the crucial parts (textures and such) I’ll upload the program with source as usual.

I had some huge difficulties with the code to start with, the data I loaded in made no sense, I spent several hours debugging without finding the solution, then I looked further op the file and saw this line which loads the .bsp file:

in.open(filename, ios::binary | ios::in | | ios::nocreate);

The error had completely missed my attention since it was as simple as a single pipe, after changing that line to:

in.open(filename, ios::binary | ios::in | ios::nocreate);

Everything worked like it should. Dammit, that was a stupid bug, I have to stop programming so late at night, those bugs will kill me someday.

Well, my parents are visiting tonight so I’m taking them out for dinner, see ya.

Landscape Engine

Landscape engine with lambertian shadingI finallly found the time to implement per-vertex precalculated lightning in the landscape engine. I’m quite satisfied with the result and it gives the landscape a less boring look.. The reflection method I use is called Lambertian reflection, but you might now it better by the more common name diffuse reflection. Anyway, whatever you call it it’s easy to implement – all you need is the vector from the vertex to the sun and the vertex normal.I’ve also written a new function for the octree system that tests whether a ray intersects any of the triangles in the octree, at first I used that function along with the reflection technique above to make sure that the points could “see” the rays from the sun. I removed that however since the check of the thousands of verts took several minutes on a large heightmap :). Instead I moved the sun far away so that all rays has become almost parallel ensuring that all points on the landscape are hit (I have no overhangs and such).

Shot of landscape engine with lambertian shadingA completely new logging system has also been added to the engine, the old one was rather clumsy and way to simple. It’s still simple, but at least it looks like OOP now :).
You can download the new engine, and the source, right here: landscape.zip.

Tommorow I’m going 250km by car to my aunts birthday, we’ll be sleeping in our Compi-Camp (some kind of tent wagon) so don’t expect any updates tomorrow . And about the move to the new server, I expect that I can be finished with all the uploading and stuff by the weekend, then I need a “hosted by” image which Scorpion will supply, and then It’ll be up and running. See you there :).

New Build of the Landscape Engine

I’ve uploaded the lates build of the landscape engine. I don’t have a lot of time right now so I’ll make a brief description. It has frustum culling (using an octree) and textures generated from data in the heightmap, here’s a screenshot:
screenshot2.jpg
And here’s another showing a tiny part of the octree:
landscape
The next thing I’ll have to add is precalculated lightning (using raytracing) and some better looking textures. I’d like some feedback if you have any. You can download the engine from
here.
Did I mention that the source is included?
If you run the program in windowed mode the settings are a bit strange, you’ll only see it in wireframe. Press ‘i’ to make it solid again, and ‘u’ to turn the textures on.

Frustum Culling, Octrees and More

The frustum culling part is now finished, the engine now does a rough hidden source removal based on the octree. So I’m able to load large heightmaps and display them smoothly now :). But I ruined the textures and the fog feature as I changed the renderer to use vertex arrays so you’ll have to wait a couple of days for the upload.
Did you see the CL final yesterday? What a match, I was cheering for Bayern so I’m glad that they won, but both teams played a great match I must say! Anyways, I have an oral in ancient history coming up next thursday so I might be a bit sloppier with my programming and updates, we’ll see.

Ramblings, Landscape Engine Updates

Denmark finished second in the Eurovision song contest last night, I watched the contest at a bigscreen at a bar, and ppl was cheering when we got points, great evening :)
My texture generation function for the landscape works fine now, I’ve spend a lot of time debugging it and just recently realized that the problem was that I forgot that bmp files are stored in a BGR format instead of RGB format, so I got a really weird looking landscape texture:). But I’m not really satisfied yet, since the generated landscape texture is at the same resolution as my heightmap I’ve only got colors for the vertices, and not the pixels inbetween, I guess I need another approach, right now I just use the generated texture to set the colors for the the vertices and then apply an ordinary textue on each triangle, it looks ok – and runs twice as fast as the prev version which used per-vertex lightning – but I’m not _fully_ satisfied.
I’ve also decided to try to implement a visible surface determination feature based on octrees, I’ve never worked with any kind of recursive algorithm before so I’m not sure It’ll go as smoothly as I’d like it to go.
That was what I had to say today, if you have any advise about the texture thing or something else, please mail me
here, thanks.

Blabla

I’ve started completely from scratch with the new engine using the things I learned with my last. I finished the pipeline programming yesterday and I’m pretty content with the result, the ohjects are tied to the world in a linked list and each object has children and a pointer to a linked list containing its polygons.
Another thing is that Lars at the fame had drafted a new design for this page which he’ll try to make in the next couple of weeks, it’ll look really cool!.

Software Engine

I’ve been working on a very simple 3D engine these past days. It’s far from being cool, but since it’s my first try at a completely software based engine with unlimited object and vertex storage (as long as there’s memory ofcourse) I’m fairly pleased. I’ve uploaded a linux tarball containg the source and some scripts which can be found here(enging-0-11). You’ll need SVGAlib to compile and run the demo, but if you want you could alter the main.cpp file to make it work in dos mode (since the engine is 100% software based and simple, all you need to use it is a pointer to the bytes in which you want to store the result. Anyways, the demo shows a red cube built of triangles rotating about the x and y axis. If you press ‘l’ you’ll enable the only feature in the engine so far: the visible line determination which will make the cube a lot cooler, ‘q’ quits the program. Next step is to implement a zbuffer or something to allow me to perform hidden-surface removal on several objects (they can be displayed as it is, but without any sorting which looks stupid). But I’m currently converting the framework to 100% OOP so it may be a while since I made many of the changes while watching Denmarks match in Prague this wednesday, a good advice: NEVER implement anything important while watching football, you’ll make zillions of bugs:).