HARDWARE ManualVDP1 User's Manual
BackForward
VDP1 User's Manual / Chapter 6 Command Table

■ Color calculation

Color calculation bit: color calculation bit, bits 2 to 0
Specifies Gouraud shading, shadow, semi-brightness, and translucent color operations.
The respective functions of each bit are as follows:

 bit
 function
2
 Gouraud shading valid bit
1
 Original picture 1/2 valid bit
0
 Base 1/2 effective bit

Performs a color operation on the drawn sprite or non-textured pixel data and the pixel data already drawn in the frame buffer.
Except for replacement and shadow color calculation, the color code of the original picture is valid only when it is an RGB code. Color operations can also be performed with color bank codes, but the results are not guaranteed.
For sprites, you can perform color calculations when the color mode is mode 1 (lookup table mode) and the color code of the color lookup table is RGB code, or when mode 5 (RGB mode). When non-texture is used, color calculation can be performed when the non-texture color is RGB code.
In the color calculation of the part with the original picture, the transparent code is valid when SPD = 0, the end code is valid when ECD = 0, and the color calculation is not performed for those pixels.
In the color calculation for polygons, polylines, and lines, the color calculation is valid only when the non-texture color is RGB code.
Color calculation is not possible at 8bit / pixel (high resolution or rotation 8).

Color calculation
Color calculations include replacement, shadow, semi-brightness, translucent, and Gouraud shading, and Gouraud shading semi-brightness and Gouraud shading translucent, which are a combination of the two. To specify these, do the following:
 Color calculation bit
 Groundwork
MSB
 Original picture
 Groundwork
 Types of color operations
 Available modes
 2
 1
 0
 Original picture
 Groundwork
0 0 0 1 0
 Replace
 No limit
 No limit
0 0 1 0 0 1
 Do not rewrite
 No limit
 No limit
1
 0 * 1
1/2
 Shadow
 RGB
0 1 0
 1/2
0
 Half luminance
 RGB
 No limit
0 1 1 0 1 0
 Replace
 RGB
 No limit
1
 1/2
 1/2
 Semi-translucent (half translucent)
 RGB
1 0 0
 Gouraud
0
 Gouraud shading
 RGB
 No limit
1 0 1
 Setting prohibited (Please do not set)
1 1 0
 Goolow 1/2
0
 Gouraud shading + half brightness * 2
 RGB
 No limit
 1
 1
 1
0
 Gouraud
0
 Gouraud shading
 RGB
 No limit
1
 Goolow 1/2
 1/2
 Gouraud shading + translucent * 3
 RGB
 [Note]-: Don't care
  Original picture: Pixel data to be drawn with sprite or non-texture
  Background: Pixel data already drawn in the frame buffer
  * 1: The original picture (transparent pixel end code) is referenced.
  * 2: After the gourd calculation, the saturated data is halved.
  * 3: After the gourd calculation, the background is added to the saturated data to make it 1/2.

Replace (color calculation mode = 0)
Replace does not perform color operations. The part to be drawn is written to the frame buffer as it is.
Pixel data already written to the framebuffer has no effect.
Color calculation is not possible at 8bit / pixel, so specify replacement.

Shadow (color calculation mode = 1)
The processing differs depending on the MSB of the pixel data already drawn in the frame buffer. If the MSB of the frame buffer is 0, the color operation including replacement is not performed and the frame buffer remains as it is.
Shadowing occurs when the MSB of the framebuffer is 1.
With shadows, pixel data that has already been written to the frame buffer is subject to color calculation. The target area on the frame buffer is calculated from the character pattern and its drawing coordinates in the case of sprites, and from the drawing coordinates in the case of non-textures. The brightness of the pixel data that is in the target area where the part is drawn and has already been written to the frame buffer is halved for R, G, and B, respectively.
The shadow does not change the underlying MSB. Areas that were transparent remain transparent.

Shadows halve the brightness of pixels in the framebuffer. If you want to reduce the brightness to 1/4, set the same command table twice on VRAM. If you want to make it 1/8, set it 3 times.
Note that shadows calculate the pixel data read from the writing coordinates of the pixel data of the original picture, which slows down the drawing speed. It takes 6 times longer than without color calculation.

Half brightness (color calculation mode = 2)
Half-brightness halves the brightness of the pixel data of the drawn parts for R, G, and B, respectively.
Pixel data already written to the framebuffer has no effect.

