Thursday, March 20, 2008

Seasons

I'm still avoiding CLOD, but the distraction I came up with was kinda cool so I thought I'd share. It occurred to me that I could create a neat seasonal effect if I play with the terrain texturing. Terrain texturing is a single texture made from a blend of base textures, the blend depends on the height of the terrain at a certain point and the height range for each base texture. Well, if we were to multiply each height by a factor when we're working out what texture to use so that the heights appeared to be bigger than usual, then we'd get a lot more snowy texture on the terrain (and vice versa for grass). I had to include a couple of extreme cases in the existing code (like if the height is higher than the max range of the snow texture, just make it snow) but it was simple to add the seasonal factor. Here's what the effect produced:

season1 season2 season3 season4 season5 season6

It's nice to watch the snow creep in over time, but it really slows the frame rate right down (to about 2 fps). I worked with Bitmaps in C# before and it seems to be about 100 times faster to lock the pixels and access them directly rather than use GetPixel and SetPixel. I'm also sure there are fancy hardware things you could do too.



If I keep up these distractions, the real-world season is likely to change before I get on with CLOD. Well, except here, it seems to be cold and rainy season indefinitely.

No comments: