Any update on shaders?

General chat related to ScummVM, adventure gaming, and so on.

Moderator: ScummVM Team

AgustinCordes
Posts: 32
Joined: Wed Nov 23, 2011 2:08 am
Location: Buenos Aires, Argentina
Contact:

Re: Any update on shaders?

Post by AgustinCordes »

almeath wrote: Thu Apr 23, 2020 1:36 am
AgustinCordes wrote: Thu Apr 23, 2020 1:27 am I tweaked the Lottes shader from the crt-emulation branch with the following results:
Wonderful! Presets would be great, but could you also provide a quick set of instructions to advise how to alter the key settings, particularly curvature - I’m not a huge fan of curvature, just my personal preference. Well done though! :D
Sure thing, I'm assuming you're comfortable with compiling from source, right? This is the file you need to replace: https://www.dropbox.com/s/xu2jz02wun13n ... r.cpp?dl=0

And this is the bit you need to edit to disable the curvature effect:

Code: Select all

	"// Display warp.\n"
	"// 0.0 = none\n"
	"// 1.0/8.0 = extreme\n"
	"vec2 warp=vec2(1.0/64.0,1.0/32.0); \n"
It's slightly tweaked in the version I uploaded, so give it a try. If you want to disable it completely, though, just do:

Code: Select all

vec2 warp=vec2(0.0,0.0);
AgustinCordes
Posts: 32
Joined: Wed Nov 23, 2011 2:08 am
Location: Buenos Aires, Argentina
Contact:

Re: Any update on shaders?

Post by AgustinCordes »

almeath wrote: Thu Apr 23, 2020 4:19 am
AgustinCordes wrote: Thu Apr 23, 2020 1:27 am I like it myself. It's a tad more aggressive than my Boxer shader but still looks authentic.
I would like to try your Boxer shader, and was wondering if it can be converted into a GLSL shader file for DOSBox and/or implemented in the ScummVM CRT branch?
Sure, this is easier. It's been merged in this branch, which is more or less becoming the "official" one: https://github.com/MaddTheSane/Boxer

It's actually GLSL-based and uses the same format as DOSBox SVN. It needs a bit more work to be integrated in ScummVM, though.
User avatar
almeath
Posts: 178
Joined: Fri Mar 14, 2008 1:40 pm
Location: Australia

Re: Any update on shaders?

Post by almeath »

AgustinCordes wrote: Thu Apr 23, 2020 8:24 pmSure thing, I'm assuming you're comfortable with compiling from source, right? This is the file you need to replace: https://www.dropbox.com/s/xu2jz02wun13n ... r.cpp?dl=0
I am unable to compile when just swapping out the shader.cpp file. I noticed the file is located in two places:

/backends/graphics/opengl/shader.cpp
/backends/graphics/opengl/pipelines/shader.cpp

Regardless of which of these I replace (either or both), the build fails with the warnings about use of undeclared identifier 'kCRTEmulationFilter'

