Skip to content

Original paint fill method used was very slow.#3635

Open
fuzorsilverbolt wants to merge 1 commit into
JannisX11:nextfrom
fuzorsilverbolt:fix/paint-bucket-large-texture-freeze
Open

Original paint fill method used was very slow.#3635
fuzorsilverbolt wants to merge 1 commit into
JannisX11:nextfrom
fuzorsilverbolt:fix/paint-bucket-large-texture-freeze

Conversation

@fuzorsilverbolt

Copy link
Copy Markdown

What was wrong:
Filling a mesh face drew one tiny 1×1 square per pixel — millions of draw commands on a big texture — so Blockbench hung for minutes or crashed on large textures. I understand why the original fill was done the way it was but its too slow.

The fix:
Now it fills the shape in horizontal strips (one rectangle per row) instead of pixel-by-pixel. Same result, but draw commands go from millions to a few thousand. So fill is completed in seconds at almost any texture size.

New helper:
Added Painter.scanlineConvexPolygon(), which walks a face row by row to produce those strips. Unusual (concave) faces fall back to the old method, so nothing breaks.

Changed Files:
One file updated: painter.js
I've tested this for about a week after workin on this for a while. I also worked on testing the town model, on github ticket 3487,
which was impossible to fill with the paint bucket and now it can be filled!

I dont want credit for patch, new code is CC0 for Janis to use or not use at his discretion.

…each mesh face into a coverage mask instead.
@JannisX11 JannisX11 changed the base branch from master to next July 6, 2026 21:41
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