Difference between revisions of "CRT Geom"
(→Tweaking CRT Geom) |
m (Cleaning) |
||
(24 intermediate revisions by 13 users not shown) | |||
Line 1: | Line 1: | ||
[[File:Retroarch_2013-07-22_17-21-17-60.png|thumb|298px|CRT-Geom-Flat, with default settings]] | [[File:Retroarch_2013-07-22_17-21-17-60.png|thumb|298px|CRT-Geom-Flat, with default settings]] | ||
− | + | '''CRT-Geom''' is a popular CRT shader created by cgwg. | |
+ | |||
+ | ==Download== | ||
+ | *[https://github.com/libretro/common-shaders/blob/master/crt/shaders/crt-geom.cg crt-geom.cg] | ||
+ | *[https://gist.github.com/anonymous/dda125d65ded3fe9ed955800666eacf9 crt-geom-flat.cg] | ||
+ | |||
+ | ==Versions== | ||
+ | ===Standard=== | ||
+ | The original, standard version. | ||
+ | |||
+ | ===Sharpness=== | ||
+ | A sharper version with the phosphor coding removed, and light scanlines. | ||
+ | |||
+ | ===Halation=== | ||
+ | A multipass version with a "halation" effect that replicates the bloom of a CRT TV. | ||
==Tweaking CRT Geom== | ==Tweaking CRT Geom== | ||
− | CRT Geom is highly customizable. You can open up | + | CRT Geom is highly customizable. You can open up the .cg file in [http://notepad-plus-plus.org/ Notepad++] and edit it. Regular notepad will work, but Notepad++ is recommended. |
+ | Shader parameters can be changed by editing the first value of the parameter at the beginning of the file, or through [[RetroArch]]'s shader menu. | ||
[[File:Retroarch_2013-07-22_17-22-39-87.png|thumb|225px|CRT-Geom-Flat, with brighter scanlines]] | [[File:Retroarch_2013-07-22_17-22-39-87.png|thumb|225px|CRT-Geom-Flat, with brighter scanlines]] | ||
− | |||
− | |||
===Scanline Brightness=== | ===Scanline Brightness=== | ||
− | + | float4 weights = float4(distance / 0.3); | |
Raise the 0.3 to a higher value to make the scanlines brighter. I do not recommend going past 0.4, as at that point on bright colors scanlines completely disappear, and going further makes them appear again, but on the wrong field in said bright colors, which is inaccurate. Try 0.35. | Raise the 0.3 to a higher value to make the scanlines brighter. I do not recommend going past 0.4, as at that point on bright colors scanlines completely disappear, and going further makes them appear again, but on the wrong field in said bright colors, which is inaccurate. Try 0.35. | ||
+ | |||
===Sharpness=== | ===Sharpness=== | ||
− | + | '''old XML shader format only''' | |
[[File:Retroarch_2013-07-22_19-24-11-41.png|thumb|225px|CRT-Geom-Flat, at 2x sharpness]]If you find the shader looks too blurry, you can increase the sharpness by going to the sections in the code that have the following lines (should be at the beginning of both the vertex and fragment portions of the shader code): | [[File:Retroarch_2013-07-22_19-24-11-41.png|thumb|225px|CRT-Geom-Flat, at 2x sharpness]]If you find the shader looks too blurry, you can increase the sharpness by going to the sections in the code that have the following lines (should be at the beginning of both the vertex and fragment portions of the shader code): | ||
uniform vec2 rubyInputSize; | uniform vec2 rubyInputSize; | ||
Line 25: | Line 39: | ||
vec2 TextureSize = vec2(n*rubyTextureSize.x, rubyTextureSize.y); | vec2 TextureSize = vec2(n*rubyTextureSize.x, rubyTextureSize.y); | ||
[[File:Retroarch_2013-07-22_19-27-22-65.png|thumb|225px|CRT-Geom-Flat, at 4x sharpness]]Replace "n" with either 2 for increased sharpness, or 4 for maximum sharpness. Then Ctrl+F and seek out any portions of the code that say "rubyInputSize" and "rubyTextureSize", and replace them with "InputSize" and "TextureSize" respectively. | [[File:Retroarch_2013-07-22_19-27-22-65.png|thumb|225px|CRT-Geom-Flat, at 4x sharpness]]Replace "n" with either 2 for increased sharpness, or 4 for maximum sharpness. Then Ctrl+F and seek out any portions of the code that say "rubyInputSize" and "rubyTextureSize", and replace them with "InputSize" and "TextureSize" respectively. | ||
+ | |||
===Scanline Size=== | ===Scanline Size=== | ||
+ | '''old xml shader format only''' | ||
+ | |||
To obtain thinner, 480p-esque scanlines, first tweak the shader to apply greater sharpness, but only apply it to the TextureSize. The code should look like this: | To obtain thinner, 480p-esque scanlines, first tweak the shader to apply greater sharpness, but only apply it to the TextureSize. The code should look like this: | ||
uniform vec2 rubyTextureSize; | uniform vec2 rubyTextureSize; | ||
Line 36: | Line 53: | ||
===Curvature=== | ===Curvature=== | ||
+ | '''old xml shader format only''' | ||
− | To make it flat, just set | + | To make it flat, just set corner size (line 107) to 0.001 and corner smooth (line 110) to 8000.0. Then, comment out (i.e., put two slashes in front of it, like this: // ) line 141, #define CURVATURE. |
− | + | //#Define CURVATURE | |
− | |||
− | //#Define | ||
===Interlacing=== | ===Interlacing=== | ||
+ | For the original, to disable interlacing, comment it out: | ||
+ | |||
+ | //#define INTERLACED | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
===Phosphor=== | ===Phosphor=== | ||
− | [[File:Retroarch_2013-07-22_19-33-30-35.png|thumb|225px|CRT-Geom-Flat, with phosphor disabled]]To disable phosphor emulation (which alternately tints pixels green and magenta), comment out | + | [[File:Retroarch_2013-07-22_19-33-30-35.png|thumb|225px|CRT-Geom-Flat, with phosphor disabled]]To disable phosphor emulation (which alternately tints pixels green and magenta), comment out #define DOTMASK: |
− | + | //#define DOTMASK | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
===Halation=== | ===Halation=== | ||
If you find the effect too strong on the Halation version, go to the following line of code: | If you find the effect too strong on the Halation version, go to the following line of code: | ||
− | mul_res += pow( | + | mul_res += pow(tex2D(decal, xy2).rgb, float3(monitorgamma))*0.1; |
− | |||
− | |||
− | + | Lowering the last number reduces the effect of the halation. This is preferred since the default halation level is too high. | |
− | |||
[[Category:FAQs]] | [[Category:FAQs]] | ||
[[Category:Shaders/Filters]] | [[Category:Shaders/Filters]] |
Latest revision as of 23:26, 17 October 2021
CRT-Geom is a popular CRT shader created by cgwg.
Contents
Download[edit]
Versions[edit]
Standard[edit]
The original, standard version.
Sharpness[edit]
A sharper version with the phosphor coding removed, and light scanlines.
Halation[edit]
A multipass version with a "halation" effect that replicates the bloom of a CRT TV.
Tweaking CRT Geom[edit]
CRT Geom is highly customizable. You can open up the .cg file in Notepad++ and edit it. Regular notepad will work, but Notepad++ is recommended.
Shader parameters can be changed by editing the first value of the parameter at the beginning of the file, or through RetroArch's shader menu.
Scanline Brightness[edit]
float4 weights = float4(distance / 0.3);
Raise the 0.3 to a higher value to make the scanlines brighter. I do not recommend going past 0.4, as at that point on bright colors scanlines completely disappear, and going further makes them appear again, but on the wrong field in said bright colors, which is inaccurate. Try 0.35.
Sharpness[edit]
old XML shader format only
If you find the shader looks too blurry, you can increase the sharpness by going to the sections in the code that have the following lines (should be at the beginning of both the vertex and fragment portions of the shader code):
uniform vec2 rubyInputSize; uniform vec2 rubyTextureSize;
then add these lines afterwards:
vec2 InputSize = vec2(n*rubyInputSize.x, rubyInputSize.y); vec2 TextureSize = vec2(n*rubyTextureSize.x, rubyTextureSize.y);
Replace "n" with either 2 for increased sharpness, or 4 for maximum sharpness. Then Ctrl+F and seek out any portions of the code that say "rubyInputSize" and "rubyTextureSize", and replace them with "InputSize" and "TextureSize" respectively.
Scanline Size[edit]
old xml shader format only
To obtain thinner, 480p-esque scanlines, first tweak the shader to apply greater sharpness, but only apply it to the TextureSize. The code should look like this:
uniform vec2 rubyTextureSize; vec2 TextureSize = vec2(2*rubyTextureSize.x, 2*rubyTextureSize.y);
Again, this is for both the vertex and fragment portions. Don't forget to seek out any other instances of rubyTextureSize, and replace them with simply TextureSize.
Now, go to the beginning of the fragment portion, and modify it as such:
<fragment filter="nearest" outscale_x="1" outscale_y="2"><![CDATA[
This will only yield satisfactory results at 4x integer scale. Anything else will likely cause problems. It might also be wise to disable the phosphor emulation, as leaving it on produces a "grid"-like effect, which may or may not be desirable.
Curvature[edit]
old xml shader format only
To make it flat, just set corner size (line 107) to 0.001 and corner smooth (line 110) to 8000.0. Then, comment out (i.e., put two slashes in front of it, like this: // ) line 141, #define CURVATURE.
//#Define CURVATURE
Interlacing[edit]
For the original, to disable interlacing, comment it out:
//#define INTERLACED
Phosphor[edit]
To disable phosphor emulation (which alternately tints pixels green and magenta), comment out #define DOTMASK:
//#define DOTMASK
Halation[edit]
If you find the effect too strong on the Halation version, go to the following line of code:
mul_res += pow(tex2D(decal, xy2).rgb, float3(monitorgamma))*0.1;
Lowering the last number reduces the effect of the halation. This is preferred since the default halation level is too high.