tiled icon indicating copy to clipboard operation
tiled copied to clipboard

Visual issues when adding a new Tileset to a map, causing it to disappear.

Open pat-p opened this issue 1 year ago • 2 comments

Describe The Bug When adding a second Tileset to a map, the second Tileset will flicker between visible and invisible and when hovering over the image, it will remove some squares from the second Tileset (just visually). The Tileset is based off an image. Whenever you zoom in a certain amount, any other Tileset image besides the first one will go invisible. I feel my OS (Windows 11) has a lot to do with it as 5 others I know who downloaded at the same time, do not have this issue. I was recommended by someone in the Discord to try turning on Hardware Accelerated Drawing, however they didn't help either with the Tilesets added after number one completely disappearing. It did make it so the single squares no longer disappeared when zoomed out, however it still goes invisible when zooming in.

To Reproduce Steps to reproduce the behavior:

  1. Be on Windows 11(?)
  2. Create new Map
  3. Create First new Tileset based on image
  4. Add first Tileset to Map
  5. Create second new Tileset based on image
  6. Add second Tileset to Map
  7. Move mouse over where you placed second Tileset into the map to see squares visually disappear
  8. Zoom in couple times to have the second Tileset go completely transparent

Expected Behavior All Tileset images should be visible at all times.

Media Check the following link for a video on the whole process to recreate the issue; https://drive.google.com/file/d/1T1xducEouVozye3zE_3Nseer_NiyHTSk/view (Figured it would be a lot easier to upload a whole short video and upload it to drive)

Specifications:

  • OS: Windows 11
  • Tiled Version: 1.9.0

pat-p avatar Aug 10 '22 21:08 pat-p

This issue isn't because of Windows 11 (happens on Windows 10, too) or connected to using multiple tilesets (happens with a single tileset too). Rather, the issue is that OP is using tiles that are way larger than the map cells, and Tiled doesn't account for the fact that tiles that are very far away may still need to be drawn.

  • Zooming in causing the tiles to disappear: The chunk and cell the large tile is placed is in way off-screen, so Tiled doesn't draw it, even though the tile should actually still overlap the viewport.
  • Brush preview with another tileset (or even a tile with the same tileset!) causes holes in the tile: Tiled only redraws the current chunk, or neighbouring chunks if you're right near their edge, so it doesn't redraw the distant large tiles.

Here's a screenshot where I created a tileset with one 1920x1080 tile, placed it on a map with 16x16 cells, and then moved my brush preview around with that same tile still selected: image The major grid here is 16x16, representing Tiled's internal chunks. Notice how the chunk in which the placed tile is actually located is always redrawn correctly, and it's only redraws that are a tile+ outside of that chunk that are incorrect.

Workaround for OP: Avoid using tiles that are significantly larger than your map's grid size. If you want to place a large background in your map, use an Image Layer. If you'd rather use a Tile Layer, load your tileset with a smaller tile size, and place your background as many tiles.

A fix for this issue would require Tiled to account for the fact that some tiles are very large by not assuming that tiles only affect their chunk and the tiles immediately near their chunk, but instead keep a list of other chunks that overlap each chunk, or some similar approach. I imagine most attempts to fix this would be complicated and hurt performance, though. Perhaps it might be simpler to offer a setting to always redraw the whole map instead of calculating a minimal redraw region for users using such unusual tilesets? The performance cost of doing a full redraw might not be that much larger than doing a cleverer redraw calculation. Some might enable this option to get rid of the numerous other, small redrawing artefacts Tiled has.

eishiya avatar Aug 13 '22 22:08 eishiya

This should already work, in that Tiled normally already accounts for tiles extending beyond their grid cell, so this is a bug. But it's either a rare one or I might have broken something recently, will need to investigate.

bjorn avatar Aug 19 '22 10:08 bjorn