在 Flash 中绘制透视建筑物(GTA1/2 风格)?

发布于 2024-10-01 03:01:27 字数 317 浏览 1 评论 0原文

任何人都知道我如何用 3D 透视高度绘制建筑物,就像在原始 GTA 中一样: http://www.gtanetwork.it/gtaold/pics/screen/gta1_01.jpg 在 Flash 中?

我尝试使用 beginBitmapFill() 并绘制多边形,但纹理看起来不正确,因为它缺乏正确的深度。

有人有想法吗?不是在寻找完整的 3D 引擎,我只是希望建筑物具有深度,其他所有内容都将在同一平面上。

Anyone know how I could go about drawing buildings with 3d perspective height, like in the original GTAs: http://www.gtanetwork.it/gtaold/pics/screen/gta1_01.jpg in Flash?

I've tried using beginBitmapFill() and drawing the polygons but the texture doesn't look right because it lacks the correct depth.

Anyone have ideas? Not looking for a full 3D engine, I just want the buildings to have depth, everything else will be on the same plane.

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

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

发布评论

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

评论(1

淡淡の花香 2024-10-08 03:01:27

您会看到,透视纹理映射是任何 3D 引擎的主要功能之一。这就是我们拥有它们的原因。 3D 点透视分配、用颜色填充多边形、甚至 z 缓冲都很容易 - 所有这些仍然很容易。

透视纹理映射更进一步...它涉及到纹理提供程序和转换器,并且转换器必须分割顶点(对于真正的透视),然后在位图上应用仿射变换,绘制每个顶点...如果您想用自定义(甚至是时间线......这将非常烦人)代码来制作它,那么这一切都很难维护。 3D 引擎提供了更多的功能(阴影也很好),并且非常容易维护。

我会推荐 PaperVision 3D,尽管您必须自己分割顶点(或者 AFAIK PV3D 不自动支持)。

在有人说这很容易通过 BitmapData 的自定义循环来完成之前,分配像素......事实并非如此。透视不是线性的 - 并且非线性循环在那里会非常慢。

You see, perspective texture mapping is one of the main features in any 3D engine. That's WHY we have them. It is easy to do the 3D point perspective allocation, as well as just filling polygons with colours, even z-buffering - all these are still quite easy.

Perspective texture mapping goes a little bit further... It involves having a texture provider and transformer, and the transformer has to split up the vertices (for real perspective), then apply affine transformations on the bitmap, draw each of them... That is all hard-to-maintain if you want to make it in custom (or timeline even... that would be VERY annoying) code. 3D engines provide much more features (shading would be nice too), and are VERY easy to maintain.

I would recommend PaperVision 3D, although you will have to split the vertices by yourself (or AFAIK PV3D doesn't support that automatically).

And before anybody says that this would be easy to do in just a custom loop-through a BitmapData, allocating the pixels... It isn't. Perspective isn't linear - and a non-linear loop would be very slow there.

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