Terrain generation using Perlin Noise and fractals

Why a terrain generation demo? Well, for several reasons:

  • Our image synthesis classes won't start before some weeks and I wanted to give it a try.
  • My portfolio doesn't include a single 3D app since I found my way only recently.
  • I'd like to find an internship in graphics programming, in another country, i.e. in the next two months (see previous point).
  • C'mon, procedural generation is FUN :D

A month ago, I developed a first version of this small application. I used the SFML - after recompiling it - to create the window and an OpenGL context. Then I implemented heightmap generation by "stacking" several layers of Perlin Noise, fractal-style (looks like it's called a "fBm", but I wouldn't venture into defining a term I don't fully grasp yet).

Generated heightmap

The resulting pictures looked nice, so I moved on to the next step: 3D! One vertex per pixel, y-coordinate function of the greyscale value of the heightmap...

Wireframe terrain

Finally, using this tutorial (in French) as a basis, I generated a texture from three input images (grass / rock / snow), blended according to elevation.

Textured terrain

Some filtering now, maybe?

All this took me about one week. I then added some simple keyboard / mouse nav (antigrav-FPS style). The next step was to make the whole thing more usable by adding a GUI. You can read here that the first step, picking a library, wasn't exactly a walk in the park. I settled on gtkmm, which looked very promising...

...until it turned out that there was no way to create an OpenGL context without making the widgets disappear. I tried using the SFML (using this code), and not using it, no way: the context always seems to take hold of the whole window, instead of just its part. After a whole day trying to fix this, I had to resolve to a simple, hacky solution: two windows.

During three weeks, I added functionalities one by one. First, heightmap generation:

Generation tab

Then terrain geometry:

Geometry rendering tab

Then texturing...

Texturing tab

...and lighting.

Sun lighting tab

I won't explain every single button or slider here, that would take a while ;) I'll make the app available, with a readme. I'll also make the sources available even if they're not very interesting (verbose GUI code).

The nuts and bolts of this program are gtkmm for the GUI, SFML for the OpenGL context, two simple shaders, and a VBO (after someone told me displayLists were a bit outdated :D).

I plan to add a proper sky, maybe with some clouds, and a pleasant horizon, either by generating over a larger range or using the hack of this talk (which is: mirroring). Oh, and fog as well. But for now I have cover letters to write and a portfolio to fill :D

EDIT: You can read more about this and find the files here.

Let's shoot at Wheel of Time

Since writing only about tech could get boring, and because this series annoys me more and more with each page, this is my completely non-objective opinion about the book series Wheel of Time. I'm only 80% through the second book but I've already had more than enough.

[SPOILER WARNING] I'll go rambling guns blazing about a large part of the first two volumes, so here be many spoilers ;) [/SPOILER WARNING]

First a quick recap about the world (which is actually quite interesting). I'll spare you the theological details, but in this world is a One Power, split in two halves: yin and yang, male and female. Due to the evil deeds of the Dark One (sic), the male half has been tainted and turns every man wielding the power crazy. These men are then hunted and "gentled" by women using the power. When our story begins, the Dark One is of course breaking free from his seals, and the world can only be saved by the Dragon, which is born again and again since the beginning of the world to fight against darkness and save the world. But well, he's a man, so he will of course go mad and cause some trouble (how nice does "Breaking of the World" sounds to you?). So the world thinks he's actually on the Dark One's side.

And the world lives in fear and hope that the Dragon will be Reborn.

Let's begin. Here is our hero, Rand al'Thor. Please note that "al" is a particle usually found in noble names, how funny is that? Of course he's tall, handsome, smart - well sort of, as we'll see later on - and loves reading, and he fences great as soon as he gets a sword. He doesn't live in an ordinary family, as he lives alone with his father, in a farm away from the village, blahblahblah. Not exactly original. And yeah, before I forget, he's the first character we meet. And the Dragon Reborn (told you there were spoilers). I could deal with it though, if there was nothing else to blame.

Our next target is... female characterisation! Yes I know that's a recurring one but here are the four female archetypes you'll meet:

  • goodwives: housewives, inn owners and more, these are strong women but wholeheartedly devoted to their household.
  • maiden: even if they have only had a short glimpse of Rand, they's obviously already in love. We'll come back to this.
  • Aes Sedai: women wielding the One Power. Of course they're seen as scheming witches by the rest of the world.
  • Aiel Spearwives: very strong fighters, wholly devoted to fighting, won't live for nothing else, etc.

Am I the only one seeing something wrong here? A world in which a woman can only be a goodwife or have powers making her hated and feared is a little oversimplistic to me. "But Aes Sedai are strong women!", will the naive reader object. No. If every single powerful woman is feared and hated, something's deeply wrong with the "strong woman" image. And if that's not enough to you, Aes Sedai belong to different orders ("Ajahs"). The Brown devotes itself to pure knowledge and cuts itself from the outside world. The Red hunts men using the Power and gentles them (that's as good as killing them). The Green likes men though. A "green" Aes Sedai is said to be surrounded by several men (unless she's MARRIED, of course).

C'mon. Indifference, hatred, polygamy or wedding? Is there really no other relationship possible between men and women, saner and more flexible? M. Author, this is really disappointing.

But I had said I would be coming back to the maiden. Here are the most important ones:

  • Egwene, childhood friend of Rand (which of course always assumed she'd marry him). She eventually discovers that she is extraordinarily gifted with the Power (what else), but she still cares a lot about Rand and even has foretelling dreams about him! How cute.
  • Min, a tomboy which our heroes meet in the first town they cross. She sees things about people, as symbols even she cannot interpret. Could be interesting, though a bit cliché. If she hadn't had a crush on Rand at first sight.
  • Elayne, daughter-heir to the throne of Andor. She has only seen Rand for a moment when he fell down a wall - long story - but of course she cured his wounds and felt her heart melt.
  • Nynaeve's the exception: former Wisdom in Rand's village, she is extraordinarily gifted with the power (none for centuries and now two in the same village? Coincidences are so funny). Since she was raised to Wisdom-acy very young, she's very motherly (though severe) to everyone in the village, especially Rand and Egwene. But wait, she's desperately in love with the warrior travelling with them!

And guess what's the first information about every one of these characters? "Very pretty". The rest's not worth commenting.

So now to our stupid hero. Yes, stupid, really. In the middle of volume 2, he ends up in a parallel world - long story, again - though involuntary use of his power. And he meets a young woman...

  • about his age
  • described as gorgeous
  • with alabaster skin
  • very knowledgeable about this world and more
  • mysterious
  • speaking as if they're meant for one another
  • ...

It's already ridiculous enough. But the worst if that Rand TRUSTS her immediately, without a care in the world. I don't mean she HAS to be a traitor: but were I Rand, I certainly wouldn't trust her that quick. And if he's mesmerized by her beauty, the writing doesn't reflect any of it. Only teenager excitement in front of pretty flesh.

Should I continue? Ogier women tricking men into marriage they have no interest into. An army from the other side of the ocean putting Aes Sedai into leashes. Egwene, Min and Elayne chatting merrily about which one of them will marry Rand. And so on.

Wheel of Time has an interesting universe and nice, original ideas. But the writing is very poor, the hero is flat at his best, and the sad and grotesque depiction of the women make me sick. It's not about keeping women in secondary roles, as is often the case: it's much more insidious, and probably not even on purpose. It's about making them either lacking power, or being hated. They have no other options. So no, I won't read volume 3 and the following ones, even though I'd like to know how it ends. My values run too deep.

EDIT: Well, done, I've finished it. And guess what? This beautiful lady IS evil. How unexpected. I'd also like to add that these books are not "bad". Just very mild average in my opinion, and not worth my time. The story remains enticing despite being cliché, and even if the writing is poor I've seen worse. Still, I wonder why it's such a reference.