Feat(canvas): add pressure dependent opacity for brush#9232
Conversation
|
The issue is limited to reloading/rehydrating unflattened pressure-opacity strokes. Reconstructing them from the persisted segmented representation can introduce overlap artifacts after a refresh or in a new session. I spent a significant amount of time investigating possible solutions. The approaches I explored mainly involved persisting a baked raster representation of pressure-opacity strokes and restoring that on reload instead of reconstructing them from their original transparent segment objects. However, every variation I tried introduced additional metadata and state complexity without providing a clean solution. From my current understanding of the architecture, a robust fix appears to require a dedicated baked persistence path for these strokes, which is beyond the scope of this PR. For now, I propose treating reload fidelity for unflattened pressure-opacity strokes as a known limitation. That said, my understanding of this part of the codebase may well be incomplete. If someone more familiar with the architecture has a cleaner or more robust approach, I would genuinely welcome the suggestion. |
…-dependent-opacity-for-brush # Conflicts: # invokeai/frontend/web/src/features/controlLayers/konva/CanvasTool/CanvasBrushToolModule.ts
|
The actual culprit was the reload-only compositor introduced by ab1aab8. It attempted to distinguish local overlaps from stroke revisits, but loops were classified incorrectly and reconstructed as separate translucent shapes. |


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:
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
Merge Plan
Normal merge is fine.
Checklist
What's Newcopy (if doing a release after this PR)