Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CRT shaders #12014

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Add CRT shaders #12014

wants to merge 2 commits into from

Conversation

Clownacy
Copy link

@Clownacy Clownacy commented Jun 29, 2023

I've ported a couple of shaders from RetroArch - particularly the crt-pi and crt-lottes-fast ones. Unlike other shaders such as crt-royale, these shaders are single-pass, allowing them to work within Dolphin's framework. These look pretty good when paired with native resolution and SSAA.

crt-lottes-fast:
image

unfiltered:
image

crt-pi:
image

Unfortunately, I only noticed #11888 after I had already ported crt-pi. Still, crt-pi is specifically optimised for lower-end hardware (Raspberry Pis, in particular), so perhaps these shaders still have some utility.

Various settings have been exposed through Dolphin's configuration API, crt-pi in particular boasts extra options that even the RetroArch version does not due to being hardcoded within the GLSL code itself.

Both crt-pi and crt-lottes-fast run with every backend that I have tested (OpenGL, Vulkan, Direct3D 11, and Direct3D 12).

I've ported a couple of shaders from RetroArch - particularly the
crt-pi and crt-lottes-fast ones. Unlike other shaders such as
crt-royale, these shaders are single-pass, allowing them to work
within Dolphin's framework. These look pretty good when paired with
native resolution and SSAA.
@Dogway
Copy link
Contributor

Dogway commented Jun 30, 2023

Hi @Clownacy my shader is only for color correction + color management not scanlines per se so it can be run at increased resolutions which I prefer for GC and Wii games.

Still if there are people that prefer native+scanlines your ports are a good option. I recently found zfast_crt to be both very good while at the same time very fast. I used it to create a monolithic shader for the Chromecast (so figure how fast it is), this is my version for RA with vignette, distortion, corner size, and phosphor*temperature. Runs at 60fps on RetroArch/snes9x in Chromecast HD.

@Clownacy
Copy link
Author

Clownacy commented Jul 1, 2023

Thanks for the clarification!

@nyanpasu64
Copy link
Contributor

Rather late to say this, but these look more like LCD shaders than CRT, because the phosphor grid is as wide as the scanlines are tall. In CRTs generally the phosphor spacing is narrower than the electron beam's width at full brightness (though the electron beam often gets narrower in dimly lit parts of the image).

@golivax
Copy link

golivax commented Sep 8, 2023

I personally love this! The crt-lottes-fast shader looks gorgeous on my 4k tv. Can't wait to see other high-quality shaders (e.g., zfast_crt) ported to Dolphin. Hopefully someday Dolphin will also support multi-pass shaders (e.g., royale, crt-guest-advanced, ntsc adaptive).🤞

@golivax
Copy link

golivax commented Oct 23, 2023

Hi all! Is there any chance we can get this merged? This PR is "just" porting two well-known crt shaders and both work. I understand Dolphin has its roadmap and that review time is limited, but this one shouldn't take long I believe. Thanks!

@AdmiralCurtiss
Copy link
Contributor

I'm never sure what to do with shader PRs since, honestly, I don't think they should be part of the Dolphin codebase at all, and if someone wants them they can just download them from some user-managed repository/forum thread/whatever of shaders and drop them into their Dolphin user folder. None of the maintainers (including myself) seem to care much about these, and those users that do can certainly do a much better job of curating the shaders than us.

@walterg74
Copy link

walterg74 commented Mar 9, 2024

Hi @Clownacy , I am testing these out with the latest Dolphin, and neither works. I get this error:

Dolphin_Shader_Error

Any idea what I could do?

@Clownacy
Copy link
Author

Clownacy commented Mar 9, 2024

@walterg74 Are you sure you downloaded the shaders correctly? The error message suggests that the first line of the shader's code is at least 124 characters long, but that should not be the case.

Here are links to the raw files. If you download these, they should be correct.
https://raw.githubusercontent.com/dolphin-emu/dolphin/b1537ca2326114087f7af7836f2a5ba54b764e6d/Data/Sys/Shaders/crt_lottes_fast.glsl
https://raw.githubusercontent.com/dolphin-emu/dolphin/b1537ca2326114087f7af7836f2a5ba54b764e6d/Data/Sys/Shaders/crt_pi.glsl

@walterg74
Copy link

walterg74 commented Mar 9, 2024

@Clownacy I believe so, but I will download again from these links and check!

Edit: Clearly my download was whack... Now they worked. Thanks!!

@Kingedeji
Copy link

@Clownacy Thanks for the shaders and with all those settings it's perfect. Really good to have something like this in dolphin proper!

@sebasasa
Copy link

I tried crt-pi on dolphin android, and i got an error
1:316: S0012: Global variable initializer must be a constant expression

I asume this probably stems (Like most problems of these kind) from android being limited by OpelGL ES? Or is there something else going on here? If it is indeed a GL version problem i could probably take the time to fix it if people are interested in giving that retro feel to portable gc gaming

Global variables require constant initialisers.
@Clownacy
Copy link
Author

@sebasasa I have fixed crt-pi and tested it in both OpenGL ES and Vulkan on my Pixel 6. All should be working now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

8 participants