November 30, 2009

Lightmaps and Vertex Buffer Objects

I spent some time familiarising myself a bit more with multipass rendering. I set up a very simple test application where I could do live editing of the major settings and see the effect.

This had a quick win: I figured out that my equation for blending in the lightmaps was wrong. The screenshot above shows the right settings (with the top for the base texture, and the bottom for the lightmap). The screenshot below shows the result when applied to a Quake level.

The scene is much more vibrant now. I think this is how it should have looked from the start. But it's hard to find this kind of information online. It really takes some experimenting to figure it out.

I also put some work in improving the performance. I figured that switching from vertex arrays to vertex buffer objects should be a smart thing to do. This way I could upload the scene data to the graphics card just once, and reuse it as needed. No more continuous streaming of vertex array data. Everything is reduced to a bound id and an offset.

The result isn't bad: an increase in fps of about 50%. So where I got 100fps before, now I see 150fps. In some locations that goes up to about 200fps.

Next I should really do some cleanup of my code. All the hacking and experimenting has degraded the quality somewhat.

November 25, 2009

Lightmaps (ctd.)

I tried to improve the framerates for lightmapping by going for a multipass rendering setup. And it seems to have worked.

Rates are up from about 5fps to around 100fps. Not bad for a multipass-newbie.

But it could be better. I'm thinking 200+fps should be reasonable for simple lightmapping. So the experimentation continues.

All tips are welcome. :-)

November 22, 2009


I got lightmaps working. As you'll see it's very pixelated. I need to set the right texture filters to fix that. It's also very slow, but that's because I'm (again) throwing too many texture switches at the graphics card. Need to fix that as well.

November 17, 2009

Another copy-paste victim

Seems I forgot to remove the following from my code:

try {
} catch (InterruptedException e) {

This also nicely explains the five fps I was getting. :-)

Aaaaaaanyhoo, framerates are obviously up. Seem to be ranging from 150 to somewhat over 200 depending on the part of the scene you're viewing. Quite pleased with that. This gives me a good base to work further from. On the todo-list: lightmaps, patches (the Bezier kind), and fixing the geometry and UV coordinates (Quake 3 BSPs use a different coordinate system from OpenGL).

November 16, 2009

Still got the BSP bug...

so I'm trying to make the most of it.

Here's the story sofar. I'm walking the BSP tree and am using frustum culling to prune the tree down. I'm also using bitmasks to prevent against double rendering of faces. And I'm grouping faces per texture to cut down on texture switches.

The result: the framerate is quite steady, but it is steady at a very low number: just under five fps. This is despite the aggressive culling I have been doing. I just did some profiling and even when drawing only fifteen faces, making use of four textures, my framerates won't cross the five fps border.

At this point I'm thinking the problem is not with the BSP rendering. I'm thinking the problem is with the textures. I remember doing a simple skybox once (that's just six quads, each with one texture) and it was slow even then. And that was just a silly skybox...

If it is the texturing I don't have any immediate ideas on how to fix that. So I think I'll start with trying to verify if it is indeed texturing that's to blame. But given the minimal amount of vertices I'm pushing I don't see what else it could be.

Update: Well, disabling all texturing in the level doesn't help. My framerate is only marginally better, but still no five fps...

November 11, 2009

BSP Rendering (now textured)

With some more work I now have textured BSP levels going. Take a look.

No lightmaps yet. And the psychedelic colours in the previous post were still an error made by me. The real colours are much nicer.

The current rendering is slow as hell (not fps but spf, if you catch my drift). That's mainly because I'm not using the visibility information yet to cut unnecessary clusters. I'm also being quite liberal in switching texturing on and off, and not caching any of the textures. So some obvious improvements to be done.

But that's for another day.

November 10, 2009

BSP Rendering

Yeah. I think I'm doing something wrong. ... lol :-)

Update: well, the vertex data seems correct, at least. I'll need to check that I'm using the correct mesh definitions.

Update: the face data is also correct. So I'm probably doing something wrong when trying to use vertex arrays...

Update: figured out my problem. I was using the "firstVertex" value as if it were a byte offset into the vertices, when it was really saying "the n-th vertex". I.e. I had to multiply it with the size of a vertex to get the real offset in bytes. So now it's looking much better... except for the psychedelic colours. :-) That's not a mistake though. I'm just not using the textures yet.

PS. This tutorial is quite helpful if you're considering of trying this for yourself.

October 31, 2009


I found this game through a review on Ars Technica. The visuals are stunning:

I bought it. It's about 16 euros, and for that you can download a Mac, Windows and Linux version, and you get the soundtrack in mp3 format as well. No registration codes or DRM of any kind, so once you buy it you can install it on any machine you have without hassle. Super!

Ah yes, the gameplay. It's actually a very nice game. It's all puzzles, of course, but they're never intimidating. Plus you always get one free hint in each area, and if that doesn't help you there's a walkthrough as well. The temptation of using the latter is dampened by the fact that you have to beat a small sidescrolling shooter before you can access the solution to that area.

It's not always perfect though. I have hit on the right solution on a few occesions, only to see it fail because I wasn't necessarily standing in the right spot. Sometimes a meter to the right or left makes all the difference.

The story is very simple and nice. The way it is told is also quite unique. It makes for a very strange yet endearing atmosphere. Even though it's all about robots you find out they have emotions just like the rest of us. These Tin Men have hearts already. Well, most of them.

Anyway, lovely game, and well worth the time.

October 10, 2009


I just released a new project on Sourceforge. It's something I have been working on quite a bit over the course of the past month or so (I had plenty of time while being unemployed ;). The project is named Skribler, and it is part structured editor, part framework for setting up a structured editor for domain-specific languages.
Skribler has two related goals. One is to make it easy to define custom domain-specific languages. The other is to get rid of the need for parsers by persisting the abstract syntax trees, not the source code. It is the latter which really started this work. It's really a very simple idea, and I don't know of any editor which takes this approach.
Below are two screenshots of Skribler in action. You'll probably notice the highlights on the text: this indicates the selected element and what you can do with it. It is the whole point of a structured editor that you can only do things which don't invalidate the structure.

Right now there are two languages defined in Skribler. One is a pure demonstrator based on Martin Fowler's Record Configuration language from his Language Workbenches article. The other is a lite version of WASA Templates, which is a high-level language for defining webpages by combining small templates. Skribler allows you to define the template composition, and has a basic compiler which then performs the compositions as specified. I'm using this right now to build a new personal website, and it's quite usable. Yes, I'm eating my own dogfood here. :-)
Anyway, it's alpha software, very much in the prototyping stage, and I love it! I welcome any feedback if you tried it out, as well as comments on the ideas that are behind it.
PS. If anyone is looking for a software engineer in the region of Aalst, keep on looking. I'm off the market again; starting a new job next monday. Jay!

September 23, 2009

Web = Random Acts of Kindness ?

I love this guy's take on the web. Doubly so because it's actually an optimistic view coming from a *gasp* lawyer... As usual, found through TED.

September 17, 2009

Cambrian Games

Cambrian Games is a very cool blog by Abraham Parangi. Games, graphics and ALife. 'Nuff said. Go check it out!

September 13, 2009


While on holiday in the Dordogne (go figure) I added a small animation framework to BlueSG, and here is a screenshot (which, I know, isn't animated) of it in action:

These are 512 animated fish (imagery courtesy of Lost Garden), and they are swimming at about 45fps. That may not be much, but for the simplistic thing that it is, this is fine. It is also more than enough for my current needs.

PS. If anyone in the region of Aalst is looking for a full-time software engineer, feel free to contact me.

August 29, 2009

Sustainable code

I have found the First International Workshop on Software Research and Climate Change an intriguing combination of topics. It's a workshop asking what software research can contribute to the challenge of climate change.

There are certainly a number of things we can do, but I can really only come up with supporting tasks. I was hoping there is something more fundamental to be found in software research.

Here is a point against this hope: the fact that all software seems to expand to consume the available resources. And when the machine is no longer able to keep up we simply ask for a new and bigger machine. After all, there will always be a better machine right ? (Thank you, Moore's law!)

In terms of climate change this is similar to saying that we let the system grow until it consumes all available resources (air, water, food,...), after which we ask for a new and bigger Earth. After all, there's always a better Earth, right ? Right ? Erm, wait...

So one solution to the climate change problem lies in finding a way to double the Earth's resources every 18 months or so. I'm guessing that's going to be a tough target to hit.

The really interesting question to me is how to grow software without it outgrowing the machines it's on. If we knew the answer to that we would not only improve the overall state of software, but we might actually have something essential to contribute to the problem of climate change.

Sustainable code, it's a great idea.

Anyone know how to get there ?

August 26, 2009

Dan Pink on the science of motivation

I found the following talk through TED. It's a case made by Dan Pink against sticks and carrots. And it's based on actual science. Warning: this may start you questioning what you think you know about motivation (which is, of course, the whole point).

Dan Pink owns a blog, which is a fun read. Given his postings of XKCD and Dilbert comics I somewhat suspect him of being a geek.

PS. If you're not following TED: shame on you!

August 24, 2009

Nerds, Jocks, and Lockers

I love the story behind this math teacher's challenge. I heard a different version of this where it was a guard doing rounds and toggling the state of cell doors. The question at the end was how many convicts could just walk out after the guard had finished his rounds. I actually turned this into an exercise for first year students of the course "computertechnologie" back in my predoc years at Ghent. The catch was that they had to code up the algorithm in Motorola MC68000 assembler (most did a great job too). Yup, fun times.

August 07, 2009

First go at Rhonda

I talked about Rhonda in a previous post, stating that I couldn't wait to get my hands on it. Well the Rhonda developers must have been listening because they released a first beta shortly after. Before I get to my impressions, here is a quick model I made using the beta:

Okay, so it's not exactly worthy of the museum, but it was a nice initial test. And my impressions after making it are these: Rhonda is fun, but not as intuitive as I had hoped. The drawing part is very straightforward of course, especially if you're using a pen tablet. The problem is positioning your model in such a way that what you draw ends up in the right place and adds to the model. The control scheme for doing that is, sofar, not nice. My model never seems to twist quite the way I want it to. And once you have drawn more than a handful of lines they start hampering your visibility.

All in all I feel that (so far) Google SketchUp is quite a bit more straightforward to use than Rhonda. Here is a model I made in SketchUp:

But then again, this model has no organic shapes to it. I wouldn't want to create a model of a tree in SketchUp. For such things freehand drawing still seems like the way to go. So I'll experiment with Rhonda some more, and will definitely be trying the next beta. But dear developers: please give me better control over my model !

The really big question at the end of all this though: can you somehow take your freehand model and generate a solid one (i.e. with surfaces) ?

August 06, 2009

Koopa Cobol Parser

I just uploaded the very first release of the Koopa Cobol Parser project on sourceforge. You can find the website for the project here.

If you're wondering "why?", then this project probably isn't for you. A short answer is that there exist no free, extensible, adaptable Cobol parsers which are able to handle real legacy Cobol code. Koopa tries to fill that gap.

While it is still very much an alpha release, there are some redeeming features:

  • It makes extensive use of unit testing at the level of individual grammar rules. This helps with quick, detailed detection of problems.
  • It includes an ANSI 85 testsuite, which it is able to process quite well. There are some failures, but these are quite reasonable.
  • It has been run on over 1.5GB of industrial Cobol code, and again performs quite well.

So if you're looking for a no-strings-attached flexible Cobol parser, give Koopa a try!

PS. If you're wondering about the name, the thought process went something like: Cobol Parsing -> Co Pa -> Koopa...

August 03, 2009

Why marketing is too important to be left to the marketing department

“If you’re going to interrupt everybody with an ad, it better be something everybody wants to buy. So what do you end up with? Average products for average people.”

Yes, this is software related. This talk by Seth Godin can only be classified as +1 Insightful. Definitely worth watching. (Found through joelonsoftware, another worthwhile blog.)

July 23, 2009


I found the following through the Procrastineering blog:

What you see here is Rhonda, a 3D modeling tool which makes use of freehand drawing for defining geometry. And I want it! I'm good at drawing, but can't get my head around 3D modeling. Well, I have done some architectural models, but I fail epicly with anything organic. Something like Rhonda seems like a way of getting around this problem by leveraging something which I do know how to do.

What the video doesn't show though, is whether you can go from these wireframe impressions to real solid geometry...

July 14, 2009

0 A.D. going Open Source

From the announcement:

0 A.D. is a free, real-time strategy game currently under development by Wildfire Games. It's cross-platform, 3D and historically-based. Wildfire Games is switching from a closed development process to open source, making the game's code available as GPL and the art content available as CC-BY-SA.

More info can be found here.

This is a very nice development. If they keep/make the engine scriptable enough this could also become a platform for other kinds of games (RPGs are an obvious choice). Definitely one to keep an eye on.

July 12, 2009

Meta Mindy Time

The following is based on a small pun which got started at an office meeting. It's Meta Mindy! ... This will likely only be funny if you speak Dutch, know something of Belgian shows for kids, play Magic The Gathering, and have some affinity with meta programming. Not likely to be a very big demographic, I suspect...

June 02, 2009

Ysaneya's galaxy

When I'm not working on my own blog —which, let's face it, is most of my time— I read some blogs by other people. One of them recently had something which I can only characterise as impressive. Take a look at this. This is a post by Ysaneya, who is working on an MMO space game, Infinity. His posts are almost always impressive, but when it comes to a procedurally generated galaxy... wow.

Be sure to check out the Youtube video as well!

May 13, 2009

Crimson13 joins the blogosphere

Check it out here. It contains Lisp, Quenya and neural net geekiness. Yay!

April 01, 2009


Priority number one for my spare time these days is getting the house in order for our new-to-be inhabitant. So please forgive me if I'm not doing anything interesting codewise. I have plenty of ideas floating around, the most important of which will build further on BlueSG. I just don't have the time/energy to do anything about them.

February 14, 2009

BlueSG: now with zoomable Swing components

I spent some time figuring out how to get Swing components to show correctly in my scenegraph, with correct translations and scale. Last time I showed you that I could include Swing components in my scene, but that scaling them only scaled their bounds. Their contents remained at the same size.

Well, I got that fixed (be sure to compare this to the screenshot from the previous post):

The solution involves installing a custom RepaintManager, and doing some AWTEvent capturing and forwarding. It's all very tedious, but once it works it's quite fun to see the effect. There still seem to be some imperfections, but most of the components I tried (I tried several of varying complexity, though by no means all) now work as expected. Even when scaled.

The result is that I can now leverage the existing Swing components in my scene, without having to reinvent them.

January 04, 2009

BlueSG: a basic 2D Java SceneGraph library

I've been spending some of my holiday time setting up a basic 2D scenegraph library for Java. It takes Java 2D graphics and adds a layer for easily setting up complex hierarchies of assets (bitmaps, text, etc.). Here is an example:

Sofar it supports arbitrary positioning and scaling of text, shapes, bitmaps and Swing components. The Swing components don't scale in the real sense; that is, only their bounds are scaled, not their contents (due to not knowing how to get that done correctly).

There exist some similar projects, but none seemed useful to me. There is, of course, Project Scene Graph (back-end of JavaFX), which I once tested at work for doing code visualisations. The conclusion then was that its performance was abominable for anything non-trivial due to the way it handled updates of the scene graph. More interesting is PulpCore, but this is targeted at applets. I tried hacking it into Java apps, but it was too much tied to browser contexts. Processing is another tool for setting up interesting visuals, but it doesn't provide something at the level of a scenegraph. It also uses its own programming language targeted towards graphics programming, which is nice but which could confront me with a language integration problem at a later time.

I, of course, have something in mind to use it for, but that idea is still in the design stage...