RetroTV Effect Suite is an in-progress set of effects and shaders designed to help you in giving your game a very nostalgic retro flair.
RetroTV effects aren’t just made to be “inspired by” older games. I spent the time and effort researching exactly why old games looked the way they did. And with this knowledge I set out to recreate the same effects as accurately as I could, for the most authentic retro experience you can get in Unity.
Authentic NTSC television emulation
The included CRT Effect script performs accurate emulation of the way RGB colors were turned into a composite signal and then decoded back into RGB on the screen.
It really looks like you’re playing the game on a CRT television because it works essentially the same under the hood.
Before and after images of the effects applied to a screenshot from an emulator. Animated GIF version here
Old-school wobbly meshes
Old 3D games had a lot of wobbly meshes, from the SuperFX chip used in some SNES cartridges all the way to the PlayStation 1. Recreate this effect instantly with the included PS1Object shader. It even includes the same texture mapping artifacts as the PS1 for ultimate authenticity.
The PS1Object effect in action. Notice the popping on the Robot character, and the wobbly texture on the ground.
Color LUT generator
Want to restrict your game to a limited number of bits per color? Use the included Color LUT generator. You can just enter the number of bits per channel and hit Generate for a ready-made color LUT which can be plugged right into the stock Color Correction effect.
Or, go even farther - the color LUT is generated from a virtual digital-to-analog electronic circuit which can be tweaked. Your color LUT can be the result of an actual theoretical video circuit!
Before and after of a 4-bit per channel color LUT applied.
I’d like to make this package as extensive as possible. If there’s any features you’d like to see, or if you have some feedback about what I’ve got here, please don’t hesitate to let me know
I’ve been working on the UI for the effect script inspector and consolidating multiple features into one effect using multi compiled shaders.
Additionally, I have added two new effects - it’s possible to use a multiplied overlay texture now for the screen edges, and additionally a rolling flicker effect has been added to simulate what happens when a camera films a TV and the two have different refresh rates. Also, I have slightly tweaked the TV distortion effect so that it pulls the corners in instead of pushing the edges out, so the CRT distortion is a bit more intuitive now.
Today I completely reworked the inspector interface and additionally added a brand-new feature - video modes!
You can now pick one of the following modes to use:
Composite
S-Video
Component
VGA/SCART
Composite of course has the most blurring and artifacting. S-Video separates out the luma signal which makes the image much cleaner. Component separates out all three Y, I, and Q color components for a completely clean look. Finally, VGA/SCART just uses plain old RGB.
Video of the new video mode support in action (for best results please watch fullscreen 1080p):
A little update…
So I’ve actually fixed a bit of an issue in the CRT Effect. If you notice in the last video, switching from Component to VGA highlighted a bit of a shift towards brown in the whole palette when using everything except for VGA (basically, any of the video modes using the YIQ color space).
Originally, I had chalked this up to color gamut differences between YIQ and RGB, but then when I added support for using matrices to do the conversion instead of lookup textures the color shift vanished. It turns out my color LUTs were slightly wrong. That being said, instead of correcting the LUTs I decided to scrap them entirely. Fixing them is trivial, but after a chat with some helpful people on the Unity IRC, the LUTs weren’t nearly as good an idea as I had thought before - best case scenario, you’re on a platform where the difference between a LUT and a straight matrix multiply isn’t even measurable, worst case scenario you’re on a platform where the LUT either isn’t even supported or, even if it was, would introduce a very cache-unfriendly dependant texture read (imagine black and white pixels next to each other - they’re on opposite ends of the color cube. so that leaves you with both a cache miss AND a texture read).
So now it just uses a matrix multiply. The color differences are much subtler now. In fact, Component and VGA/SCART modes are nearly identical now (in most cases, I can’t see any difference).
On another note, I’m thinking of including several guides with this product, the idea being if you want to make a game really look like it’s running on an old system it’s best to know what limitations you’d have to deal with on those systems. So there’d be guides for many major console systems included, detailing audio and graphical limitations and what to keep in mind when developing with Unity (since it can be so easy to accidentally break those limitations). They should be a good resource in replicating the look and feel of older systems.
Thanks
I wanted this to look as close to the real thing as possible, especially the TV effect. I figured there was no better way to do that than to replicate how the signals actually work under the hood, rather than just make an effect that’s loosely inspired by what I remember them looking like.
Just tested RetroTV FX for WebGL compatibility - it’s 100% compatible! Here’s that SHMUP demo I made, 100% playable in a browser. Tested in Chrome and FIrefox (use Firefox for improved performance):
Hm, interesting. I hadn’t thought about supporting RF, even though I actually primarily used an RF connector for most of my PS2 gaming
Seems to me RF might be slightly more difficult to accurately emulate than the other standards included, not least of which because RF is also supposed to carry audio signals (which I can’t do from a shader, naturally). However, as far as I can tell RF still works somewhat similarly to Composite, with the addition of modulation/demodulation for carrying it over radio frequencies. In the end, it’s blurrier than Composite and is also subject to noise. Therefore, I could add an option to increase blurring in Composite mode and add an extra noise pass on top of the generated signal. I’ll probably give this some experimentation and see what I can come up with.
Yup, I see a lot of those too. And it’s always “hey, look, this looks sort of like a CRT!” but, having actually used one extensively, it just doesn’t even look remotely close to me.
Actually, the VGA LUT thing is actually not that noticeable. I’m actually thinking of scrapping it - the result is nearly identical to just doing a simple quantize, and also requires the use of a 3D LUT which locks out certain platforms. In the Roguelike demo above, I used a simpler quantize method to produce 9-bit color. With this feature you just specify bits per channel in the inspector and it handles the rest.
As far as customization, some things are limited. Color smearing can be played around with, there’s two constants defined in a RetroTV.cginc file which are COMPOSITE_LOWPASS and SVIDEO_LOWPASS. Unfortunately those both are pretty fiddly, it’s easy to accidentally render the entire screen grayscale with some values. That said, anywhere between 0.5 and 1.5 seems to work fine, so I could potentially expose that range to the inspector. You can also tweak horizontal blurring with display resolution though (more explained later).
Also, I haven’t implemented any form of aspect ratio locking, but you can definitely lock the video resolution! There’s an effect in there which lets you specify a game resolution. Right now internally it creates its own camera which renders to that resolution, although I’m thinking of scrapping that and letting you just specify your own camera (or array of cameras, in the case of split screen perhaps?). Also, you can specify the display resolution of the TV. By default it’s set to 960x480 (as mentioned above, you can set the horizontal width higher to limit horizontal blurring - so set it to 640x480 for example for a high amount of blurring, or 1280x480 to reduce blurring).
I’ll take a look and see if it’s possible to lock the aspect ratio and center the TV image on the screen. Right now it just stretches to fill the screen.
The game resolution effect sounds very useful, especially for 2D games aiming for that pixel-perfect appearance. As long as it still works alongside other camera assets (eg: Camera Perspective Editor, Pro Camera 2D) and the effect’s output remains consistent regardless of users’ full-screen/windowed resolutions, it should be enough! (For single player at least)
Display resolution sounds like it’s set up to control pixel interpolation? It’s interesting, definitely useful for fine-tuning CRT effects, as well as softening up the composite video a little.
Looking over the thread more carefully, there’s only a couple extra features I can think of that haven’t already been addressed:
For 3D games: A camera effect that sets it up with a target display aspect ratio, samples the camera frame at a specific render resolution, and then *stretches the sampled frame back to the target ratio. Think PS1 games with resolutions like 512×240 (non-interlaced) or 256×480 (interlaced) targeting 4:3 on TVs, or N64 games that could switch between 3:2 and 16:9 target ratios while rendering at 320×240.
It’d probably make more sense for the CRT Effect to do the stretching step. Hell, this step might already be covered by its Display Size options.
Pixel Aspect Ratio. A bunch of older consoles (NES, SNES, Game Gear, etc) had a pixel aspect ratio of 8:7, so the output was always slightly wider than native resolution. Many would probably prefer to stick to 1:1 PAR by default, but it’s nice to have the option for authenticity’s sake.
I was going to suggest a “Pixel Perfect Display” option, for people who’d want the game to be displayed at perfect multiples of the game’s internal resolution (on top of being pixel-perfect by design), but I’m not sure if it’s suitable for the suite? There’s other assets out there that can handle pixel-perfect multiples in the meantime (2D Toolkit offers a fairly comprehensive custom camera), so: eh.
Either way, I’m excited to see how this asset evolves, it’s looking awesome.
The lo-res effect should work 100% with other assets. All it does is create an internal render texture sized so a specific resolution (by default 320x240), then sets the game camera to render to that texture and then blits it to the screen (so, instead of just scaling down the screen, it actually renders to that resolution). As long as an asset can handle rendering a camera to a texture, it should work with no problems.
1.) Maybe, in line with what was said previously about an option to not fill the entire screen, it could be possible to just specify an aspect ratio to display the final “screen” at? Then you could essentially have your game render at for example 256x240, and then specify that it renders at 4:3 aspect ratio scaled to fit within the screen. Though at the moment it just stretches the internal resolution to fill the entire screen, which can be seen if you fullscreen either of the demos I’ve uploaded.
2.) Would the above option fulfill the pixel aspect ratio feature?
3.) Not sure if that’s even necessary TBH. You could just pick multiples of the internal render resolution yourself, right? Unless I’m missing something. And the main thing it would affect is the pixel mask overlay more than anything else.
That’d do the trick! What you said for #1 sounds pretty much like what I was thinking: Give the camera an aspect ratio and a resolution to render into, and then a display aspect ratio to stretch back out to. If it could allow for arbitrary aspect ratios in some way, then yeah, #2 would be fulfilled as well.
Alright, well I’ve now exposed two options. The Lo-Res Effect has an “Override Aspect” function, and an aspect ratio. If Override Aspect is unchecked it just uses the aspect ratio of the resolution you specified (so if you use 320x240 for example it renders at 4:3 aspect ratio), but you can check it and specify a custom aspect ratio instead. It probably shouldn’t be used for pixel-perfect games since it will scale the view horizontally and ruin the pixel-perfect alignment, but can be used for 3D games.
Additionally, CRT Effect now has a “Stretch To Screen” option. It’s on by default which makes the virtual screen stretch to fill the window or screen, but you can disable it and specify a custom aspect ratio. In that case it sizes the virtual screen to your custom aspect ratio and scales it to fit within the window or screen (sort of like how the Gameboy Advance let you toggle between stretch modes with the bumpers while playing Gameboy or Gameboy Color games)
Here’s “Stretch To Screen” disabled, with an aspect ratio of 1.33 specified. In this case the screen is pillarboxed (but can also be letterboxed depending on the difference between actual screen aspect ratio and custom-defined aspect ratio).
Additionally, in that screenshot it was set to render at 256x240, which is stretched to fill the 4:3 ratio. However, if I enable Override Aspect on the low-res effect and specify a custom aspect ratio of 1.33:
This way, it can render at other resolutions but still use the target aspect ratio for the projection matrix.
All that being said, I’m thinking of pruning out some of the other effects I’ve been working on, like the PS1-style shader, and just shipping the CRT effect by itself. If I do it that way, I can get it out sooner and consider the other things as either addons or just plain free releases, as I think the CRT effect is really the main effect in this package and is enough to stand by itself. Any thoughts or feedback on that?
Thank you for adding those features! Looks like they do the job perfectly. (gotta love that low-poly racer too, haha)
Yeah, it makes sense to keep the asset focused on CRT/screen effects. And besides, you could always update the RetroTV asset with new effects later on, or even save them for another asset suite if it turns out that way.