#144 FOV Calculation in "perspective" wrong, severe impact

Andy Lorino

The documentation for the perspective element states: (1.4.1 and 1.5.0)

"If the <aspect_ratio> element is not specified, it is calculated from the <xfov> or <yfov> elements
and the current viewport. The aspect ratio is defined as the ratio of the field of view’s width over its height;
therefore, the aspect ratio can be derived from, or be used to derive, the field of view parameters:
aspect_ratio = xfov / yfov."

However, this equation is not correct. The equation works only for LINEAR fov values but not for angular values as used in COLLADA. The correct equation is tan(0.5*xfov) / tan(0.5*yfov) which basically converts angular to linear and divides as before. Common factors of 2/2 and the viewing distance have been removed. Example: xfov of 40 deg and yfov of 30 deg. Incorrect aspect is 4/3 = 1.3333. Correct aspect = 1.358, approx 2% higher. Out of a 2K image, that's 40 pixels, a huge error.

*** SERIOUS IMPACT *** any COLLADA readers that rely on the incorrect equation will have subtly incorrect results. The equation can get (mis)used in several different ways as various combinations of xfov, yfov, and aspect are supplied. Though the results may appear correct to an inattentive human, the results are catastrophic when the file at hand is describing a matchmove result. Preliminary testing suggests this to be the case in at least the supplied OSX collada viewer.