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\$
  • \$\begingroup\$ Can you share a before/after image so we can see the symptoms? \$\endgroup\$ – DMGregory Apr 13 '18 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. Apr 13 '18 at 13:30
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\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.