Mdapt & gdapt - dithering treatment [Updated 06/06/14]

That looks great, man. Especially those SFA3 shots :open_mouth:

Very good, indeed!

I’m eager to test it on RA 0.9.9 for PS3.

btw found another excellent example for the shader:

still working on a way to implement one line dither merging in the current version without too many false detections.

It’s very good.

I can see a false positive at TM mark. Maybe lowering the contrast threshold can fix that.

I got your output image and applied 3xBR to see how it would look. I think the results are better with it, indeed!

3xBR-LVL3-noblend on raw image (no dithering treatment):

3xBR-LVL3-noblend using mdapt as first pass:

1 Like

nice shots, good to see that mdaps works well together with xBR.

the checkerboard detection actually works without any kind of threshold. except for special cases and other little things the algorithm just looks for these patterns:

where black stands for one fixed color and every mangenta field can be an arbitrary color (except for the “black color”).

well let me see what I can do about the TM issue, thanks for the hint.

I think I’m using an older version, but in Final Fantasy Tactics, the shader tries to shade the text. A false positive.

the gba version? could you post a screenshot?

Is it necessary? Final Fantasy Tactics is made for lcd screens.

Can someone have a look between Sp00kyFox’ mdapt and coastkids cbod, because mdapt doesn’t work on NVIDIA OpenGL. I have to change to Direct3D. cbod works fine with NVIDIA OpenGL. Sp00kyFox doesn’t have a NVIDIA graphic card to test.

FFT for PS1, not FFTA. The text in the intro and name input screen.

Ideally, it’d be nice to just leave the dithering shader on at all times because I won’t know which games will use dithering. Just last night I found that Metal Warriors uses a bit of it for the sky in some levels. But I guess it’s inevitable that there will be false positives.

1 Like

I can try to fix it nontheless. but I would need a screenshot to see where exactly the problem is. optimally one without the shader and one filtered.

Alright, I’ll do that. To confirm, thhe latest version is the one from the anonfiles link above? I might have been using a version before that.

It will take me a day to upload the screenshots, as I don’t have proper Internet access right now.

yeah, here is the link again to make sure: https://anonfiles.com/file/7d8e2992fe5f27b56a06e273f468e76c

I tried that version and it keeps retroarch keeps crashing. The version I was using was 1.0 and it was just the dithering. That version has both dithering and pseudo hi res blending. Old version worked, this doesn’t.

Can I get theater version with just the dithering?

sry, but to be honest I don’t have too much experience with cg. at least one user also told me that my shader doesn’t work with opengl on his nvidia card. but unless someone else has a look an my code I don’t know if I can fix it.

ok, here is the new version. I couldn’t avoid it but to add another pass to the shader (so in total there are 4 now). the good news is that the one line dither detection is back and many false detections are gone. (for example the TM in the ecco title screen won’t get affected anymore)

a few notes:

  • the one line dither detection must be activated in pass1 (just set the corresponding flag to true).
  • the new pass 2 terminates false detections. there are two parameters at the beginning of the file which you can modify.

here is the download: https://anonfiles.com/file/4a0fe90504089e6b6ba4bc88e15e05f3

@tripulent maybe there is some info about the crash in the retroarch log?

There’s no error listed in the log at all. Now I’ve tried the 1.4 version, and it crashes as well. Nvidia card, and OpenGL mode. In Direct3D mode it works. I also can’t get full speed on games, which I could with 1.0.

In FFT, the text is less distorted. Readable, and improved upon 1.0, but still not untouched. There is very slight dithering for the backgrounds, but its not essential.

In Silent Hill, it doesn’t get all the dithering. It seems to get some, but not all. That game might need a specific dithering shader written just specifically for it, since it’s a bit more complex than most games I take it.

thx for the feedback. yeah, I know about the nvidia-ogl issue but I don’t know what the problem is and how I can fix it. someone from the more experienced shader coders should have a look at it. performance in retro resolutions is good on my side but I guess it can be a problem for higher resolutions with old GPUs.

regarding silent hill. judging from the screenshots it’s more like a “manhattan pattern” than a checkerboard one, so no wonder why mdapt doesn’t work too well with the game (you could try activating horizontal or/and vertical dithering in the first pass though). I’ll look into that in the future.

I’m working on a dithering filter too. For now it’s only in kega fusion plugins format:

https://anonfiles.com/file/9650c6f0c63d60eacc3a1ebf8a89bcac

It’s in early stages yet, but I like how it filter some jaggies even if it wasn’t intended.

btw I’d like to squeeze out some performance. I think I’ve read somewhere that for CG in an boolean expression every element will get evaluated even if one substatement will falsify the whole statement. since I have a lot of code like this in my shader it could speed up the algorithm.

@Hyllian interesting. I’ll look into you attempt.

btw I’m sorry about still not explaing the mechanics of my shader. I was too busy implementing new ideas and fixing little things. but I’m pretty satisfied with the result for now so I’ll get onto it :wink:

No problem, take your time.

In Cg I try to get rid of branches to get speed up.