papervision3d 如何变换纹理?

发布于 2024-07-20 05:09:34 字数 553 浏览 1 评论 0原文

最终,papervision3d(流行的 Flash 3D 渲染包)如何将转换后的纹理绘制到屏幕上?

它是否在内部使用 Flash 的任何渲染设备 - 即通过将纹理绘制到 DisplayObjects 中并对其进行转换,或者例如使用 3D MovieClip? 或者也许是过滤器? 或者它最终只是从纹理中读取像素并将它们绘制到输出中,就像在任何软件平台中一样?

我问这个问题是因为直接的答案是后者,但经过一番测试后,似乎 getPixelsetPixel 对于这种方法来说速度不够快,所以看来一定有更神秘的事情发生了。

感谢您提供任何信息!

编辑 - 我的答案总结:Papervision 本身不进行透视变换。 它只对纹理的每个三角形进行缩放和倾斜变换,如果使用足够的三角形,就会出现透视错觉。 仿射变换利用了 Flash 的渲染装置,因此可以避免昂贵的像素操作。

How, ultimately, does papervision3d (the popular 3D rendering package for Flash) draw transformed textures onto the screen?

Is it internally using any of Flash's rendering apparatus - i.e. by drawing textures into DisplayObjects and transforming them, or with 3D MovieClips for example? Or perhaps filters? Or is it ultimately just reading pixels out of the textures and painting them into the output, as you would in any software platform?

I ask because the straightforward answer would be the latter one, but after a little testing it seems that getPixel and setPixel simply aren't fast enough for this kind of approach, so it seems like there must be something more arcane going on.

Thanks for any info!

Edit - my summary of the answer: Papervision does not do perspective transforms, per se. It does only scale and skew transforms on each triangle of texture, and the illusion of perspective arises if you use enough triangles. The affine transformations make use of Flash's rendering apparatus, so that's how costly pixel operations are avoided.

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

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

发布评论

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

评论(1

无风消散 2024-07-27 05:09:34

这一切都是使用绘图 API 进行渲染的。 (lineTo) 使用绘图 API,您可以设置位图填充率而不是颜色,这样您就可以绘制纹理。 在内部,它们会将您作为纹理传入的每个资源转换为 BitmapData 对象,以便在渲染时使用。 然后,对于 3D 对象所具有的细分(三角形),他们会对其进行预先转换以获得正确的视角。

这种方法仍然是处理器密集型的,但比设置每个像素更快。 它的工作原理与其他 3D 渲染软件非常相似,使用 smae 技术和理论,专门为 ActionScript 构建。

It's all rendered using the drawing API. (lineTo) With the drawing API you can set a bitmapFill ratehr than a colour, which allows you to draw textures. Internally they are converting every asset you pass in as a texture into a BitmapData object to use when rendering. Then for ever subdivision (triangle) that your 3D object has, they prefrom transformations on it in order to get the right perspectives.

This approach is still very processor intensive, but faster then setting each pixel. It works very similiar to other 3D rendering softwears, using the smae techniques and theories, just built specifically for ActionScript.

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