2009-12-09

Projection mapping in 3d

Encouraged by previous results I decided to try to play more.
This time in 3D. By 3D I mean projecting on the object in such a way that it looks like you are actually projecting from different sides of it.

2D in 3D - Lets say we want to project a rectangle on one of the sides of a cube. It's easy when the projector is exactly in front of the target side.

If not then we will quickly observe a keystone effect. Simply speaking the image will be distorted.

How to overcome that? We just have to project image that looks like the projector "sees" it.

Ok. So now we know the theory let's talk about how to apply it in practice. All
I need is some way to distort an image so it looks like a "viewed from the side".
There is a Processing library for that,
vvvv patch,
or even specialized app called VPT (video projection tools).
Non of them allowed me to program my own visuals on arbitrary number of surfaces (and vvvv is Windows only...).
So I made my own Processing sketch which for defined number of rectangles displays handles in each corner
that can be dragged around to match target geometry.

Corner - As a first victim or my new projection I have chosen a corner in our studio.

!VIMEO,7630182,640,480

Cube - After some time I noticed an empty box lying on a desk, guess what I did...

!VIMEO,7630261,640,480

3D in 3D - is projecting 3D graphics on a 3D object. While it can be done it's quite limited.
The problem is that it looks good from only one point of view. As you can see on the image below
in case "a" when we are standing in front of the projected surface everything looks good.
We can get the feeling of depth and so on. But immediately once we start moving more to the
left or right and viewing angle increases the image becomes more and more flat - case "b". The last case "c" shows what would we expect.

I had one attempt to display something 3D but it wasn't very successful to I decided to spend my time tweaking my 2D code.

More examples? Look here or here.