Japanese
HARDWARE ManualVDP2 User's Manual
BackForward
VDP2 User's Manual

Chapter 6 Rotating scroll screen


The rotary scroll screen has two sets of parameter tables called "rotation parameter A" and "rotation parameter B", and screens based on each parameter table can be displayed simultaneously. In addition to storing these two sets of parameters in VRAM as rotation parameter tables, they can also be stored in VRAM as corresponding coefficient tables.

There are two sets of rotation parameters: rotation parameter A and rotation parameter B, and each is stored in a table. RBG0 can simultaneously display one screen specified by rotation parameter A or rotation parameter B, or two screens specified by rotation parameter A and rotation parameter B, and RBG1 can display the screen specified by rotation parameter B. can only be displayed. Table 6.1 shows the relationship between the rotation scroll screen and rotation parameters.

Table 6.1 Rotating scroll screen
screen Single display Relationship with rotation parameters
RBG0 Possible 1 screen specified by either rotation parameter A or B,
Or two screens specified by rotation parameters A and B can be displayed simultaneously.
RBG1 Not possible (RBG0 is also displayed)
Must)
Display the screen specified by rotation parameter B

Rotation parameter A and rotation parameter B can each have their own coefficient tables, and various displays can be made by reading the coefficient data line by line or dot by dot. You can also use rotation parameter A to scale or rotate the sprite frame buffer.

■6.1 Rotating scroll coordinate calculation

The display screen of the rotating scroll screen rotates (including parallel translation) the viewpoint and the screen (TV screen) based on the center point, and the line of sight from the transformed viewpoint through the transformed screen is fixed. It is a collection of points that intersect with the scroll map. Figure 6.1 shows how to display the rotating scroll screen.

Figure 6.1 How to display the rotating scroll screen

From the rotation transformation formula, the viewpoint coordinates after transformation and the screen screen coordinates after transformation are expressed by the following formula.


┌  ┐   ┌     ┐   ┌       ┐   ┌  ┐   ┌  ┐
│Xp│   │A B C│   │Px - Cx│   │Cx│   │Mx│
│Yp│ = │D E F│ x │Py - Cy│ + │Cy│ + │My│
│Zp│   │G H I│   │Pz - Cz│   │Cz│   │Mz│
└  ┘   └     ┘   └       ┘   └  ┘   └  ┘
┌  ┐   ┌     ┐   ┌       ┐   ┌  ┐   ┌  ┐
│Xs│   │A B C│   │Sx - Cx│   │Cx│   │Mx│
│Ys│ = │D E F│ x │Sy - Cy│ + │Cy│ + │My│
│Zs│   │G H I│   │Sz - Cz│   │Cz│   │Mz│
└  ┘   └     ┘   └       ┘   └  ┘   └  ┘

A, B, C, D, E, F, G, H, I: Rotation matrix parameters
               Px, Py, Pz: Viewpoint coordinates before rotation transformation
               Sx, Sy, Sz: Screen screen coordinates before rotation transformation
               Cx, Cy, Cz: Rotation center coordinates
               Mx, My, Mz: Parallel movement amount
               Xp, Yp, Zp: Viewpoint coordinates after rotation transformation
               Xs, Ys, Zs: Screen screen coordinates after rotation transformation

In addition, the line of sight that passes through the screen after rotation conversion from the viewpoint after rotation conversion is expressed by the following formula.


X − Xp   Y − Yp   Z − Zp
―――――― = ―――――― = ――――――
Xs− Xp   Ys− Yp   Zs− Zp

Here, since the scroll map is fixed on the XY plane (Z = 0), the display coordinates (X, Y) on the scroll map can be calculated using the following formula.


X = k (Xs−Xp)+Xp
Y = k (Ys−Yp)+Yp

however,


     −Zp
k = ――――――
    Zs− Zp

This k is called the perspective transformation coefficient, and with X-axis rotation, it changes only in the vertical direction of the screen and remains constant in the horizontal direction. Additionally, Y-axis rotation changes only in the horizontal direction of the screen and remains constant in the vertical direction. It is always constant in Z-axis rotation.
Normally, the screen screen before rotation conversion is the same as the TV screen, so Sx is the horizontal coordinate value (H counter value) on the TV screen, Sy is the vertical coordinate value (V counter value) on the TV screen, and Sz is 0. It will be. The coordinate values of the screen when rotated around the perpendicular line (SZ axis) of this screen are calculated using the following formula.


┌  ┐   ┌     ┐   ┌          ┐   ┌   ┐   ┌   ┐
│Sx│   │a b 0│   │Hcnt - Csx│   │Csx│   │Msx│
│Sy│ = │c d 0│ x │Vcnt - Csy│ + │Csy│ + │Msy│
│Sz│   │0 0 1│   │     0    │   │ 0 │   │Msz│
└  ┘   └     ┘   └          ┘   └   ┘   └   ┘

   a, b, c, d: Screen rotation matrix parameters
   Hcnt, Vcnt: HV counter value
     Csx, Csy: Screen rotation center coordinates
Msx, Msy, Msz: Amount of parallel movement of the screen

The above formula is expressed as:


Sx = Xst+DX・Hcnt+DXst・Vcnt
Sy = Yst+DY・Hcnt+DYst・Vcnt
Sz = Zst

however,


Xst = −a・Csx−b・Csy+Csx+Msx
Yst = −c・Csx−d・Csy+Csy+Msy
Zst = Msz

△X = a
△Y = c
△Xst = b
△Yst = d

Xst, Yst, Zst: Screen screen start coordinates
      △X, △Y: Screen screen horizontal direction coordinate increment
  △Xst, △Yst: Screen screen vertical direction coordinate increment

From the above formula, the formula for calculating the display coordinates (X, Y) when performing both 3-axis rotation of the scroll screen and rotation of the screen screen is as follows.


X = kx (Xsp+dX・Hcnt)+Xp
Y = ky (Ysp+dY・Hcnt)+Yp

however,


Xsp = A{(Xst+△Xst・Vcnt)−Px}+B{(Yst+△Yst・Vcnt)−Py}+C(Zst−Pz)
Ysp = D{(Xst+△Xst・Vcnt)−Px}+E{(Yst+△Yst・Vcnt)−Py}+F(Zst−Pz)
Xp  = A(Px−Cx)+B(Py−Cy)+C(Pz−Cz)+Cx+Mx
Yp  = D(Px−Cx)+E(Py−Cy)+F(Pz−Cz)+Cy+My
dX  = A・DX+B・DY
dY  = D・DX+E・DY

   Xst, Yst, Zst: Screen screen start coordinates
     △Xst, △Yst: Screen screen vertical direction coordinate increment
         △X, △Y: Screen screen horizontal direction coordinate increment
A, B, C, D, E, F: Rotation matrix parameter
      Px, Py, Pz: Viewpoint coordinates
      Cx, Cy, Cz: Center coordinates
          Mx, My: Amount of parallel movement
          kx, ky: Enlargement/contraction coefficient
      Hcnt, Vcnt: HV counter value

VDP2 reads each parameter line by line from the rotation parameter table stored in VRAM, calculates Xsp, Ysp, Xp, Yp, dX, and dY using the above formula, and uses the results to Find the display coordinates (X, Y) of . The scaling factors kx and ky are normally read from the rotation parameter table, but you can also change the values for each line or dot by using the coefficient table.


BackForward
HARDWARE ManualVDP2 User's Manual
Copyright SEGA ENTERPRISES, LTD., 1997