Skip to content

Material blend modes. - #297

Open
tychedelia wants to merge 1 commit into
strokes-3dfrom
blend-modes
Open

tychedelia wants to merge 1 commit into
strokes-3dfrom
blend-modes

Conversation

@tychedelia

@tychedelia tychedelia commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

Cleans up how materials specify a blend mode.

Previously there were two overlapping ways to do this, mat.transparent() / mat.opaque() and mat.blend_mode(..), which under the hood was just an int for a pre-computed blend mode.

The new way:

  • mat.blend_mode(mode) is the only way to say how a material should blend. mode is OPAQUE, BLEND, ADD and the other presets, PREMULTIPLIED, or a custom BlendMode(...) in Python.
  • When a material is created and an explicit blend mode isn't set, it'll follow the blend mode at draw time.
  • Global blend_mode(OPAQUE) forces everything opaque regardless of the fill's alpha.
  • mat.mask(cutoff) stays as its own thing since it isn't blending, plus mat.no_mask(). We should add an image mask here to our shader extension in the future.
  • mat.opaque(), mat.transparent() and the alpha_mode= kwarg are gone.

The engine API matches: material_set_blend_mode and material_set_mask replace the numbered material_set_alpha_mode`, and the C and Node bindings follow.

Stack created with GitHub Stacks CLI • Give Feedback 💬

@tychedelia
tychedelia requested a review from catilac November 30, 2026 22:34
@tychedelia
tychedelia marked this pull request as ready for review November 30, 2026 22:34
@github-actions

Copy link
Copy Markdown

Visual regression: 1 changed, 2 new of 45 cases

case status detail
py_custom_vertex 🆕 new no baseline on main
py_particles_stress ❌ changed 100% of pixels differ
py_first_frame 🆕 new no baseline on main

If these changes are intentional, add the deliberate-rendering-change label.

baseline 27c15a47d5 · adapter llvmpipe (LLVM 20.1.2, 256 bits) (Vulkan, Mesa 25.2.8-0ubuntu0.24.04.5 (LLVM 20.1.2))

Open the visual report · workflow run

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant