Repository navigation
feat: Add culling support for Tiled layers with tiles bigger than their cells - #4126
Open
ufrshubham wants to merge 3 commits into
Open
ufrshubham wants to merge 3 commits into
ufrshubham wants to merge 3 commits into
Conversation
ufrshubham
added this pull request to stack #4127
October 21, 2026 16:46
…that stick out of their cells Layers with tiles that are bigger than their cells, or that have an offset, were not split, because drawing their tiles chunk by chunk could change which tile is painted on top. These layers are now split in runs: pieces of one row, drawn in the order that the tiles are painted in, so they look exactly like a layer that is not split.
ufrshubham
force-pushed
the
devkage/tiled-run-culling
branch
from
October 23, 2026 18:31
b26cf75 to
7d1176c
Compare
ufrshubham
marked this pull request as ready for review
October 23, 2026 18:32
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
#4124 skips the tiles of a Tiled layer that are out of view by splitting the layer in square chunks.
That only works when every tile stays inside of its cell. Tiles that are bigger than their cells,
like the cubes and trees of many isometric tilesets, tiles with an offset, and tiles turned a
quarter in cells that are not square, are painted over the tiles around them. Drawing them chunk
by chunk could change which tile ends up on top, so #4124 keeps those layers in a single batch,
which is drawn in full on every frame.
This PR splits those layers in runs instead: pieces of one row of tiles, of up to four times
chunkSizetiles, which are drawn in the same order as the tiles are painted in. The layer looksexactly like a layer that is not split, and the runs that are out of view are skipped.
chunkSizeis still the only option, and maps that don't set it(and are not infinite) are not split, as before.
TiledComponent#4124, which need fewer drawcalls. Flame picks runs or chunks for each layer when it is loaded.
tileStackkeeps the run of a tile that is handed out drawn, like it does for chunks.Tests and examples
test/assetsthat have tiles bigger than their cells, flips,offsets or tall hexagons. They check that the layers are split in runs, and that they render
pixel for pixel what they render without splitting, with and without a camera. With chunks
instead of runs, 13 of these comparisons fail.
with a map of trees and rocks that are taller than their cells. The visualized example draws the
runs instead of the chunks for it.
tile_layer_benchmark.darthas cases with tiles that have an offset, which are split in runs.Demo (Windows)
tiled_culling_isometric_tall_windows.mp4
tiled_culling_visualized_isometric_tall_windows.mp4
Checklist
docsand added dartdoc comments with///.examplesordocs.Breaking Change?
Related Issues