Hi Vince,
please try to implement this pseudocode:
viewMatrix = imageTarget.getViewMatrix(); rot = new Matrix3(new float[]{viewMatrix[0], viewMatrix[1], viewMatrix[2], viewMatrix[4], viewMatrix[5], viewMatrix[6], viewMatrix[8], viewMatrix[9], viewMatrix[10]} ); rot = rot.transpose(); //Only because Matrix3 is not in the same colomn/row mode translation.set(viewMatrix[12], viewMatrix[13], viewMatrix[14]); position = -translation; finalRotation = rot.inverse() finalPosition = rotate position around the origin(0,0,0) by finalRotation // The following is taken from unity and may differ for your rendering engine Vector3 direction; direction.x = finalRotation.m02; direction.y = finalRotation.m12; direction.z = finalRotation.m22; Vector3 upwards; upwards.x = finalRotation.m01; upwards.y = finalRotation.m11; upwards.z = finalRotation.m21;
Please note that this implementation may be different for your rendering engine.
Best Regards,
Alex
Hi,
Why do you inverse the rotation matrix ? This seems to be the main difference with my implementation.
Thanks.
Regards,
Vincent
Hi Vincent,
I just saw that you are assuming a projection where x+ = right, y+ = up, z- = camera direction. The Wikitude projection matrix is actually x+ = right, y- = up, z+ = camera direction and the camera origin is 0,0,0.
Are you trying to have a static scene with a moving camera?
Best Regards,
Alex
Hi Andreas,
Yes in my rendering engine, the camera is moving not the scene.
The camera is doing the same movements to device do in real world, and my virtual world is Y-up, (right : X, front : -Z).
What is strange is : my view matrix seems good, but the tracking is not stable/precise, when I move from left to right, the 3D augmented object is moving relative to the image marker. Or maybe this is an issue about background picture rendering.
The whole recorded image from the device camera is used for tracking ? (Of course since device screen display quite never have the same ratio of the device camera, cropping is needed)
Thanks.
Regards,
Vincent
Hi Vincent,
The matrices from the ImageTarget will be in the same system as your virtual world(Y-up, X-right, -Z-front).
We use the whole image for tracking but the camera image and is then cropped for displaying.
Best Regards,
Alex
Vincent B
Hi,
Here is my question since I'm not sure of my implementation due to my results not very stable.
I need to get from ImageTarget the camera's position, direction and up.
What I did :
Do you agree with this implementation ?
Thanks.
Vince