Log in or register to post comments

Prime31 movie texture and Vuforia - is integration possible?

April 2, 2012 - 7:52pm #1

I'm trying to make an augmented reality application where, when a target object is recognized, a movie is played over top of the target. The combined functionality of Prime31's movie texture plugin and Vuforia should be sufficient. However I recently got this reply from the creator of Prime31;

Quote:

the video texture will not work with QCAR/Vuforia. They hold the hardware hostage so no other processes can use it.

Is this true? Is there a reasonably easy workaround? Will this still be an issue in the new version of Vuforia?

Thanks for any help.

Re: Prime31 movie texture and Vuforia - is integration possible?

April 27, 2012 - 1:06pm #5

Here's the relevant bits:

1. Using code directly into your iOS objective-C app

Let's use ImageTargets sample. Here are the changes you would need.

Grab VideoTextureManager.h/.m & add those to your project

in renderFrameQCAR(),

if ( firstTime == true)
    {
        GLuint nID;
        glGenTextures(1, &nID);
        
        [VideoTextureManager sharedManager].textureId = nID;
        [VideoTextureManager sharedManager].loop = true;
        
        NSString* resourcePath = [[NSBundle mainBundle] resourcePath];
        NSString* fullPath = [resourcePath stringByAppendingPathComponent:@"wired_01.mp4"];
        
        [[VideoTextureManager sharedManager] startPlayback:fullPath];
        
        [[VideoTextureManager sharedManager] processAsset:[VideoTextureManager sharedManager].videoAsset];
        
        firstTime = false;
    }
    if (state.getNumActiveTrackables() > 0)
    {
        [[VideoTextureManager sharedManager] processAsset:[VideoTextureManager sharedManager].videoAsset];
    }
            glBindTexture(GL_TEXTURE_2D, [VideoTextureManager sharedManager].textureId);

2. Using the unity extension (this part's a little more hazy b/c I'm trying to remember what changes I made vs. what comes as part of Prime31)

There should be a VideoRenderer object with the VideoTextureRenderer script attached to it as a behavior in Unity (i think this is default with Prime31?).

Change Start() to:

void Start () {
	
		Debug.Log("Started GQCover video load");
		
		texture = ARBinding.startVideoTexturePlayback( "HoloVideo.mp4", 640, 480, true );
        target.renderer.sharedMaterial.mainTexture = texture;
        ARBinding.updateMaterialUVScaleForTexture( target.renderer.sharedMaterial, texture );
	}
void OnApplicationQuit()
	{
        //ARBinding.stop();
        Destroy( texture );
        texture = null;
	}

A couple of things to note:
It drops frames/plays at a slower framerate. Mileage may vary depending on your app

Also, there are several optimizations that can be added into the way Prime31 does video handling that are possible with iOS 5. If you look up WWDC 2011, there are talks/presentations about these new improvements (basically, you can DMA straight into video memory....what this means is that on every frame, you avoid a very useless and expensive copy of the video frame from memory to the GPU memory)

Re: Prime31 movie texture and Vuforia - is integration possible?

April 14, 2012 - 5:32pm #4

can you explain how you got the two to work together?

Re: Prime31 movie texture and Vuforia - is integration possible?

April 7, 2012 - 4:18am #3

It's possible. I did the same thing and did some tweaking to get it working. It's not done in hardware so it does drop frames.

I'd post the code if Prime31 wasn't selling it

Re: Prime31 movie texture and Vuforia - is integration possible?

April 2, 2012 - 8:10pm #2

* I have not tested their solution.

Also see this thread for a recommendation on using PlayMovie() - http://ar.qualcomm.at/node/2001697

And the Unity docs on their Movie Texture, and alternatives for iOS and Android - http://unity3d.com/support/documentation/Manual/Video%20Files.html

Log in or register to post comments