-
-
Notifications
You must be signed in to change notification settings - Fork 417
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
Blend Mode ADD too bright #1077
Comments
Btw, to properly reproduce this, the original image is needed as well. |
@Gama11 As in, the add layer without the blend? |
Yes. How are you supposed to run the code otherwise? :) |
@mikeevmm your art style is pretty awesome. Can you explain why you're using the add layer like this? (Why not just generate the image in GIMP/etc. with the add layer?) |
@ashes999 dynamic animated effects is one use case (varying partially transparent overlay w/ blending) |
@ashes999 Thank you, but I'm just the programmer :( @larsiusprime is spot on. |
Hey @mikeevmm, I tried to replicate this but haven't been able to (in the sense that both neko and flash gave the same output - or so it seemed). As a side note, github seems to have autoconverted the above layer.png into a jpeg, so losing the alpha values (although I've also tested it by making it a png with white being transparent). If you can please post a complete project I'm willing to look into it a bit more, can you? Also: does something change if you use |
I'm sorry I've taken so long to reply; school got in the way -- I'll send a complete project asap. Disabling hardware made the game unbearably slow. |
@azrafe7 Mind if I send you the project privately/through PM or email? I'm working with a team, so I'm not sure whether disclosing art/etc is okay. |
@mikeevmm, I'd suggest replacing the art files with temp ones (f.e. from here), and post the minimal project publicly so that others can help/take a look at it. (Also, using different assets might also exclude the hypothesis that the problem has to do with incorrect formats). On the other hand, I'd be glad to take a look at what you have right now (if you feel so inclined). Of course no guarantee I'll be able to find a solution ;) |
Ok, this is not a final answer, but here's what I've found so far:
As I said, not a final answer (I'll probably tink more with it tomorrow). In the meantime I'd hope to be successful in summoning @mrcdk (sorry to bother you) - who seems quite knowledgeable about the matter at hand - and see what his opinion is about this. Worth noting is that the (f.e.: this is a diff made with imagemagick Also, it seems that blendmodes work correctly with openfl next (anyone correct me if I'm wrong here). |
Hey @mikeevmm, can you please test the pure-openfl branch here and report what you see by running I've added 2 screenshots in there that show what I see on my laptop, and was surprised to see that they are very similar (as opposed to what I experienced by running the flixel test). Don't feel to exclude that I'm doing something different on my end though (I've rebuilt lime ndll quite a few times lately). |
(I'm starting to suspect that there's something weird with TileSheet, not sure on what side - my code?, openfl?, flixel?) |
@mikeevmm Maybe I've found a solution... \o/ Not an official fix as this could break somewhere else, but the results are encouraging (and hope someone more knowledgeable than me will chime in to comment). My understanding is that it has to do with premultipliedAlpha and BlendMode.MULTIPLY. Probably the fix could be applied directly to OpenGLContext.cpp, or legacy openfl (haven't tried honestly - and don't forget that this is legacy!). In the meanwhile please test this repo and report back. |
@azrafe7 thank you! \o/ Will test ASAP |
@azrafe7 Have tested the master branch of your fork; everything looks fine, both on lime and windows: 👍 👍 👍 |
Great! 👍 |
@Gama11 Perhaps this could be temporarily fixed in HaxeFlixel by setting premultiplied alpha to true if blendMode = MULTIPLY and cpp? |
I'd rather not, that sounds like a pretty nasty hack. Who knows what side-effects enabling premultiplied alpha could have... |
Just a note: with |
You mean OpenFL 4? |
Oh, sorry, I made a big mess between branches, And yet, it does seem to be gone? |
Probably a side effect of it only exisiting in OpenFL legacy, and legacy having been removed? |
Legacy has been removed? |
It depends on whether you are using a |
The core difference is that old code used non-premultiplied alpha, the new code has premultiplied alpha in textures This changes how blend modes behave, if you guys have suggestions, I'd be happy to look at moving to blend modes that match the GL blend functions appropriate for premultiplied alpha Thanks |
@jgranick Ah, I'm a bit out of my league here... |
I am closing this issue, because it no longer applies to current OpenFL/Lime releases (very different codebase), but I am also tracking here: In general, we need to look at our blend mode support across GL, canvas and Cairo, and visit what we can reliably support out-of-the-box, and what we should consider making up with filters Thank you |
From HaxeFlixel repository:
Code snippet reproducing the issue:
bg.png:
addlayer.png:
Observed behavior:
Expected behavior:
According to @Gama11:
The text was updated successfully, but these errors were encountered: