Skip to content

Feat(canvas): add pressure dependent opacity for brush#9232

Open
DustyShoe wants to merge 5 commits into
invoke-ai:mainfrom
DustyShoe:Feat(Canvas)/pressure-dependent-opacity-for-brush
Open

Feat(canvas): add pressure dependent opacity for brush#9232
DustyShoe wants to merge 5 commits into
invoke-ai:mainfrom
DustyShoe:Feat(Canvas)/pressure-dependent-opacity-for-brush

Conversation

@DustyShoe
Copy link
Copy Markdown
Collaborator

Summary

This PR adds pressure-dependent brush opacity to the canvas and separates the old pressure sensitivity toggle into two independent settings: Pressure Affects Width and Pressure Affects Opacity.

2026-05-25.12-15-35.mp4

The main goal was to make opacity pressure usable with a hard brush. Previously, canvas pressure input only affected stroke width. This PR adds pressure-dependent brush opacity and implements a smoothed rasterized opacity path so the committed stroke stays visually continuous. This change switches the pressure-opacity brush path to a smoothed rasterized opacity workflow, keeps the committed stroke smooth, and preserves pressure width behavior as a separate option.

This PR also:

  • adds a settings migration from the legacy pressureSensitivity flag
  • updates the pressure-enabled brush and eraser paths to use the new settings, and lays the groundwork for pressure-controlled soft erasing in the future
  • replaces the old single pressure sensitivity setting with separate width and opacity options
  • adds focused frontend tests for settings migration and pressure stroke rendering behavior

Related Issues / Discussions

Discord discussion around pressure-dependent brush opacity, segment seams, and smoothing during stroke commit.

https://discord.com/channels/1020123559063990373/1049495067846524939/1504674583846850760
https://discord.com/channels/1020123559063990373/1020123559831539744/1508389863781568512

QA Instructions

  1. Open canvas settings and verify the two options are shown as:
    • Pressure Affects Width
    • Pressure Affects Opacity
  2. Enable only Pressure Affects Width and draw pen strokes. Verify width changes with pressure and opacity stays constant.
  3. Enable only Pressure Affects Opacity and draw pen strokes with light-to-heavy and heavy-to-light pressure. Verify the committed stroke opacity changes smoothly.
  4. Enable both options and verify width and opacity both respond to pen pressure.
  5. Draw long curved strokes and fast strokes, then confirm the committed result is smooth and does not show the obvious bead-like segment artifacts from the old approach.
  6. Reload the app and confirm the new pressure settings persist correctly.
  7. Verify legacy settings migration by loading existing persisted canvas settings and confirming width pressure remains enabled while opacity pressure stays disabled by default.

Merge Plan

Normal merge is fine.

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Tests added / updated (if applicable)
  • ❗Changes to a redux slice have a corresponding migration
  • Documentation added / updated (if applicable)
  • Updated What's New copy (if doing a release after this PR)

@github-actions github-actions Bot added the frontend PRs that change frontend files label May 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend PRs that change frontend files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant