r/shaders • • 12d ago

Vector Display shader

https://www.youtube.com/watch?v=1ABNiqwhG1Q

I made this vector graphics shader for a game I'm working on. The main goal is to emulate the appearance of an old school vector display like a vectrex. The core of the shader is pretty simple. It relies on cycling between textures to do the phosphor decay. One texture gets new lines written to it, then that gets copied to a new texture and everything gets its brightness reduced. Then the roles are reversed so that texture gets new lines written to it. A lot of stuff kind of falls out of that structure for free, like getting free motion trails. Then by controlling how you write lines you can get a lot of other things for free. The flicker effect is from imposing a limit on how many lines (really how much beam time) can be written in a single frame. So if you go over that, things start to flicker. Bloom is just a little tweak on the eventual color values so writing to the same position results in more "energy" and it blooms to white (and also adds energy around the spot).

All of the UI is just placeholder stuff to demo the shader. I like that the shader has real artistic constraints to it. I can't know for sure but it feels like similar constraints you'd have working on a real vector display.

0 Upvotes

2 comments sorted by

1

u/shurco 10d ago

if the phosphor target is 8-bit, that brightness multiply rounds the dim tail into flat bands. a half-float buffer lets those lines fade out instead of snapping to black.

1

u/danmwilson 10d ago

Thanks. They are 16 bit buffers.