回顾下pipeline

pipeline:
 建模空间--(世界变换)--世界空间--(视见变换)--摄像头空间--(投影变换)--投影空间。
 
 
关于投影变换:
D3DXMatrixPerspectiveFovLH 函数
D3DXMATRIX *WINAPI D3DXMatrixPerspectiveFovLH(      

    D3DXMATRIX *pOut,     FLOAT fovy,     FLOAT Aspect,     FLOAT zn,     FLOAT zf );
 

Remarks

The return value for this function is the same value returned in the pOut parameter. In this way, the D3DXMatrixPerspectiveFovLH function can be used as a parameter for another function.

This function computes the returned matrix as shown.

w       0       0               0
0       h       0               0
0       0       zf/(zf-zn)      1
0       0       -zn*zf/(zf-zn)  0
where:
h is the view space height. It is calculated from 
h = cot(fovY/2);

w is the view space width. It is calculated from
h = w / Aspect

 

-------------------------------------------

推导一个摄像机空间的点(x,y,z,1)最终要变成投影空间的点(x',y',z',1)=(ax,by,cz,1) 而a,b,c的值就是通过上面的计算矩阵计算出来的。

 

hy/z=cot(fovY/2)y/z=(z/y1)y/z=y/y1(此y/y1是缩放比,即原vertex要投影在近平面时,应该缩放的系数。)

 

 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值