libass icon indicating copy to clipboard operation
libass copied to clipboard

\fry strange random behavior

Open SSgumS opened this issue 4 years ago • 4 comments

Hello

I tested this situation on mpv and aegisub. Both had the issue. So I thought maybe it's from libass itself.

As we can see in the video, the drawing with \fry disappears suddenly. I should mention that this is not consistent between different \fry. With \fry 29 it's ok but when I set it to 30 or 60, it breaks.

In mpv: https://user-images.githubusercontent.com/25867589/122224932-d3acd600-cec9-11eb-872b-0df9d1ca4a9d.mp4

In Aegisub: Screenshot 2021-06-16 174332

Subtitle file used: fry.zip

SSgumS avatar Jun 16 '21 14:06 SSgumS

@MrSmile Remember this? Looks like it’s not working too well. :(

astiob avatar Jun 16 '21 14:06 astiob

Found the better link: https://github.com/libass/libass/pull/285#discussion_r172273478

astiob avatar Jun 16 '21 14:06 astiob

@SSgumS If you want your rotation to actually look right—and this affects VSFilter, too—you need to make the yellow rectangle smaller. When you rotate it beyond about 29.5°, its left edge gets too close to the camera, so both VSFilter and libass start to distort it. As you can see, libass may even drop it entirely when it gets too large, or when it does show it, e. g. for \fry between 61.2 and 74.5, it takes multiple seconds for every single frame to rasterize it. But again, even ignoring performance and disappearance issues, it simply looks wrong in both VSFilter and libass:

Current libass screenshot. At 65° in current libass, the vertical intersection is not the full height of the red rectangle.

Simulated VSFilter screenshot. At 65° in VSFilter, the vertical intersection is above the red rectangle.

Generally, at such extreme \fry rotations, the source coordinates of the points that rotate towards the camera should be at most −296.875 relative to the \org point. (In your example, the x coordinate is −600, i. e. half of the 1200 width, as the rectangle is centre-aligned.)

astiob avatar Jun 16 '21 15:06 astiob

This is really a problematic case as it can lead to overlarge bitmaps. I think it's better to not render it at all than to freeze. I'm planning to implement screen clipping someday, that should solve similar cases for good.

Also for such cases to look right we should implement rational spline rendering (but it would be incompatible with VSFIlter).

MrSmile avatar Jun 16 '21 15:06 MrSmile