Log In  


Cart #three_shears-0 | 2026-10-07 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
5

This cart performs sprite rotation using an old technique called "three shears rotation":

  1. Do an X shear on tan(angle / 2).
  2. Do a Y shear on -sin(angle).
  3. Do the first shear again.

One interesting property is that no pixels are created or destroyed, only displaced. This got me curious how it would look, so I went ahead and did a small implementation in Pico-8. Ended up being a bit disappointed in the quality, but maybe someone will find it useful.

It has some precision issues due to how it works (it offsets scanlines onto another buffer, then samples from that buffer for the next step). I tried to counter that by introducing a rounding offset to the first and third shears, with limited success. I might tweak this some more to see if I can preserve some of the subpixel precision. For now, you can swap the X and Y shears and see if you get better results with one over the other.

5


nice demo cart

note that it is highly impractical given the memory reads/cache trashing on actual (old) hardware.
"old games" used something more akin to: https://www.lexaloffle.com/bbs/?pid=52525#p



[Please log in to post a comment]