opentoonz / opentoonz

OpenToonz - An open-source full-featured 2D animation creation software
https://opentoonz.github.io/
Other
4.46k stars 511 forks source link

Allow pixel perfect translations with animate tool #1782

Open Israro opened 6 years ago

Israro commented 6 years ago

I have a problem with the animate tool. It happens to me with imported images and also using the raster (any bitmap image). When you move the image with the animate tool it deforms or creates new blurry pixels around it. The result is not visible in the workspace but if you look at the preview or render the work. I understand that a bitmap image would be deformed by altering its size or perhaps by rotating it, but I find it strange that it happens only with moving it. This prevents me from making animations even a simple interpolation of moving an object from one point to another. I do not know if this is something normal or I'm doing something wrong. I hope you can clarify my doubts. And excuse my English, I do not speak the language well but I hope it is understood.

01

So it looks without making any change:

02 03

And this the result after moving the image with the animate tool

04

The test was performed on two different computers and the result is the same. The specifications are:

Laptop dell latitude E6530 Intel Core i5-3340 2.70 Ghz 4gb ram intel HD Grafics 4000 windows 7

and a desktop HP compaq 6200 Pro intel pentium G630 2.70 Ghz 4 Gb ram AMD Radeon HD 6450 windows 10

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/54447477-moving-an-object-with-the-animate-tool-deforms-the-object?utm_campaign=plugin&utm_content=tracker%2F33713530&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F33713530&utm_medium=issues&utm_source=github).
Lovewyrm commented 5 years ago

The blur is caused by fractions in the pixel position of the raster object when animating it via keyframes that have smooth interpolation, like ease in and out, etc.

In other words, if the position of the object is not a "whole" pixel, then it will be interpolated/resampled as per the render/preview sampling settings.

One way of dealing with it is to change the "Resample Balance" in the "output settings" to nearest neighbor, aka "closest pixel".

It's not perfect but its the most direct approach. I think a fix would be an option that rounds pixel positions up and down. Edit: Rounds it only for previewing/rendering. Aside from that, it could probably keep its floating point value in the keyframe table itself. Might be less code change required that way.

Maybe like "if column is not vector, interpret movement/scaling/rotation data as properly rounded integer instead of double"

RodneyBaker commented 5 years ago

@Lovewyrm It looks like you are on to something here. I like the idea of keeping the floating point values for precision and rounding upon preview/render.

The fractional interpolations of pixels surely must effect other areas of Opentoonz processing as well which likely relates to issues that appear to be related to antialiasing and such.

Nice.

ghost commented 4 years ago

This is now a feature request.