Units in Three.js

Notice that when you resize a Three.js application, the height of the viewport affect object sizing, so there isn’t really an absolute size for everything. I’m thinking of how to introduce absolute sizing to Three.js. For starters, figuring this out will begin to help understand how to do that. Ultimately, Three is drawing to the pixels on the screen, so there is for sure some way to map a size in Three to a number of pixels on the screen given that the camera is configured in a specific way and that obbjects are position on a specific plane perpendicular to the camera’s line of site.

Once I figure that out (I’m sure someone already knows), then in certain environments (f.e. Electron, Cordova) it is possible to get the physical dimensions of a display. Then it would be possible to specify that something is 1 inch wide, and for us to be able to place the object somewhere in the camera’s frustum so that the size we see on the display is actually 1 inch (measured with a ruler).

Being able to do this sort of thing is useful for display-independent sizing, which would be nice to have for cross-platform applications.