Sign in to follow this  
PinkFish

problem with D3DXMatrixPerspectiveFovRH

Recommended Posts

I was working out the math for D3DXMatrixPerspectiveFovRH and reached something I do not understand. using D3DXMatrixPerspectiveFovLH, and working out the math, transforming a point x,y,z,1 to a point x',y',z',w' we get: (1) z' = z * zf/(zf-zn) - zn*zf/(zf-zn) which is nice because setting z=zn -> z'=0 and setting z=zf -> z'=zf however, using D3DXMatrixPerspectiveFovRH (http://msdn.microsoft.com/en-us/library/bb205351(VS.85).aspx) I do not why zn*zf/(zn-zf) is not actually -zn*zf/(zn-zf) because again transforming a point with a RH matrix would give: (2) z' = z * zf/(zn-zf) + zn*zf/(zn-zf) what bothers me is the + instead of the - in (1) because this produces a non zero result when replacing z with zn. namely: z=zn -> z' = 2 * znzf / (zn - zf) and z=zf -> z' = (zfzf + znzf) / (zn - zf) can anyone comment on that?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this