pixijs / spine-v8

PixiJS v8 port of the official spine runtime
https://pixijs.io/spine-v8/examples/
MIT License
38 stars 6 forks source link

fix: pma textures are requested to be loaded as already premultiplied #30

Closed davidetan closed 3 months ago

davidetan commented 4 months ago

A Spine atlas txt files that are generate in conjunction with the respective atlas textures contains a pma option that holds the information regarding the textures beinga premultiplied or not. This information can be used to inform the texture loader to premultiply or not the texture on load.

This PR allows to use the pma information and to request to the pixi texture loader to premultiply the texture or not.

When webgpu is used, this is sufficient. However, when webgl is used, it is necessary to set on PIXI.Assets the preferWorkers to false when Spine premultiplied textures are loaded because currently when createImageBitmap is used, the given alphaMode is ignored. This can be avoided if this other PR is merged: https://github.com/pixijs/pixijs/pull/10803

If this PRs are merged, it would be cool if the blog news examples would be regenerated to use this fix. Currently, all textures have the problem of using pma textures, but are loaded without taking this in consideration.