Anyone know how to calculate pixel size of an object as seen by the camera without any Unity methods?
Reason being I’d like to compile a spreadsheet that I can calculate to figure out necessary texel densities for combinations of FOV and view distances of a 1x1 unit plane.
I found this post from a different forum that does output the right size, but it uses the WorldToScreenPoint camera method which I cannot view the math for:
Hmm, I thought it was a little more involved than this
Isn’t this just the calculation for frustum height though? Like I am looking for the size of an object inside of that frustum plane at a given distance.
Oddly enough though, the screen height divided by the number generated by this equation gives me the correct size of a unit plane at said distance. I’m not sure of the math behind that now though / what is going on with that relation.
For example, a full HD display (1920x1080) with a unit plane 1 unit away from the camera at the default 60 degree FOV equates to size = 1.155. 1080 divided by 1.155 equals approximately 935 pixels which matches with the result from the linked post equations and also confirmed in Photoshop.
Wasn’t so much the trig, but not keeping units in the equation was what was confusing me. The end result being a fustrum of Y units when object is X units away. Thus screen height dividing by Y units results in pixels per unit, which is also how tall a unit plane is at same distance. Coffee hadn’t kicked in yet
Thanks @Kurt-Dekker for your assistance with this though.