libretro / common-shaders

Collection of commonly used Cg shaders. These shaders are usable by either HLSL and/or Cg runtime compilers. The cg2glsl script will translate most of these into GLSL shaders.
http://www.libretro.com
1.05k stars 254 forks source link

Avoid moire effect when using curvature #163

Open franciscusm opened 3 years ago

franciscusm commented 3 years ago

Hi.

When using curvature simulation a 'moire' effect appears. Would it be possible to avoid this? (maybe by altering the order each effect is executed).

While I remember some of my arcade monitors showed a subtle moire effect (Intervideo i.e.) others like the Hantarex Polo /2 didn't.

Thanks.

hizzlekizzle commented 3 years ago

Unfortunately, moire is a tough nut to crack, and basically requires pretty significant antialiasing/blurring. If you're trying to curve a previously flat shader using an additional pass, the "ewa-curvature" shader is one way to do it, the last pass of crt-royale is another. You can also use noise to hide it, like I did with the crtglow shader. (I don't think the crtglow curvature/noise or ewa-curvature are available in Cg format, only slang)

franciscusm commented 3 years ago

I'm using just CRT Royale for Mame and old games in a 4k screen trying to mimic as much as possible the aspect of a CRT , so I use the curvature effect of CRT royale.

Oh, that's bad news then. But thanks anyway, the CRT feeling -even with a bit of moire- is incredible.

I'll play with antialiasing and blurring to see what can I achieve, though.

hizzlekizzle commented 3 years ago

Ah, yeah, if you're already using CRT-Royale, it's about as good as you're going to get, unfortunately. You can try increasing the anti-aliasing options in the shader's runtime parameters and see if higher values improve anything. Good luck :)