Sonic and Sega Retro Message Board: Sprite Rotation Utility - Sonic and Sega Retro Message Board

Jump to content

Hey there, Guest!  (Log In · Register) Help
  • 2 Pages +
  • 1
  • 2
    Locked Forum

Sprite Rotation Utility rotsprite

#1 User is offline Xenowhirl 

Posted 17 January 2007 - 03:32 AM

  • Posts: 175
  • Joined: 26-November 06
  • Gender:Male
  • Wiki edits:30
Making rotated versions of sprites is usually a pain in the ass, because most programs that rotate a sprite will antialias it (which blurs it and messes with the colors) and ones that don't antialias it tend to do a poor job of preserving features of the original image. It usually takes a lot of manual touch-up work to make the rotated sprite look good. (If you didn't know already, the walking and running frames in Sonic 1, 2, and 3 all need 45 degree rotated equivalents, and I believe those were custom-drawn by the artists at Sega for lack of any good way of generating them)

So I wrote a little utility to avoid those problems: It can rotate sprites at arbitrary angles without antialiasing and (IMHO) without making them look demented. I call it rotsprite because I suck at inventing names and don't care. It attempts to preserve lines and (to some extent) curves in the original image, it never mixes colors together, and it considers multiple rotation offsets to minimize error. It can optionally scale up or down while rotating.

It isn't perfect; it minimizes error by a very simple method, but won't try to intelligently recognize and eliminate oddities like a human could. Other, simpler methods may do better for certain parts of the image, but rotsprite output should require much less touch-up work overall. It works best on small images, so the quality of rotation can suffer if you place many sprites in an image and rotate the whole image instead of rotating them separately. Dithering (fine-grained checkerboard patterns) can confuse it because it tries to rotate the pattern itself without considering it a single color, so if you need to rotate something dithered I suggest replacing the dithered parts with solid blended colors before rotation, and replacing those colors with the dithering pattern after rotation.

The program asks for input when you open it, should be self-explanitory. To use it as a commandline utility, here are the flags:
rotsprite -in "input.png" -out "output.bmp" -angle 22.5 -endangle 180 -scale 1.0 -endscale 1.0 -frames 8

Now for some sample output:
Creating angled frames for an animation without them:
Posted Image

Comparing automatically rotated sprites with Sega's actual final rotated sprites:
Posted Image

More comparison between regular aliased rotation and this program's output:
Posted Image

Fun with upscaling and rotation:
Posted Image

Making a silly animation (64 rotation angles):
Posted Image

If you missed the download link here it is again: http://www.fileden.c...3/
This post has been edited by Xenowhirl: 17 January 2007 - 02:40 PM

#2 User is offline Chimpo 

Posted 17 January 2007 - 03:44 AM

  • Posts: 7295
  • Joined: 26-July 06
  • Gender:Male
  • Project:Atomic Sonic Part II
Why didn't you make this before I did my sprites :'(

Awesome tool though, will make rotation touch ups quick and easy, especially considering how annoying it is when you have to do it for every single frame.
This post has been edited by ChimpoMcCrazypants: 17 January 2007 - 03:48 AM

#3 User is offline Orengefox 

Posted 17 January 2007 - 04:33 AM

  • The world's greatest scientist and soon to be the world's greatest pervert.
  • Posts: 453
  • Joined: 25-May 04
  • Gender:Male
  • Location:Right in front of my computer.
  • Project:Some artwork, a ZZT game, and a hack.
Egad, that is freakin sweet. I know you were talking about this a couple of days ago as far as rotating sprites and if there were programs out there that could possibly do the job well; but to make a program that specializes in rotating sprites with very little trouble, that was very unexpected. Excellent job of making this nifty program and thanks ^_-
This post has been edited by Orengefox00: 17 January 2007 - 04:35 AM

#4 User is offline Yuski 

Posted 17 January 2007 - 06:34 AM

  • Dragons, dragons everywhere!
  • Posts: 347
  • Joined: 15-July 05
  • Gender:Male
  • Wiki edits:2
I officially love you. =P

#5 User is offline JcFerggy 

Posted 17 January 2007 - 07:20 AM

  • Do you want to taco 'bout it?
  • Posts: 1282
  • Joined: 22-February 06
  • Gender:Male
  • Location:Nova Scotia, Canada
  • Project:GoldenEye: Source, Other Stuff
  • Wiki edits:57
This program will help me alot and has re-motivated me to work on my hack again, Thanks!

#6 User is offline Ultima 

Posted 17 January 2007 - 08:13 AM

  • Games Publisher
  • Posts: 2396
  • Joined: 26-January 03
  • Gender:Male
  • Location:London, England
  • Project:Publishing mobile games!
Fucking nice, dude ;P

#7 User is offline StephenUK 

Posted 17 January 2007 - 11:37 AM

  • Liquor in the front, poker in the rear
  • Posts: 1675
  • Joined: 30-December 04
  • Gender:Male
  • Location:Manchester, UK
  • Project:Quackshot Disassembly
I think I'll start working on my hack again and put the sprites in now. Manual rotation was the main thing putting me off from doing it, but this is perfect. Keep it up.

#8 User is offline jman2050 

Posted 17 January 2007 - 01:32 PM

  • Teh Sonik Haker
  • Posts: 633
  • Joined: 10-December 05
  • Wiki edits:4
Holy crap, a rotation program that *works*. I honestly had a bit of trouble telling the difference between rotsprite's output and Sonic's official rotated sprites (the differences are there, but they can easily be touched up). Nifty program.

#9 User is offline Techokami 

Posted 17 January 2007 - 02:54 PM

  • For use only on NTSC Genesis systems
  • Posts: 1286
  • Joined: 19-November 05
  • Gender:Male
  • Location:HoleNet!
  • Project:Sonic Edge
  • Wiki edits:63
Man, this will be useful in many applications, not just ROM hacking :D

#10 User is online Dark Sonic 

Posted 17 January 2007 - 03:08 PM

  • Posts: 11328
  • Joined: 21-April 06
  • Gender:Male
  • Project:Working on my art!
  • Wiki edits:10
This will come in handy for many people, my self included. Perhaps now I will be arsed enough to change Sonic's sprites in the game. But still, fine job on this and your sprite editor. You continue to amaze all of us with your awesomeness.

#11 User is offline Yoshi 15 

Posted 17 January 2007 - 05:53 PM

  • Posts: 857
  • Joined: 23-July 03
  • Gender:Male
  • Location:Northern New Jersey
  • Wiki edits:4
This would definitely come in handy for some people, not me for right now, but still useful none the less.

#12 User is offline superstarCSB 

Posted 17 January 2007 - 06:28 PM

  • snootch
  • Posts: 621
  • Joined: 23-November 03
  • Gender:Male
  • Location:Lawrence, Kansas
  • Project:I probably should get back to work on my site someday...
This looks like a nifty little program. I too, seemed to become frustrated in doing sprite edits when I had to try and redraw the sprite at different angles. Hopefully this will motivate me to actually put something out.

#13 User is offline Kampfer 

Posted 17 January 2007 - 06:57 PM

  • Posts: 1606
  • Joined: 30-November 03
  • Gender:Male
Nice job.

Its neat stuff like this that makes me wish I had time to re-learn how to hack things. I remeber it was a bitch to try and get my Metal Sonic Sprites to look half way decent for slopes.

#14 User is offline Xenowhirl 

Posted 18 January 2007 - 12:50 AM

  • Posts: 175
  • Joined: 26-November 06
  • Gender:Male
  • Wiki edits:30
I'm glad people are finding this useful and motivating; hopefully someone will put this to better use than I can.

BTW, even though the main feature is rotation, the scaling is decent compared to point sampling. It's handy if you have some sprites you want to use but they're the wrong size for the game:

Posted Image

The angled ones were made by scaling and rotating at the same time. It looks worse if you rotate and scale separately, so... don't do that. For comparison, here's what normal point sampling/rotation gives:

Posted Image
This post has been edited by Xenowhirl: 01 February 2007 - 12:28 AM

#15 User is offline Eli White 

Posted 18 January 2007 - 01:14 AM

  • Posts: 60
  • Joined: 31-December 03
While it's not perfect, it's damn good. Thanks!

Edit: oops, wrong account. :P
This post has been edited by Eli White: 18 January 2007 - 01:14 AM

  • 2 Pages +
  • 1
  • 2
    Locked Forum

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users