AssetStudio icon indicating copy to clipboard operation
AssetStudio copied to clipboard

Bottom-right glitch in sprites. (Bug)

Open RiffyDiffy opened this issue 2 years ago • 5 comments

Hi, RiffyDiffy, here! So, I'm ripping some stuff from the Cuphead DLC, and trust me, I got this problem before (When trying to rip some cutscene sprites from Cookie Run: Kingdom.). See, the anteater's sprites has this weird glitch in the bottom-right corner, and I absolutely have no idea what is causing it. AssetStudioGUI_ELs7TPzPBF If you can provide a fix to this, that would make me happy. Thanks for reading this!

RiffyDiffy avatar Jul 01 '22 15:07 RiffyDiffy

If it helps isolate the issue here, apparently this glitch was introduced sometime between v0.16.8 and v0.16.21 (the first version with this issue). So for now, rollback to v0.16.8 until it's fixed.

RandomTBush avatar Jul 18 '22 23:07 RandomTBush

Apparently this issue's been around since this Dec. 3 commit: https://github.com/Perfare/AssetStudio/commit/e501940f035cbf561e22350bb1c8fb3f0be7fe31 . The lines of code highlighted below seem to have unintentionally created this problem, and a test compile I did changing those lines back to their previous commit revision's seemingly fixed the issue.

https://github.com/Perfare/AssetStudio/commit/e501940f035cbf561e22350bb1c8fb3f0be7fe31#diff-5c38f3d6e5d1adc64f2144ccaef1dfd54e903a302a0ae07a2b18ea5fe3c55458R103-R110

RandomTBush avatar Jul 19 '22 03:07 RandomTBush

Addendum: Apparently v0.16.0 and v0.16.8 also have a different kind of issue where some sprites have vertical lines slicing through them instead (which v0.16.21 at least fixed, despite causing the alternate glitch above), so v0.15.47 appears to be the last version before these sprite glitches started showing up.

RandomTBush avatar Aug 03 '22 17:08 RandomTBush

Looks like I found a proper fix for this issue!

In line 98 of SpriteHelper.cs: https://github.com/Perfare/AssetStudio/blob/master/AssetStudioUtility/SpriteHelper.cs#L98

The following line needs to be changed from mask.Mutate(x => x.Fill(options, SixLabors.ImageSharp.Color.Red, path)); to something like: mask.Mutate(x => x.Fill(options, SixLabors.ImageSharp.Color.Red, path).Draw(options, Pens.Solid(SixLabors.ImageSharp.Color.Red, 3), path));

The issue stems from the fact that the cutout mask doesn't have any outlines drawn along it (something that is more visible if you change the "antialias" option a few lines above to "true", so adding a three-pixel border around the mask's triangles seems to remove the holes.

RandomTBush avatar Dec 27 '22 21:12 RandomTBush

Went and made a fork which has the fixes applied to it. Don't mind the repeated messages, I made mistakes as I tend to do when I'm working on things at 4AM.

RandomTBush avatar Jan 18 '23 09:01 RandomTBush