Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blendMode can be changed when filter applies. #2222

Closed
wants to merge 0 commits into from

Conversation

ivanpopelyshev
Copy link
Collaborator

blendMode can be changed when filter applies. No changes in current filters are required.

@ivanpopelyshev
Copy link
Collaborator Author

However, demo from #1598 wont work on that, because Multiply operation is not additive. Those small squares in intersections are black if you dont apply filter:

Alt text

UPD. but if we use two graphics with two multiplies - it will work like a charm ;)

@ivanpopelyshev
Copy link
Collaborator Author

how it works:

container.filters = [bloomFilter];
container.filterBlendMode = PIXI.BLEND_MODES.ADD;

@ivanpopelyshev
Copy link
Collaborator Author

That patch has solved this case: http://www.html5gamedevs.com/topic/19029-cant-set-blendmode-with-filters/

@ivanpopelyshev
Copy link
Collaborator Author

By the way, PIXI.Container doesnt have blendMode on its own , so filterBlendMode can be good solution for two other cases:

  • blendModes that arent supported by glBlendFunc
  • use of globalCompositionMode in canvas fallback on whole container

@englercj
Copy link
Member

englercj commented Dec 9, 2015

This PR can't be merged for a couple reasons:

  1. It creates new properties on the object during runtime, which destroys the hidden class optimizations. Any property on the object must be created at constructor time.
  2. I don't think this is the right way to do this, You have render target access in the apply methods of filters, I wonder if it makes sense for the filter to be applying a blend mode there.

@ivanpopelyshev
Copy link
Collaborator Author

Help me with 1, I know you can change PR before you apply it.

As for 2, I dont want to change other filters, and for example, BlurFilter does apply two times.

I thought about that stuff for 5 days already, and I dont see other solutions. BlendMode is using data from renderTarget , its not a filter, its a special case.

Also, to implement all standart blendModes we'll have to use "readPixels", we cant avoid that.

@GoodBoyDigital
Copy link
Member

what do you guys think about putting the filter blend mode property as a property on the filter as it feels like its more of a filter specific thing?

@ivanpopelyshev
Copy link
Collaborator Author

It makes sence only for last filter in the list, and we have to implement that thing inside FilterManager, so filters will be able to call that special method which is taking care of blendMode.

@lock
Copy link

lock bot commented Feb 25, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Feb 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants