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

Premultiply Alpha Preview #29

Open
raeleus opened this issue Oct 22, 2017 · 2 comments
Open

Premultiply Alpha Preview #29

raeleus opened this issue Oct 22, 2017 · 2 comments

Comments

@raeleus
Copy link

raeleus commented Oct 22, 2017

I have a suggestion regarding the Premultiply Alpha option. The preview should reflect the use of premultiply alpha. Right now, it uses the default blend mode and renders the preview with the ugly black edges and such.

Black edges should be white

If I got it right, you'll need to change the blend mode to the following before you render the preview:
spriteBatch.setBlendFunction(GL20.GL_ONE, GL20.GL_ONE_MINUS_SRC_ALPHA);

And then you would need to switch it back for your UI:
spriteBatch.setBlendFunction(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);

This should only be applied to textures packed with Premultiply Alpha selected, of course. Thanks for your consideration.

@metaphore
Copy link
Member

metaphore commented Oct 23, 2017

Thanks for the suggestion. I got your point here, but I'm not sure this is the right approach to apply any sort of post processing to the original atlas pages. You see, there could be a lot of different options that make plain pages look different from what they should be in the actual game, but those artifacts may be the only thing that can point to specific applied techniques to the atlas composing. From my perspective, it's important to show the original pages first and maybe like a second option allow user to turn on additional render features to check some cases they interested in.

On the other hand, atlas preview now operates like a dedicated component, it has no connection to selected atlas model and only works with the data it obtains from the actual saved file, which in this case has no information about premultiplied alpha and many other options. But this is rather implementation issue and since I'm going to extend supported export formats, this will be no longer a working solution and the atlas preview must be rewritten to reflect actual atlas state on the fly. So this probably will be a right moment to put such features in.

If you have any other ideas on how to improve atlas preview, I'm all ears!

@raeleus
Copy link
Author

raeleus commented Oct 23, 2017

Yes, you raise very good points. A selectable option in the preview would be good. Other additions could be an option to change the transparency grid colors and the ability to select the corresponding file in Pack files by clicking the image in the preview. I don't think any of these are critical features though.

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

No branches or pull requests

2 participants