• Editor
  • Rendering to FBO problems

Hey!

I have a question about rendering a spine sprite over a FBO (Frame Buffer Object) in LibGDX.

If I render the sprite directly to the screen, I get no problems, but if I render it to a FBO and then to the screen, this black borders
appears again (viewtopic.php?f=9&t=1046).

What's the problem? I need to configure something in the FBO? filtering? blending function? some spine exporting options?

Thanks in advance.

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

Are you using premultiplied alpha? It is needed to get the correct blending.

I've enabled premultiplied alpha using skeletonRenderer.setPremultipliedAlpha(true) to draw to the FBO.

[...]

FBO.begin();

skeletonRenderer.setPremultipliedAlpha(true);
skeletonRenderer.draw(batch,skeleton);
batch.flush();

FBO.end();

[...]

batch.draw(texture region asociated to FBO);

Did it help? You'll still need to use premultiplied images, eg when packing your atlas.

Doesn't work 🙁 .Firstly, We're using bleeding, but for this test I disabled bleeding and save the atlas using premultiplied alpha and now, black borders appears rendering directly to the screen (enabling premultiplied alpha in the skeleton renderer of course). Maybe I misunderstood something?

Bleeding is really just a hack to work around incorrect blending when not using premultiplied alpha (PMA). You shouldn't see black borders if your images are PMA and you enable PMA for the renderer. I just tested spineboy, exported the JSON with atlas using PMA, ran AnimationStateTest, had black borders (forgot linear in this screenshot):

Изображение удалено из-за отсутствия поддержки HTTPS. | Показать

Called renderer.setPremultipliedAlpha(true) and rendering is good:

Изображение удалено из-за отсутствия поддержки HTTPS. | Показать

Maybe Have We configured incorrectly the texture atlas settings?

This is the character in spine.

Изображение удалено из-за отсутствия поддержки HTTPS. | Показать

Texture atlas settings:

Изображение удалено из-за отсутствия поддержки HTTPS. | Показать

In Game Character:

Изображение удалено из-за отсутствия поддержки HTTPS. | Показать

Are We doing something wrong? 🙁

Settings look fine. It shouldn't look like that if you are calling renderer.setPremultipliedAlpha(true). You sure you are?

OMG I have 2 constructors, and I do renderer.setPremultipliedAlpha(true) in just one, the one that.... I'm not using really. Everything works fine now and I feel myself a little bit silly xD. Thank you for your help and sorry for wasting your time Nate.

😃