backends/graphics/opengl/opengl-graphics.cpp:157:29: warning: declaration requires a global constructor [-Wglobal-constructors]
const OSystem::GraphicsMode glGraphicsModes[] = {
^ ~
backends/graphics/opengl/opengl-graphics.cpp:236:29: warning: declaration requires a global constructor [-Wglobal-constructors]
const OSystem::GraphicsMode glStretchModes[] = {
^ ~
C++ backends/graphics/opengl/pipelines/fixed.o
C++ backends/graphics/opengl/pipelines/pipeline.o
2 warnings generated.
C++ backends/graphics/opengl/pipelines/shader.o
C++ backends/events/sdl/legacy-sdl-events.o
C++ backends/events/sdl/sdl-events.o
C++ backends/graphics/sdl/sdl-graphics.o
backends/graphics/opengl/pipelines/shader.cpp:580:12: error: use of undeclared identifier 'kCRTEmulationFilter'
_builtIn[kCRTEmulationFilter] = new Shader(g_defaultVertexShader, g_crtEmulationFragmentShader);
^
1 error generated.

Or...

backends/graphics/opengl/opengl-graphics.cpp:157:29: warning: declaration requires a global constructor [-Wglobal-constructors]
const OSystem::GraphicsMode glGraphicsModes[] = {
^ ~
backends/graphics/opengl/opengl-graphics.cpp:236:29: warning: declaration requires a global constructor [-Wglobal-constructors]
const OSystem::GraphicsMode glStretchModes[] = {
^ ~
backends/graphics/opengl/shader.cpp:580:12: error: use of undeclared identifier 'kCRTEmulationFilter'
_builtIn[kCRTEmulationFilter] = new Shader(g_defaultVertexShader, g_crtEmulationFragmentShader);
^
1 error generated.
make: *** [backends/graphics/opengl/shader.o] Error 1
make: *** Waiting for unfinished jobs....
2 warnings generated.



I tried compiling from both the braindx branch as well as latest pull from master. Same errors are occurring with each. :|
User avatar
almeath
Posts: 178
Joined: Fri Mar 14, 2008 1:40 pm
Location: Australia

Re: Any update on shaders?

Post by almeath »

AgustinCordes wrote: Thu Apr 23, 2020 8:24 pm
Sure thing, I'm assuming you're comfortable with compiling from source, right? This is the file you need to replace: https://www.dropbox.com/s/xu2jz02wun13n ... r.cpp?dl=0
Would you be willing to zip up your main ScummVM build directory with the Lottes shader already patched, and then provide that either by DropBox or via PM? I could then try compiling straight from that and also make comparisons with my own build directory, to try to establish why it will not work for me.
AgustinCordes
Posts: 32
Joined: Wed Nov 23, 2011 2:08 am
Location: Buenos Aires, Argentina
Contact:

Re: Any update on shaders?

Post by AgustinCordes »

almeath wrote: Fri Apr 24, 2020 3:06 am
AgustinCordes wrote: Thu Apr 23, 2020 8:24 pm
Sure thing, I'm assuming you're comfortable with compiling from source, right? This is the file you need to replace: https://www.dropbox.com/s/xu2jz02wun13n ... r.cpp?dl=0
Would you be willing to zip up your main ScummVM build directory with the Lottes shader already patched, and then provide that either by DropBox or via PM? I could then try compiling straight from that and also make comparisons with my own build directory, to try to establish why it will not work for me.
Sure, here you go, and sorry about the delay. Let me know how this works, it's the very same and complete folder I'm using to compile the project: https://www.dropbox.com/s/0inx6azkhl5k9 ... d.zip?dl=0

Just in case, the file to replace is /backends/graphics/opengl/shader.cpp.
User avatar
almeath
Posts: 178
Joined: Fri Mar 14, 2008 1:40 pm
Location: Australia

Re: Any update on shaders?

Post by almeath »

AgustinCordes wrote: Mon Apr 27, 2020 1:42 am Sure, here you go, and sorry about the delay. Let me know how this works, it's the very same and complete folder I'm using to compile the project: https://www.dropbox.com/s/0inx6azkhl5k9 ... d.zip?dl=0

Just in case, the file to replace is /backends/graphics/opengl/shader.cpp.
Thanks - that works for me now. I do not know what I was doing wrong there.

I changed the settings to match the more subtle curvature found in the tyrells DOSBox version:

vec2 warp=vec2(1.0/128.0,1.0/64.0)

This is the result:

https://www.dropbox.com/s/8fks8i3699y21ed/KQ6.png?dl=0

https://www.dropbox.com/s/uvmqzcpgkd7v08b/KQ7.png?dl=0

It does not look entirely like the version in DOSBox for some reason, but fairly close. I clearly see the shadow mask effect but the bloom and scanlines are less prevalent. I will do some more tweaking..

I also want to get this one working:

https://www.dropbox.com/s/adjsydefgv1kt ... hader?dl=0
AgustinCordes
Posts: 32
Joined: Wed Nov 23, 2011 2:08 am
Location: Buenos Aires, Argentina
Contact:

Re: Any update on shaders?

Post by AgustinCordes »

almeath wrote: Mon Apr 27, 2020 7:37 amIt does not look entirely like the version in DOSBox for some reason, but fairly close. I clearly see the shadow mask effect but the bloom and scanlines are less prevalent. I will do some more tweaking.
Mind you, you happened to test two hires games (KQ6 CD & KQ7). The shader looks rather different with more pixels. Most of these shaders have that problem and it's something I'd to fix: ensuring it looks the same regardless of the game resolution.

Anyway, make sure you're comparing the exact games to get the results you want.
User avatar
almeath
Posts: 178
Joined: Fri Mar 14, 2008 1:40 pm
Location: Australia

Re: Any update on shaders?

Post by almeath »

AgustinCordes wrote: Mon Apr 27, 2020 1:49 pm Anyway, make sure you're comparing the exact games to get the results you want.
In lower resolution games it does looks better, but not quite as sharp as with the DOSBox tweaked version.

Just a question .. was your edited shader file based on the original lottes crt or the tweaked version from the tyrells github repository?

It is true though, we ideally need several pre-sets, for different resolutions. In higher res it looks more like a honeycomb effect..
AgustinCordes
Posts: 32
Joined: Wed Nov 23, 2011 2:08 am
Location: Buenos Aires, Argentina
Contact:

Re: Any update on shaders?

Post by AgustinCordes »

almeath wrote: Mon Apr 27, 2020 3:17 pmIn lower resolution games it does looks better, but not quite as sharp as with the DOSBox tweaked version.

Just a question .. was your edited shader file based on the original lottes crt or the tweaked version from the tyrells github repository?

It is true though, we ideally need several pre-sets, for different resolutions. In higher res it looks more like a honeycomb effect..
No, I simply tweaked the Lottes shader that was bundled in the braindx branch. It will take a bit more work to integrate other shaders and/or presets. I'll try to get in touch with braindx and see if we can work together on his/her branch.
AgustinCordes
Posts: 32
Joined: Wed Nov 23, 2011 2:08 am
Location: Buenos Aires, Argentina
Contact:

Re: Any update on shaders?

Post by AgustinCordes »

Also, just briefly comparing both shaders (braindx and tyrells takes on Lottes), it would seem they're quite different approaches. For sure they aren't the same code, even though they're both GLSL-based.
User avatar
almeath
Posts: 178
Joined: Fri Mar 14, 2008 1:40 pm
Location: Australia

Re: Any update on shaders?

Post by almeath »

AgustinCordes wrote: Mon Apr 27, 2020 5:03 pm Also, just briefly comparing both shaders (braindx and tyrells takes on Lottes), it would seem they're quite different approaches. For sure they aren't the same code, even though they're both GLSL-based.
Yes, I attempted to translate one to the other and it was just too confusing. I like what tyrells did with lottes - it scales perfectly between low and hi-res games in DOSBox, and he/she perfected the bloom and scan lines to be very close to the real thing. So I was hoping to achieve a similar effect in ScummVM.

On the Amiga side, there are some great GLSL shaders here, which may or may not be more translatable into something for ScummVM:

https://github.com/guestrr/FS-UAE-Shaders

I like the "CRT-guest-sm" shader in particular, but there is no editable curvature setting for it.

Anyway, these are just some ideas on what to pursue .. I am just happy there is interest in getting some of these into a usable ScummVM branch, and I will support the effort in any way I can.
AgustinCordes
Posts: 32
Joined: Wed Nov 23, 2011 2:08 am
Location: Buenos Aires, Argentina
Contact:

Re: Any update on shaders?

Post by AgustinCordes »

Oh, I didn't know there were shaders for FS-UAE! Are they usable in the main branch?

I'll check out DOSBox SVN as well to see if I can merge tyrells take on ScummVM.
User avatar
almeath
Posts: 178
Joined: Fri Mar 14, 2008 1:40 pm
Location: Australia

Re: Any update on shaders?

Post by almeath »

AgustinCordes wrote: Mon Apr 27, 2020 6:30 pm Oh, I didn't know there were shaders for FS-UAE! Are they usable in the main branch?

I'll check out DOSBox SVN as well to see if I can merge tyrells take on ScummVM.
Yes, they are usable in the main branch. They are activated from your FS-UAE config with the commands:

shader=[name of built in shader] or [path to compatible shader file with .shader extension]

The built-in shaders are listed here: https://fs-uae.net/docs/options/shader

To get the multi-pass shaders to work on macOS you need to use the latest stable build: https://fs-uae.net/stable/3.0.5/

Thanks - it would be great if Tyrell's shaders can be ported .. I know they are actively working on them on the DOSBox side and I have been monitoring their progress on VOGONS.
AgustinCordes
Posts: 32
Joined: Wed Nov 23, 2011 2:08 am
Location: Buenos Aires, Argentina
Contact:

Re: Any update on shaders?

Post by AgustinCordes »

almeath wrote: Mon Apr 27, 2020 6:42 pmThanks - it would be great if Tyrell's shaders can be ported .. I know they are actively working on them on the DOSBox side and I have been monitoring their progress on VOGONS.
Thanks for those tips, those FS-UAE shaders are mostly good!

I've also tried the tyrells shaders on DOSBox SVN and I've got some interesting results:

DOSBox SVN - crt-lottes-tweaked: https://www.dropbox.com/s/cw6b0sjein6e4 ... N.png?dl=0
ScummVM - braindx branch with my tweaks - https://www.dropbox.com/s/k6ep58f03fpsy ... M.png?dl=0
Unofficial Boxer branch - https://www.dropbox.com/s/zurlcarsphdon ... r.png?dl=0

As you can see tyrells & braindx looks very similar, and I'm pretty sure we could make ScummVM look exactly like that with the current implementation. But I must say, I very much prefer the current ScummVM look - tyrells is too soft and the grid mask too visible for my taste. I prefer the more subtle scanlines and sharper pixels.

Also, tyrells doesn't scale properly - I tried KQ6 CD and the grid mask became too prominent. So this seems to be a problem inherent to all these shaders. Makes sense as they were designed for fixed resolutions in consoles.

I'll still look into implementing loading of different shaders in ScummVM when I find the time!
User avatar
almeath
Posts: 178
Joined: Fri Mar 14, 2008 1:40 pm
Location: Australia

Re: Any update on shaders?

Post by almeath »

AgustinCordes wrote: Tue Apr 28, 2020 3:20 am
As you can see tyrells & braindx looks very similar, and I'm pretty sure we could make ScummVM look exactly like that with the current implementation. But I must say, I very much prefer the current ScummVM look - tyrells is too soft and the grid mask too visible for my taste. I prefer the more subtle scanlines and sharper pixels.

Also, tyrells doesn't scale properly - I tried KQ6 CD and the grid mask became too prominent. So this seems to be a problem inherent to all these shaders. Makes sense as they were designed for fixed resolutions in consoles.
It may also come down to the native resolution with which the shaders are used. On my 5k screen (5120x2880) I get a superior effect from the DOSBox lottes shader, but it may not look as good in lower resolutions.

As for the braindx build, the following are (1) your adjusted lottes shader and (2) the original CRT shader in the build:

https://www.dropbox.com/s/yqvkdoo4dz0xm ... x.jpg?dl=0

https://www.dropbox.com/s/8y36r7f2co46m ... x.jpg?dl=0

As you can see, neither look particularly good for a hi res game like Curse of Monkey Island. I get a patchwork shadow mask effect and not much else. Again, this is how it looks in 5k and it might be more tolerable on a lower resolution display.

If I come across some shaders that are good for hi res, I will let you know and perhaps we can try patching them into the braindx branch.
Post Reply