Perspective Projection technique

A place where you can keep others updated about your NES-related projects through screenshots, videos or information in general.

Moderator: Moderators

Post Reply
domgetter
Posts: 4
Joined: Tue Mar 12, 2019 2:03 am

Perspective Projection technique

Post by domgetter » Tue Mar 12, 2019 2:41 am

.
Last edited by domgetter on Sat Mar 16, 2019 6:40 pm, edited 1 time in total.

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

Re: Perspective Projection technique

Post by tepples » Tue Mar 12, 2019 6:06 am

It's been done before on Game Boy Color with the "Gin & Tonic trick" of the demo Mental Respirator. Except on GB, you can change only coarse X, not fine X.

domgetter
Posts: 4
Joined: Tue Mar 12, 2019 2:03 am

Re: Perspective Projection technique

Post by domgetter » Tue Mar 12, 2019 6:22 am

Oh, neat! Thank you for pointing me to that demo. Looks like setting the scroll on the GBC mid-scanline is a bit more straightforward.

User avatar
nesrocks
Posts: 434
Joined: Thu Aug 13, 2015 4:40 pm
Location: Rio de Janeiro - Brazil
Contact:

Re: Perspective Projection technique

Post by nesrocks » Tue Mar 12, 2019 6:28 am

This seems great, but I feel like it is what is done on racing games, am I wrong? If not, that's nice work then!
https://twitter.com/bitinkstudios <- Follow me on twitter! Thanks!

domgetter
Posts: 4
Joined: Tue Mar 12, 2019 2:03 am

Re: Perspective Projection technique

Post by domgetter » Tue Mar 12, 2019 6:58 am

Racing game often did preloaded graphics with scanline skipping.

Rad Racer 2 does this:

Image

To make the road curved, they set the x scroll for each line a little differently in hblank, whereas in my demo, the x scroll is changing throughout the scanline, and I don't have multiple pre-rendered versions of the same graphic.

One of the most impressive racing games to use bank switching in my opinion is Days of Thunder: https://i.imgur.com/5UpfV1y.mp4 but again, all prerendered and they switch out banks. This takes up a ton of ROM space. Days of Thunder is 174 KB compressed, and was 385 KB in the cartridge.

User avatar
Bregalad
Posts: 7766
Joined: Fri Nov 12, 2004 2:49 pm
Location: Chexbres, VD, Switzerland

Re: Perspective Projection technique

Post by Bregalad » Tue Mar 12, 2019 7:27 am

This is neat, however you should also mention that:
  • * This uses 100% of the CPU for the rendered image
    * This can only distort the image a little but not more than 7 pixels in total.
It's not different how changing X scroll or Y scroll gradually can simulate rotation by very small angles.

At some point I tried to do something like that on the SNES using offset-per-tile mode, but it ended up in a failure... It worked only in the emulator and not on real hardware, which could only change coarse scroll if I remember well.

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

Re: Perspective Projection technique

Post by tepples » Tue Mar 12, 2019 7:58 am

OPT on Super NES can change fine Y but not fine X. It'd probably be easiest to treat OPT as if it were Genesis VSRAM, using OPT only for Y and HDMA for X (of the whole layer). Star Fox does this for the skybox layer behind its Super FX canvas.

ccovell
Posts: 1006
Joined: Sun Mar 19, 2006 9:44 pm
Location: Japan
Contact:

Re: Perspective Projection technique

Post by ccovell » Tue Mar 12, 2019 5:38 pm

Wow, a pretty awesome effect! I knew that "scaling" was possible on systems like the Amiga by changing the scroll registers going across the scanline, but I figured the NES had that locked in per-line. Or else would be glitchy. The next step is to try to get the effect to do arbitrary fine/coarse X-scroll!

Bananmos
Posts: 468
Joined: Wed Mar 09, 2005 9:08 am
Contact:

Re: Perspective Projection technique

Post by Bananmos » Wed Mar 13, 2019 4:28 pm

Neat demo! I've thought of doing something along those lines before, but never had enough motivation to explore it. Great to see people are still finding out new tricks with the PPU even in 2019! :)

Though I think the drawback is evident from your ascii-diagram: A true mode7:ish scaling wouldn't suddenly scroll +2 or even +3 pixels, with the pixel increments being constant everywhere else. It would be interesting to see this animated, to evaluate how perceptually smooth it can look given this sort-of-harsh pixel skipping.

I wonder if the most practical use of this new technique would be as an interpolation method for the High Hope:ish bankswitching "cheat"? That way you could reduce the effect to just +1 scroll changes to smooth things out and substantially save on the graphics tiles you need to bankswitch to achieve the same results. Going with the reasoning that as you are already probably doing all timed scanline code for the bankswitching, you might as well put those spare cycles to good use... :)

Post Reply