Så oskyldigt

Another political song, once again — surprise, surprise! — directed mainly against the People’s Party in Sweden (surprise, surprise! ^^ /skymandr). The leader of this party is currently in charge of educating our kids, and he hardly had time to put on his minister hat after the recent election before he started his campaign to make primary school education more similar to what it was when his ideology was really in vogue — the 19th century.

The melody is perhaps not as well known as the one in the previous songs. It is “Balladen om dagen efter” by Bengt Sändh, which I cannot find on YouTube, but there are CDs with this melody (I have one), so it is available.

Unlike the other songs, however, this is written together with S. I wrote one verse, and challenged him to write the next, and so on.
Continue Reading »

Scientists in virtually every field are repeatedly inundated by popular science. Continue Reading »

Lately I’ve been preoccupied with typography, which lead me back to cartography. I’ve been meaning to make touched up versions of the maps I made of Anarres and Urras last year, and so I started looking for tutorials for Inkscape and/or Gimp and came across the brilliant Cartographers’ Guild. More specifically, I came across a very nice tutorial (updated version here) by Rob Antoishen. The result, after an afternoon’s work, was this:

Anarres, azimuthal equidistant projection of both hemispheres; digitally remastered.

Another rendition of Anarres. Continents are lined up at the equator, but unfortunately I used an old version as template, so the Northern parts don’t line up. Too late to do anything about that, though. Not too fond of it, too be frank.
(License: CC:By-NC-ND, with caveats as stated below.)

For several reasons, some of which are mentioned below, I’m not very fond of it, and therefore I’m putting a CC:By-NC-ND license on it: feel free to share it (mentioning me and Ursula K. Le Guin as the originators), but please don’t base any derivative works on this version of the map: use the versions from my previous post for that!

Continue Reading »

A very small update. I decided to take a few days off from coding, instead spending them digging, swimming and drinking beer (all both in game and IRL). I hope to get back on track again, but we’ll see. There’s a bit too much pollen in the air for any sort of major commitments. Speaking of commits, my friend Bam decided to make me socially awkward by cloning my repository, implementing a benchmarking suite and then requesting a merging of the two repositories. All in all, it wasn’t too bad, and since he’s a very competent programmer, his contribution (and praise) was appreciated.

Since the last update, I’ve implemented the simple linear fader, which perhaps gives even more predictable results than Gaussian. I also toyed with the light settings, but I’ve sort of concluded that I like it best when then light follows the camera precisely, though I may tweak that a bit in the future. Most importantly, however, I’ve made a new ship, which while being (I hope) a clear homage to it, isn’t just an imperfect clone of the Zarch/Virus Lander:

New ship trying to do an Immelmann and over-compensating...

New ship, and slightly updated house model. Click for full-size! (CC: BY-NC-SA-2.5-SE)

The new ship is red, to reflect its designation as a “Fire Fighter”. I tried giving it stripes, but I didn’t like the look, so I reverted to the more simple design. The house has also been updated slightly, by dividing the faces into more triangles (4 per rectangle rather than 2) which gives it better sorting and shading properties.

Some more progress today:

  • The colours now fade to black with distance. After much discussion with my friends who work professionally with 3D graphics, I implemented a function neither of the suggested, but that seems all right to me, namely, Gaussian luminescence. This has the property, that the lighting stays roughly constant near the camera, then gradually decays to zero further off. There are many ways of doing the same thing, but Gauss is very convenient to me as a physicist, since it has a well defined scale to it which can easily be tweaked (the physicist in me chooses not to think to much about the fact that the light should really fade like 1/R²…). I also tweaked the light source to have a very faint red hue, but it’s very subtle.
  • I’ve implemented rotations for the objects (and refactored that piece of the code since it was becomming stupidly redundant). This means that the engine is now visible! I’ve implemented the rotations by using explicit rotation matrices, which is what I know and understand, but its probably not very efficient compared to quarternions. If, at a future stage, this appears to be a performance issue, then maybe I’ll have to learn about those…

Next on the list are (in no particular order):

  • Depth culling
  • Better object sorting
  • Controls (mouse + keyboard)
  • More objects
  • Shadows
  • Particles
  • Variegated ground

But that’s all for another day!

Lander-craft  doing aerial acrobatics. The small house has turned and repositioned to have a better view in the dimming light.

Lander-craft doing aerial acrobatics. The small house has turned and repositioned to have a better view in the dimming light. Click for full-size! (CC: BY-NC-SA-2.5-SE)

Guess what? It turns out, that rather than being trivial, sorting is one of the main problems in 3D graphics. The landscape renders ok, as long as the camera is not too low, it should be fine due to its ordered nature (small angles between neighbouring patches), but when it comes to more complex objects it becomes a hassle. There are no simple solutions, and no elegant ones, so I nearly gave up on it, until a friend (who is soon a Ph.D. in 3D graphics, and yet was kind enough not to laugh out loud at my dabbling in his field) pointed out that one can choose only to render surfaces whose normals point toward the screen. That is simple, it is almost elegant, and it solves much of the problem if care is taken when constructing the objects. Three cheers for science!

Below, you can see a picture of the “Lander-craft” (our hero-to-be) hovering over a landscape with a small house. The landscape is generated from data generated using pseudo-random sine waves, by way of an extremely circuitous route involving FFTs, binary morphology, and a lot of heuristics. Unfortunately, the engine of the craft is not visible in this view. Not that it’s visually very impressive, but I had to work quite a bit to get it to “stick” through triangle sorting… The next job is to make the demo interactive and implement some sort of dimming of the light with distance, neither of which should be too hard either…

Lander-craft (our hero-to-be) hovering over a landscape with a small house.

Lander-craft (our hero-to-be) hovering over a landscape with a small house. Click for full-size! (CC: BY-NC-SA-2.5-SE)

This post is a follow-up to the previous post on 3D rendering. I thought I’d made enough progress to warrant a new post. The landscape is still the same, but I’ve now implemented a “patch” renderer, where the ordered set of points in space combine to create square (in the xy-plane) patches. If these are above the sealevel, they are flattened and given a blue colour, whereas if they are above it, they are given a green colour. The base colours are then shaded by a simple light scattering algorithm, based on their (approximate) normals’ orientation with respect to a light source, which in my example follows the camera.

The sea is treated in two different ways, depending on whether the “flattening” is performed before or after the normals are calculated: in the first case, the result is a sea with a fairly uniform blue, whereas in the second case the structure “beneath the surface” shows in the colour of the “waves”. Both versions have their merits, but final judgement will have to be made when I’ve seen how it looks when the camera is closer (the intended view for the eventual game is 12 * 9 patches on screen, while this scene is 64 * 62 patches). For this zoomed out version, I’m inclined towards the flat sea.

Continue Reading »


Get every new post delivered to your Inbox.