HLSL Introduction

OK these options are very complex and require a bit of knowledge on how a Cathode Ray Tube TV works. In the simplest terms a beam of photons is fired at a phosphorescent screen behind a mesh of red,green and blue colours. If say it wanted a red colour, the beam would miss the green and blue colours and only hit the red one. Using a combinatoin of colours and power, the beam can create almost any colour.

The beam travels across the screen hitting the colours it needs.This is called a scanline. To generate a whole screen the beam first travels down every other scanline and then as it switches off those lines it draws the lines in between. This is called interlacing and can happen at different hertz (normally 50hz or 60hz). Interlaced screens were the norm for many years until progressive screens came in. These ran at twice the speed but drew each line in one pass. This gave a more detailed picture and most modern tv's are now progressive scan.

Anyway back to the hlsl parameters...

The Color-Processing Parameters affects how each coloured dot on the screen affects the others. As screens get older they get less accurate in aligning the beam of photons. This leads to colours bleeding into other colours and some colours being brighter than others. Changing the scales on these settings can affect the colour output of each pixel on the screen. The saturation setting is the same as adjusting the colour setting on your TV.

Convergence-Processing Parameters affects how accurately MAME simulates the beam drawing the screen. By changing the parameters you can again affect colour and also the definitiion of the screen.

Front-Surface Processing Parameters are the final effects that affect the final output of the screen. The posphor life affects the speed of each scanline going dark,the higher the number, the longer it takes. The scanlines options affect the darkness between each drawn line. The reason there are visible dark lines is that you have a large monitor (16" +) only drawing 400 or so lines. Because the scanlines are spaced out there is a visible darkness between each line. Arcade monitors were curved the curvature and pincushion change the shape of the drawn screen to simulate this.

Finally NTSC Processing Parameters... Well I dont have a clue about these. NTSC is the US TV standard and works a little different from other TV standards. I assume these settings simulate these differences.

Here are the parameters you can change. I've left the original descriptions from the hlsl text file supplied by MAME...

Color-Processing Parameters

red_from_r -2.0 to 2.0
red_from_g -2.0 to 2.0
red_from_b -2.0 to 2.0
green_from_r -2.0 to 2.0
green_from_g -2.0 to 2.0
green_from_b -2.0 to 2.0
blue_from_r -2.0 to 2.0
blue_from_g -2.0 to 2.0
blue_from_b -2.0 to 2.0

red_scale -2.0 to 2.0
green_scale -2.0 to 2.0
blue_scale -2.0 to 2.0

red_offset -1.0 to 1.0
green_offset -1.0 to 1.0
blue_offset -1.0 to 1.0

saturation 0.0 to 4.0

red_power -4.0 to 4.0
green_power -4.0 to 4.0
blue_power -4.0 to 4.0

red_floor 0.0 to 1.0
green_floor 0.0 to 1.0
blue_floor 0.0 to 1.0


red_converge_x -150 to 150
red_converge_y -150 to 150
green_converge_x -150 to 150
green_converge_y -150 to 150
blue_converge_x -150 to 150
blue_converge_y -150 to 150

red_radial_converge_x -150 to
red_radial_converge_y -150 to
green_radial_converge_x -150
to 150
green_radial_converge_y -150
to 150
blue_radial_converge_x -150 to
blue_radial_converge_y -150 to

defocus_x 0.0 to 32.0
defocus_y 0.0 to 32.0

Front-Surface Processing

red_phosphor_life 0.0 to 1.0
green_phosphor_life 0.0 to 1.0
blue_phosphor_life 0.0 to 1.0

scanline_alpha 0.0 to 1.0
scanline_size 0.0 to 4.0
scanline_bright_scale 0.0 to 2.0

scanline_bright_offset 0.0 to 1.0

scanline_jitter 0.0 to 2.0

shadow_mask_alpha 0.0 to 1.0

shadow_mask_texture [file]



shadow_mask_usize 0.0 to 1.0
shadow_mask_vsize 0.0 to 1.0

curvature 0.0 to 1.0

pincushion 0.0 to 1.0

oversample_x 1.0 to 4.0
oversample_y 1.0 to 4.0

NTSC Processing Parameters

yiq_w 4.1187867

yiq_a 0.0
yiq_b 0.5
yiq_fsc 1.5
yiq_fsc_scale 1.0
yiq_phase_count 2

These parameters define a 3x3 matrix which is
multiplied by the incoming RGB signal. This can
be used for any standard matrix convolution,
including H/S/V or simply affecting the TV-style

These parameters define a value for each color
channel that is multiplied with said channel after
matrix convolution.

These parameters define a value for each color
channel that is added to said channel after
scaling and after matrix convolution.

This parameter defines the amount each color
channel is raised above said channel's baseline
grayscale value. A value of 0.0 gives a gamma-
correct grayscale image, whereas 1.0 is full
saturation, with each channel being
oversaturated equally beyond that.

These parameters define the exponent for each
color channel that is applied after scaling,
offsetting, saturation and matrix convolution.

These parameters define the lower limit of each
final color channel value; 0.05, for example,
raises the minimum to 0.05 but re-scales to
leave the max at 1.0.

These parameters define the overall
convergence, in pixel space, for each channel.

Radial convergence occurs relative to the center
of the screen, whereas the other six define
overall translation values.

These parameters define the overall defocus
radius for the three post-converged beams.

These parameters define the phosphor lifetime
for each channel, with 0.0 representing no
phosphorescence and leaving the channel on

The overall darkness of each scanline furrow.
The overall height of each scanline.
The overall brightness multiplier for each
The overall brightness additive value for each
The relative scanline movement per field.

The overall darkness of each shadow mask
A PNG that defines the shadow mask for each
1+ The count of shadow mask elements, X
(usually 640-ish)
1+ The count of shadow mask elements, Y
(usually 480-ish)
These parameters define the *in-use* pixel
count on the X and Y axes of the shadow mask

Screen curvature. Affects borders and shadow
Image curvature. Affects the source image only.

These parameters define a multiplier for each
axis of the internal render target. Powerful GPU

W parameter for: C(t) = Y(t) + I(t)sin(Wt) +
A parameter for: t = x + ay + b;
B parameter for: t = x + ay + b;
Relative color subcarrier frequency
Color subcarrier frequency scale
Number of frames for NTSC processing (3 for
NES, else 2)