Monday, October 8, 2007

Subdivision curve planet

My week of vacation was a bit of an adventure. An old friend of ours went into labor five weeks early so we took care of her three-year-old for a night. Nobody slept much that night. After that I caught a cold.

Overall it was a good vacation, though. I put together a tricycle for my daughter, read some books, and got caught up on a lot of backlogged household chores. We also spent time with our new neighbors who also have a two-year-old daughter.

I did some computer chores as well. I'm going to give Windows Vista's backup system a try, and back up my work to my external USB hard drive once a week. The old computer is almost back to normal with its new hard drive; we've been installing stuff on it. My notebook computer had some divergent versions of my projects due to my switch from version 7 to version 8 of Visual C++. I've been reconciling and consolidating those.

Early in the week I did some work on terrain modeling. I had been thinking about using subdivision curves, and I wrote a test application that generated a random “planet” out of them. Since the world is two-dimensional the planet consists of a single polygon. I implemented scalar-valued creasing, so the vertices in the control polygon each have a hardness ranging from zero (completely smooth) upward. Basically, if a vertex's hardness is n, it will be not be smoothed for the first n subdivision steps, and then it will be smoothed for all steps thereafter. Fractional values are handled by blending the smooth and hard solutions at the transitional subdivision level.

Here's a screenshot:

The control polygon is drawn in faint gray; you can see it on some of the smoother corners.

Ultimately, though, I decided it's not time yet to make a terrain editor. I really need to focus on basic gameplay and functionality right now.

No comments: