directx 9 设置相机

发布于 2024-09-30 16:04:14 字数 356 浏览 1 评论 0 原文

这是基本问题。我在设置相机时遇到了麻烦,不是如何设置它,而是我应该将其设置为什么值。有没有任何应用程序可以帮助设置相机,就像您设置它一样,它会为您提供值,或者您可以解释一下这些值代表什么以及如何缩放它们。

D3DXMatrixLookAtLH(&matView,
    &D3DXVECTOR3 (value, value, value),    // the camera position
    &D3DXVECTOR3 (value, value, value),      // the look-at position
    &D3DXVECTOR3 (value, value, value));

this is basic question. im having touble setting the camra not how to set it but what values should i set it to. is there any app that can help with setting camra like you set it and it gives you the values or can you explain what the values stand for and how to are they scaled.

D3DXMatrixLookAtLH(&matView,
    &D3DXVECTOR3 (value, value, value),    // the camera position
    &D3DXVECTOR3 (value, value, value),      // the look-at position
    &D3DXVECTOR3 (value, value, value));

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

半葬歌 2024-10-07 16:04:14

D3DXMatrixLookAtLH 函数正在生成一个相机矩阵,该矩阵存储在您的 matView 中。
之后,该函数获取三个向量:

  • 位置
  • 查找
  • 这三个向量代表

  • 相机的位置 - 你的相机所在的位置。例如,它可以是 (0,0,0)。 (这些是您在世界中的 x、y 和 z 坐标。)
  • 观察点 - 这是您的相机观察的位置。它由您的位置+您(通常)标准化的视图方向组成。因此,当您站在 (0,0,0) 处并想要向下看负 z 轴时,您的观察点是 (0,0,-1)。如果你站在 (1,2,3) 处向下看负 x 轴,则
  • 向上向量是 (0,2,3) - 通常是 (0,1,0)。

如果您现在四处移动,而不环顾四周,则位置和观察向量会发生变化以反映您的新位置。
如果你站着不动并环顾四周,只有观察点会发生变化。
仅当您滚动相机时,向上矢量才会发生变化。

有很多不错的相机教程,向您展示如何在使用相机环顾四周时更改这三个矢量 - 例如 这个

The D3DXMatrixLookAtLH function is generating a camera matrix, that gets stored in your matView.
After that, the function gets three vectors:

  • position
  • look-at
  • up

Those three vectors stand for:

  • the position of your camera - where your camera is. It could be (0,0,0) for example. (Those are your x, y and z coordinates in the world.)
  • the look-at point - this is where your camera looks at. It consists of your position + your (usually) normalized view direction. So when you stand at (0,0,0) and want to look down the negative z-axis, your look-at point is (0,0,-1). If you stand at (1,2,3) and look down the negative x-axis, it's (0,2,3)
  • the up-vector points up - normally this is (0,1,0).

If you move around now, without looking around, the position and the look-at vectors change to reflect your new position.
If you stand still and look around, only the look-at point changes.
The up-vector only changes if you roll the camera.

There are plenty of nice camera tutorials out there, that show you how to change those three vectors when looking around with the camera - for example this one.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文