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

Var transparent mode #444

Merged
merged 13 commits into from
Feb 2, 2021
Merged

Var transparent mode #444

merged 13 commits into from
Feb 2, 2021

Conversation

Variable-ind
Copy link
Contributor

I modified my earlier version a little bit so that it would reset to zero in full screen mode hence removing the blackness issue

@kleonc
Copy link
Contributor

kleonc commented Jan 29, 2021

For sure you're not blending colors correctly:

Opaque image (100% transparent mode)

yZdInjYGI6

Not opaque image (100% transparent mode)

It's too dark, blending with the white background shouldn't make it darker.

NZNlnAZWzn


Setting blending mode to premultiplied alpha for the main ViewportContainer seems to fix it:

Not opaque image (100% transparent mode).

EqRnzyV5uG

@Variable-ind
Copy link
Contributor Author

Variable-ind commented Jan 29, 2021

it is not a bug. If you look at the code, the transparency does not affect the image(even a little bit), it only effects the TransparentChecker.shader and the background.

@Variable-ind
Copy link
Contributor Author

however it does seem to get the job done so i am going to add it

@kleonc
Copy link
Contributor

kleonc commented Jan 29, 2021

it is not a bug. If you look at the code, the transparency does not affect the image(even a little bit), it only effects the TransparentChecker.shader and the background.

Image can be transparent and thus its colors are already multiplied by alpha of the layers etc. So if you're changing Viewport's background to be transparent you need to take into account that the alpha was already applied to the image (RGB values of the image are already multiplied by the alpha). Otherwise you'll end up with the darker colors when backgroundAlpha != 1.0 because RGB values of the image would be again multiplied by some factor < 1.0 (which you can see happening on the image in my previous comment).

@Variable-ind
Copy link
Contributor Author

yes i found it just now and am enabling material.blend_mode = CanvasItemMaterial.BLEND_MODE_PREMULT_ALPHA thanks for letting me know

Fixed the bug that darkens image when decreasing opacity
Copy link
Member

@OverloadedOrama OverloadedOrama left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to be working well, good job! I left some comments too, and I would also like to propose to change "Transparency Mode" to "Window Transparency", in order to make what the option does more obvious to the user. As for the option's UI, I'm still unsure if this is a good place for it, but I suppose we could leave it as it is for now, and we could change it in the future if we think of something better.

src/Main.gd Outdated Show resolved Hide resolved
src/Main.gd Outdated Show resolved Hide resolved
Copy link
Member

@OverloadedOrama OverloadedOrama left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All right, awesome, thank you!

@OverloadedOrama OverloadedOrama merged commit dc469dd into Orama-Interactive:master Feb 2, 2021
@Variable-ind Variable-ind deleted the Var-TransparentMode branch February 9, 2021 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants