Perspective Projection technique

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Perspective Projection technique
by on (#235938)
.
Re: Perspective Projection technique
by on (#235942)
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.
Re: Perspective Projection technique
by on (#235943)
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.
Re: Perspective Projection technique
by on (#235945)
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!
Re: Perspective Projection technique
by on (#235947)
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.
Re: Perspective Projection technique
by on (#235949)
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.
Re: Perspective Projection technique
by on (#235951)
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.
Re: Perspective Projection technique
by on (#235982)
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!
Re: Perspective Projection technique
by on (#236025)
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... :)