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

AGS 4: custom BlendMode on GUIs conflict with its rendering as a composite texture #2694

Open
ivan-mogilko opened this issue Feb 28, 2025 · 0 comments
Labels
ags 4 related to the ags4 development context: graphics type: bug unexpected/erroneous behavior in the existing functionality

Comments

@ivan-mogilko
Copy link
Contributor

ivan-mogilko commented Feb 28, 2025

Problem

Since #1874 each GUI with its controls are being composed to a separate texture (render target), which is then rendered on screen.
Because of this composition, final GUI texture pixels end up with a premultiplied alpha, and requires separate blend mode when drawn.

This was not much of an issue in v3.* engine, but in AGS 4 we have custom BlendModes which may be applied to GUIs as well.
Currently having a BlendMode assigned to GUI will likely make it draw incorrectly, because their implementation does not account for a premultiplied alpha.

Suggestion

I don't yet know which options are available to solve such issue. The most straightforward that comes to mind is to try to provide a separate implementation for the blend modes in case we're drawing such texture, to make them account for premultiplied alpha.

If that is not possible, then we need to investigate if other solutions exist.

NOTE: there's #1885 which suggests to reimplement blend modes as shaders, but it's possible that that proposal is incorrect and should be rewritten or closed, as shaders AFAIK affect only the current texture, and cannot reference what's below. I may be wrong though. In any case I wrote this bug report separate, as #1885 not necessarily provides a proper solution.

@ivan-mogilko ivan-mogilko added ags 4 related to the ags4 development context: graphics type: bug unexpected/erroneous behavior in the existing functionality labels Feb 28, 2025
@ivan-mogilko ivan-mogilko added this to the 4.0.0 (preliminary) milestone Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ags 4 related to the ags4 development context: graphics type: bug unexpected/erroneous behavior in the existing functionality
Projects
None yet
Development

No branches or pull requests

1 participant