Running at 240p

Earlier this year I felt compelled to make sure Animal Well was able to run on a CRT at a clean 240p resolution with no weird down sampling. I'm making a low resolution pixel art game, and it would be blasphemous if this were some how not true. It turns out this was even more annoying than I was expecting, so I figured I would document the experience.

Last summer I picked up a Sony PVM off eBay while I was visiting Los Angeles. I've been really enjoying playing older games on it and got really excited at the thought of seeing it display my own game. I just needed to figure out how to get it connected to my PC. PVMs typically have BNC connectors that can accept RGB or component yPbPr. My computer has a GTX 980 graphics card which happens to have an analog VGA port on it.

Not really having any idea what I was doing, my first thought was that I needed to somehow get the rgb pins of the vga output connected to the the rgb bnc inputs on the back of the PVM, and then maybe something might happen. One half assed google search later, I found some VGA to BNC cables on monoprice -- easy! 

It turns out this is absolutely not enough to get anything working, and I was eventually forced to develop a working understanding of sync signals and how they relate to VGA. If you look at the pinout of a VGA connectors you'll find two sync lines, one for horizontal and one for vertical. The inputs on the PVM only had one line for the sync signal, so I realized the sync signals need to be combined in some way.

I wanted to see what would happen if I just spliced the horizontal and vertical sync lines together and plugged it into the sync input on my pvm. That's what combined sync is right? Also, this was probably a terrible idea, and could have damaged the tv, but I did it anyway 😅. As you might have guess, this also was definitely not going to work. It turns out combining sync signals is a pretty non-trivial process, and I was quickly discouraged from trying to rig together some type of homebrew solution myself.

After doing a bunch of research, I concluded that what I needed was an old Extron analog sync converter, which pretty much did exactly what I needed. This is a device that was popular in a lot of old schools and office buildings and allows you to hook up a PC to a projector. A lot of projectors use RGB and BNC connectors for input.

In this case, all it does is combine the H and V sync signals into on C-sync (combined sync) signal, leaving the rest of the video unaffected. I found this page on on RetroRGB to be pretty helpful when learning about these things.

The last and final thing I was wrestling with during this process, that I haven't mentioned yet, was getting my Nvidia graphics card to output 240p. Nvidia's control panel lets you define custom resolutions, but I found it to be an incredibly buggy and inconsistent experience. (Something tells me this is functionality that doesn't get a lot of QA attention each driver release.) Apparently if I had an AMD card, there are custom drivers I can install that add enhanced support for low res analog signals, But I really wanted to make it work with my existing Nvidia card/stock driver. With enough patience, and a couple reboots I eventually got some resolutions to work. I had to manually enter all the timing values. I found this site which has modelines for a bunch of different arcade/console setups. In my case I ended up using some timing values for one of the video modes of the NTSC Sega Genesis, to get a 320x240 resolution. Animal Well uses an internal resolution of 320x180 meant for 16:9 widescreen, so I was okay with a little letter boxing, and squashed aspect ratio. 

The final result
Close up of the scanlines

I was very excited to get this working. I took great care to make sure my DX11 renderer introduced no extra frames of input lag, but connecting it to a CRT lowered the lag even further.

This was a very fusty process and I had a lot of trouble finding info on the internet about doing this exact thing. If you have any questions or advice, feel free to reach out!

1 comment: