Skip to content
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

Truncating last column and last row #2

Closed
dbeef opened this issue Mar 9, 2020 · 4 comments
Closed

Truncating last column and last row #2

dbeef opened this issue Mar 9, 2020 · 4 comments

Comments

@dbeef
Copy link

@dbeef dbeef commented Mar 9, 2020

Problem:

Given this 16x16 image in input:

0

This 24x24 image is outputted:

level_tiles

Truncating last column (blue) and last row (red).

How to reproduce:

atlasc 0.png -o level_tiles

Rest of the story:

I was looking for a command line texture packer, with no graphical interface, with just the very exact options your tool exposes, and I am very satisfied. Easy to build (about time for everyone to finally switch to CMake), no dependencies outside of the codebase. Just fantastic.

That being said, I am afraid there's a bug.

My use case is packing a bunch of uniform, 16x16 tiles that I will use in my tile renderer.
I also utilize the mesh option, so to parse UVs and normalize them during game's runtime, and use outputted index buffer.

So I found out that using outputted UVs pixel bleeding occurs. As I investigated, UVs seemed to be OK (16x16), also no half-pixel correction was needed on my side.

I looked at the tilesheet outputted from atlasc and I was bewildered - every tile was 15x15 instead of 16x16 given in input.

My call was:

atlasc *.png -o level_tiles -B 0 -P 0 -m -W 512 -H 512 -2

Am I using atlasc wrong?

@dbeef

This comment has been minimized.

Copy link
Author

@dbeef dbeef commented Mar 9, 2020

In my trivial use case applying this correction by one:

off_by_one

Fixes the problem, but I imagine that for sprites of non uniform size such naive approach may not work.

@septag

This comment has been minimized.

Copy link
Owner

@septag septag commented Mar 25, 2020

Sorry to get back to you late. and thanks for your nice comments about this repo
I'll inspect the bug and get back to you soon.

@septag

This comment has been minimized.

Copy link
Owner

@septag septag commented Mar 26, 2020

Actually, you are right!
sprite_rect is [0, 0, 15, 15] , which shouldn't be the case obviously. I added a single unit to the rectangle as you suggested. and this should be fine, because the tracer finds points on the image [0..(size-1)] which then, we should add one unit to convert it to bounding rectangle.

So, It is fixed now, and thank you very much!

@septag septag closed this Mar 27, 2020
@dbeef

This comment has been minimized.

Copy link
Author

@dbeef dbeef commented Mar 27, 2020

Thank you too!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.