简体   繁体   English

画布3D查看器的角度

[英]Canvas 3D viewer's perspective

I am working on rendering a 3D world in a 2D space. 我正在努力在2D空间中渲染3D世界。 I found this article: https://en.m.wikipedia.org/wiki/3D_projection . 我找到了这篇文章: https : //en.m.wikipedia.org/wiki/3D_projection In the perspective projection sub-category, it talks about "the viewer's position relative to the display surface" which is represented by e. 在透视投影子类别中,它谈论由“ e”表示的“观看者相对于显示表面的位置”。 Where is e. e在哪里。 Is it where the viewer is looking ( the center of the screen), the viewer's actual position relative to the screen(if so how this is gotten), or something completely different? 是观看者正在观看的地方(屏幕的中心),观看者相对于屏幕的实际位置(如果是这样,是如何获得的)或完全不同的东西?

Position of e depends of coordinate system (space) we consider to be the camera in. In world space e has different coordinates, in view space or screen space it is always located at the origin. e位置取决于我们认为是摄像机所在的坐标系(空间)。在世界空间e具有不同的坐标,在视图空间或屏幕空间中, e始终位于原点。

But the thing is that in computer graphics there's no such thing as camera (same as viewer, eye, e from your article), so transforming (rotating, translating or scaling) the camera actually means applying the appropriate transformations for the whole scene just with opposite values. 但事实是,在计算机图形学中,没有像照相机这样的东西(与您的文章中的查看器,眼睛等相同),因此变换(旋转,平移或缩放)照相机实际上意味着仅对整个场景应用适当的变换即可。相反的值。 for instance to rotate the camera around y axis by alpha radians you should rotate the scene around same axis by -alpha radians, thus camera always stays in the same position therefore emulating real world camera where scene stays in the same position but camera keeps transforming. 例如,要将摄影机绕y轴以alpha弧度旋转,您应该将场景绕同一轴以-alpha弧度旋转, 因此摄影机始终停留在同一位置,因此模拟了现实世界中的摄影机,其中场景停留在同一位置,但摄影机不断变换。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM