VOGONS


some more shaders for SVN r4319 and later

Topic actions

Reply 20 of 67, by jmarsh

User metadata
Rank Oldbie
Rank
Oldbie
Diduz wrote on 2020-04-15, 10:00:

Of course Retroarch allows fiddling with overscan parameters, but getting that option in standalone Dosbox would be great.

Any DOS environment variables starting with "GLSHADER_" get inserted into the shader source during compilation. So entering the following at the DOSBox command line:
> set GLSHADER_OVERSCAN 1.0
> glshader crt

would reload the "crt" shader with "#define OVERSCAN 1.0" added to the beginning of the shader source.

Reply 21 of 67, by Diduz

User metadata
Rank Newbie
Rank
Newbie
jmarsh wrote on 2020-04-15, 12:18:
Any DOS environment variables starting with "GLSHADER_" get inserted into the shader source during compilation. So entering the […]
Show full quote
Diduz wrote on 2020-04-15, 10:00:

Of course Retroarch allows fiddling with overscan parameters, but getting that option in standalone Dosbox would be great.

Any DOS environment variables starting with "GLSHADER_" get inserted into the shader source during compilation. So entering the following at the DOSBox command line:
> set GLSHADER_OVERSCAN 1.0
> glshader crt

would reload the "crt" shader with "#define OVERSCAN 1.0" added to the beginning of the shader source.

Cool, I didn't know that! Thanks a lot. 😀

Reply 22 of 67, by Diduz

User metadata
Rank Newbie
Rank
Newbie
jmarsh wrote on 2020-04-15, 12:18:
Any DOS environment variables starting with "GLSHADER_" get inserted into the shader source during compilation. So entering the […]
Show full quote
Diduz wrote on 2020-04-15, 10:00:

Of course Retroarch allows fiddling with overscan parameters, but getting that option in standalone Dosbox would be great.

Any DOS environment variables starting with "GLSHADER_" get inserted into the shader source during compilation. So entering the following at the DOSBox command line:
> set GLSHADER_OVERSCAN 1.0
> glshader crt

would reload the "crt" shader with "#define OVERSCAN 1.0" added to the beginning of the shader source.

I've tried this with lottes shader and I get an "Environment variable GLSHADER_OVERSCAN 1.0 not defined". I think I'm missing something. I've tried and change the value from 1.0 to 0.5 and other numbers, but I get the same error message.

Reply 24 of 67, by tyrells

User metadata
Rank Newbie
Rank
Newbie

Thanks everyone for the feedback. I have lowered the version of the xBR shaders from 130 to 120 in the repository. And I have uploaded CRT-Geom too.

There seems to be some issues with how CRT-Geom renders the DOS console, but it seems to work in game. If someone with a bit more experience using it can test it for me that would be appreciated.

Last edited by tyrells on 2020-04-16, 14:45. Edited 1 time in total.

Reply 25 of 67, by Diduz

User metadata
Rank Newbie
Rank
Newbie
jmarsh wrote on 2020-04-16, 03:50:

Where is the error message coming from?

The error message is displayed in the DOS prompt itself, it's the response to the "set GLSHADER_OVERSCAN 1.0" command.
BTW, I'm using DosBox ECE 4334 (maybe something has changed in the yesterday build?).

@tyrells: I'll test CRT-Geom, great! Unfortunately I'm not a programmer, so I cannot help with the code. 🙁

Reply 27 of 67, by Diduz

User metadata
Rank Newbie
Rank
Newbie

@jmarsh: The "set" command works now, but nothing happens, the screen is unaffected. I am not able to increase or decrease the size of the screen by that value.

@tyrells: I gave CRT-Geom a try and seems to work on low resolutions only. I've also noticed that its overscan settings produce visual glitches, especially when you try and reduce the size of the screen. A huge smearing trail appears on the left of the image. I remember this kind of bug with the shaders in another discontinued DosBox fork, the OpenGL ES one. However, in this case only CRT-Geom seems to be affected by these issues. 😀

Last edited by Diduz on 2020-04-17, 14:45. Edited 1 time in total.

Reply 29 of 67, by Diduz

User metadata
Rank Newbie
Rank
Newbie
jmarsh wrote on 2020-04-17, 09:06:

You have to reload the shader with the glshader command after each change.

I did, but no dice. Unless I'm doing something wrong. To sum up, let's say I'm redifining overscan for "lottes.glsl".
I should type

> set GLSHADER_OVERSCAN = 1.0
> glshader lottes.glsl

or should I type "set LOTTES_OVERSCAN = 1.0"? Maybe that's my mistake.

Reply 30 of 67, by tyrells

User metadata
Rank Newbie
Rank
Newbie
Diduz wrote on 2020-04-17, 13:02:
I did, but no dice. Unless I'm doing something wrong. To sum up, let's say I'm redifining overscan for "lottes.glsl". I should t […]
Show full quote
jmarsh wrote on 2020-04-17, 09:06:

You have to reload the shader with the glshader command after each change.

I did, but no dice. Unless I'm doing something wrong. To sum up, let's say I'm redifining overscan for "lottes.glsl".
I should type

> set GLSHADER_OVERSCAN = 1.0
> glshader lottes.glsl

or should I type "set LOTTES_OVERSCAN = 1.0"? Maybe that's my mistake.

Hi @Diduz . For this to work correctly, the shaders themselves would have to reference the GLSHADER_* environment variables / #DEFINEs in the body of the shader. At the moment, most of the parameters are just static #DEFINEs or const values. These can be seen in lines 42-57 of crt-geom.glsl and lines 83-91 of CRT-Lottes_tweaked.glsl.

That being said, you should be able to adjust these parameters relatively easy by changing the values directly. For crt-geom for example, it looks like overscan is controlled by the overscan_x and overscan_x parameters, which are set to a default value of 100.0 on lines 51-52. If you change these directly, you should see the effect that you're looking for.

Reply 31 of 67, by jmarsh

User metadata
Rank Oldbie
Rank
Oldbie

It looks like there's some problems with the current code not detecting modifications properly so you might need to switch between "none"/current shader to apply changes (rather than just reloading the current shader by itself) until a commit is done to fix it.

Reply 32 of 67, by tyrells

User metadata
Rank Newbie
Rank
Newbie
Diduz wrote on 2020-04-17, 07:25:

@jmarsh: The "set" command works now, but nothing happens, the screen is unaffected. I am not able to increase or decrease the size of the screen by that value.

@tyrells: I gave CRT-Geom a try and seems to work on low resolutions only. I've also noticed that its overscan settings produce visual glitches, especially when you try and reduce the size of the screen. A huge smearing trail appears on the left of the image. I remember this kind of bug with the shaders in another discontinued DosBox fork, the OpenGL ES one. However, in this case only CRT-Geom seems to be affected by these issues. 😀

@Diduz can you give me some example of games and resolutions where you're seeing glitches and I will try take a look at them?

Reply 33 of 67, by Serious Callers Only

User metadata
Rank Member
Rank
Member

Another world intro and crt-geom and normal2x has a funny wobbling effect that's maybe a bad interaction between the shader and scaler. You can avoid it by setting none scaler when using a glshader.

BTW this really should be something upstream does, when a glshader is turned on, turn off the normal scaler. Combining a software scaler and a glshader seems like a recipe for unnecessary pain. In fact maybe it would be better to 'pretend' both use the same mechanism in the conf file just to prevent confusion with this and the need to turn off the one you're not actually using.

Last edited by Serious Callers Only on 2020-04-19, 11:34. Edited 3 times in total.

Reply 34 of 67, by Diduz

User metadata
Rank Newbie
Rank
Newbie
tyrells wrote on 2020-04-18, 15:06:
Diduz wrote on 2020-04-17, 07:25:

@jmarsh: The "set" command works now, but nothing happens, the screen is unaffected. I am not able to increase or decrease the size of the screen by that value.

@tyrells: I gave CRT-Geom a try and seems to work on low resolutions only. I've also noticed that its overscan settings produce visual glitches, especially when you try and reduce the size of the screen. A huge smearing trail appears on the left of the image. I remember this kind of bug with the shaders in another discontinued DosBox fork, the OpenGL ES one. However, in this case only CRT-Geom seems to be affected by these issues. 😀

@Diduz can you give me some example of games and resolutions where you're seeing glitches and I will try take a look at them?

EDIT: Hires gaming seems to be fine under CRT-Geom until resolution doesn't go beyond 640x350 (i.e. Sim City). Games that go over those values, such as SimAnt (640x480), show the same "wobbling" effect you get when setting the scaler to normal2x for lowres. Text modes as seen in the initial prompt are also garbled and wobbling, as you already know btw.
Anyway, this screenshot shows the strange behaviour of CRT-Geom when overscan is modified (78 instead of 100, in my case). Top and left pixels are sort of "dragged".
My scaler is set to "none".

Attachments

Reply 35 of 67, by jmarsh

User metadata
Rank Oldbie
Rank
Oldbie
Serious Callers Only wrote on 2020-04-19, 11:22:

Another world intro and crt-geom and normal2x has a funny wobbling effect that's maybe a bad interaction between the shader and scaler. You can avoid it by setting none scaler when using a glshader.

CRT-geom is designed for interlaced content (console video output), it looks "funny" because PC video is mostly all progressive/it's throwing away half the lines of the input.

BTW this really should be something upstream does, when a glshader is turned on, turn off the normal scaler. Combining a software scaler and a glshader seems like a recipe for unnecessary pain. In fact maybe it would be better to 'pretend' both use the same mechanism in the conf file just to prevent confusion with this and the need to turn off the one you're not actually using.

No because there are things scalers can do that shaders can't and vice-versa. Someone might want to use HQ2X/3X scaler with a CRT shader, for example.

Reply 36 of 67, by Diduz

User metadata
Rank Newbie
Rank
Newbie
jmarsh wrote on 2020-04-19, 20:23:
Serious Callers Only wrote on 2020-04-19, 11:22:

Another world intro and crt-geom and normal2x has a funny wobbling effect that's maybe a bad interaction between the shader and scaler. You can avoid it by setting none scaler when using a glshader.

CRT-geom is designed for interlaced content (console video output), it looks "funny" because PC video is mostly all progressive/it's throwing away half the lines of the input.

That's it! That was the problem. I managed to deactivate interlacing following the guidelines here:
https://emulation-general.fandom.com/wiki/CRT_Geom

Interlacing
For the original, to disable interlacing, change this line:

ilfac = vec2(1.0,floor(rubyInputSize.y/200.0));

to the following:

ilfac = vec2(1.0,1.0);

Hires screens and games work correctly again. 😀
No luck with the garbling/smearing of CRT-Geom overscan, though. It's beyond my knowledge and ability. 😁

Reply 37 of 67, by tyrells

User metadata
Rank Newbie
Rank
Newbie
Diduz wrote on 2020-04-19, 21:29:
That's it! That was the problem. I managed to deactivate interlacing following the guidelines here: https://emulation-general.fa […]
Show full quote
jmarsh wrote on 2020-04-19, 20:23:
Serious Callers Only wrote on 2020-04-19, 11:22:

Another world intro and crt-geom and normal2x has a funny wobbling effect that's maybe a bad interaction between the shader and scaler. You can avoid it by setting none scaler when using a glshader.

CRT-geom is designed for interlaced content (console video output), it looks "funny" because PC video is mostly all progressive/it's throwing away half the lines of the input.

That's it! That was the problem. I managed to deactivate interlacing following the guidelines here:
https://emulation-general.fandom.com/wiki/CRT_Geom

Interlacing
For the original, to disable interlacing, change this line:

ilfac = vec2(1.0,floor(rubyInputSize.y/200.0));

to the following:

ilfac = vec2(1.0,1.0);

Hires screens and games work correctly again. 😀
No luck with the garbling/smearing of CRT-Geom overscan, though. It's beyond my knowledge and ability. 😁

Thanks @Diduz and @jmarsh, I have applied the change to the filter to disable interlacing by default.

Reply 38 of 67, by Serious Callers Only

User metadata
Rank Member
Rank
Member
jmarsh wrote on 2020-04-19, 20:23:

BTW this really should be something upstream does, when a glshader is turned on, turn off the normal scaler. Combining a software scaler and a glshader seems like a recipe for unnecessary pain. In fact maybe it would be better to 'pretend' both use the same mechanism in the conf file just to prevent confusion with this and the need to turn off the one you're not actually using.

No because there are things scalers can do that shaders can't and vice-versa. Someone might want to use HQ2X/3X scaler with a CRT shader, for example.

The price of that kind of brittle flexibility (instead of say, making a two pass glshader for crt-hqx), is that you're going to get a bunch of 'spurious' bug reports that you can't do anything about because they're 'user errors' and the users are going to be pissed it's so easy to get it wrong.

In my particular computer (my experience only), besides the bugs, combing these two is asking for slowdown that might not happen if you only use either one apart - but that's likely because by computer is very very bad. Anyway, anecdotal datapoint: don't combine a software scaler with a glshader when your computer cpu/gpu are bad - two things that might be bearable individually might become horrible combined. In my case, even scale2x scaler combined with any shader is asking for sub 30 fps, while i can use pixel-perfect glshader with no scaler, go figure.

Reply 39 of 67, by jmarsh

User metadata
Rank Oldbie
Rank
Oldbie
Diduz wrote on 2020-04-19, 21:29:

No luck with the garbling/smearing of CRT-Geom overscan, though. It's beyond my knowledge and ability. 😁

That's due to sampling the input texture with negative X/Y co-ords, they get clamped to 0. The same effect would be happening on the right/bottom sides if there wasn't extra padding.