lorimt: (Default)
lorimt ([personal profile] lorimt) wrote2009-08-07 02:07 am

Electronic funhouse mirror - or - Calling all ray-tracers?

I want to build a funhouse mirror. I even have convoluted plans. But first, I'd like to try out a few electronic tests. Specifically, I want to find/build/acquire some program that will let you specify the surface of a funhouse mirror (at whatever resolution makes suff work, but basically, a set of x-y-z coordinates), then give it an image that is assumed to be directly in front of it, and see the resulting tranformation/map.

Does anyone have any brilliant ideas? Ray tracing seems relevant here, but I know next to nothing about it. Any clues on where to get started would be excellent.

[identity profile] derakon.livejournal.com 2009-08-07 06:22 am (UTC)(link)
A little trig and a function describing the surface normal at any given point on the surface should be all you need. You take each pixel in the result image and backsolve to figure out where it came from in the source image (having some sane value for when the source pixel is out of bounds).

This is the kind of stuff we did in graphics in college, but I can't remember all the terminology involved.

[identity profile] kinejoshua.livejournal.com 2009-08-07 10:03 am (UTC)(link)
It would be pretty easy to code but, you know, you'd have to code it.

I'm pretty sure you could use a standard ray-tracer, like POV-Ray. It's got "height field" and "patch" objects, one or both of which you could use to describe your surface. Then you set diffuse reflectivity to 0 and specular reflectivity to something not-0, and tada, you have a mirror. Plop in your picture, a camera, and some ambient lighting, and you are set.

It'll be a bit of a pain to figure out, but such is the sacrifice for funhouse mirrors. (And I think it's the least painful route.)

POV-Ray Documentation: Objects (http://www.povray.org/documentation/view/3.6.1/273/)