> I found it actually worked better if I omitted the x offset from the distance calculation (so just sqrt(y2 + z2)), otherwise objects near the edge of the field of view were weirdly distorted. But I wouldn't suggest doing that in the general case.
I think this is because you should actually just be dividing by y, the perpendicular distance through the screen. Probably adding z to the mix, while wrong, doesn't make it too weird because of the limited set of z values used.
If the result with just division by y looks distorted, then I would suggest fiddling with the value of k, which effectively controls how wide-angle versus telephoto things look.
I think this is because you should actually just be dividing by y, the perpendicular distance through the screen. Probably adding z to the mix, while wrong, doesn't make it too weird because of the limited set of z values used.
If the result with just division by y looks distorted, then I would suggest fiddling with the value of k, which effectively controls how wide-angle versus telephoto things look.