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

Onion skinning with tinting does not work for all colors #1125

Closed
Cerno-b opened this issue May 8, 2016 · 4 comments
Closed

Onion skinning with tinting does not work for all colors #1125

Cerno-b opened this issue May 8, 2016 · 4 comments
Assignees
Labels
Milestone

Comments

@Cerno-b
Copy link
Contributor

Cerno-b commented May 8, 2016

I love the onion skinning function but ran into some trouble recently when I tried the red/blue tinting for black pixels, which does not work (you only get grayscale onion skinning).

So I ran some tests.
Top to bottom: white, black, blue, green, red.
Left column: Previous frame
Right column: Next frame

onion

So some colors seem to have trouble getting the tinting right. Instead of using the original onion skin and tinting it, I would suggest the following:

As an example, I will take a black pixel at 000000FF, which currently does not work at all in tinted onion skin. I will assume that the prev tint is supposed to be red with some alpha: FF000040.

The process is as follows:

  1. Convert the prev cel to grayscale (since our pixel is black, this is still 000000FF)
  2. Calculate the per-channel average of the grayscale from 1. (000000) and your target tint (FF0000). Note I left out the alpha channel. You get (7F0000).
  3. Replace the prev cel's alpha with the target tint alpha, so you get 7F000040.

Let's repeat this for a white pixel FF0000FF:

  1. Convert to grayscale (still white): FF0000FF:
  2. Calculate average of orignal FF0000 and target tint FF0000, so you get FF0000.
  3. Add the target tint alpha for the final result: FF000040

Final example for a medium gray pixel at 7F7F7FFF:

  1. Convert to grayscale (still gray): 7F7F7FFF
  2. Calculate average of 7F7F7F and FF0000 to get BF4040
  3. Add the target tint alpha for the final result: BF404040

Visualization here:
onion_new

Since this seems to work for the whole grayscale spectrum and you can convert any color cel into grayscale, this should do the trick. You may want to add some weight factors to give it a little more contrast between white and black but in general it should be able to solve the problem.

Please let me know what you think.

@dacap dacap added the bug label May 9, 2016
@dacap dacap added this to the v1.1 milestone May 9, 2016
@dacap dacap self-assigned this May 9, 2016
@dacap dacap closed this as completed in 736f631 May 10, 2016
@dacap
Copy link
Member

dacap commented May 10, 2016

Thanks for the details @Cerno-b, I've implemented this for the next release v1.1.5.3

@Cerno-b
Copy link
Contributor Author

Cerno-b commented May 13, 2016

Wow, you're fast! Looking forward to the next release then :)

@dacap
Copy link
Member

dacap commented May 13, 2016

@Cerno-b it's already available ^_^ (v1.1.5.4 is the latest version available)

@Cerno-b
Copy link
Contributor Author

Cerno-b commented May 13, 2016

I haven't been at my PC for a while, that's good news!

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

No branches or pull requests

2 participants