AGS 4: custom BlendMode on GUIs conflict with its rendering as a composite texture #2694
Labels
ags 4
related to the ags4 development
context: graphics
type: bug
unexpected/erroneous behavior in the existing functionality
Milestone
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.
The text was updated successfully, but these errors were encountered: