Thursday 2 July 2009

Terrain part 1

... so, I'm fiddling with xna a bit. Trying to implement some good-looking terrain. I was inspired somewhat by Shamus Young's blog, which led me to this paper, and I set about implementing the algorithm described therein (I'm a sucka for this sort of thing - one day maybe I'll tell you about the time I implemented a lossy networks algorithm from a PhD thesis!).

I've got it sort of working. Here's a "naive" implementation with no clever algorithms (btw, the numbers at the top are frame-rate and number-of-triangles respectively):





Here's a couple of images at two different levels of detail. The algorithm is building a triangle strip dynamically (you can see the arrangement of the vertices is different to the picture above - that's because it's a quadtree in the algorithm, which leads to a different layout).









Now we get to the next point where the algorithm determines which vertices to include, and builds a (potentially complex) triangle strip:




Then I tried to implement the view fustrum culling part ... it isn't quite working:





I may pursue this further if I have some energy, but I think it's probably not the right route to go for a game anyway ... this algorithm runs every frame, regenerating a fresh triangle strip each time, which is probably overkill for a standard game. I'm going to explore some other options next, I think ... watch this space!

No comments:

Post a Comment