Hi, I'm Lex. A few years ago I made this demo of a sprite scaling smoothly on the SNES.
However, I haven't shared the demo publicly until now.
So to explain the shrinking you first need to know that SNES graphics are made up of bytes. So to shrink an
8x8 sprite we would simply shrink all of its bytes. So in this demo, there are 8 lookup
tables. Each byte in each lookup table tells you how a certain byte would look when shrunken
by the shrink value.
To generate the lookup tables, I wrote a program in C#.
When a byte is loaded from the sprite data, it loads a byte from the lookup table associated
with the current shrink value for the current 8-pixel wide column. The byte in the lookup
table basically tells you what the byte would look like when shrunken by the shrink value.
A shrink value basically tells you how much a certain 8-pixel wide column will shrunken.
The value that controls how much a sprite is shrunken horizontally is the horizontal scale
value. Based on the horizontal scale value, a table of shrink values is created.
The table of shrink values tells you how much each 8-pixel wide column will be shrunken.
Once all of the shrunken columns have been written to a buffer in work ram; the program
updates OAM so that all of the sprites that make up your sprite are stitched together.
So basically you combine the different shrunken columns using sprite positions. This makes
it so that you don't have to do any bit-shifting. To know how much to move each sprite in
each column there is a table.
SNES fast sprite shrinking demo
Moderator: Moderators
Forum rules
- For making cartridges of your Super NES games, see Reproduction.
SNES fast sprite shrinking demo
- Attachments
-
- 64x64_scaling_demo.smc
- (1 MiB) Downloaded 61 times
-
- 32x32_scaling_demo.smc
- (1 MiB) Downloaded 56 times
Re: SNES fast sprite shrinking demo
Similar concept to my NES demo from 2014?
Re: SNES fast sprite shrinking demo
I'm not sure your demo is working correctly for me in mesen... it doesn't looking like scaling.. until the last 2 or 3 frames. Otherwise it looks like distortion. Sort of like a coarse fish-eye lens effect - the center of the image isn't scaling but the edges are, so it looks like the edges are collapsing in on itself.
Re: SNES fast sprite shrinking demo
Yeah, the concept in that post inspired me to program this.
Hmm, you're right it does have a fish-eye lens effect. Probably just a problem in how I generated the lookup tables. To do the horizontal scaling, I'm basically subtracting vertical lines from the sprite. I'll probably will fix it so it looks more like scaling though.turboxray wrote: ↑Sun Jan 01, 2023 12:08 am I'm not sure your demo is working correctly for me in mesen... it doesn't looking like scaling.. until the last 2 or 3 frames. Otherwise it looks like distortion. Sort of like a coarse fish-eye lens effect - the center of the image isn't scaling but the edges are, so it looks like the edges are collapsing in on itself.
Re: SNES fast sprite shrinking demo
The 64x64 example looks very fake because of how static the middle 16x16 part is during the scalling, but the 32x32 one looks nice.