According to this, if I understand well, at z=0
the scene that is rendered on the screen is in pixel size. Hence a z=0
the scene is window.innerHeight
units high and camera.aspect * window.innerHeight
units wide (same as in pixels). I do get it that this is a different api (javafx), but I was wondering whether three.js
follows the same paradigm. Unless I am mistaken this is not the case.
Is there a way to determine the relationship between pixels and units at z=0
(or some other given z?)
If you check the source code how the projection matrix is calculated, you can find the answer of your question. Alternative approach is to have two points that make a line, parallel to the screen, … and then calculate their screen coordinates in pixels (by using the camera’s projection matrix). This will give you the unit/pixel ratio at the given distance.
– Pavel