Tuesday, December 25, 2018

fakin' spheres

There's an old edutainment toy Thinkin' Things Collection 2 - I cued that link to what I thought was the most interesting bit, wrapping bitmaps around spheres and cones and whatnot.

For funsies, I wanted to see if I could replicate the effect by (somewhat linear) taking a "view window" that slid across the square bitmap, then stretching it into a circle. The result, "sphereit", made an interesting visual effect but wasn't quite what I had hoped for... (in retrospect, too-cheat-y; the full width of each row gets stretched exactly the same amount, which isn't the case for a sphere.)


Also I made it MUCH harder on myself in solving the "what to do when the 'window' that we're using to map onto the front of the 'sphere' falls off the side" problem. The easiest solution would have been to construct a double-image offscreen graphic and slide the window across the center of that, resetting before reaching the edge. Instead I used two "windows" on a single-width bitmap, which made the math really tough to glue 'em back together at exactly the right proportions for displaying as a single thing. (I put back in a broken version at the lower right, since it was visually interesting.) Here are the notes I scrabbled onto my iPad to work it through.

I've always been interested in ways of faking 3D. One of the coolest I used in my 2012 Advent Calendar entries frostyspin and treemergent - I first saw the effect on a interactive exhibit at the defunct Boston Computer Museum - if you have enough particles following a simple rule of "if you're left of center accelerate to the right a bit, and vice-versa" a pleasing illusion of rotating depth soon appears. (Interestingly, there's nothing in the display that says "this is going clockwise" or counter-clockwise, and with some mental effort you can get it spinning the other way.)

Anyway, Happy Holidays to all!

No comments:

Post a Comment