Force Pixel Snapping

Hi, everyone! I’m trying to figure out a way to force the origin (or offset) of a layer to be a whole number of pixels in every frame.

The reason is: I export my animations as .png sequences, and then use ShoeBox to pack them into textures. ShoeBox will optimize textures by stacking frames, but only if they are identical. I have a lot of frames in some animations where only the origin has moved, so it would be nice if I could get ShoeBox to stack those. But since the origin is not set to a whole number of pixels, the renderer interpolates each frame just a little bit differently, so each .png image is slightly different even after cropping. This results in textures that are much bigger than they need to be.

Here is what I’ve tried:

  • turning off antialiasing for all objects
  • using a super sample layer with various settings
  • using guides

but none of those worked.

I think some parameter conversion might fix it… but I can’t find one that will round parameters to the nearest integer. Does anyone have any ideas?

playing with the project size + grid ON + stick to grid ? or maybe the project render size ?

Thanks for the response. After thinking and reading some more, I decided what I’m trying to do is completely inconsistent with the unit system Synfig uses.

If I need to make smaller textures, I’ll just snap each frame by hand. Most of the time it won’t be necessary.

d_g_

synfig by 1.0 use pixel has default units … ,

setting my document to 128x128 px, activating grid (grid color can by adjusted by metadata panel) and snap … could do the job … ?

synfig-pixel128grid.png

OK, I tried that with a simple animation, and it cut the size by about 70% – which is great! Thanks. I’ll have to remember to set up the grid ahead of time for future animations.

There are still some duplicates, but I think it’s because of rounding – even though the default unit is pixels, it still stores the origins and offsets in units.