Page 1 of 1

fov

Posted: Mon Feb 23, 2004 11:19 pm
by jugurdzija
i cant get that fov values right,45 is ok but when i increase it camera gets inverted...is that a bug?

Posted: Tue Feb 24, 2004 1:53 am
by Mercior
I think the fov value for cameras is in radians, ie: PI*(degrees/180)

Posted: Tue Mar 16, 2004 11:40 pm
by Celebrandil
The FOV is obviously implemented backwards. I made the following changes to matrix4::buildProjectionMatrixPerspectiveFovLH() and got something that looks alright to me.

f32 w = 2.0 * (f32)(sin(fieldOfViewRadians/2) / cos(fieldOfViewRadians/2));
f32 h = w * aspectRatio;

(*this)(0,0) = 1.0/w;
(*this)(1,1) = 1.0/h;