-
-
Notifications
You must be signed in to change notification settings - Fork 397
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
Effects change pixels outside of selection #615
Comments
This bug is the same in these effects:
|
If you do desaturation/HSV with 0 effect, and check what happened to the colors, you'll see that the semi-transparent colors got darker by exactly the amount of their alpha. So something to do with Premultiply Alpha is happening. Adding this line to the shader fixes the effect once applied to the project, but has the opposite effect in the preview (where the semi-transparent pixels are now brighter): 2021-12-19.13-27-04.mp4According to this: godotengine/godot#17574 it seems to be due to how rendering images in viewports work. I'm guessing what's happening is that the viewport gives us a texture that has its alpha premultiplied (making these pixels darker). The render_mode blend_premul_alpha on the shader is meant for displaying textures that have had their alpha premultiplied, and will make the semi-transparent pixels brighter. So what happens with this fix is that the semi-transparent pixels become brighter, then darker. (Which is the opposite of the usual way but I guess it works). To fix the preview a couple things can be done: There also seems to be another bug where some colors come out a little different, as shown in the blue (but only in the selection). I'm guessing this has to do with how the shader converts between RGB to HSV and back. |
Pixelorama version:
Pixelorama master
OS/device including version:
Arch, AMD RX5700 XT - mesa 21.2.5
Issue description:
It seems that some Image shader effects like desaturation affect pixels with alpha<255 outside of selection even if "Only affect selection" is toggled.
I think that the problem is somewhere in
ShaderImageEffect.gd
because I encountered it also while trying to use it for bucket fill shader.The text was updated successfully, but these errors were encountered: