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: reimplement custom Blend Modes using shaders #1885

Open
ivan-mogilko opened this issue Jan 6, 2023 · 1 comment
Open

AGS 4: reimplement custom Blend Modes using shaders #1885

ivan-mogilko opened this issue Jan 6, 2023 · 1 comment
Labels
ags 4 related to the ags4 development context: graphics

Comments

@ivan-mogilko
Copy link
Contributor

For Direct3D / OpenGL renderers the custom blend modes were implemented using standard alpha-blend operations, which seem to have two problems:

  • the result is not precise;
  • this may conflict with situations where we must use specific kind of alpha blending operations for other reasons.

The latter is now a real problem, after #1874: as the textures used as render targets for the group of sprites must be blended using very particular blend ops.

The proposed solution is to reimplement these Blend Modes using shaders.

My understanding is that in OpenGL shaders must include transparency, because it's currently done through a shader, although I cannot remember why that was made so (afaik this was a part of switching to a more contemporary OpenGL style). Existing shaders may be used as example.

Besides that, we need to decide whether Tint and LightLevel effects should apply along with the BlendMode or not. This decision will affect the complexity of this task.

@ivan-mogilko ivan-mogilko added context: graphics ags 4 related to the ags4 development labels Jan 6, 2023
@ivan-mogilko ivan-mogilko added this to the 4.0.0 (preliminary) milestone Jan 6, 2023
@ericoporto
Copy link
Member

ericoporto commented Jul 30, 2023

My understanding is that in OpenGL shaders must include transparency, because it's currently done through a shader, although I cannot remember why that was made so

I am not 100% sure, but it may be when the OpenGL ES2 version of the renderer was written, because OpenGL ES2 has a lot less things in its API.

Edit: we could move to OpenGL ES3, It may have a bit more things and is available in most devices - Apple added support to WebGL 2.0 in Safari in 2021 which mean it could be used in the Emscripten emulation nowadays.

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
Projects
None yet
Development

No branches or pull requests

2 participants