• Stars
    star
    172
  • Rank 221,201 (Top 5 %)
  • Language
    C#
  • License
    Other
  • Created almost 8 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A small collection of shaders for a range of authentic old TV effects (Composite, S-Video, RF, etc)

RetroTVFX

A small collection of shaders for a range of authentic old TV effects (Composite, S-Video, RF, etc) in Unity.

Installation

From Git URL

Open the Package Manager in Unity, click the Plus icon in the upper left corner, and select "Add package from Git URL". Enter this repository's URL ([email protected]:GlaireDaggers/RetroTVFX.git) into the field.

From disk

Clone this repository to your computer. Open the Package Manager in Unity, click the Plus icon in the upper left corner, and select "Add package from disk". Browse to where you cloned this repository to and select the "package.json" file.

After the package has installed, you may optionally install the test and example assets via the Package Manager.

Examples

See the example scenes in Samples/RetroTVFX/[version]/Examples/Scenes

  • Basic shows off a minimal example with a rotating 3D cube
  • PSX goes beyond basic, adding a low-res effect and wobbly PSX-esque model
  • 2D shows a demo scene of a sprite running down a hallway with onscreen controls for the CRT effect

Quick Start

Just add the CRT Effect component to your camera. It should work out of the box as a post effect script.

CRT Effect parameters

Filter Quality

Sets the quality of the luma/chroma signal filters. 8 taps is lower quality but likely faster, 24 taps is higher quality but likely slower. Use 24 if you need more accurate NTSC behavior, otherwise 8 should work just fine.

Video Mode

Sets the mode of the video signal. Think of this like switching what kind of cable hookup you're using to display the image.

Video Mode Description
RF Looks like an RF coax cable. Blurriest option and adds signal noise
Composite Acts like a composite RCA video cable. A little clearer than RF and no noise
S-Video Acts like an S-Video cable. Splits luma and chroma signals for a much cleaner look
Component Acts like Y/I/Q component cables. No color bleeding at all.
VGA/SCART Acts like a VGA or SCART cable. Should be nearly indistinguishable from Component
VGA/SCART (Fast) Much like VGA/SCART, but with fewer blit operations. Performs no downscaling, so it may look artificial.

Quantize RGB

Allows incoming RGB values to be quantized to a lower bit depth. Set the bits per R, G, and B channels.

Display size X/Y

Sets the internal render texture size. The screen will be downscaled to this size before being passed through the video filter.

In general, size Y can be left at 480 and size X can be used to control blurriness - 640 leads to a much more fuzzy image, and 1280 is a much sharper image.

Stretch to display

Causes the final image to be stretched to the bounds of the game window.

Aspect Ratio

If Stretch to display is disabled, you can use this to force an aspect ratio for the image. The image will be fit to the bounds of the game window and surrounded with a black border. Note that this may produce a squashed image if the camera renders at a different aspect ratio, attach the Override Aspect Ratio script to correct for this.

Enable TV Curvature

If enabled, warps the image with a barrel lens effect.

Curvature

Sets the amount of distortion for TV curvature

TV Overlay

Sets an image to be overlaid on top of the image (to add a border mask like effect)

Enable pixel mask

Enables a pixel mask to be overlaid on top of the image to emulate shadow masks or dot grills.

Pixel mask texture

The texture to be overlaid for pixel mask effect

Mask repeat X/Y

Amount to repeat pixel mask texture on X/Y axes

Pixel mask brightness

Allows to compensate for pixel mask darkening by overbrightening image. Use values >1 to over-brighten.

Rolling sync flicker

Enables a "rolling flicker" type effect you'd see when recording a CRT television with a camera.

Rolling flicker factor

Sets the opacity of the rolling flicker effect.

Rolling V-Sync time

Sets the phase duration of the V-Sync. 1.0 is perfectly synchronized and will not display any "rolling". Any value other than 1.0 will simulate the "desynchronized" effect and cause it to roll faster or slower

RF Noise

Sets the amount of RF noise added to the image (RF only)

YIQ Filter

Allows the YIQ signal to be distorted. The chroma plane can be scaled and offset, and the luma signal can also be sharpened here

Enable burst count animation

Enable animating the NTSC burst phase, which causes the scanline flickering. Disabling this will freeze the animation and make the scanline artifacts more apparent, but some old consoles did work this way.

Anti flicker

When burst count animation is enabled, this adds an option to reduce the amount of flickering by blending the current and previous frames together. This adds a "motion blur" like effect, but reduces the amount of flickering which may be desirable.

Low resolution effect

The PSX demo scene includes an example of adding a low-res effect. This is done by splitting your camera setup into two cameras: One camera will render the game world into a render texture, and the other will display that render texture to the screen and apply the CRT effect. I'll call these the RenderCamera and the DisplayCamera, respectively.

Your RenderCamera should have a target texture assigned. Several are included, but if you want to make your own you can just create a RenderTexture asset set to the desired resolution and assign it to the camera's Target Texture slot.

Meanwhile, your DisplayCamera should be set to a Culling Mask of Nothing (so you don't render the scene twice), preferably a Clear Flags of Solid Color, and you should attach the Blit Render Texture script above the CRT Effect, assigning it the same render texture your RenderCamera is rendering into.

Unity UI Input

The 2D demo scene includes an example of rendering Unity UI into the low resolution target texture and then displaying that on the screen. However, this complicates input a bit, as changing the aspect ratio, resolution, and even the TV curvature distortion can all throw off the cursor position. To fix this, use the included LoResStandaloneInputModule script.

When you create a new Canvas in Unity, a new EventSystem game object is created as well. On this object, remove the built-in StandaloneInputModule script and add the LoResStandaloneInputModule to replace it. The parameters are as follows:

Desired res x/y

The resolution of the render texture being rendered into

Fisheye x/y

Should be set to the same value as "Curvature" on the CRT Effect script

Stretch to display

Should be set to the same setting as "Stretch to display" on the CRT Effect script

Display Aspect

Should be set to the same setting as "Aspect ratio" on the CRT Effect script, if Stretch to display is disabled.

More Repositories

1

Netcode.IO.NET

A pure managed C# implementation of the Netcode.IO spec
C#
256
star
2

ReliableNetcode.NET

A pure managed C# socket-agnostic reliability layer inspired by reliable.io and yojimbo
C#
151
star
3

Unity-Netcode.IO

A lightweight plugin to allow Unity games to use Netcode.IO for secure UDP socket communication.
C#
122
star
4

Pretty-Fast-Video

Designed as successor to Pretty-Good-Video for improved codec structure, API design & performance
Rust
52
star
5

BNA

A minimal game framework inspired by XNA for the Beef programming language
HyPhy
22
star
6

Open-World-Builder

Open source level editor toolkit built on FNA+ImGui.NET
C#
17
star
7

ContentPipe

A simple framework for automating content pipelines for indie games
C#
13
star
8

Effect-Build

A simple commandline frontend for D3DCompile to build FX 2.0 HLSL effect files, designed for FNA-based games
C++
13
star
9

Godot-RetroTV

Authentic TV shaders for Godot with accurate composite video artifacts
GDScript
8
star
10

ResourceCache

A simple resource loading framework for .NET games
C#
8
star
11

Beef-Toml

A simple TOML serializer/deserializer for Beef
HyPhy
7
star
12

Praxis.NET

A C# ECS game engine built on FNA
HTML
7
star
13

com.glairedaggers.sonke

Implementation of Sonic Adventure inspired physics for Unity 2020.3 and above
C#
6
star
14

dreambox-doom

A port of DOOM to the Dreambox fantasy console
C
5
star
15

Pretty-Good-Video

A toy MPEG-like video codec
Rust
4
star
16

CritChanceStudio.Tools

Source code of various CritChanceStudios internal tools (built on FNA & ImGUI)
C#
3
star
17

godot-datatable

Implementation of DataTable-style resources for Godot
GDScript
3
star
18

libpfvdec

A fast & portable C library for decoding PFV video streams
C
3
star
19

ImGuizmo.FNA

A demo project showcasing ImGuizmo integration with FNA
C#
1
star
20

GD-Localization-For-RMMV

Localization plugin for RPG Maker MV
JavaScript
1
star
21

cozi-lang

A work-in-progress hobby language project
C#
1
star
22

PSX-VAG-.NET

Simple minimal lib for encoding & decoding PSX vag/vagi audio
C#
1
star
23

DBSDK-Rust

SDK for writing DreamBox games in Rust
Rust
1
star