Log in or register to post comments

Render Teapot in Background Texture Sample

April 27, 2014 - 6:44am #1

Dear Forum,

The Background Sample Texture app located at:

https://developer.vuforia.com/resources/sample-apps/background-texture-access-sample-app

Which successfuly shows how to apply shader effects to the camera feed using the background camera object provided by Vuforia.

One of the things this sample DOES NOT show is how to include the Teapot for the above backgrond camera processing.

I found this forum post that closely resembles what i trying to achieve:

https://developer.vuforia.com/forum/qcar-api/texturing-3d-objects-camera-background

However, i cannot locate the functions the above link is referring to.

My suspicions is that I have to modify the VideoTextureBehaviour.cs Script to include the teapot as a gameobject and grab its texture and push it into the mTexture Object:

 

public void UpdateBehaviour()

    {
        if (mVideoBgConfigChanged && QCARRenderer.Instance.IsVideoBackgroundInfoAvailable())
        {
            // reset the video texture:
            if (mTexture != null)
                Destroy(mTexture);

            CreateAndSetVideoTexture();

            QCARRenderer.VideoTextureInfo texInfo = QCARRenderer.Instance.GetVideoTextureInfo();

            // Cache the info:
            mTextureInfo = QCARRenderer.Instance.GetVideoTextureInfo(); ;

            Debug.Log("VideoTextureInfo " + texInfo.textureSize.x + " " +
                texInfo.textureSize.y + " " + texInfo.imageSize.x + " " + texInfo.imageSize.y);

            // Create the video mesh
            MeshFilter meshFilter = GetComponent<MeshFilter>();
            if (meshFilter == null)
            {
                meshFilter = gameObject.AddComponent<MeshFilter>();
            }

            meshFilter.mesh = CreateVideoMesh(m_NumDivisionsm_NumDivisions);

            // Position the video mesh
            PositionVideoMesh();

            if (TextureChanged != null)
                TextureChanged();

            mVideoBgConfigChanged = false;
        }
    }

 

 

Please can somebody please supply code to help me? Please provide code as the above is already confusing and i have spent already a week trying different options to integrate the teapot for background camera rendering.

Log in or register to post comments