-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Texture altas import breaking sometimes - Cutting off sprite #41414
Comments
@Giwayume please include proper steps on how to reproduce the issue. We can't help otherwise. |
@Rubonnek I'm not going to walk through creating the images, that is infeasible. All you need to know is I've provided you sample images that cause the TextureAtlas to not function properly. Is there something that isn't clear about creating a TextureAtlas from images? I wouldn't know how to go into more detail on this, short of pointing you to a tutorial. |
@Giwayume you are right, never mind -- I thought the instructions were cut off somewhere because the images under the I wasn't able to reproduce this exact problem, but after deleting all the |
I would assume if you selected all of the images and imported them into the atlas you should see the same generated atlas image I uploaded above? |
I also attempted attempted that and I still got a fully transparent atlas instead. On my end it seems that for any set of images I try, I will still get an empty one but of correct size. I'm not sure what's going on here, but I'm also running Godot in Linux for what it's worth. |
@Giwayume Did you find a solution to this issue, or can you still reproduce this on 3.4? |
Oh, I assumed at some point it started working because I have gotten past this point in my project, so I closed it. But no, looks like I never set up the atlas for this character. It's still broken in 3.4. This is especially weird, since the atlas works great for literally every other sprite I've created. |
For what is worth, and for future reference to anyone stumbling upon this issue, as a workaround I wrote an The workflow to get the I've been meaning to document the whole process in the plugin repository for a while but never got around to it. Maybe I will soon. |
My first thought is maybe Image::get_used_rect() is failing somehow, but I recreated the bounding boxes in GIMP using the numbers it outputs during (Re)import and they're correct. Actually now that I look at it, the atlas region and margin appear to be correct if the atlas image itself didn't cut off the sprite. This must be a problem when the importer draws the image to the atlas itself. We can assume the image data in memory is correct because it generated a good bounding box. |
Ok I don't fully understand this code but I kinda see the problem. In this line, "xf" starts at the left margin in the original sprite frame (source) image. Which in my case is a 512x512 image with the eyeball in the middle and a lot of empty space around it. This 512x512 dimension is set to the The variables It looks like in this loop it's limiting by the generated atlas's width when it's actually looping through the source image's pixels.
So instead it should limit by the source image's width.
This indeed produces the correct results. And it makes sense why the images were getting cut off before. I don't yet know the full implications of changing this line, though. The code doesn't seem to crash when I regenerate another atlas where the atlas size is much larger than a source animation frame size. |
Godot version:
3.2.3.rc3
OS/device including version:
Windows 7
Issue description:
I have a specific set of images where changing their import settings to texture atlas causes them to be cut off in the atlas.
Steps to reproduce:
Check the reproduction project. All I did was select all the images and re-import them as an atlas file. Import mode doesn't make a difference. The result looks like this where half the sprite is cut off:
Minimal reproduction project:
atlas-bug.zip
The text was updated successfully, but these errors were encountered: