Raeleus

Hello. I've read somewhere here that Spine works faster and better if you use premultiplied alpha. That's fine and I use premultiplied alpha in most of my projects. However, my current project requires premultiplied alpha to be set to false. I happened to notice that alpha blending looks awful when premultiplied alpha is set to false:

premultiplied alpha false.gif

Notice how the lines look like they're being mixed with black.

premultiplied alpha true.gif

This is how it's supposed to look like with premultiplied alpha set to true. Ignore the way the list looks below. I am careful to pack my textures with the appropriate setting in each example.

What I would like to know is if this is a known behavior of Spine. Is there a workaround for this issue without switching to premultiplied alpha? I find it curious that LibGDX is very much against using premultiplied alpha and Spine is the polar opposite.

Reproduction Steps:
*Create an animation that fades from transparent to opaque.
*Pack the textures with premultiplied alpha set to false.
*In your LibGDX game, set the following: skeletonRenderer.setPremultipliedAlpha(false);
*Play the animation on a light background.

Thank you for your time.
Bạn không được cấp phép để xem tập tin đính kèm trong bài viết này.
Hình đại diện của thành viên
Raeleus
  • Bài viết: 91

Nate

PMA provides correct blending, not just in Spine, but in any game toolkit. Non-PMA provides only a close approximation to correct blending. PMA also has the advantage that it can do additive blending without a batch flush while non-PMA requires a flush to change to additive and another to change back.

libgdx is certainly not against PMA, in fact there is no debate about it at all. It is a fact that PMA is correct blending and non-PMA only comes close.

Here is spineboy with his head fading out in Skeleton Viewer with your background color, looks right:
Hình đại diện của thành viên
Nate

Nate
  • Bài viết: 12024

Raeleus

libgdx is certainly not against PMA, in fact there is no debate about it at all.
I was referring to something Mario said on twitter in response to "would you use [PMA] for 2d games?". His response was "i wouldn't use it for 2D games". He's also said on the forums "Currently we do not support premultiplied alpha" in 2012. I guess that's not the current state of things :) .

Anyway, thanks for your response. That encouraged me to find another solution. Changing the blend modes seemed to do the trick.
Hình đại diện của thành viên
Raeleus
  • Bài viết: 91

Mario

Don't listen to me, I don't know what I'm doing. PMA all the way, plus it's supported in libGDX now.
Hình đại diện của thành viên
Mario

Mario
  • Bài viết: 3154

Raeleus

Don't say that. Things change all the time. I feel kind of foolish for basing my information on ancient history :-)
Hình đại diện của thành viên
Raeleus
  • Bài viết: 91


Quay về Runtimes