image - 与图像序列相比, Sprite 表的优缺点是什么?

标签 image animation sequence sprite-sheet

我来自 2D 动画背景,所以当我使用动画序列时,我更喜欢使用图像序列。对我来说,这很有意义,因为您可以轻松地从合成/编辑软件中导出图像序列并轻松定义方面。

我是游戏开发的新手,对 Sprite 表的使用感到好奇。有什么优点和缺点。文件大小是问题吗? - 对我来说,一堆小图像似乎与一个大图像相同。此外,定义 Sprite 的每个单独区域似乎很麻烦。

基本上,我不明白你为什么要使用 Sprite 表 - 请赐教。

谢谢

最佳答案

Sprite 表的性能更好,因为您将所有数据都包含在单个纹理中。假设您有 1000 个 Sprite 从 Sprite 表播放相同的动画。绘图的过程会像这样。

Set the sprite sheet texture.
Adjust UV's to show single frame of animation.
Draw sprite 0
Adjust UV's
Draw sprite 1
.
.
.
Adjust UV's
Draw sprite 998
Adjust UV's
Draw sprite 999

使用纹理序列可能导致最坏的情况:
Set the animation texture.
Draw sprite 0
Set the new animation texture.
Draw sprite 1
.
.
.
Set the new animation texture.
Draw sprite 998
Set the new animation texture.
Draw sprite 999

嘎!在绘制每个 Sprite 之前,您必须将渲染状态设置为使用不同的纹理,这比调整几个 UV 慢得多。

关于image - 与图像序列相比, Sprite 表的优缺点是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3473151/

相关文章:

java - 使用 bufferedimage java 设置图像 src

image - Sitecore 8 RTE 图像大小调整

jquery - 如何为该 jQuery 代码设置超时?

algorithm - 没有重复字母的最长单词序列

java - 如何从 Java 中的字符串中提取 7 个数字的序列?

java - 将区域 (100x100px) 写入大文件而不读取目标 jpeg

c++ - 在 OpenCV 中从 RGB 图像访问 channel 的更快方法?

jquery - 循环动画

html - 有没有办法用纯CSS让div飞进/飞出

algorithm - 序列覆盖算法