Zfast CRT Shader feature request - vertical

Not sure who to ask about this request so I’ll just ask it here. Would it be possible to add a parameter in Zfast CRT that allows the user to change the direction of scanlines from horizontal to vertical? This would be ideal for vertical/tate games that use newer MAME cores These cores incorrectly rotate scanlines to be horizontal across vertical displays. CRT-Hyllian has this feature but does not work on Lakka (RPi4). ZFast CRT is now my shader of choice due to its superior non-integer scaling with no perceptible scaling artifacts, so a scanline direction parameter would make it perfect.

EDIT: This seems to not be necessary, see posts below.


I’m not an expert but I did manage to hack a vertical version of Zfast CRT based on what I saw from crt-pi and crt-pi-vertical. HOWEVER I have only tested this in MAME 2003-plus and it requires some fiddling with the aspect ratio to get integer scaling on the horizontal axis. Depending on how the core rotates the image, this may or may not work…

Try this:

Copy crt/shaders/zfast_crt.glsl to crt/shaders/zfast_crt_vertical.glsl

Open zfast_crt_vertical.glsl and change lines 181 and 184 from:

COMPAT_PRECISION float whichmask = fract( gl_FragCoord.x*-0.4999);
COMPAT_PRECISION float whichmask = fract(gl_FragCoord.x * -0.3333);

to

COMPAT_PRECISION float whichmask = fract( gl_FragCoord.y*-0.4999);
COMPAT_PRECISION float whichmask = fract(gl_FragCoord.y * -0.3333);

Again, I’m no expert so maybe someone can do this properly.

1 Like

So it seems that Zfast CRT was very recently updated, the code is now different.

fix zfast_crt for rotated games · libretro/[email protected] (github.com)

In this case I don’t know if my solution is required or valid…

The update is intended to make it flip properly with the frontend rotation. So, your change (or at least something like it; (vTexCoord.y * OutputSize.y) instead of gl_FragCoord.y) should still work, but shouldn’t be necessary, AFAIK.

Indeed it is not necessary, I just tested it:

image

Therefore I don’t understand the issue @retroFuture is having.

1 Like

My issue seems to be me using an old version of the shader :slight_smile: Just to clarify, I’m using Laka 3.3 on my RPi4. This shader update should appear in the next Lakka version. Apologies, I should have specified the OS and platform in my original post.

1 Like

Sure no problem. BTW you can manually update the shaders, there is no need to wait for a new release.

2 Likes