LeonNeol

I've been hearing a lot about how you can reduce batch flush with additive blend mode and pma. Nate mentioned it in http://vi.esotericsoftware.com/forum/LibGDX-Alpha-Fading-with-Premultiplied-Alpha-9367:
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.
However I am struggling to understand the concept of it. I checked https://github.com/EsotericSoftware/spine-runtimes/blob/4.0/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/BlendMode.java and it seems that whether pma is involved or not changing from Normal to Additive still require changing destColor from GL_ONE_MINUS_SRC_ALPHA to GL_ONE, isn't that a state change and trigger a batch flush?
LeonNeol
  • 記事: 10

Nate

The magic happens here:
https://github.com/EsotericSoftware/spine-runtimes/blob/4.0/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonRenderer.java#L108-L111
Using PMA lets us achieve additive blending by setting the alpha to 0 while using the "normal" blend mode. It is also better if you are using mipmaps.
アバター
Nate

Nate
  • 記事: 11351

LeonNeol

I got this working! This thing is amazing. Thank you
LeonNeol
  • 記事: 10


Return to Runtimes