Is rotation possible on nes?

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems. See the NESdev wiki for more information.

Moderator: Moderators

User avatar
MartsINY
Posts: 66
Joined: Sun Jun 11, 2017 5:39 pm

Is rotation possible on nes?

Post by MartsINY »

I saw a video of this game boy game: https://www.youtube.com/watch?v=AyjU4MtonZM

At 0:46 I think they rotate a sprite (or they have every possible sprite)?

Is it possibile to do so on nes?
User avatar
rainwarrior
Posts: 8732
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Is rotation possible on nes?

Post by rainwarrior »

Battletoads' intro "software renders" the flying spaceship into CHR-RAM with a scaling operation. (Check the CHR pattern pages in a debugger to watch it in action.)

A rotation would be similarly feasible. (Could probably scale at the same time as rotating too without extra complexity.)
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Is rotation possible on nes?

Post by tepples »

True sprite rotation is very slow without a coprocessor. In some cases, a small amount of rotation can be faked with shearing. But usually, pre-defined rotations are stored in the ROM.

Scaling without rotation is faster because it can be done with lookup tables.
User avatar
rainwarrior
Posts: 8732
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Is rotation possible on nes?

Post by rainwarrior »

tepples wrote:True sprite rotation is very slow without a coprocessor.
Hmm, doing a quick estimate, I think a naive fixed point 32x32 rasterizing could probably be done at 30fps?

You could keep up with a vblank bandwidth of 128 bytes per frame, I believe.
User avatar
Bregalad
Posts: 8056
Joined: Fri Nov 12, 2004 2:49 pm
Location: Divonne-les-bains, France

Re: Is rotation possible on nes?

Post by Bregalad »

MartsINY wrote:I saw a video of this game boy game: https://www.youtube.com/watch?v=AyjU4MtonZM

At 0:46 I think they rotate a sprite (or they have every possible sprite)?

Is it possibile to do so on nes?
What is shown in this video is wireframe graphics. This is perfectly on a NES. Elite is a game released only with those. I did a demos myself using that, and so did other nesdev people.

My demo does not look really 3D, but I have another one on my hard disk with pre-calcluated 3D shapes and it works and looks impressive. I wanted to save it for a real game so I didn't publish this but since I don't know if I'll ever release a real game...

Another approach to rotating sprites is simply to pre-render it. Usually pre-rendering is the key of success when it comes to this stuff :p
User avatar
pubby
Posts: 583
Joined: Thu Mar 31, 2016 11:15 am

Re: Is rotation possible on nes?

Post by pubby »

It's 1000 times easier to bake rotation into sprites than it is to generate them on the fly.
psycopathicteen
Posts: 3140
Joined: Wed May 19, 2010 6:12 pm

Re: Is rotation possible on nes?

Post by psycopathicteen »

Say you are using a mapper with 16kB of memory per bank. In that bank you can store a 256x64 8-bit bitmap image. Have all the rotatable sprites located in the middle of that 256x64 bitmap, with extra space between them. Then you can calculate the ROM address for each pixel by having X location as the low byte, and Y location as the high byte. Then fetch the pixels and convert them to planar format.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Is rotation possible on nes?

Post by tepples »

A 64x64 pixel 2bpp graphic is 1 KiB. A 256x64 pixel 8bpp graphic is 16 KiB. If you'll be wasting 94% of each bank on 8bpp sprites with huge blank spaces between them, you might as well just use the space for 16 pre-baked rotations that you can scale using a shrinking LUT.
User avatar
Fisher
Posts: 1249
Joined: Sat Jul 04, 2015 9:58 am
Location: -29.794229 -55.795374

Re: Is rotation possible on nes?

Post by Fisher »

Little Samson's character select screen have the selected character rotating.
I think it's a prerendered rotation, not made on the fly.
But it's a nice effect!!
Pokun
Posts: 2681
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: Is rotation possible on nes?

Post by Pokun »

Heh yeah it's nice but I don't think the topic is about that kind of rotation. That's just normal animation.
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Is rotation possible on nes?

Post by tokumaru »

You'd need 3D models to do Little Samson's rotation in real time...
User avatar
Sumez
Posts: 919
Joined: Thu Sep 15, 2016 6:29 am
Location: Denmark (PAL)

Re: Is rotation possible on nes?

Post by Sumez »

Pretty sure all of Little Samson is prerendered :D
User avatar
zeroone
Posts: 939
Joined: Mon Dec 29, 2014 1:46 pm
Location: New York, NY
Contact:

Re: Is rotation possible on nes?

Post by zeroone »

tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Is rotation possible on nes?

Post by tepples »

The effect seen in Super Spy Hunter is shearing, the overhead counterpart to how Pole Position and Rad Racer draw their roads.
psycopathicteen
Posts: 3140
Joined: Wed May 19, 2010 6:12 pm

Re: Is rotation possible on nes?

Post by psycopathicteen »

tepples wrote:A 64x64 pixel 2bpp graphic is 1 KiB. A 256x64 pixel 8bpp graphic is 16 KiB. If you'll be wasting 94% of each bank on 8bpp sprites with huge blank spaces between them, you might as well just use the space for 16 pre-baked rotations that you can scale using a shrinking LUT.
You can composite 4 sprites into the 8bpp bitmap, and even rotate all 4 at once that way.
Post Reply