bontrager

Hi,

I am using spine-c to load a character in iOS device with Cocos2D,
spAtlas *atlas = spAtlas_createFromFile([user.skeleton.atlasURL UTF8String], 0);
spSkeletonJson *myJson = spSkeletonJson_create(atlas);
spSkeletonData* skeletonData = spSkeletonJson_readSkeletonDataFile(myJson, [user.skeleton.skeletonURL UTF8String]);
skeletonNode = [SkeletonAnimation skeletonWithData:skeletonData andArrayOfSkin:[self getDefaultUserSkinWithAdditionalSkin:skins]];
It loaded the character, but the result looks different with the android (libgdx).

Here is the image from iOS
Screen Shot 2019-10-31 at 16.16.21.png


And here is the image from android
Screen Shot 2019-10-31 at 16.16.07.png


I think the image on the iPhone seems rough, with some black thin border-like line in some parts. While on android, it rendered smoothly with the same image asset as the iOS version.

Any ideas why?
Thank you!
У вас нет необходимых прав для просмотра вложений в этом сообщении.
bontrager
  • Сообщения: 8

Nate

In your iOS screenshot it looks like the texture has PMA but is rendered as if it doesn't. In spine-cocos2d-objc the API to render using PMA is SkeletonRenderer setOpacityModifyRGB. Eg, adding to your code:
...
skeletonNode = [SkeletonAnimation skeletonWithData:skeletonData andArrayOfSkin:[self getDefaultUserSkinWithAdditionalSkin:skins]];
[skeletonNode setOpacityModifyRGB:true];
Аватара пользователя
Nate

Nate
  • Сообщения: 9288

bontrager

Nate писал(а):In your iOS screenshot it looks like the texture has PMA but is rendered as if it doesn't. In spine-cocos2d-objc the API to render using PMA is SkeletonRenderer setOpacityModifyRGB. Eg, adding to your code:
...
skeletonNode = [SkeletonAnimation skeletonWithData:skeletonData andArrayOfSkin:[self getDefaultUserSkinWithAdditionalSkin:skins]];
[skeletonNode setOpacityModifyRGB:true];
What spine runtimes version are you using? - (void) setOpacityModifyRGB:(BOOL)value is deprecated in our project. I called it, and it still produce some weird rendering character.
bontrager
  • Сообщения: 8

Nate

I linked to 3.8:
spine-runtimes/SkeletonRenderer.m at 3.8

An alternative is to not use premultiplied alpha when packing your atlas.
Аватара пользователя
Nate

Nate
  • Сообщения: 9288

bontrager

Nate писал(а):I linked to 3.8:
spine-runtimes/SkeletonRenderer.m at 3.8

An alternative is to not use premultiplied alpha when packing your atlas.
It is deprecated, right?

I already set _premultipliedAlpha to false in my - (void)initialize:(spSkeletonData*)skeletonData but still, there is a border line in each asset area. Or did I miss something, here?

I load my atlas with
spAtlas *newAtlas = spAtlas_createFromFile([skinAtlas UTF8String], 0);


---

bontrager писал(а):
Nate писал(а):I linked to 3.8:
spine-runtimes/SkeletonRenderer.m at 3.8

An alternative is to not use premultiplied alpha when packing your atlas.
It is deprecated, right?

I already set _premultipliedAlpha to false in my - (void)initialize:(spSkeletonData*)skeletonData but still, there is a border line in each asset area. Or did I miss something, here?

I load my atlas with
spAtlas *newAtlas = spAtlas_createFromFile([skinAtlas UTF8String], 0);
There is a difference after I called setOpacityModifyRGB,

This one is setOpacityModifyRGB:NO
Screen Shot 2019-11-05 at 11.28.02.png


And this one is setOpacityModifyRGB:YES
Screen Shot 2019-11-05 at 11.28.09.png


I am not sure, the border line is not completely gone. But I think, it has a difference, thin and thick.
У вас нет необходимых прав для просмотра вложений в этом сообщении.
bontrager
  • Сообщения: 8

Nate

Strange. How do you export the atlas? Export without PMA, then try rendering with or without PMA. My guess is you export the atlas with PMA, then something in your toolchain is applying PMA to it again.

setOpacityModifyRGB is a cocos2d-objc method to tell if a node should be rendered with PMA. It may be deprecated there (I don't know, cocos2d-objc is becoming quite dated) but still, that is the way you tell the SkeletonRenderer if your atlas has PMA.
Аватара пользователя
Nate

Nate
  • Сообщения: 9288


Вернуться в Runtimes