-
-
Notifications
You must be signed in to change notification settings - Fork 658
Open
Description
Summary
The following CSS blend modes are only supported by the Canvas renderer and fall back to "normal" in WebGL:
overlaycolor-dodgecolor-burnhard-lightsoft-lightdifferenceexclusion
These modes require per-pixel conditional math that cannot be expressed with gl.blendFunc/gl.blendEquation. The only way to implement them in WebGL is via custom fragment shaders.
Current state
- PR Expand blend mode support with darken/lighten in WebGL2 #1317 added
darken/lightenin WebGL2 viagl.MIN/gl.MAX setBlendModereturns the actually applied mode, so callers can detect unsupported modes- The Blend Modes example shows green/red indicators for supported/unsupported modes
Implementation approach
Each advanced blend mode would need:
- A custom fragment shader with the blend formula (e.g. overlay:
base < 0.5 ? 2*base*blend : 1-2*(1-base)*(1-blend)) - A two-pass render: first pass renders to a texture, second pass blends using the shader
- Integration with the existing
setBlendModeAPI
Reference
- W3C Compositing and Blending spec — canonical blend formulas
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels