Forums > Jitter

How to "wrap" a texture around a mesh

January 10, 2013 | 7:56 pm

Hello everybody,
I started exploring using Kinect following this great thread:

I added a simple depth control, so I can just grab figures excluding the background.

But now I have a big doubt about textures and the jit.mesh object.
Let me attach an image to explain what I would like to do:


So, that’s me, grabbed by this patch:

– Pasted Max Patch, click to expand. –

trying to see the Mona Lisa "wrap" around my body, but actually just obtaining some sort of "masking".
And here comes the question: can I have the desiderd effect with Or should I try to follow a different path? Maybe But how to obtain the right controlmatrix starting from camera grabbing?

  1. Screenshot20130110at20.33.39.png

January 10, 2013 | 9:14 pm

What exactly do you mean "wrap" around? If you want parts of the mona lisa figure to map to similar parts of your body, you’ll need to match texture coordinates on the mesh with corresponding locations in the image. For example, for the eyes to match up, you’ll have to put texture coordinates over the vertices in the mesh where your eyes are that pull from the location in the mona lisa image where your eyes are. Since you’re moving in front of the kinect, this location in the mesh will change, so you’ll have to constant update the texture coordinate matrix accordingly.

January 11, 2013 | 9:44 am

Hello Wesley, thanks for your explanation.
Actually, I’d just like to see the texture resize around the body. So I’m making some (unsuccsessful) attempts to feed the mesh with the correct texcoords, but I still don’t get it.
Could this be a correct approach?

– Pasted Max Patch, click to expand. –

January 11, 2013 | 4:52 pm

check my reply to this post over here:

you can simply replace the live camera input with the kinect input.

January 12, 2013 | 12:02 am

I’m so sorry to bother you again, but it seems I’m not finding a way out.
What I’m trying to do is obtaining this kind of effect:

January 12, 2013 | 12:19 am

Ok. Sorry, I clicked on "Send Post" at the wrong time!

Anyway, I was talking about the "texture wrap" effect which I’m trying hard to obtain…. I’m attaching a picture just to clarify. It’s just a with an attached texture.
So, as I said above, I’d like to achieve the same effect on a mesh that has the shape of a body. Like having a big piece of paper wrapped around the body. As Wes wrote, I need to generate a texcoord array that changes following the movement of the body, but I’m still stuck on that. What I got so far (se patch above) is always some sort of "magnifying glass effect", in which the body reveals and deforms a static image.
If I understood correctly I should try to get the correct texcoord from the depthmap of the kinect, but I can’t get this part to work.
Please correct me if I’m wrong and forgive my stubbornness.

  1. Screenshot20130112at0.48.49.png

January 12, 2013 | 1:05 am

Yes, for each row of vertices you get from the kinect, you need to figure out where the body starts and put an x texture coordinate of 0. When you reach the end of the body, you need to put a 1 and interpolate in between. I don’t have a kinect, so I really can’t help by testing your patch. If you uploaded a matrix file containing the geometry that would make your patch testable by those who don’t have kinects.

January 12, 2013 | 11:17 am

Thanks Wesley, that’s a good clue for me.

By the way, I’m uploading a matrix for testing, and a slightly modified patch.

– Pasted Max Patch, click to expand. –

Thanks for your patience.

Viewing 8 posts - 1 through 8 (of 8 total)