Jump to content

DisplayObject.filters questions


yahiko
 Share

Recommended Posts

I have some questions about filters and how they behave in Pixi.js.

1. When settings filters on a display object like this:

stage.filters = [filter1, filter2, filter3, filter4];

Is the order defined in the list is the same when rendered?

2. Does Pixi.js create brand new FrameBuffer Objects for each filter, or does it reuses the output of the previous filter as input for the next filter?

Sorry if I'm not really clear or accurate since I'm not a WebGL expert ^^

Thanks for your insights :)

Link to comment
Share on other sites

Good questions.

1. Yes, but i dont remember which one is applied first or last.

2. There's a pool of temporary pow2 render textures that is used. Also it needs only two textures, it swaps them every time.

We want to evade the unnecessary resize (slow on mobile), that's why pooled textures have pow2 size. It comes with a drawback - https://github.com/pixijs/pixi.js/wiki/v4-Creating-Filters

Also you can set the blendMode of last/first filter, it works like blendmode of sprite.

Also this thing wont work because of stupid setter:

var f = [filter1, filter2, filter3, filter4];
stage.filters = f; // COPIES THE ARRAY!!!
f.push(filter5); // wasnt added to stage  :(

//lets fix that
stage._filters = f; // link by referencem yes, its a hack.
f.push(filter6); // added to stage :)

 

Link to comment
Share on other sites

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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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