Japanese
HARDWARE ManualVDP1 User's Manual
BackForward
VDP1 User's Manual/Chapter 5 Table

■5.3 Gouraud shading table

This table specifies the RGB data of 4 points when performing Gouraud shading processing on parts. Each of the 4 points of data is 16 bits, so 1 table requires 8 Bytes. Place it at the position starting from the 8HByte boundary address. However, please do not write from 00000H to 0001FH.
VRAM is up to address 7FFFFH. Do not define Gouraud shading tables beyond address 80000H.
The table defines RGB data in the order of vertices (A), (B), (C), and (D). For lines, only vertices A and B are valid, and correspond to the line start and end points. For sprites, vertices (A), (B), (C), and (D) correspond to the top left, top right, bottom right, and bottom left.
This table is referenced from the command table when Gouraud shading processing is specified.

Table 5.2 Gouro shading table
 table address
 corresponding vertex
 sprites, polygons, polylines
 line
 Table start address
 Vertex (A)
 line start point
 Table start address +2
 Vertex (B)
 line end point
 Table start address +4
 Vertex (C)
 ignore
 Table start address +6
 Vertex (D)
 ignore

Figure 5.4 RGB code format
MSB LSB
┌─┬─────────┬─────────┬─────────┐
│ │    B    │    G    │    R    │
│X├─┬─┬─┬─┬─┼─┬─┬─┬─┬─┼─┬─┬─┬─┬─┤
│ │4│3│2│1│0│4│3│2│1│0│4│3│2│1│0│
└─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘

●Gouraud shading
Gouraud shading processing can be performed on parts drawn with RGB code. Gouraud shading uses a Gouraud shading table to specify the amount of change in brightness for each RGB code for RGB code parts. Valid only for RGB code color codes.
If Gouraud shading is specified for the color code of the color bank code, the color is not guaranteed.

●Specifying Gouraud shading
When performing Gouraud shading processing, specify Gouraud shading using the color calculation bit. Color operation bit is the start address of the command table

Located in bits 2-0 of the drawing mode word at +04H. When Gouraud shading is specified, specify the Gouraud shading address.
For the Gouraud shading table address, set the Gouraud shading table start address /8H to the command table start address + 1CH.

●Gouraud shading processing
For the Gouraud shading table, specify the RGB variation data for 4 points (2 points for lines) of the part. The data interpolated between the four points for each RGB is added to the original color of the part.
Each RGB value takes a value from 00H to 1FH, so subtract 10H from the complemented RGB data and add it to the original color of the part. For example, if the RGB value is 10H, the original color will be kept, if it is 00H, it will be -10H, and if it is 1FH, it will be +0FH. If the value after calculation is less than 00H, it will be set as 00H, and if it is larger than 1FH, it will be set as 1FH.
The relationship between Gouraud shading table settings and correction values is shown below.

Table 5.3 Relationship between Gouraud shading table settings and correction values
 Table setting value
 Correction value for original data
 Table setting value
 Correction value for original data
	
00H
 −10H
 10H
 0
01H
 −0FH
 11H
 +01H
02H
 −0EH
 12H
 +02H
03H
 −0DH
 13H
 +03H
04H
 −0CH
 14H
 +04H
05H
 −0BH
 15H
 +05H
06H
 −0AH
 16H
 +06H
07H
 −09H
 17H
 +07H
08H
 −08H
 18H
 +08H
09H
 −07H
 19H
 +09H
0AH
 −06H
 1AH
 +0AH
0BH
 −05H
 1BH
 +0BH
0CH
 −04H
 1CH
 +0CH
0DH
 −03H
 1DH
 +0DH
0EH
 −02H
 1EH
 +0EH
0FH
 −01H
 1FH
 +0FH

True Gouraud shading changes only the brightness, but since this method changes RGB individually, the hue may also change depending on the case.
To avoid changing the hue, define each RGB position of one point defined in the Gouraud shading table to the same value. This will give you a white gouraud.
Lines, polylines, and polygons are processed for non-texture colors, and sprites are processed for colors referenced in character pattern data or color lookup tables.


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