相关疑难解决方法(0)

如何构建透视投影矩阵(无API)

我开发了一个简单的3D引擎(没有使用API​​),成功地将我的场景转换为世界和视图空间,但是使用透视投影矩阵(OpenGL样式)无法投影我的场景(从视图空间).我不确定fov,近和远的值,我得到的场景是扭曲的.我希望有人能指导我如何使用示例代码正确构建和使用透视投影矩阵.在此先感谢您的帮助.

矩阵构建:

double f = 1 / Math.Tan(fovy / 2);
return new double[,] { 

    { f / Aspect, 0, 0, 0 },
    { 0, f, 0, 0 },
    { 0, 0, (Far + Near) / (Near - Far),  (2 * Far * Near) / (Near - Far) }, 
    { 0, 0, -1, 0 } 
};
Run Code Online (Sandbox Code Playgroud)

矩阵使用:

foreach (Point P in T.Points)
{     
    .
    .     // Transforming the point to homogen point matrix, to world space, and to view space (works …
Run Code Online (Sandbox Code Playgroud)

math 3d graphics transformation projection

19
推荐指数
1
解决办法
3万
查看次数

标签 统计

3d ×1

graphics ×1

math ×1

projection ×1

transformation ×1