Feature 2

Generating terrain wasn’t terribly hard. At first, I wanted to write my own generator, with an algorithm other than diamond square. I wanted a landscape that resembled mountain ranges more than rolling hills. I got about half way there. The issue was all of the mountains looked like long, skinny ramps due to the order of iteration. Solving this problem was a lot more time consuming than I felt was worth it, so I went back to the diamond square algorithm.

I made three changes to the script Chris made in his video. First, I am using ruby 1.8.7, and could not get 1.9.3 to install for whatever reason. This means I have no Random class. So I simply made calls to rand without using an instance of Random (first image). Second, I added default values for the size, max rand value, and decay factor (first image). Not a big change, but it saves you from a bit of typing once in a while. Lastly, I rotated the terrain so that horizontal plane is the xz plane as would be expected (second image). This required flipping the y and z coordinates for each vertex, and declaring the faces in a clockwise direction.

Using ruby 1.8.7 and defaults

Rotating

 

 

 

 

 

 

 

 

 

 

The render and shaders are a just the basic versions of what we have been using in lab.

Here is a short video showing one of the generated terrains:
[youtube http://www.youtube.com/watch?v=5LEDCBcKYq8?feature=player_detailpage]

 

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *