使用 Sandy 3D AS3,用多个 3D 对象填充视口(精确配合)
我正在使用 sandy.primitive.Box 的多个实例将图像拼接在一起。每个盒子的尺寸为 96x91,而视口为 960x273,如果我将盒子布局在 10x3 的完美网格中,这应该会完全适合。但是,我似乎无法获得确切的相机视野。我尝试了几个公式(一个用于调整“焦距”,一个用于直接调整视场)。这两个公式都会产生太窄的视场角。
// focal length
(stage.stageHeight/2) / Math.tan(cam.fov / 2 * Math.PI / 180)
// field of view
2 * Math.atan2( (stage.stageHeight/2), -cam.z ) * (180 / Math.PI)
关于同一项目的另一个问题: 我需要调整每个立方体的视角,使图像看起来处于 2D 空间(平面)中...关于计算此类“校正”的最佳方法有什么想法吗?
I'm stitching together an image using multiple instances of the sandy.primitive.Box. Each box is 96x91 while the viewport is 960x273 which should make for an exact fit if I layout the boxes in a perfect grid of 10x3. However, I can't seem to get the exact camera fieldOfView. I've tried a couple formulas (one for adjusting the "focal length" and one for adjusting the fov, directly). Both of these formulas produce a fov angle that is too narrow.
// focal length
(stage.stageHeight/2) / Math.tan(cam.fov / 2 * Math.PI / 180)
// field of view
2 * Math.atan2( (stage.stageHeight/2), -cam.z ) * (180 / Math.PI)
Another question about the same project:
I need to adjust the perspective of each cube so that the image appears to be in 2D space (flat)... Any ideas on the best method for calculating such a "correction"?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在提出这个问题后不久,我意识到在确定距离时我没有考虑立方体的深度(实际上是深度的一半)。
I realized shortly after posing this question that I wasn't taking into account the cubes' depth (actually, half of the depth) when determining the distance.