More complex mode 7 rotation (z-axis)

Discussion of hardware and software development for Super NES and Super Famicom. See the SNESdev wiki for more information.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
Post Reply
Molive
Posts: 50
Joined: Sat Apr 07, 2018 7:39 pm
Location: EN

More complex mode 7 rotation (z-axis)

Post by Molive »

Hey guys,

So I've been thinking about how mode 7 works and the ways which you can rotate the background.
It's pretty trivial to rotate about the x-axis by changing the matrix values. It's also somewhat easy to rotate about the y-axis using HDMA and stuff.
However, I was wondering if there was a good way to rotate the background on the z-axis? It seems like the hardest option here and really complicated, as the whole background will not be used per scanline, amongst other problems.
I'd be quite interested on what you guys think is the best way to achieve this.

Thanks,
Molive.
SNES demos are great
niconii
Posts: 219
Joined: Sun Mar 27, 2016 7:56 pm

Re: More complex mode 7 rotation (z-axis)

Post by niconii »

If I understand what you're saying, you basically mean having a horizon that isn't horizontal?
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: More complex mode 7 rotation (z-axis)

Post by tepples »

Molive wrote:However, I was wondering if there was a good way to rotate the background on the z-axis? It seems like the hardest option here and really complicated, as the whole background will not be used per scanline, amongst other problems.
I'd be quite interested on what you guys think is the best way to achieve this.
GSU.
Molive
Posts: 50
Joined: Sat Apr 07, 2018 7:39 pm
Location: EN

Re: More complex mode 7 rotation (z-axis+others)

Post by Molive »

So I've been looking at this by messing with a plane in the 3D modelling software Blender, and I don't think there's actually any angle where the rotation can't be defined as a set of scanline strips of a matrix transformed plane. However, I very well may be wrong.

Nicole: Yes, exactly.

tepples: I don't feel like the GSU is totally needed for this, as the PPU should handle it. A coprocessor to generate HDMA tables/Matrix values may be needed however, with some complicated maths...

Also, before I forget, I messed around with some pixel rendering to see if I could get close to what I wanted, and I realised that a similar effect could be achieved by using vertical shearing that changes per scanline: so the top is sheared a lot up on one side, the middle isn't sheared, and the bottom is sheared a lot down on the same side, with a linear slide of shearing in-between. Basically turning the background into a parallelogram.
I guess the next step is combining rotation axes.
SNES demos are great
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: More complex mode 7 rotation (z-axis)

Post by tepples »

Say you have rolled the camera by 90 degrees. (Take an F-Zero screenshot and turn it by 90 degrees.) What would the matrix for each such scanline look like?
Molive
Posts: 50
Joined: Sat Apr 07, 2018 7:39 pm
Location: EN

Re: More complex mode 7 rotation (z-axis)

Post by Molive »

A=D
B=0
C is changed using hdma
SNES demos are great
White Flame
Posts: 7
Joined: Wed Oct 18, 2017 1:33 pm

Re: More complex mode 7 rotation (z-axis)

Post by White Flame »

The matrix coefficients can be seen as simple deltas. Every time the raster moves 1 pixel to the right, the 2D texel coordinate moves by +(A,C). Every time the raster moves 1 pixel down, the texel moves by +(B,D).

If the horizon is vertical on the screen, then the boundaries between tiles on a single scanline look something like this:

Code: Select all

|     |   |  | |||
This means C is increasing every time the scanline moves to the right (assuming the +Y texel direction goes into the horizon), not remaining constant for the line. How often are you assuming you're going to update it, and how would HDMA work with it?
Post Reply