Graphic Adapter Pro
Post-processing effect for unity3d which emulates retro videocards
tags: gamedev, indiedev, unity, c#, glsl, glitchart, retrogaming

Graphic Adapter Pro is a camera post-processing effect for Unity 3D that emulates look and feel of retro videocards and graphics adapters such as Teletext (1976), Apple II (1977), Atari 2600 (1977), Commodore 64 (1982), Amstrad CPC (1984), ZX Spectrum (1982), IBM CGA (1981), etc. It emulates screen resolution and pixel aspect ratio, color encoding and downsampling, dithering and subsampling. It emulates the way the old videocards were transmitting and encoding the signal. Besides that it allows you to color/limit output using different retro color palettes. The special algorithm allows you to use one of existing palettes or your own custom palette with a big amount of colors (up to 512+). You can also use the replacement color palette which allow you to replace particular colors in your original palette or remap them all.
It's best for for 2D console-like games, 70's/80's/Retro/VHS look, security cameras, robot/computer vision and video processing.

Read the development thread here

1. Preset

You can choose one of the existing presets to set all the parameters at once. This is helpful for searching the look you need and quickly browsing through the retro video card emulation without tweaking the parameters and searching for the tech parameters of each videocard.

You can choose between these presets:

"Teletext (1976)/78×69, 8-colors",
"Apple II (1977)/Lo-Res, 40×48, 16-colors",
"Apple II (1977)/Hi-Res, 280×192, 6-colors",
"Atari 2600 (1977)/160x192 NTSC",
"Commodore 64 (1982)/Multicolor, 160×200, 16-colors",
"Commodore 64 (1982)/High Resolution, 320×200, 16-colors",
"Amstrad CPC (1984)/160×200, 16-colors",
"Amstrad CPC (1984)/320×200, 4-colors",
"Amstrad CPC (1984)/640×200, 2-colors",
"ZX Spectrum (1982)/256×192, 16-colors",
"IBM CGA (1981)/320x200, Palette 1",
"IBM CGA (1981)/320x200, Palette 2",
"IBM CGA (1981)/160x100, 16-colors"
"IBM CGA (1981)/640×200, 2-colors",

2. Screen Resolution (Pixelation, Screen Emulation)
The picture will be quantized vertically and horizontally. You can choose the amount of pixels in the result picture.

a. Screen Width
The pixels per width in the output picture

b. Screen Height
The pixels per height in the output picture

c. Pixel Aspect Ratio
Old monitors and encoding standards most of the time were working with non-square pixels. This gave the picture special unique look. This parameter allows you to emulate non-square pixels. The picture will be stretched automatically vertically or horizontally depending on the value. !important about colliders

d. Background color
You can use this color to color the rest of the screen after stretching.

e. Stretch To Fullscreen
If you just want to use certain Screen Resolution without special pixel aspect ratio you can use this option. it will stretch the output picture to the size of whole output window.

3. Color Encoding & Downsampling
Nowadays we are used to see million of colors on the monitor because the videocards became very powerful. However, back in the days, the old videocards had very limited memory and data bandwidth. The same story was with the monitors. In 70s and 80s most of the time a videocard could encode only a couple of bits of color per channel. This section allows you to emulate color per channel downsampling. The information each channel can carry.

