These are chat archives for pixijs/pixi.js

23rd
Jan 2018
Charles Forman
@setpixel
Jan 23 2018 00:53
hi friends! I have a newbish question. I'm trying to get the pixel data of a render texture. I bind the rendertexture to the the renderer and I readPixels() from the gl context, and everything almost works. But the alpha is premultiplied :(
Does anyone know the best way to get the pixels from a render texture including the alpha?
Ivan Popelyshev
@ivanpopelyshev
Jan 23 2018 08:48
you have to patch pixi that way it uses non-premultiplied alpha in rendertextures
the only thing about NPM i made is for sprites that use NPM textures
all framebuffers are premultiplied, if you want a non-premultiplied buffer, prepare to patch renderer plugins that you use (sprite, graphics, mesh, e.t.c.)
its hard.
Charles Forman
@setpixel
Jan 23 2018 14:13
@ivanpopelyshev are PM textures lossy?
I am just saving layers of drawings, that will be only displayed in the app I'm working on, so maybe saving PM data is totally ok?
Ivan Popelyshev
@ivanpopelyshev
Jan 23 2018 14:23
if you dont store specific data in alpha channel, just use PM.
Charles Forman
@setpixel
Jan 23 2018 14:25
well - it is opacity data for the drawing
i like your postdivide function!
@ivanpopelyshev i think I understand now why exotic blendmodes are difficult... because of PM? right?
Ivan Popelyshev
@ivanpopelyshev
Jan 23 2018 14:29
that's small issue compared to whole "you need to copy a part of current framebuffer into texture"
Charles Forman
@setpixel
Jan 23 2018 14:30
yeah