jPCT-AE - a 3d engine for Android > Support
integrating JPCT-ae with QCAR(vuforia)
MrYogi:
Hi All
i know what i am going to ask is already discussed sometimes in this forum but after going through all of them i can't found my complete answer so i am asking it in a new thread.
when i tried integrating JPCT with QCAR all goes well as expected, i got my modelview matrix from renderframe from jni and successfully transferred that in java to jpct model is shown perfectly as expected. but when i tried to pass this matrix to JPCT world camera my model disappear.
my code:in onsurfacechanged:
--- Code: ---world = new World();
world.setAmbientLight(20, 20, 20);
sun = new Light(world);
sun.setIntensity(250, 250, 250);
cube = Primitives.getCube(1);
cube.calcTextureWrapSpherical();
cube.strip();
cube.build();
world.addObject(cube);
cam = world.getCamera();
cam.moveCamera(Camera.CAMERA_MOVEOUT, 10);
cam.lookAt(cube.getTransformedCenter());
SimpleVector sv = new SimpleVector();
sv.set(cube.getTransformedCenter());
sv.y -= 100;
sv.z -= 100;
sun.setPosition(sv);
MemoryHelper.compact();
--- End code ---
and in ondraw:
--- Code: ---com.threed.jpct.Matrix mResult = new com.threed.jpct.Matrix();
mResult.setDump(modelviewMatrix ); //modelviewMatrix i get from Qcar
cube.setRotationMatrix(mResult);
cam.setBack(mResult);
fb.clear(back);
world.renderScene(fb);
world.draw(fb);
fb.display();
--- End code ---
after some research i found that QCAR uses a right-handed coordinate system meaning that the X positive goes right, the Y positive goes up and the Z positive comes out of screen but in JPCT coordinate system the X positive goes right, the Y positive goes down and the Z positive goes into the screen.
so please suggest me what i am missing here?
EgonOlsen:
You can convert the matrices by simply rotating by PI around X. I've no idea if that fixes the problem though. It's a bit unlucky that QCAR returns a model view matrix. The camera's matrix is actually the rotational part of the view matrix. The model matrix is the one that transforms the object. Both combined are the modelview matrix, but that's actually not what the camera should contain. If done correctly, it'll work though...but it's still not the right way...
MrYogi:
thanks for your reply...
i inverted modelview matrix and now it is responsive to position of image detected,but it is misplaced,assuming the coordinate system stated above it tried to rectify it but seems that axis positions are taking effect correctly but axis angles are not ...i tried everything from cam.rotateX() to invertmatrix.rotateX() but nothing is solving my issue,could you please explain how to get proper positioning by changes in angles? :(
MrYogi:
--- Quote from: EgonOlsen on October 18, 2012, 07:55:55 pm ---You can convert the matrices by simply rotating by PI around X. I've no idea if that fixes the problem though. It's a bit unlucky that QCAR returns a model view matrix. The camera's matrix is actually the rotational part of the view matrix. The model matrix is the one that transforms the object. Both combined are the modelview matrix, but that's actually not what the camera should contain. If done correctly, it'll work though...but it's still not the right way...
--- End quote ---
i am posting matrices to be more clear:
modelviewmatrix:
1.512537 -159.66255 -10.275316 0.0
-89.86529 -1.1592013 4.7839375 0.0
-8.619186 10.179538 -159.44305 0.0
59.182976 93.205956 437.2832 1.0
modelviewmatrix after reverse using cam.setBack(modelviewmatrix.invert(modelviewmatrix)) :
5.9083453E-5 -0.01109448 -3.3668696E-4 0.0
0.0040540528 -3.8752193E-4 0.0047518034 0.0
-0.004756433 -4.6811014E-4 0.0040459237 0.0
0.7533285 0.4116795 2.7063704 0.9999999
exactly what matrix is needed to draw model ?Rotaional,model or view matrix and what is the role of FOV ?i am bit confuse between these,please help me out
MrYogi:
the coordinate system QCAR uses is:
please have a look at this thread for QCAR matrix:https://ar.qualcomm.at/content/how-get-quaternion-or-rotationmatrix-pose-matrix#comment-2014099
if i remove 13,14 and 15 matrix element assuming 3*3 rotation matrix...model is rotated properly but translation(in and out movement of image) is not there..i am really stuck at this position,,can anyone help me? :( :( :(
Navigation
[0] Message Index
[#] Next page
Go to full version