ETC1 texture in spine animations

ETC1 texture in spine animations
0
#1

Hello to all :raised_hand::grin:
I want to use the ETC1 compression format for spine animations and improve performance on Android platform, but I can’t add an alpha channel to the texture.
A little search by code revealed the ability to attach a file with an alpha channel using the suffix “@alpha”.
I compress “sleleton.png” animations texture file using TexturePacker in 2 files - “skeleton.pkm” for RGB and “skeleton.pkm@alpha”.
Suffix great works with objects of the Sprite class(i use create() method), but does not work for “spine::SkeletonAnimation”. What can I do about it?
Code:

auto tmpSprite = Sprite::create(animDir + “skeleton.pkm”);
bg->addChild(tmpSprite);
tmpSprite->setPosition(center);

auto tmpSk = spine::SkeletonAnimation::createWithJsonFile(animDir + “skeleton.json”, animDir + “skeleton.atlas”);
tmpSk->setAnimation(0, “static”, true);
bg->addChild(tmpSk);
tmpSk->setPosition(center + Vec2(500, 0));

result:
example_for_forum
On the left is the Sprite (from the animation atlas)
On the right is the spine::SkeletonAnimation, there is no alpha channel

Cocos2dx version 3.17

The debugger checked that when loading animation textures, the setAlphaTexture method is called for them. But obviously, this is not enough.

0 Likes

#2

which version of spine runtime do you use?

0 Likes

#3

I admit that v3.6.39 (from cocos2dx changelog at May.21 2018)

0 Likes

#4

@halx99 , it seems you have implemented this feature in cocos2dx. I would be grateful if you would help to use it for our project, because this is the only way to optimize spine animations on Android platform.

0 Likes

#5

Can you provide spine animation files?

0 Likes

#6

Solution found.
There is a special shader for correctly drawing ETC1 textures.
image

1 Like

#7

As you are new, do know it when a solution is found it is best to mark it as a solution by clicking this tick box that will appear for you here:

image

0 Likes

#8

Great👍job.

0 Likes

closed #9

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

0 Likes