Search the Community
Showing results for tags 'getPixels'.
-
RenderTexture has an awesome function called getPixels, which returns a Uint8Array of rgba pixel data. Is there a way to create a pixi object from a Uint8Array of pixels? I'm writing an image processor which works in a webworker. The Uint8Array is already perfect for passing to/from the webworker, I'm just not sure how to use that pixel data again when it comes back from the worker. On a related note, the main reason I'm looking into using the webworker is because I can't quite get webgl filters (fragment shaders) to perform fast enough for me. I am using a ColorReplaceFilter and applying it to a sprite approximately 12-15 times to create my desired artwork. This creates a lag of 40-80 ms on my system. I need to get this number down to less than 16 ms. It is only the step of rendering via rendertexture with filters that causes this lag. Fifteen might sound like a lot of filters, and I could certainly engineer a single filter that does the work of 15, but the majority of the performance hit comes from applying 1 filter, adding subsequent filters does not slow things down very much. I don't really know how webgl works, but seems to me like something is blocking the main thread and creating this lag. What is the source of this? I feel like there might be an easy solution somewhere. If the problem is that the filters need sent from the cpu to the gpu, perhaps I could send them one at a time (not sure how). If the problem is that PIXI.RenderTexture.render blocks the main thread until webgl has processed all the filters and rendering is complete, perhaps there could be a PIXI.RenderTexture.asyncRender that uses a callback and allows for some image processing magic. Any ideas?
- 5 replies
-
- webgl
- color replacement
-
(and 3 more)
Tagged with: