Project/unproject texture from perspective

Hey all,
I’m trying to “project” a texture onto 3D geometry in a realtime manner. Here’s a video of what I’m trying to achieve, this is is Lightact:

Ideally, I’d like to be able to do this in a way where I can overlap multiple projections–so I can have a foreground over a background. I’ve done a lot of research on this, but I suspect this technique is called something that I don’t know, so I haven’t be able to find it.

I don’t have access to the image you shared, but if I understand correctly, you need to map a 2d image onto a 3d shape, so that it looks correct from one angle but wrong / broken from other angles. (I could be wrong, just extrapolating on what you said)…

I’ve done this in the past by projecting the 3d shape to 2d – there’s a function in ofCamera called worldToScreen that gives you the 2d coordinate for a 3d point. You may need to manipulate this (I can’t remember if it maps directly to the screen or is normalized in some way) – but what I’ve done in the past is using a camera (typically ofEasyCam) I take the vertices of a mesh, project them to 2d, then use that to get the UV position in the texture. then I add uv coordinates to the mesh as texture points and draw it again in 3d but using the texture.

here’s an example using a webcam, and you’ll notices there’s just some angles where the 2d looks correct