Open rakkarage opened 2 years ago
Ok so I found the issue. This is the code used on the TileSet's side:
for (int region_x = region.get_position().x; region_x < region.get_end().x; region_x++) {
for (int region_y = region.get_position().y; region_y < region.get_end().y; region_y++) {
if (texture->is_pixel_opaque(region_x, region_y)) {
is_opaque = true;
break;
}
}
if (is_opaque) {
break;
}
}
The issue comes for the is_pixel_opaque
function, which is called here on an ImageTexture.
The ImageTexture class uses this to generate it's alpha bitmap:
alpha_cache->create_from_image_alpha(img);
We can provide a custom threshold for create_from_image_alpha
(the default in 0.1, which causes the issue), but we currently have no way to make this configurable in ImageTexture
.
So I don't know, we could add a property to ImageTexture
maybe, or lower the default.
0.1 seems high for default? Everything under 10% alpha is discarded? I tested with 0.01 and my example works fine. Edit: I am thinking I am fixing it in the gif by selecting those last few tiles... but it is already too late and the engine has not copied them? I am selecting nothing? :(
but it is already too late
You can just manually create those tiles
Thanks. Sorry, I was assuming it happening in other places too like tile merge, etc but they all come through merge fine. It is just a dialog not actually editing data/image. 0.1 still does seem high... like me.
Godot version
v4.0.alpha1.official [31a7ddbf8]
System information
Windows 10
Issue description
Here is a set of 32 'light' tiles that are black with changing alpha... When the TileSet automatically detects tiles or I manually trigger a detection with the menu item it ignores 4 tiles with non-zero alpha. The menu item says "Create Tiles in Non-Transparent Texture Regions" so I expect it to ignore the last one because it has alpha 0 but the rest do not.
Thanks.
Steps to reproduce
Minimal reproduction project
https://github.com/rakkarage/TestLight