I have the exact position of the camera in the world. I'm bassicly getting the distance in meters for every fram from an arbitrary 0,0,0 in the world and I want to use this data in after effect along with the 3D camera to be able to place some text in the video.
What I can't figure out is how the real world units I have relate to the pixel units that AE uses. Also what do the units mean exactly because I've noticed that my y value goes down as the camera go up. Is it the translation of the origin to the camera?
If you're wondering how I'm getting the data its video game footage and I'm getting it the data directly from the game engine.
There is zero correlation to AE's pixel units to realworld units and coordinates start at the top left corner of the comp or layer. That's all you have to know. The rest is just arbitrary math remapping the underlying vector data to AE's 16 bit integer values. If you need real integration, you have to come up with your own expressions to "normalize" values to different ranges and figure out the trig.
Perspective is controlled by camera position, framing by focal length. It's that way in the real world with a real camera, and even with your eye.
Perspective may or may not be accurate in your game capture footage so the Camera Track data may or may not correspond to the real game world. Let's talk about Camera tracking.
If you want an actual starting place at 0, 0, 0 then you have to set an origin and ground plane, then add a solid and a camera so you have something to work from. The camera is the only thing that moves as you add different reference Track Solids to the scene. You can calculate the distance between any two of these 3D layers. You can also calculate the distance from the camera to the 3D layer. Tracker Cameras do not have a point of interest, they rely on orientation and rotation to keep lined up with the camera movement.
If you have the distance between two objects in the game footage, and you can attach a reference solid (I don't use nulls because they are hard to see so I never know if I picked the right markers) to each surface and simply calculate the distance between them using the length(point 1, point 2) expression. All you have to do is set up a simple ratio. If the distance between the two reference solids is 5000 pixels and the distance between the two surfaces you attached a solid to is 200 meeters then the math is pretty simple. one meter is 5000 divided by 200 or 25 pixels per meter. d
I'm also not exactly sure what you mean when you say "my 'y' value goes down as the camera goes up." What y value. Any solids, or nulls, or text you add to the scene should not move. The distance from the camera changes as the camera's position changes. I can't really figure out what you are trying to do. If you have two surfaces and you want to have a text layer read out the distance then the math is simple. If you animate the position of either of those surfaces (Track Solids), then the calculations are the same. If you need the distance from the camera, the same applies.
On the other hand, If you just want to put a text layer that shows the distance between two objects (surfaces) in the game footage, and you have the data from the game engine, then you don't need camera tracking, all you need is a text layer and/or some feature tracking.