# 透视矩阵的推导（最直观、最深入、最复原，看完请点赞。）

www.MyException.Cn  网友分享于：2013-09-17  浏览：0次

POpenGL=$P_{OpenGL} =$cot(fovy2)aspect0000cot(fovy2)0000f+nfn1002nffn0$\begin{pmatrix} \frac{cot(\frac{fovy}{2})}{aspect} & 0 & 0 & 0 \\ 0 & cot(\frac{fovy}{2}) & 0 & 0 \\ 0 & 0 & -\frac{f+n}{f-n} & -\frac{2nf}{f-n} \\ 0 & 0 & -1 & 0 \\ \end{pmatrix}$

cot(fovy2)aspect=cot(fovx2)=2nrl,$\frac{cot(\frac{fovy}{2})}{aspect} = cot(\frac{fovx}{2}) = \frac{2n}{r-l},$
cot(fovy2)=2ntb.$cot(\frac{fovy}{2}) = \frac{2n}{t-b}.$

POpenGL=$P’_{OpenGL} =$2nrl00002ntb0000f+nfn1002nffn0$\begin{pmatrix} \frac{2n}{r-l} & 0 & 0 & 0 \\ 0 & \frac{2n}{t-b} & 0 & 0 \\ 0 & 0 & -\frac{f+n}{f-n} & -\frac{2nf}{f-n} \\ 0 & 0 & -1 & 0 \\ \end{pmatrix}$

POpenGL=$P_{OpenGL} =$2nrl00002ntb00r+lrlt+btbf+nfn1002nffn0$\begin{pmatrix} \frac{2n}{r-l} & 0 & \frac{r+l}{r-l} & 0 \\ 0 & \frac{2n}{t-b} & \frac{t+b}{t-b} & 0 \\ 0 & 0 & -\frac{f+n}{f-n} & -\frac{2nf}{f-n} \\ 0 & 0 & -1 & 0 \\ \end{pmatrix}$

POpenGL=T×POpenGL=100001000010r+lrlt+btb01×2nrl00002ntb0000f+nfn1002nffn0=2nrl00002ntb00r+lrlt+btbf+nfn1002nffn0