• 中文
  • cocos如何隐藏人物脸上的线条

cocos如何隐藏人物脸上的线条

Related Discussions
...
  • Изменено

如果您使用预乘 alpha 导出图集,则会发生这种情况,但不要告诉 spin-cocos-objc 使用预乘 alpha 进行渲染。 您可以使用此方法启用 PMA:
https://github.com/EsotericSoftware/spine-runtimes/blob/4.1/spine-cocos2d-objc/src/spine/SkeletonRenderer.m#L480

This happens if you export your atlas with pre-multiplied alpha, but don't tell spine-cocos-objc to render with pre-multiplied alpha. You can enable PMA with this method:
https://github.com/EsotericSoftware/spine-runtimes/blob/4.1/spine-cocos2d-objc/src/spine/SkeletonRenderer.m#L480

您好,我这边使用的是4.0的版本,经过调试该方法如果不主动调用的话,是不会走到这里的,我通过QQ邮箱907689522提供了运行实例,期待您的回复非常感谢

Hello, I use the 4.0 version here. After debugging, this method will not go here unless it is actively called. I provided the running instance through QQ mailbox 907689522. I look forward to your reply. Thank you very much

该方法在 4.0 中也可用:
https://github.com/EsotericSoftware/spine-runtimes/blob/4.1/spine-cocos2d-objc/src/spine/SkeletonRenderer.m#L480

恐怕我无法让您的项目运行。 调试也很复杂。

The method is also available in 4.0:
https://github.com/EsotericSoftware/spine-runtimes/blob/4.1/spine-cocos2d-objc/src/spine/SkeletonRenderer.m#L480

I'm afraid I could not get your project to run. It's also to complicated to debug.

5 дней спустя

After testing, it is found that this method cannot be implemented, and calling this method prompts that the method is enabled, and it is found that the default value in the 87 line of SkeletonRenderer. m file is_ premultipliedAlpha=true。
Thank you for your reply.


The resource file has been uploaded, and we look forward to your reply

My apologies. cocos2d-objc automatically premultiplies any image it loads. This means you must NOT set the "premultiplied alpha" checkbox when exporting your atlas from the Spine Editor. I re-exported your atlas without premultiplied alpha and used these settings:

[skeletonNode setOpacityModifyRGB:YES];
skeletonNode.twoColorTint = YES;

And the result looks like it should.

Hello, if the premultiplied alpha is not checked for export, two problems will occur:

  1. We use the web side to load animations. The web export requires pre multiplying alpha, otherwise the loading will cause problems (the objc side and the web side are incompatible on the contrary).
  2. At present, we have hundreds of resources. If we can't handle them here, we need to re export the resources.
    Look forward to your reply Thank you

Then the only way to fix this is to modify cocos2d-objc to not premultiply loaded images automatically. On iOS, cocos2d-objc uses UIImage to load image files. This will automatically premultiply all RGB values with alpha, if the loaded image has an alpha channel. I'm afraid that is not something we can fix on our end. The place to modify cocos2d-objc is likely CCTexture initWithCGImage.

thank you