c# - Perspective Projection Matrix appears to have incorrect FOV -


i'm using sharpdx write "3d soft engine scratch" per tutorial on msdn. however, cannot expected , actual fields of view match up.

my now-simplified world comprises of 4 3d vertices z=0 @ (0,1,0);(0,-1,0);(1,0,0);(-1,0,0). place camera @ (0,0,2) , @ (0,0,0) (0,1,0) up. setup projection matrix fov of 90 degrees (pi/2 radians) , prepare render each of 4 vertices calling vector3.transformcoordinate(vector3, matrix).

my understanding fov used calculate scale factor 1/tan(fov/2) can applied every (y,z) pair such y' = y * scale / z. similarly, given aspect ratio, scale calculated (x,z) pairs too.

for (vertical) fov of 90 degrees , camera distance 2, have expected of vertices reasonably far edges of bitmap. however, top , bottom vertices have y-values of -0.49 , +0.49 means they'd practically touching screen boundary if rendered. have misunderstood concept of fov? results i'm seeing i'd expect fov of 53 degrees. it's though tangent being halved before inverse taken...

i first tried camera @ (0,0,1) , fov of 90 degrees because felt sure scale factor 1 (1/tan(90/2) = 1) vertices off screen.

the perspective transformation transforms coordinates camera space clip space.

camera space ordinary cartesian system camera origin.

clip space temporary space afterwards mapped viewport. both x , y coordinates in range [-1, 1] points within viewport.


Comments

Popular posts from this blog

c++ - How to add Crypto++ library to Qt project -

jQuery Mobile app not scrolling in Firefox -

How to use vim as editor in Matlab GUI -