"We offer new support options and therefor the forums are now in read-only mode! Please check out our Support Center for more information." - Vuforia Engine Team

Manually freezing camera texture

I want to freeze the camera texture but CameraDevice.Instance.Stop() has a delay which makes it pretty much useless for my application. So I want to freeze the camera texture manualy. I have tried this:

[CODE]vidScreenTextureTemp = Instantiate(vidScreen.renderer.material.mainTexture) as Texture2D;vidScreenTextureTemp = vidScreen.renderer.material.mainTexture as Texture2D;vidScreen.renderer.material.mainTexture = vidScreenTextureTemp;[CODE]

But this does not freeze the camera texture so somewhere there is still a reference instead of a hard copy of the texture. I tried this as well, but that just makes the texture black:

[CODE]vidScreenTextureTemp = Instantiate(vidScreen.renderer.material.mainTexture) as Texture2D;vidScreen.renderer.material.mainTexture = vidScreenTextureTemp;[CODE]

Any ideas?

 

DavidBeard

Tue, 07/03/2012 - 16:57

One approach could be to capture the camera image, obtain its pixels, map these to color structs and then render them to a texture which you position as the video background. The Background Texture Access sample provides an example, with methods, for positioning a 2D in this way.

Render to texture requires Unity pro. At $1500 this will be out of the reach of most hobbyists as my software is open source.
Can't this be done in a shader? Edit: Ok, I can't work around this bug so I posted a bug report in another thread.