Skip to content

Wire Quill's brush UV clamp through the UI shader and clamp editor sprite sub-rect previews - #364

Closed
Acissathar wants to merge 1 commit into
ProwlEngine:mainfrom
Acissathar:quill-aa-clamp-fix
Closed

Wire Quill's brush UV clamp through the UI shader and clamp editor sprite sub-rect previews#364
Acissathar wants to merge 1 commit into
ProwlEngine:mainfrom
Acissathar:quill-aa-clamp-fix

Conversation

@Acissathar

Copy link
Copy Markdown
Contributor

Uses Anthology / Quill PR: ProwlEngine/Anthology#13

As mentioned this is out of my wheelhouse, so largely handled by Claude. Tested locally and it does fix the issue though.

Problem

Sprite sub-rect draws through Paper/Quill bleed the neighbouring atlas cell along their edges:
RectFilled's AA fringe extends half a physical pixel past the nominal rect, and the canvas shader
samples the brush texture by fragment position with coverage applied after the sample, so fringe
fragments read UVs outside the sprite's window. See the companion Anthology PR for the full
mechanism and the new SetBrushTextureClamp API (with its load-bearing half-texel inset).

Fix

Consume the new Quill brush UV clamp:

  • Prowl.Runtime/Assets/Defaults/UI.shader — add the textureClamp uniform and clamp the brush UV
    before the sample (port of the Canvas.slang change).
  • Prowl.Runtime/GUI/PaperRenderer.cs — upload drawCall.TextureClamp.
  • Prowl.Editor/.../SpriteAssetEditor.cs and Prowl.Editor/.../UIImageEditor.cs — the two editor
    previews that draw sprite sub-rects opt in with canvas.SetBrushTextureClamp(u0, v0, u1, v1)
    after setting the brush texture/transform.

Notes:

  • Depends on the Anthology PR: needs a Prowl.Paper package containing Brush.TextureClamp /
    SetBrushTextureClamp / DrawCall.TextureClamp (version bump) before this builds against the feed.
  • The runtime UIImage component is unaffected by design — it maps sprite UVs through mesh vertex
    UVs, not Quill brush sampling.
  • Full-texture editor brush draws (texture preview, sprite editor backdrop, scene/game view RT
    blits) are left unclamped on purpose: their [0,1] windows only artifact on Repeat samplers.

@michaelsakharov

Copy link
Copy Markdown
Contributor

Oh, wait sorry i merged the other one didnt consider its changes leak into everything taht uses quill.
That includes ALL of papers sample projects, quill samples, Origami Samples, and Prowl as well as all other applications people have made.

Sorry, i jumped the gun, Could you look into instead padding Brush Texture when assigning it inside the canvas when AA is enabled to simply align taking into account AA, rather then a clamp?

@Acissathar

Copy link
Copy Markdown
Contributor Author

Not actually needed - can just use this chunk before rendering the texture brush and it solves the issue entirely:

bool prevAA = canvas.AntiAlias;
canvas.SetAntiAlias(false);
canvas.RectFilled(x, y, w, h, tint);
canvas.SetAntiAlias(prevAA);

@Acissathar Acissathar closed this Aug 26, 2026
@Acissathar
Acissathar deleted the quill-aa-clamp-fix branch August 26, 2026 17:48
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.

2 participants