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

Add dual source blending sample #441

Open
beaufortfrancois opened this issue Aug 22, 2024 · 3 comments
Open

Add dual source blending sample #441

beaufortfrancois opened this issue Aug 22, 2024 · 3 comments
Labels
sample request Request for a new sample sample wanted We definitely want to add this sample; contributions welcome

Comments

@beaufortfrancois
Copy link
Collaborator

I think a WebGPU sample illustrating the dual source blending feature would be nice.
@Jiawei-Shao Did you have something in mind already?

@Jiawei-Shao
Copy link

No I haven't. I just know it is useful in Skia. Maybe I can prepare and add one to this repository.

@beaufortfrancois
Copy link
Collaborator Author

Chatted with @Kangz, and we're not 100% sure a dual-source blend is the best way for you to spend your time. But hey, I'm still game for one if you are!

@kainino0x kainino0x added the sample wanted We definitely want to add this sample; contributions welcome label Aug 27, 2024
@kainino0x
Copy link
Collaborator

Comment or assign yourself if you plan to work on it, otherwise this one can be "contributions welcome"!

https://registry.khronos.org/OpenGL/extensions/ARB/ARB_blend_func_extended.txt says:

Example Use Cases

    There are several potential uses for this functionality. A first example
    is in the implementation of sub-pixel accurate font rendering algorithms.
    Given a known layout of pixel elements (red, green and blue components),
    coverage may be calculated independently for each element and passed
    to the blender in the second source color as a per-channel opacity. To use
    this mode, use the following blend functions:

        glBlendFunc(GL_SRC1_COLOR, GL_ONE_MINUS_SRC1_COLOR);

    As a second example, consider a partially reflective colored glass window.
    It will attenuate light passing through it, and reflect some of the light
    that strikes it. Using an appropriate combination of functions, this effect
    may be simulated in a single pass using only fixed-function blending
    hardware. In this case, the following blend functions may be used:

        glBlendFunc(GL_SRC_ALPHA, GL_SRC1_COLOR);

@kainino0x kainino0x added the sample request Request for a new sample label Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sample request Request for a new sample sample wanted We definitely want to add this sample; contributions welcome
Projects
None yet
Development

No branches or pull requests

3 participants