a. Encoding Mode
Different videocard used different way to encode the signal. So, you can choose between few color encoding modes: "Grayscale", "RGB", "YIQ (YI-Synced)", "YIQ (NTSC)". Each mode allows you to adjust the amount of colors per channel (don't mix it up with bits per channels).

b. Colors per channel
Different for different color encoding modes.

• "Grayscale" (1 channel)
Gray - colors per one channel
Color - allows you to color the output

• "RGB" (3 channels)
R,G,B - allows you to adjust colors per each channel

• "YIQ (YI-Synced)" (3 channels where I and Q channels are synched)
Chroma, Luma - allows to adjust color per channel for Y(chroma) and QI(luma).

• "YIQ (NTSC)" (3 channels)
Y,I,Q - allows you to adjust colors per each channel

c. Synced
You can use this mode to tweak colors per channel simultaneously for RGB, ... modes.

d. Sync Channels
Adjusts color per channel for all 3 channels in the same time

4. Dithering
Dithering creates the illusion of "color depth" in images with a limited color palette. In a dithered image, colors that are not available in the palette are approximated by a diffusion of colored pixels from within the available palette.

a. Dithering Mode
You can choose between different ways/algorithms of dithering

"No Dithering",
"Horizontal Lines",
"Vertical Lines",
"2x2 Ordered",
"2x2 Ordered 2",
"Uniform noise",
"Triangle noise"

b. Dither Amount
Allows you to adjust the amount of dithering.

5. Analog Encoding & Subsampling
Subsampling is the practice of encoding images by implementing less resolution for chroma information than for luma information, taking advantage of the human visual system's lower acuity for color differences than for luminance In the old videocards it was very important 'because of the limitation of the hardware.

a. Subsampling Mode
You can choose one of the standard subsampling modes:

"4:4:4 No Subsampling",
"4:2:2 DVCPRO HD",
"4:2:0 JPEG,MPEG,HDV",
"4:1:0 VHS",

b. Subsampling Width
In the custom subsampling mode you can set width of subsampling yourself

c. Subsampling Height
In the custom subsampling mode you can set height of subsampling yourself

6. Palette
Allows you to limit the picture colors by the palette. I wrote a special optimization algorithm which allows you to use very big palettes (up to 256-512 colors).

a. Palette Preset
You can use one of the existing color palettes from the the old videocards

"IBM CGA > Full Palette",
"IBM CGA > Palette 1, High Intensity",
"IBM CGA > Palette 1, Low Intensity",
"IBM CGA > Palette 2, High Intensity",
"IBM CGA > Palette 2, Low Intensity Brown",
"IBM CGA > Palette 2, Low Intensity Dark Yellow",
"Atari > NTSC",
"Atari > PAL",
"Atari > SECAM",
"MS DOS > Duke Nukem 3D",
"MS DOS > Doom 1",
"MS DOS > Quake 1",
"Nintendo > Gameboy",
"Nintendo > NES",
"Apple II > Palette Hi",
"Apple II > Palette Low",

b. Accuracy
This parameter allows you set how accurate the color matching is. Small values work faster but bigger are more precise. This also allow you to make more unique look of the picture.

c. Custom Palette
You can use your own palette.

Important notes:
1. The palette textures must be writable.
For each palette you have to set these params in the Editor :
Texture Mode = Advanced
Read/Write Enabled = True
Generate Mip Maps = False
Filter Mode = Point
Format = RGB 24-bit

2. Custom palette should be a file with a set of pixels where each pixel represents the color in the palette. There should not be same colors twice in the palette.

d. Update Texture
Press this after you using new custom texture

7. Replacement Palette
Replacement palette allows you to replace the colors in the original palette which you chose in the Palette section. In the normal case the both palettes must be the same size but you can try whatever you want. If works also with custom palette. If nothing is selected in Palette section then this section also not gonna work.

Normally, the workflow is like this.
First you make color downsamling in "Color Encoding" section.
Then you limiting / remaping them in "Palette" section.
And, finally, you are remaping them again in "Replacement Palette" section.

a. Replacement On
Turns on and off the part with replacement texture.

b. Replacement Palette
Choose the replacement palette.

Important notes: They are the same like with the custom texture. Please, read the notes in custom texture section.

b. Update Texture
Press this after you using new replacement texture

8. Custom Texture

You can use a custom texture if you want it to be affected by the effect. When you using the custom texture the effect will work only on this texture and it will bypass the input. If you drop the MovieTexture then it will play automatically.

9. Important Notes

a. Mouse/ Touch Interactions.
You should remember that when you are changing pixel aspect ratio the image is getting squeezed. Everything else in the scene except the output image is still on their previous places. You should be aware of that when, for example, you are working with the mouse or touch input and expecting interactions with the collision boxes. Since the output image could be transformed - you also have to transform the collision boxes and all interactable elements.
If your pixel aspect ratio is 1.0 or you are not interacting with the screen with mouse or touch then you don't have to worry about it.
If someone will write a script how to, for example, transform the collision boxes for the new pixel aspect ratio, I'd love to have it and put in the asset or to post it to the development thread.

b. Multicompile / Runtime Feature Switching
I'm following the best practices and using shader features for this plugin. It means that you can play with the plugin in the Editor but when you make the build - all your selected features becoming unchangeable. The parameters you still can tweak but you can't switch the features in runtime. If you still wanna do it then you have to use multicompile.
For example, if you wanna switch subsampling in runtime (in the build) then you have to add next line to the main shader file
#pragma multi_compile ___ PP_SUBSAMPL_ON

c. Bleeding / Smoothing
The plugin itself doesn't do any smoothing, blurring of the picture. The output picture will have very sharp pixel edges. If you wanna make picture more retro-looking you should use some CRT emulation (Cathode Ray Tube) or post blurring or smoothing.
I recommend to use my other asset - VHS Pro which does that.

Doom 4 with palette from Quake 1
Future Development

At the moment, I almost finished the shader and gonna submit it to Unity Asset Store very soon. Later I'm gonna implement more features and presets with different old videocard hardware emulation.

Back to main page