Hammster / windows-terminal-shaders

A small collection of terminal shaders
Creative Commons Zero v1.0 Universal
510 stars 34 forks source link

Glowing Text #6

Open ghost opened 3 years ago

ghost commented 3 years ago

Would it be possible to mix this with the Experimental Retro Effects that come preinstalled with windows terminal?

Hammster commented 3 years ago

I was playing around with it, but I did not manage to get it working properly, it's definitely something I want to add though. This is how far I got in my initial try, by just copying and pasting the retro shader code.

WindowsTerminal_PsBm6RpzYj

ghost commented 3 years ago

Sorry if i'm not formatting these correctly, I haven't used Github much, but where would I be able to find the code for the Retro Terminal code? I can't seem to find the file location.

Hammster commented 3 years ago

It's inside the Windows terminal repository, the Blur function is the one responsible for the glow effect 🙂

https://github.com/microsoft/terminal/blob/main/samples/PixelShaders/Retro.hlsl

I think the issue was that the scale was not properly applied. But I could be mistaken since this is basically the first time that I have written any shader that's more than just a color tint 😄

rbeesley commented 3 years ago

I merged Retro.hlsl with crt.hlsl. I made a couple tweaks so that it didn't over-bloom the colors and fixed the ENABLE_NOISE / ENABLE_GAIN. At the same time I used the scanline routine from Retro.hlsl so that the moiré wasn't quite so strong and addresses the fix comment you have.

There's probably a lot of refinement before I'd commit this to release and you'd have to see how the license for Retro.hlsl fits, but it is at least a first step to resolving this.

image

rbeesley commented 3 years ago

@Hammster, check out the crt.hlsl I have in my crt.hlsl with retro.hlsl branch.

image

I've replaced the blur routine with my "bloom" routine. This gives a slightly brighter leading edge of the electron beam and personally I think it helps define foreground/background better for text. Blur is pretty computationally expensive and I couldn't come up with a better version which played well with Windows Terminal. I could implement it in SHADERed, but curve with blur "wouldn't compile," yet they each worked fine with any other combination of options. I actually like this result better.

I implemented a blur which doesn't cause compile problems, and it can be used with all options turned on including bloom. I still think it needs work and I still prefer the effect of bloom, but it's an available option.

This is a screen capture with everything turned on: image

The only thing still hanging on from retro.hlsl is the scanlines. There isn't much to what is provided from retro.hlsl and I can't think of a better way to write how it works. If you want to take a stab at that, it should be the last thing.

erjadi commented 3 years ago

Hey guys, I did my own shader based on the original crt.hlsl and I added the glow and rgb misalignment. I didn't see @rbeesley 's edit yet, that might be a better implementation. The rgb misalignment I hadn't seen before, but I thought it gives the image another nice retro touch. By scaling the RGB images by slightly different ratios, we can get that ghosting effect where edges of pure white boxes become red on one side and blue on the other. Both effects together

In addition I added slight displacement on the scanline, and in my version turned down the warping a bit.

image

Let me know how this looks, I can do a PR.

rbeesley commented 3 years ago

@erjadi, looks like an alignment and convergence modifier? If you want to maybe replace the scanline routine on my pr and add this as another option it would probably be easier to merge. Can you control the focus of each electron beam on its own? Definitely a modifier for color CRTs.

TheOld commented 2 years ago

Hey @erjadi , I know this is somewhat old, so sorry for necroing this, but do you mind sharing your configuration (specifically the RGB shift one) if you still have it? Thanks!

DanielBrittainJr commented 1 year ago

just +1 here @erjadi to see if you could share the config you posted above, it looks awesome!