m88 Posted April 14, 2017 Share Posted April 14, 2017 I think I have seen this question asked before, but I have not been able to implement a working solution in pixi.js v4.5.0. I am new to this, so bear with me.... I have a custom GLSL filter (the Game of Life, for now)-- I want to continually apply the filter to the sprite in a feedback loop. That is: Apply filter to sprite image Capture the result Set sprite image to result Apply filter to sprite image Loop I have attempted this with PIXI.Texture.fromCanvas(app.view) -> texture.update(), but that resulted in a black screen. I think using RenderTexture buffers with app.renderer.render may be on the right track, but I'm not sure how I should be applying them. I attempted to set my sprite.texture to a RenderTexture and it resulted in an error... I've also had various "Feedback loop detected" warnings in the console when I attempted to pass render textures as filter uniforms and read from those. Is there a way to set the sprite texture to the filtered sprite? Quote Link to comment Share on other sites More sharing options...
Taz Posted April 17, 2017 Share Posted April 17, 2017 Here's a demo that shows a way to do this for Pixi 4.5.0. Just click or tap the bunny to start applying the filter once per frame. This custom GLSL filter just reduces the brightness by 2%, so you can see the bunny become dimmer and dimmer as the filter is applied over and over. The demo uses two sprites and two render textures, one for filtering and one for displaying, and swaps the render textures before each render. Quote Link to comment Share on other sites More sharing options...
marteiro Posted May 3, 2021 Share Posted May 3, 2021 Can you guys point me to a working example of this? Or a solution on how to capture the filter result and feedback? Thanks Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted May 4, 2021 Share Posted May 4, 2021 There's a demo for v5 too https://www.pixiplayground.com/#/edit/Ngi8fYSPwGGZYnfGIHb9O It was mentioned here: https://github.com/pixijs/pixi.js/wiki/v5-Hacks#re-use-previous-frame-of-filtered-object for v6 you have to update the code a bit because filterSystem most probably was changed marteiro 1 Quote Link to comment Share on other sites More sharing options...
marteiro Posted May 5, 2021 Share Posted May 5, 2021 (edited) Thanks @ivan.popelyshev, that was very helpful. Edited May 5, 2021 by marteiro 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.