Pages

Thursday, October 4, 2012

libNoise, OpenGL and George R.R. Martin

Hello

       I've been quite busy in the last weeks, but still had time to investigate a pair of libs:

When I was thinking in how to make a procedural generated map I saw simple-map-generation from Amit Pattel, so I knew I had to use a noise function generator, that lead me to discovered libnoise: it is a simple library that allows to generate noise maps, apply colors , generate height maps, and many other things!!:

<2d noise map loaded (left), and a zoomed window (right) >

After playing a while with it I knew my maps would be generated by 2D noise functions , first I loaded the map with standard SDL, and made a map explorer, with the zoomed map..

Then I tought.. what if those colored quads were drawn by OpenGL???

I was kinda afraid and excited about the idea at the same time...

Excited about all the things I could do with OpenGL...

Afraid because OpenGL meant start from 0 again .... So I got all the courage I had and told me myself... "If you are into computers you will be learning all your life"

So I started to read the "OpenGL RedBook" and after like 250 pages and failing a few times I finally got my color-map to load on screen with Opengl!



Well, it was just a bunch of quads, but you could just Imagine it is a map...

After that I loaded the height map too and made the "z" from the map depend in the height, so I got the first improvements:



But I didn't wanted to make a minecraft-clone... so I decided to make the quads based in the corners, not just floating quads...






I failed in my first attempt, but had a very fun land strips...



But finally made it! I was starting to get very satisfied with the results, but I wanted to make it smooth so I divided the quads into triangles:


It looked much better, but after I applied normals to all vertexes I got the look I was looking for:






Got it, finally!! , so resuming:

<A Map>

+


<An height map>

=

<A 3D map!>

A final Note: had a few hard weeks at work so many days I just didn't had energy to code, I have been reading instead George R.R.Martin book "A song of Ice and fire", and got pretty hooked to it, in fact I read the 3rd book (+-900 pages) in a week...

I'm still were do I continue now, any suggestions?

See you