Page 1 of 1
Mode 7 help
Posted: Mon Jul 28, 2014 7:15 am
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.
Re: Mode 7 help
Posted: Mon Jul 28, 2014 1:14 pm
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.
Re: Mode 7 help
Posted: Tue Jul 29, 2014 4:37 am
by Kannagi
OK thank you, I'll test.
Re: Mode 7 help
Posted: Wed Jul 30, 2014 12:51 am
by Kannagi
I can more or less do rotation.
and I have a result:
How to do this:
(I scale Y but it does not work).

Re: Mode 7 help
Posted: Wed Jul 30, 2014 11:04 am
by lidnariq
A perspective transformation like that will require the use of HDMA to change the matrix transformation registers on every scanline.
Re: Mode 7 help
Posted: Wed Jul 30, 2014 5:54 pm
by ccovell
And also colour addition in HDMA to make it brighter near the horizon.
Re: Mode 7 help
Posted: Wed Jul 30, 2014 10:25 pm
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.
Re: Mode 7 help
Posted: Wed Jul 30, 2014 11:39 pm
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.