Saturday, February 21, 2009

Fishy Terrain

Not all is well in 3D land.  I've been trying to get into DirectX programming for a few days now.  More accurately, I've been meaning to get into it for ages but until a few days ago I never put in any serious effort.  With XNA & Game Studio 3.0 (which is really a misnomer since there's not really anything particularly gamey or studioy about it), things are a lot more organized than they used to be.  Five years ago my only real choice was to use C++ and access DirectX directly.  Boring.  I hate C++ because it over-complicates even the simplest of tasks.  It's also not appreciably faster for most tasks than the generic .NET framework is these days.

Enter my recent progress.  I started by ripping the art assets from a Microsoft terrain tutorial and re-wrote the game engine in my preferred language:  VB.NET (3.5 pref, but anything 2.0 or newer is fine).  It ran great and I was excited to expand.  Unfortunately, everyone is eager to give away art but not explain how it can be produced, so I had to quickly abandon the thought of creating a bigger terrain mesh, etc.  Instead I've had to rely on generating terrain meshes based on programmatic means.  Today marks my first successful result:  Using a PNG as a heightmap, I've created an engine that will generate a grid and apply the height information from the image.

As you can see, something is awry.  Theoretically, this is what should be happening:
- Grid of points on the X and Y axises with Z info from bitmap
- Two indexed triangles created from each point (excluding the last row and column of points)

While I'm certainly getting terrain, it's haphazard.  Instead of smooth hills I get something like SimCity 2000 where everything looks like it is terraced.  Very fishy...hopefully I get this ironed out soon.

No comments: