I am wondering how many pixels is 1 unit in Unity3D for Oculus rift. For example, how a cube of 1 by 1 by 1 units could be given its dimensions in pixels.
CodePudding user response:
There's not a 1:1 correlation here. It depends on many factors, such as the distance to the object, the angle you're viewing the object, the field of view of your camera, and the pixel resolution of your headset.
This is sort of like asking how many feet an object should be in a movie so that it takes up 6 feet of a movie theater screen. It'll depend on the kind of lens the movie is shot with, how far away the movie camera is, how big the movie theater screen is, etc.
However, at runtime, you can get the current pixel position on the screen of a position in the 3D world using Camera.WorldToScreenPoint. You could then do this for multiple points (say, at each end) of an object of interest to determine how large it is currently appearing on the screen.