Jump to content

Filter Feedback / Apply Filter Multiple Times?


Recommended Posts

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:

  1. Apply filter to sprite image
  2. Capture the result
  3. Set sprite image to result
  4. Apply filter to sprite image
  5. 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?

Link to comment
Share on other sites

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.


Link to comment
Share on other sites

  • 4 years later...

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...