- Modifié
自行替换Spine生成的.atlas,.png发生的问题
您好,我在项目使用的过程中,因为有一些通用性需求,我想实现的功能是一组近似的角色使用一个相同的Spine动画,我想用代码的方式重新生成.atlas文件和.png文件来达到这个功能。但是我自行替换掉.atlas和.png后,位置没有问题,但是发现每张图都有一个白色的背景,请问这是什么问题造成的?
在Spine中打包的纹理图集页(.png图像文件)不仅仅是将多个图像打包成一个图像,而且还对透明像素进行了处理。如何处理取决于纹理打包器的输出部分的设置。:
The texture atlas page (.png image file) packed in Spine is not just packed multiple images into a single image, but also processed for transparent pixels. How processed depends on the settings in the output section of the texture packer:
纹理打包 - Spine用户指南: 输出
例如,如果启用 预乘Alpha
的默认设置,像素的RGB值会乘以alpha值。因此,完全透明的像素将是完全黑色的。如果你想知道透明像素的颜色,在GIMP中打开图像,这是一个免费的开源图像编辑器,并隐藏阿尔法通道。
For example, if the default setting of Premultiplied alpha
is enabled, the RGB values of the pixels are multiplied by the alpha value. As a result, completely transparent pixels will be completely black. If you want to know the color of transparent pixels, open the image in GIMP, a free and open source image editor and hide the alpha channel.
如果你想知道更具体的解决方案,如果你向我们展示你使用什么代码来打包图片,我们也许能给你建议。
If you want to know more specific solutions, we might be able to advise you if you show us what code you are using to pack the images.
非常感谢,我大概找到思路了,我先自己测试下,如果行不通,再来这里寻求指导。