JuanluGC

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.
Аватара пользователя
JuanluGC
  • Сообщения: 90

Nate

Are you using premultiplied alpha? It is needed to get the correct blending.
Аватара пользователя
Nate

Nate
  • Сообщения: 11260

JuanluGC

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);
Аватара пользователя
JuanluGC
  • Сообщения: 90

Nate

Did it help? You'll still need to use premultiplied images, eg when packing your atlas.
Аватара пользователя
Nate

Nate
  • Сообщения: 11260

JuanluGC

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?
Аватара пользователя
JuanluGC
  • Сообщения: 90

Nate

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):



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

Аватара пользователя
Nate

Nate
  • Сообщения: 11260

JuanluGC

Maybe Have We configured incorrectly the texture atlas settings?

This is the character in spine.



Texture atlas settings:



In Game Character:



Are We doing something wrong? :(
Аватара пользователя
JuanluGC
  • Сообщения: 90

Nate

Settings look fine. It shouldn't look like that if you are calling renderer.setPremultipliedAlpha(true). You sure you are?
Аватара пользователя
Nate

Nate
  • Сообщения: 11260

JuanluGC

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.
Аватара пользователя
JuanluGC
  • Сообщения: 90

Nate

:D
Аватара пользователя
Nate

Nate
  • Сообщения: 11260


Вернуться в Editor