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

More blendmodes #5391

Merged
merged 17 commits into from Jan 29, 2019
Merged

More blendmodes #5391

merged 17 commits into from Jan 29, 2019

Conversation

@ivanpopelyshev
Copy link
Member

@ivanpopelyshev ivanpopelyshev commented Jan 27, 2019

Ready for review!

Example: https://www.pixiplayground.com/#/edit/Y3HeuBbbllstbzsfp5g8t

There's no SUBTRACT blendMode for canvas2d.

Some blendModes require extra clip on canvas2d.

Code of CanvasSpriteRenderer is improved, slightly.

Aliases:

  1. DST_OUT aka ERASE is the best eraser, it also does not require clip on canvas2d!
  2. SRC_OVER is our default normal blendMode.
@Dairnon
Copy link
Collaborator

@Dairnon Dairnon commented Jan 28, 2019

With WEBGL2.0 we get more out of box support for other blend modes right? Stuff like screen?

Or does that still require renderTexture/shader hacks.

remove NONE patch
@ivanpopelyshev
Copy link
Member Author

@ivanpopelyshev ivanpopelyshev commented Jan 28, 2019

Something is very wrong with canvas renderer blendModes, I'm working on it. WebGL ones are working.

@ivanpopelyshev
Copy link
Member Author

@ivanpopelyshev ivanpopelyshev commented Jan 28, 2019

According to example and masking, we have to add extra clip for canvas renderer to handle 5 of new blendmodes, both in Graphics and Sprite. Its interesting that this problem was solved in Mozilla Shumway canvas2d renderer.

wip
wip
@ivanpopelyshev
Copy link
Member Author

@ivanpopelyshev ivanpopelyshev commented Jan 28, 2019

Unfortunately, use of blendFuncSeparate and extra blendEq affects performance: https://jsperf.com/blendmodefunc-test .

@ivanpopelyshev
Copy link
Member Author

@ivanpopelyshev ivanpopelyshev commented Jan 28, 2019

OK, I did optimization suggested by @GoodBoyDigital

Copy link
Member

@GoodBoyDigital GoodBoyDigital left a comment

nice man! one final tweak :D

this.gl.blendFuncSeparate(mode[0], mode[1], mode[2], mode[3]);
gl.blendFuncSeparate(mode[0], mode[1], mode[2], mode[3]);
}
if (mode.length === 6)

This comment has been minimized.

@GoodBoyDigital

GoodBoyDigital Jan 28, 2019
Member

can we stick this if inside the else above?

This comment has been minimized.

@ivanpopelyshev

ivanpopelyshev Jan 28, 2019
Author Member

no, because there's else branch for that if too

Copy link
Member

@GoodBoyDigital GoodBoyDigital left a comment

fair point! 👍

@ivanpopelyshev
Copy link
Member Author

@ivanpopelyshev ivanpopelyshev commented Jan 29, 2019

I looked through it one more time, seems clean.

@bigtimebuddy bigtimebuddy merged commit 536e0d3 into dev Jan 29, 2019
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
@englercj englercj deleted the dev-blendmode-knockout branch Jan 30, 2019
@lock
Copy link

@lock lock bot commented Jan 30, 2020

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 Jan 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.