1
\$\begingroup\$

So I have a stage with some characters (Spine2D Skeletons). Each character has a health bar/stamina bar texture above them. The textures are simple PNGs with some gradient on them and transparency too.

Sometimes, when I set an animation on one of the skeletons in the stage, some of the health/stamina bars textures look like they're color burned or the transparency doesn't work on them while the animation lasts.

I tried setting PremultiplyAlpha to true and to false on the skeleton renderer but it didn't help.

Do you have any idea why this could be?

Edit: Sample before and after images:

Before animation image

After animation image

enter image description here

\$\endgroup\$
2
  • \$\begingroup\$ Can you share a before/after image so we can see the symptoms? \$\endgroup\$
    – DMGregory
    Commented Apr 13, 2018 at 13:03
  • \$\begingroup\$ Edited to include images. It feels like the problem is only for textures being drawn directly after the renderer.draw call. Each character is a LibGDX Actor with overridden draw method that draws the skeleton and the healthbars above it. \$\endgroup\$
    – Daniel D.
    Commented Apr 13, 2018 at 13:30

1 Answer 1

1
\$\begingroup\$

I ended up setting the blend mode of the batch to what it was before the SkeletonRenderer used it to render the shapes. Not sure if this is the correct approach but it does look like it's working.

int blendDst = batch.getBlendDstFunc();
int blendSrc = batch.getBlendSrcFunc();

// skeleton renderer.draw(batch, skeleton); goes here

batch.setBlendFunction(blendSrc, blendDst);

// ordinary texture batch.draw() goes here
\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .