Log in or register to post comments

Plane geometry texture from camera feed

January 3, 2013 - 2:19pm #1

Hey guys,  thanks for all of your amazing work for us.

 

Quick question - do you have any pointers on how best to apply a "live" texture to a plane.  I have a project where I'm flipping around the markers into the table to give the effect that I'm altering the real world and I'd like to avoid having to have pre-tectured planes in the application with the markers for the effect.  IS there a way to snap shot the cmaera feed and use it correctly as a texture for a plane's texture just at the size of the marker so the marker and be virtually altered without a preinserted textured plane?

 

Hopefully that made sense and thank you.

I tried to do the same thing

February 7, 2013 - 4:27am #6

I tried to do the same thing before but I found that GetPixels is quite slow. It is probably faster to use the render to texture feature of unity and then play around with the uv mapping.

Have a look at UCS (example at the end of the clip below) where I included a shader which uses this effect albeit with a live camera texture instead of just one frame. But if you copy one frame of camera texture using render texture it should give you the effect you are looking for.

http://www.youtube.com/watch?v=Uef8FFNA-F0

at 4:07

Here is an example from Vuforia which doesn't use Unity but native OpenGl:

https://developer.vuforia.com/resources/dev-guide/camera-target-patch

Edit:
Got this to work. See here:

https://developer.vuforia.com/forum/general-discussion/camera-pstch-unity-3d

Nice!

January 4, 2013 - 10:35am #5

Ok, great approach.  Thanks a ton - go back to doing awesome things with Vuforia and thank the team for me. (sorry, was logged in with another account)

So you need to extract the

January 4, 2013 - 9:43am #4

So you need to extract the pixel region that matches your target image in the frame? If so, you should be able to project the target's boundaries (e.g. corners ) into screen space and then use Texture2D.GetPixels to obtain the pixels corresponding to your target. 

See:

http://docs.unity3d.com/Documentation/ScriptReference/Texture2D.GetPixels.html

http://answers.unity3d.com/questions/352738/gameobject-width-in-screen-space.html

http://answers.unity3d.com/questions/12507/rendering-a-portion-of-a-texture-using-guibox.html

Thanks for those but that's

January 4, 2013 - 7:01am #3

Thanks for those but that's not exactly what I mean (though thos pieces are part of the technique).

This might illustrate the situation clearer:  Imagine a simple white quad as our content that is being augmented and is fit perfectly to the size of the marker - I'd like to be able to project the camera feed onto the surface of this quad to make it's texture from the feed.  Ideally this shouldn't be constantly updated and should be a snapshot so when I flip this quad it appears I'm flipping the paper that was on the table.  In essence, I'm just looking for a little help to have a live texture from the camera feed and not the whole camera feed.

 

Hope this is a little cleare and thank you.

Here are two methods for

January 3, 2013 - 6:59pm #2

Here are two methods for accessing the camera image - https://developer.vuforia.com/forum/faq/unity-how-can-i-access-camera-image

Here is another approach that obtains the image from the unmanaged buffer - https://developer.vuforia.com/forum/unity-3-extension-technical-discussion/camera-get-image-camera

Is that what you're looking for?

Log in or register to post comments