Ok, so, this means that Vuforia is still "correctly" tracking based on the original camera image (which is rotated 180), while you are now correcting the video background rendering via UV map.
So, in order to "complete" the workaround, and make the 3D augmentation consistent with the image that you have rotated "ad hoc,
you also need to modify the code that handles the camera-to-target pose, which can be found in the PositionCamera() method in the StateManagerImpl.cs script;
this script is located under Assets/Qualcomm Augmentedf Reality/Scripts/Internal
The relevant code change which should make it happen is the following (see "Workaround code start" and "Workaround code end", the rest of the code is the one that you find in the original script):
// Utility function to get a quaternion out of a matrix in Unity
private static Quaternion QuaternionFromMatrix(Matrix4x4 m) {
Quaternion q = new Quaternion();
q.w = Mathf.Sqrt( Mathf.Max( 0, 1 + m[0,0] + m[1,1] + m[2,2] ) ) / 2;
q.x = Mathf.Sqrt( Mathf.Max( 0, 1 + m[0,0] - m[1,1] - m[2,2] ) ) / 2;
q.y = Mathf.Sqrt( Mathf.Max( 0, 1 - m[0,0] + m[1,1] - m[2,2] ) ) / 2;
q.z = Mathf.Sqrt( Mathf.Max( 0, 1 - m[0,0] - m[1,1] + m[2,2] ) ) / 2;
q.x *= Mathf.Sign( q.x * ( m[2,1] - m[1,2] ) );
q.y *= Mathf.Sign( q.y * ( m[0,2] - m[2,0] ) );
q.z *= Mathf.Sign( q.z * ( m[1,0] - m[0,1] ) );
return q;
}
// Position the camera relative to a Trackable.
private void PositionCamera(TrackableBehaviour trackableBehaviour,
Camera arCamera,
QCARManagerImpl.PoseData camToTargetPose)
{
// ----------- Workaround code start -----------//
Matrix4x4 camToTargetMat = new Matrix4x4();
camToTargetMat.SetTRS(camToTargetPose.position, camToTargetPose.orientation, Vector3.one);
// Apply 180 degrees pre-rotation
Matrix4x4 rotMat = new Matrix4x4();
rotMat.SetTRS(Vector3.zero, Quaternion.AngleAxis(180.0f, Vector3.forward), Vector3.one);
camToTargetMat = rotMat * camToTargetMat;
// get back the position and orientation
camToTargetPose.position = camToTargetMat.MultiplyPoint(Vector3.zero);
camToTargetPose.orientation = QuaternionFromMatrix(camToTargetMat);
//-----------Workaround code end ------------------//
arCamera.transform.localPosition =
trackableBehaviour.transform.rotation *
Quaternion.AngleAxis(90, Vector3.left) *
Quaternion.Inverse(camToTargetPose.orientation) *
(-camToTargetPose.position) +
trackableBehaviour.transform.position;
arCamera.transform.rotation =
trackableBehaviour.transform.rotation *
Quaternion.AngleAxis(90, Vector3.left) *
Quaternion.Inverse(camToTargetPose.orientation);
}
Note: I tested it, and it seems to work as expected.
Thanks for the report. Let me pass along this information to our engineering team to see what they have to say.