Jump to content

Photo

CRT effects and Pixel Shaders

CRT reshade shader dxgl allegro

  • Please log in to reply
5 replies to this topic

#1 Volgia

Volgia

    Drunk dragon

  • Members
  • Location:France

Posted 10 November 2016 - 11:41 AM

Hi folks ^^

In case of you don't know what are CRT Shaders, there's a good explanation here :
Most of these shaders look fantastic IMO (look at this !). They give a great old school feeling, they also do a very good job at upscaling low resolutions on huge screens (I play GBA games on Retroarch on a 55' TV and it looks pretty fine).
I would really like to be able to play ZC with these types of shaders, so I've been searching here and on the AG forums and I found out that the problem seems to be the allegro library.

So I tried some workarounds.
I installed DXGL to force OpenGL backend and Reshade 2.0 but it did simply nothing. Recently I tried the new v3.0 that can be customized in-game. As sign of an improvement, now when I start ZC I can see the ReShade header that invites me to use the Shift + F2 combination to open the menu. The problem is, impossible to open the menu, Shift + F2 doesn't seem to trigger anything, so the header disappears after a few seconds. I didn't find a way to configure it outside the game. So I'm stuck... again :badrazz:

The only other solution I found was using DOS 2.10 version with DosBox inside Retroarch, and I didn't managed to get it working since it needed Windows to install. :kawaii:

So the big question is : Did some of you manage to get any method to work ?

And another question for the devs, why do DOS versions of ZC need Windows to work ? Or maybe I missed something ? That's a pity since it should be easily installed on DosBox and work on any system since it's emulated.

Thanks in advance :)

EDIT : I opened some ZC snapshots in retroarch and applied some shaders to show you :derp:

https://s21.postimg....om_no_curve.png
https://s21.postimg....jf0chz/Geom.png
https://s21.postimg....0_Composite.png


Edited by Volgia, 10 November 2016 - 02:05 PM.

  • Anthus likes this

#2 Anthus

Anthus

    Lord of Liquids

  • Members
  • Location:Ohio

Posted 10 November 2016 - 09:09 PM

I have wished for a while now that ZC/ Q had some sort of "retro" or CRT shader. I think it is a really nice, and nostalgic touch. I know *nothing* about it though, but I hope some people can shed some insight into this. :D 



#3 Ben

Ben

    a very grumpy

  • Members

Posted 10 November 2016 - 09:16 PM

Pretty sure that ReShade is going to require a bit more than that to get running. Unfortunately, ZC doesn't really use standard DirectX/OpenGL rendering the way a lot of things do, so hooking in other processes to add effects like that may require a lot more work than just tossing dxgl.dll or d3d9.dll into a directory. I actually attempted this with an ancient version of enbseries way back in like 2011 and got some functionality working but only by disabling almost every setting. I think in the end the only thing I got running reliably was the frame rate limiter. Effects didn't work, or crashed.



#4 Volgia

Volgia

    Drunk dragon

  • Members
  • Location:France

Posted 10 November 2016 - 09:41 PM

ZC doesn't really use standard DirectX/OpenGL rendering the way a lot of things do, so hooking in other processes to add effects like that may require a lot more work than just tossing dxgl.dll or d3d9.dll into a directory.

Since the Reshade menu appeared, I think there is hope if someone found a way to make the menu keys work,

The best solution would be porting the ZC player to Libretro.
But I'm just dreaming ^^



#5 Gleeok

Gleeok

    It's dangerous to dough alone, bake this.

  • Members
  • Real Name:Pillsbury
  • Location:Magical Land of Dough

Posted 11 November 2016 - 03:25 AM

allegro is a software-rendered graphics library and it's also over 16 years old and built on top of directx 3-7 (at least for windows), so internally it doesn't really know anything about graphics cards or shaders beyond what the dx7 API offers. Basically, it's really old.

ZC does have a scanlines option, but for other filtering options when pixel upscaling there's not much else built-in. Most older emulators (nes, snes, etc.) do this in CPU so it's certainly possible to add, especially since ZC is now open source. Scanlines, wavy, and quake effects are all done in ZC.

For reference here's the code that does the scanlines. As you can imagine, some of those retro effects are pretty simple:
 if(scanlines)
{
if(!scanlinesbmp)
scanlinesbmp = create_bitmap_ex(8, sx, sy);
stretch_blit(source, scanlinesbmp, 0, 0, 256, 224, 0, 0, sx, sy);
for(int i=0; i<224; ++i)
_allegro_hline(scanlinesbmp, 0, (i*screen_scale)+1, sx, BLACK);
blit(scanlinesbmp, target, 0, 0, scrx+32-mx, scry+8-my, sx, sy);
}
else
{
stretch_blit(source, target, 0, 0, 256, 224, scrx+32-mx, scry+8-my, sx, sy);
}


#6 Volgia

Volgia

    Drunk dragon

  • Members
  • Location:France

Posted 11 November 2016 - 08:52 AM

Thank you for you feedback :)
 

ZC does have a scanlines option, but for other filtering options when pixel upscaling there's not much else built-in.

I found how to activate it in ag.cfg, but the result looks pretty bad IMO, the lines aren't even aligned with the pixels in higher resolutions so I guess that's why it isn't in the menu options anymore.
But basically you say that would be easier to make a software rendered filter directy into ZC ?
I guess that matching the quality of a good realtime CRT filter would be very heavy on CPU.
Another solution would be to inlay a blank picture with scanlines only in post-processing and take benefit from the Alpha layers. But the results wouldn't be much better than the actual scanlines option. I can make one for testing purposes if you want.

Besides, I was not totally joking when I quoted Libretro ^^
Basically it makes the core run at whatever resolution you want, 320x240 or 256x224 would work perfecty. I believe the original backend doesn't matter, the core can run on software mode, D3d or Ogl. After that, Retroarch apply shaders (you can apply them pre or post upscaling), and can upscale to desktop borderless resolution. I don't know how it's done though, the only thing I know is that it uses HLSL or GL shaders depending on your system. But that would be the perfect solution for those who have problems with 8-bit colors and odd fullscreen resolutions in recent Windows versions.

I saw that the PCem emulator will soon be ported to Libretro, so I tried the PCem standalone, installed Windows 98SE, launched ZC2.10 and it seems to work. There are some bugs, though, but we have a good chance to be able to launch ZC in Retroarch with shaders without adding anything to the program.

I take this opportunity to thank all the devs that still keep ZC updated. This software is very sentimental to me, I began with the Dos 1.60 on a 486 with Windows 98 SE. When I discovered ZC 2.5 a few years ago, I was amazed to see how good it became. The scripting system and fabulous tilesets made me want to go back a it more seriously.
Keep up the good work guys !


Edited by Volgia, 11 November 2016 - 08:57 AM.




Also tagged with one or more of these keywords: CRT, reshade, shader, dxgl, allegro

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users