load 3d model from the camera Extrinsic Matrix

Started by better, November 20, 2014, 02:37:35 AM

Previous topic - Next topic

better

Hi,
   I have got a camera Extrinsic Matrix(transformation from world coordinate to camera coordinate) from PTAM which is 4X4 matrix:
   R|t
   0|1  R is a rotation matrix and t is a translation vector.
   what i want to do is : I load a 3d model ,and want to show it. When I put the camera in different position and different ditection ,I can see different side of the model,but the model is still in the origin position.
   I have tried camera.setBack() and camera.setPosition  this method ,and camera.setOrientation(),camera.setPosition() as another method ,but it does not reach what i expect.
   have you have some idea??
   many thanks!! :)
   yours better

better

if the model coordinate is x left ,y down,z out of the window which jpct's z is opposite.
should I has a tranformation between model coordinate and camera world coordinate using above method??
thanks!!

EgonOlsen

I'm not sure about the actual question, but if you have some matrix that uses another ccordinate system, you have to transform it. You've already identified the setBack() and setPosition() methods so i think you should have all you need to do that. Just keep in mind that all matrices in jPCT are row major and http://www.jpct.net/wiki/index.php/Coordinate_system.

Apart from that: Why don't you just move and rotate the camera? What's so special about these matrices that you have to use them?

better

what I do is AR based on no marker,a little like vofuria which you have said you nerver used in other topics integrated with jpct .
so with the transformation matrix ,I can different sides of a 3d model when phone camera in different pos and direction.
Is it more  complex to get angles which used in rotating camera.

and,what does the setBack() meaning .Is it the same purpose like setOrientation??
thanks!

EgonOlsen

No, setBack() just sets the rotation(!) matrix (not the combined transformation matrix) for the camera. The method's naming is historical, so please don't wonder about it. Think of it as setRotationMatrix() instead...

better

setRotationMatrix() ?? It is the Object3D's method ,not Camera's?
what i want is to keep the 3D model in the origin of  world coord .And let the camera move.
Although it is almost same with keep camera still and let model change.

EgonOlsen

I just wanted to point out that setBack() WORKS LIKE setRotationMatrix(). I wasn't saying that you should use it instead. I'm sorry for any confusion that this might have caused.

better

at last,
if you  have a transformation matrix(transformation from world coordinate to camera coordinate),composed of a rotation matrix and translation vector.
and what you do is to set the camera so that you can see the model in the origin world coord change.
Do you have some suggestions about the transformation with your Camera methods.? How to use Camera method so transformation changes,it is just like the camera changes and then we can see different sides of model.?

EgonOlsen

I'm not sure what the actual problem is (apart from coordinate system transformations, which can be tricky). I've mentioned it already: With setPosition() and setBack(), you have everything you need. You "just" have to split your 4x4 matrix in a rotational and a translational part, convert between the coordinate systems and apply both.