Ogre/Mogre:相机两点透视 [英] Ogre/Mogre: Camera two point perspective
问题描述
我正在显示一个包含一些立方体的场景.相机使用透视.一切都很好,但我希望垂直线平行(两点透视:
I'm displaying a scene with some cubes in it. The camera uses persective. Everything works great, but I'd like the vertical lines to be parallel (two point perspective: http://en.wikipedia.org/wiki/Perspective_(graphical)#Two-point_perspective).
When viewing a cube from the front:
What I want:
+-----+
| |
| |
+-----+
What I'm getting (exaggerated):
+--------+
/
/
+--+
I've tried fiddling with the camera's FOV, but to no avail.
My attempt so far:
Camera = SceneManager.CreateCamera(CameraName);
float q = 45;
float d = 5000f;
Matrix4 m = new Matrix4(
1, 0, 0, (float)(Math.Sin(q)/d),
0, 1, 0, 0,
0, 0, 1, (float)(Math.Cos(q)/d),
0, 0, 0, 0
);
Camera.SetCustomProjectionMatrix(true, m);
The University of Berkeley has a page on the different perspective transformations and the matrices you need to use. The two-point perspective transformation is:
_ _
| 1 0 0 sin(q)/d |
| 0 1 0 0 |
| 0 0 1 cos(q)/d |
|_ 0 0 0 0 _|
Where q
is the angle used to rotate the points (rather than the axes) and d
is unexplained(!) but I think it's the distance of the camera from the focal plane.
这篇关于Ogre/Mogre:相机两点透视的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!