westy Posted December 10, 2017 Share Posted December 10, 2017 I've been working with PIXI filters recently. If I apply the filter to a sprite with alpha, I've noticed that somewhere along the line the alpha gets premultiplied. For example, I have a test texture with a pixel saved as [255, 255, 255, 128]. When I sample the texture, in a filter Instead of [1.0, 1.0, 1.0, 0.5] the result is [0.5, 0.5, 0.5, 0.5]. How can I turn off this premultiplying behaviour? I've tried 'transparent: false' and 'transparent: "notMultiplied" ' in the webGL renderer settings, but neither of those seemed to make any difference? ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted December 10, 2017 Share Posted December 10, 2017 There's no way to turn it off in filters. I want that feature in v5, but in v4 its that difficult. "if (something.a>0) { vec3 rgb=something.rgb/something.a; ... } else gl_FragColor = ... ;" something like that should work. Most simplest operations are using (Ra,Ga,Ba,a) because linear filtering needs that. In case of pixi filters, its not needed but we use it just because its easier to maintain the code where (Ra,Ga,Ba,a) is the only case. A few months ago I've made a patch that allowed pixi to use non-premultiplied textures in sprites, to use with "compressed-textures" plugin. I hope to add it to PIXI.Filter in next release! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.