0
votes

I have this AR project that I need to transform the screen coordinate to world coordinate. I follow this tutorial and I almost made it.

The only problem when I try to transform from homogeneous clip space to eye space, I use the wrong projection matrix. The reason why the projection matrix is wrong because I cannot get the right width and height of the camera space. I used this library called Kudan, when i move the camera phone forward and backward, I expect the camera width and height to change since the camera space size should be getting smaller when it moves forward and vice versa.

For the last resort, currently i try to find the camera space size by myself, How do I implement this?

This is my projection matrix

Matrix4f projectionMatrix = new Matrix4f(-0.5f* currentCamWidth, 0.5f * currentCamWidth, -0.5f * currentCamHeight, 0.5f * currentCamHeight, -1f, node.getFullPosition().getZ());

Current cam width and current cam height are always constant. the coordinates are opengl coordinates

1
Camera space does not have a width/height. The closest thing you get is the FOV and the aspect ratio.Nicol Bolas
how to get fov?Robert Limanto
can we get projection matrix from aspect ratio?Robert Limanto
@RobertLimanto to construct perspective projection matrix you need: 1. aspect ratio or resolution , 2. znear, zfar 3. FOV angle or focal length. see Perspective Projection matrixSpektre

1 Answers

0
votes

when i move the camera phone forward and backward, I expect the camera width and height to change since the camera space size

Why? Just because you move around the point of view that doesn't mean that the properties of the "virtual lens" change.

should be getting smaller when it moves forward and vice versa.

Why? That's not how cameras work.


It's really hard to give a helpful answer here, without seeing the code you've written so far. At the moment it's guesswork at best.