WPF 3D透视相机问题
我正在开发一个 3D 翻转控件,它可以水平、垂直翻转,并且可以具有任何大小以及正方形或矩形形状。
当我让它工作时,我遇到了透视相机的一个非常奇怪的问题。当我创建 MeshGeometry3D 时,我会缩放到内容的适当比例。如果宽度>身高,一切都好。然而,如果高度>宽度,则 3d 网格尺寸太小。
解决此问题的唯一方法是(如果高度 > 宽度)将透视相机上的向上方向从 0 1 0 更改为 1 0 0 并应用 90 度旋转变换。当我这样做时,一切看起来都很完美。
有谁知道这是为什么吗?透视相机在调整网格大小时是否只考虑宽度?
谢谢!
I am working on a 3D flip control that can flip horizontally, vertically and can have any size and square or rectangular shape.
While I have it working, I ran into a very odd issue with the perspective camera. When I create a MeshGeometry3D I scale to the proper ratio of the content. If the width > height, all is well. However, if height > width, then the 3d mesh is sized too small.
The only thing that fixed this was (if height > width) change the UpDirection on the perspective camera from 0 1 0 to 1 0 0 and apply a 90 rotate transform. When I do this, everything looks perfect.
Anyone know why this is? Does the perspective camera only take width into account when sizing the mesh?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试使用
FieldOfView
属性。这就是摄像机“看到”场景的角度。在您的情况下,将比率乘以高度/宽度而不更改 FoV 就足够了。Try to play with the
FieldOfView
property. That's the angle at which the scene is "seen" by the camera. In your case multiplying the ratio byheight / width
without changing the FoV should suffice.