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

Strange margin defects occuring with the egg-palettize tool #181

Closed
nosyliam opened this issue Oct 21, 2017 · 6 comments
Closed

Strange margin defects occuring with the egg-palettize tool #181

nosyliam opened this issue Oct 21, 2017 · 6 comments

Comments

@nosyliam
Copy link
Contributor

nosyliam commented Oct 21, 2017

I've been using egg-palettize to group textures but there's just one issue I can't solve. Whenever, I create a palette that has the margins option on, it results in a very odd pattern around the texture. All my textures are 24-bit PNGs.

This is my .txa file:

:background 0 0 0 0

* : force-rgba linear clamp_u clamp_v rgb,rgb best
:margin 10

*.egg :

I'm also running it with -opt and using eggs made by egg-texture-cards which has the "-f rgb" option. I've been trying to find a solution for this for quite a while now, if anyone knows why this is occurring a fix/workaround would be appreciated.

@rdb
Copy link
Member

rdb commented Oct 26, 2017

Could you attach the source files we would need to reproduce the issue?

@nosyliam
Copy link
Contributor Author

I would very happy to do so privately. Do you have any other ways to contact?

@rdb
Copy link
Member

rdb commented Oct 28, 2017

Contact me at git@rdb.name.

@nosyliam
Copy link
Contributor Author

I have sent an e-mail with the files to git@rdb.name. Please let me know if you do not receive it.

@rdb
Copy link
Member

rdb commented Nov 7, 2017

So here's what's happening: since you set it to clamp mode, egg-palettize is stretching out the colours at the edge of the texture into the margin area, with the intent to reduce artifacts when you use this texture with the "clamp" texture wrap mode. Otherwise, when the texture is sampled in "clamp" mode, you may end up with a darkened border due to the filtering sampling into the margin area.

This seems to be working as intended, as far as I can tell from the files you sent; the weird colour in the margin area is just a repetition of the colours at the edges of your texture. If you change it to "repeat_u repeat_v" instead, then you'll see it wrap around instead. Note that even transparent pixels can have a colour value.

If I open the texture in the GIMP, first paint a 1-pixel border outside the texture with black (to clear the colour information) and then erase it to make it transparent, then there is no extension of the texture border in the margins. (Clearing it with black first is optional, but since egg-palettize does not premultiply the alpha, it means that you are still seeing the colour value in the .png, even though it's masked out by the .rgb that contains the alpha mask.)

Is that what you're expecting—to see only the background colour in the margins instead? It would not be very difficult to add such a feature, if you would request it. If not, and if the above is sufficient to solve your problem, please close this issue.

@nosyliam
Copy link
Contributor Author

I was originally only expecting it to make a margin with the background color, not to extend it. I've actually been making 5-pixel transparent borders on all my images manually beforehand but it's a very tedious problem that I was hoping the margin feature could solve. I'll request it as a feature in another issue, thank you :)

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

No branches or pull requests

2 participants