Jump to content

Screen Blend Mode not looking right


colourclash
 Share

Recommended Posts

Has anyone also noticed that the Screen blend mode while using the WebGL renderer looks more like an additive blend?
I've attached a test image to demonstrate the problem.
What I've done to fix it in the meantime (which to be honest is a blind guess) is to change this line in WebGLRenderer.js
this.blendModes[CONST.BLEND_MODES.SCREEN] = [gl.SRC_ALPHA, gl.ONE];
to this
this.blendModes[CONST.BLEND_MODES.SCREEN] = [gl.ONE, gl.ONE_MINUS_SRC_COLOR];

 

result.jpg

Link to comment
Share on other sites

And another moment of fame for me!

There're pull requests about it: https://github.com/pixijs/pixi.js/pull/2321 . It switched gl.SRC_ALPHA to gl.ONE if texture has premultiplied alpha. And second parameter is gl.ONE_MINUS_SRC_COLOR and I think it is correct.

Build is here: https://dl.dropboxusercontent.com/u/46636530/pixijs/blendMode/pixi.js

Test it please, I need a feedback.

Link to comment
Share on other sites

For my purposes the second output above is what I need. I did some tests with a non-premultiplied image and setting baseTexture.premultipliedAlpha to false which to my eyes didn't look the way I would expect - I normally just go with pre-multiplied images so perhaps someone who is using non-premultiplied textures can chime in here.
When switching to canvas renderer, with baseTexture.premultipliedAlpha set to true or false, they both look like the second image above.

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