Sunday, March 23, 2008

CLOD - Builder's Crack

Why put off something off until tomorrow when you can do it the day after that? I finally got around to doing Continuous Level Of Detail (CLOD), it was really frustrating trying to debug and I had a few restarts on the algorithm because it got so messed up (very handy rolling back with tortoiseSVN, SVN (best source control programs I've used) and unfuddle's free service).  Check out some of the mistakes along the way:

clodstrip1 clodstrip2 CLODv3

Here's what it looked like when I finally got it working. I've exaggerated when the level of detail changes just so the difference in polygons is obvious. Patches that are close to the camera (bottom right) are more detailed (showing more polygons) than patches farther from the camera (top left)... Shouldn't it be called Non-continuous Level Of Detail?

CLODworking

So why did I choose a pink background?  Well if you've been following fashion, you'll know that pink is the new black - this really held me up as I had to write a custom Color class which would swap colours around dependent on current trends. A handy side effect though is that it shows up the cracks that can occur using CLOD like the one on the top right:

CLODcracked

The cracks occur when 2 patches of different detail levels are beside each other, the more detailed patch has a vertex on the patch border where the less detailed patch doesn't. I'll have to increase the level of detail on any edge of a patch that borders a higher detail neighbour in order to *patch* up the cracks - get it??  See what I did there???

No comments: