Mode 7 help

Discussion of hardware and software development for Super NES and Super Famicom.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
Post Reply
Kannagi
Posts: 100
Joined: Sun May 11, 2014 8:36 am
Location: France

Mode 7 help

Post by Kannagi »

So much for the super nes I still have just a study mode 7 and sound.
In mode 7, I know use but does not include calculations to do.
I can possibly copy source code but without understanding I could not use (or source code easy for me to make rotations).
I know that:
|X2 | = | A B | X1 - X0 | + | X0 |
|Y2 | = | C D | Y1 - Y0 | + | Y0 |
A = cos theta
B = sin theta
C = -sin theta
D = cos theta

I find it difficult, any help is welcome.
thank you.
Sik
Posts: 1589
Joined: Thu Aug 12, 2010 3:43 am

Re: Mode 7 help

Post by Sik »

  • Imagine a line of length 1 at the angle you want
  • "sin theta" is the sine of that value
  • "cos theta" is the cosine of that value
  • Multiply those two by the amount of scaling you want*
Look up how sine and cosine work related to angles (in short: sine is the vertical distance, cosine is the horizontal distance). Also mind you, just use a look-up table with all the possible angles, the CPU is too weak to calculate it in real time.

*Not sure, may be divide. Either way, you'd figure it out because if it's wrong it'll scale the other way.
Kannagi
Posts: 100
Joined: Sun May 11, 2014 8:36 am
Location: France

Re: Mode 7 help

Post by Kannagi »

OK thank you, I'll test.
Kannagi
Posts: 100
Joined: Sun May 11, 2014 8:36 am
Location: France

Re: Mode 7 help

Post by Kannagi »

I can more or less do rotation.
and I have a result:
Image

How to do this:
(I scale Y but it does not work).
Image
lidnariq
Posts: 10677
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: Mode 7 help

Post by lidnariq »

A perspective transformation like that will require the use of HDMA to change the matrix transformation registers on every scanline.
ccovell
Posts: 1041
Joined: Sun Mar 19, 2006 9:44 pm
Location: Japan
Contact:

Re: Mode 7 help

Post by ccovell »

And also colour addition in HDMA to make it brighter near the horizon.
Sik
Posts: 1589
Joined: Thu Aug 12, 2010 3:43 am

Re: Mode 7 help

Post by Sik »

I don't think he's asking about the fog.

But yeah, the matrix needs to be changed every line. The background is scaled small near the horizon and scaled big near the bottom.
Kannagi
Posts: 100
Joined: Sun May 11, 2014 8:36 am
Location: France

Re: Mode 7 help

Post by Kannagi »

But yeah, the matrix needs to be changed every line. The background is scaled small near the horizon and scaled big near the bottom.
Right, I did not understand how he could do this effect.

Thank you, I'll have to work on the HDMA.
Post Reply