Semi-transparent (color calculation mode = 3)
Processing differs depending on the MSB of the frame buffer. If the MSB of the frame buffer is 0, it will be replaced.
If the MSB of the frame buffer is 1, it will be translucent.
With translucency, 1/2 (average) of the sum of the original picture and the background data is written to the frame buffer.
In the case of semi-transparent color calculation, the pixel data of the original picture and the pixel data read from the writing coordinates are color-calculated. Please note that the drawing speed will be slower in this case. It takes 6 times longer than without color calculation.

Gouraud shading (color calculation mode = 4)
Gouraud shading performs Gouraud shading processing with the RGB code set in the Gouraud shading table.
Pixel data already written to the framebuffer has no effect.
The Gouraud shading table address is specified by CMDGRDA (command table start address + 1CH).

Gouraud shading half-brightness (color calculation mode = 6)
Gouraud shading half-brightness is a combination of Gouraud shading and half-brightness. After Gouraud shading is applied to the part, half-brightness is applied.

Gouraud shading translucent (color calculation mode = 7)
Processing differs depending on the MSB of the frame buffer. If the MSB of the frame buffer is 0, it will be Gouraud shading.
If the MSB of the framebuffer is 1, Gouraud shading is translucent.

Gouraud shading translucency is a combination of Gouraud shading and translucency. After Gouraud shading is applied to the part, it is translucent.

Original picture
For parts with original pictures (sprites), color operations other than shadows are valid only in RGB mode (color mode 1 with RGB code and color mode 5). Results are not guaranteed when not in RGB mode (for characters in color bank mode).
In the color calculation of the part with the original picture, the transparent code is valid when SPD = 0, and the end code is valid when ECD = 0, so the color calculation is not performed for that pixel.
When color operations other than shadows are performed in RGB mode (color mode 5) and SPD = 1, the result of pixels with the transparent color code (0000H) of the original picture is not guaranteed. It is regarded as black and color calculation is performed.
When color operations other than shadows are performed in RGB mode (color mode 5) and ECD = 1, the pixel result of the end code (7FFFH) of the original picture is not guaranteed. It is regarded as white and color calculation is performed.
Color operations other than shadows on polygons, polylines, and lines are valid only when the non-texture color is RGB code.

Figure 6.15 Example of color calculation
┏ ━ ━ ━ ━ ┓ ┏ ━ ━━━━━━━┓
┃ MSB = 0 ┃
┃ ┌───── ┐ ┃ ┃ (pallet etc.) ┃
│ │ ┃ ┃
┃ │ Original picture │ ┃ ┠─── Below ─ Ground ─── ┨
│ │ ┃ ┃
┃ └ ───── ┘ ┃ ┃ MSB = 1 ┃
┃ (RGB etc.) ┃
┗━━━━━━┛┗━━━━━━━━━┛


Color calculation mode = 0 Color calculation mode = 1 Color calculation mode = 2 Color calculation mode = 3 
┏━━━━━━━━━┓ ┏━━━━━━━━━┓ ┏━━━━━━━━━┓ ┏━━━━━━━━━┓
┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃
┃┌─────┐┃┃┃┃┌─────┐┃┃┌─────┐┃
┃ │ │ ┃ ┃ ┃ ┃ │ │ ┃ ┃ │ replacement │ ┃
┠─┤Replace ├─┨┠─┬─────┬─┨┠─┤ Half-brightness ├─┨┠─┼─────┼─┨
┃ │ │ ┃ ┃ │ Shadow │ ┃ ┃ │ │ ┃ ┃ │ Translucent │ ┃
┃└─────┘┃┃└─────┘┃┃└─────┘┃┃└─────┘┃
┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃
┗━━━━━━━━━┛ ┗━━━━━━━━━┛ ┗━━━━━━━━━┛ ┗━━━━━━━━━┛


Color calculation mode = 4 Color calculation mode = 5 Color calculation mode = 6 Color calculation mode = 7 
┏━━━━━━━━━┓ ┏ ━━━━━━┓ ┏━━━━━━━━━┓ ┏━━━━━━━━━┓
┃ ┃ ┃ ┃ ┃ ┃
┃┌─────┐┃┃┃┃┌─────┐┃┃┌─────┐┃
┃ │ │ ┃ ┃ │ Goolow │ ┃ ┃ │ Goolow │ ┃
┠─┤ Gulon ├─┨ ┃ Setting prohibition ┃ ┠─┤ ├─┨ ┠─┼─────┼─┨
┃ │ │ ┃ ┃ │ + Semi-brightness │ ┃ ┃ │ G + Translucent │ ┃
┃└─────┘┃┃┃┃└─────┘┃┃└─────┘┃
┃ ┃ ┃ ┃ ┃ ┃
┗━━━━━━━━━┛ ┗━━━━━━━┛┗━━━━━━━━━┛ ┗━━━━━━━━━┛

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