Open Banjo-Oz opened 2 years ago
Yes, that's the feature I was talking about, with the EGA palettes just below it.
The serial mouse stuff (see further down) would be awesome to have too, IMO.
dosbox-x does have serial mouse support, but not as advanced as the new support in -staging.
I like the EGA idea. That's why I created this thread. https://github.com/joncampbell123/dosbox-x/issues/3668
There you go: https://github.com/joncampbell123/dosbox-x/commit/de7611c12b1192d4c2d3e535e98cf31e728543da
It's D3D shaders FYI 😎
none
cga_colors_agi_amiga_v1
cga_colors_agi_amiga_v2
cga_colors_agi_amiga_v3
cga_colors_agi_amigaish
cga_colors_colodore_sat50
cga_colors_colodore_sat60
cga_colors_default
cga_colors_dga16
cga_colors_ibm5153
cga_colors_scumm_amiga
cga_colors_tandy_warm
And the little program:
SCREEN 13
w = 10
h = 10
c = 320 / w
r = 256 / c
FOR y = 0 TO r
FOR x = 0 TO c
x1 = x * w
y1 = y * h
x2 = x1 + w - 1
y2 = y1 + h - 1
LINE (x1, y1)-(x2, y2), y * w + x, BF
NEXT x
NEXT y
LOCATE 16
PRINT "Press any key to exit..."
DO
LOOP WHILE INKEY$ = ""
So yeah, it's 256 colors being shown but I don't really know what game to pick for screens 🤣.
Maybe you could do some beautiful snaps of your favorite game and show us the result?😀
I have a wish that may seem strange, I hope I'm not bothering, but I wish such shaders like that, only that it only works on EGA software and below. I like to play pre-VGA games with custom 16 color palettes, but not in VGA software and above, but that doesn't mean I can't want to play VGA games and above, in custom 16 color palettes some times. I know it's possible to switch from shader to shader, without having to quit DOSBox-X each time, but it would be less tiresome not having to do it.
I've chosen to use shaders for a very simple reason: limited time and resources.
Implementing the feature exactly as it used to be is way more time consuming, you have to grab a patch from the original source, apply it and it will most certainly need some adjustments as the code bases have drifted to the point that you simply cannot cherry pick and apply commits blindly.
Not only you have to get the code working, you also have to add settings, document them and finally test the whole thing; that takes way more time than just writing shaders.
You have to see the positive things in that, shaders work for anything and can be customized by the end user without the need to recompile the software. And as you've pointed out, one does not have to quit the software which itself is a very good thing. Obviously, you can write settings that don't require to restart the software but it's even longer to implement.
As for your exact problem, there is a very simple solution: use a dosbox frontend with different configurations.
Ultimately, you'd be bothered the same as if this was an internal feature, having to switch every single time, just use a frontend with multiple configurations to solve your problem.
EGADN2.ZIP To play the Duke Nukem 2 levels with all 16 EGA colors, just like in Duke Nukem 1. Remember to set your machine to ega before running Duke Nukem 2. If you run Duke Nukem 2 with ega as machine value, without this shader, it becomes a color mess.
Staging's new Reverb and Chorus features really improve some games. I keep pausing the game on Lemmings 2 just to enjoy those tunes with the Reverb and Chorus. Really works well.
Also can make the PC speaker sound more like a real speaker with the "tiny" setting. "zorkquest1"
I would vote YES to some of these features too.
DN2FILTERS.ZIP Now I've created two fx files, or shaders, that allow you to use the 16 color palette from the Duke Nukem II levels. One for EGA and earlier, and one for VGA and later. The problem is that the new CGA colors palettes do not allow you to set custom saturations, as you can with EGAfilter3 and EGAfilter5, which I am linking to now. https://www.vogons.org/download/file.php?id=11989 https://www.vogons.org/download/file.php?id=14961 To download these, you have to click on the link with the right mouse button, and then press save link as, but I assume you already know that. No, it is impossible to set to custom colors that give you the DN2L palette in egafilter, EGAfilter3 and EGAfilter5.
I've added a feature request
label, to give your feature request more visibility, you should each create your own issue and label it with it.
@aybe Where do I find the feature request label? I can't find it.
Sorry, I've scrambled a few things...
I've updated the issue template so that when you create a new issue for a new feature, it will have such label.
The enhancement label wasn't really meaningful so I renamed it.
TL;DR; you have nothing to do, it's automatic, check the label of this issue, it is now feature request
.
That said, each of you should open their own feature request so as
Because right now, if you look at the title of this issue from the issues tab, it doesn't really tell that much about the content and when you dig into it, you can see that people have already been talking about X, Y, Z and that's even more confusing.
As you guys know, since the CGA colors FX and HLSL files found their way into DOSBox-X, I've been playing around with this thing, creating a Duke Nukem II level palette, one for VGA and later, and one for EGA and earlier . The downside to the CGA colors shaders is, like EGAfilter.fx (but unlike the unoffical EGAfilter3 and EGAfilter5), you can't set the saturation, and unlike EGAfilter.fx, you can't set the brightness either, in addition to the CGA colors shaders preset brightness seems to be a tad darker than the default brightness - which in EGAfilter.fx's case is 1.0, and I see that when I compare the level areas in Duke Nukem II with my custom Duke Nukem II level palette to the aforementioned game without this palette. In the picture on the left, as you can see, two shades of green and two shades of blue are missing, and they are, according to the picture on the right, brighter than the only shade of green and the only shade of blue, which you see in the picture on the left.
I've also tested out the Duke Nukem II level palette for VGA games on other VGA games and later, like the VESA game Duke Nukem 3D. In the picture on the left, you see how the latter game looks in the current palette, and there is a lot of gray. No wonder since many VGA and VESA colors have very low saturation. In the picture on the right, you see the same picture, only that it is colorful. That's because I photoshopped the screenshot, which I've print screened earlier, with 100% high saturation one each color, before opening the image (or all 16 images with a bit of the image) with Pictview in DOSBox-X, activated the custom palette, print screen the picture (or pictures), and pasted it (them) into Paint.
I know about the sat50 and sat60 palette (which I believe are newer), which I expect to be higher saturation palettes, but I don't think that helps, I see no difference. I also know that you can set the brightness of the palettes (in a way), but not in the same way as on EGAfilter.fx, and then you don't get the desired palette.
Here's an example on how to implement saturation in a shader:
https://docs.unity3d.com/Packages/com.unity.shadergraph@6.9/manual/Saturation-Node.html
It's pretty easy to do, check out the other adjustments next to this documentation such as contrast and so on.
Once you've got something satisfying, contribute a PR to the repository; when do you so, also update the CHANGELOG and credit yourself in there.
The shaders are here in the repository.
Something that may be of use in the future, is the automatic reloading of current shader.
I'm not sure how difficult it would be to implement for the project but I guess it wouldn't be as easy as it is in C#, i.e. unlikely to happen by tomorrow.
For the time being (and providing you're on Windows), what you could do to ease the testing process for you is to create a taskbar shortcut to start your specific DOSBox configuration to easily launch and test:
@aybe This is still new to me, in addition to the fact that English is not my native language, so there are quite a few things I need to know: on the Generated Code Example, under Saturation Node, should I paste it on the preferred HLSL file, or on the cga_colors.fx file? If yes; if I should set the saturation, where the default seems to be xxx, do you have any example saturation values, if I should set the saturation to full? I'm also new to this with Superuser. I think I will need some detailed tutorials here, in my case.
I made the first one for you:
cga_colors_default_palette.hlsl
static const float4 palette[16] = {
float4(0x00 * 255 / 63, 0x00 * 255 / 63, 0x00 * 255 / 63, 0xff) / 0xff,
float4(0x00 * 255 / 63, 0x00 * 255 / 63, 0x2a * 255 / 63, 0xff) / 0xff,
float4(0x00 * 255 / 63, 0x2a * 255 / 63, 0x00 * 255 / 63, 0xff) / 0xff,
float4(0x00 * 255 / 63, 0x2a * 255 / 63, 0x2a * 255 / 63, 0xff) / 0xff,
float4(0x2a * 255 / 63, 0x00 * 255 / 63, 0x00 * 255 / 63, 0xff) / 0xff,
float4(0x2a * 255 / 63, 0x00 * 255 / 63, 0x2a * 255 / 63, 0xff) / 0xff,
float4(0x2a * 255 / 63, 0x15 * 255 / 63, 0x00 * 255 / 63, 0xff) / 0xff,
float4(0x2a * 255 / 63, 0x2a * 255 / 63, 0x2a * 255 / 63, 0xff) / 0xff,
float4(0x15 * 255 / 63, 0x15 * 255 / 63, 0x15 * 255 / 63, 0xff) / 0xff,
float4(0x15 * 255 / 63, 0x15 * 255 / 63, 0x3f * 255 / 63, 0xff) / 0xff,
float4(0x15 * 255 / 63, 0x3f * 255 / 63, 0x15 * 255 / 63, 0xff) / 0xff,
float4(0x15 * 255 / 63, 0x3f * 255 / 63, 0x3f * 255 / 63, 0xff) / 0xff,
float4(0x3f * 255 / 63, 0x15 * 255 / 63, 0x15 * 255 / 63, 0xff) / 0xff,
float4(0x3f * 255 / 63, 0x15 * 255 / 63, 0x3f * 255 / 63, 0xff) / 0xff,
float4(0x3f * 255 / 63, 0x3f * 255 / 63, 0x15 * 255 / 63, 0xff) / 0xff,
float4(0x3f * 255 / 63, 0x3f * 255 / 63, 0x3f * 255 / 63, 0xff) / 0xff,
};
static const float saturation = 0.1f;
cga_colors.hlsl
// this a re-implementation of CGA palettes from DOSBox Staging by https://github.com/aybe
// the idea of custom CGA palettes is originally an idea from https://github.com/johnnovak
#include "shader.code"
string name : NAME = "Filter";
string combineTechique : COMBINETECHNIQUE = "Filter";
static const float4 colors[16] = {
float4(0x00, 0x00, 0x00, 0xFF) / 0xFF,
float4(0x00, 0x00, 0xAA, 0xFF) / 0xFF,
float4(0x00, 0xAA, 0x00, 0xFF) / 0xFF,
float4(0x00, 0xAA, 0xAA, 0xFF) / 0xFF,
float4(0xAA, 0x00, 0x00, 0xFF) / 0xFF,
float4(0xAA, 0x00, 0xAA, 0xFF) / 0xFF,
float4(0xAA, 0x55, 0x00, 0xFF) / 0xFF,
float4(0xAA, 0xAA, 0xAA, 0xFF) / 0xFF,
float4(0x55, 0x55, 0x55, 0xFF) / 0xFF,
float4(0x55, 0x55, 0xFF, 0xFF) / 0xFF,
float4(0x55, 0xFF, 0x55, 0xFF) / 0xFF,
float4(0x55, 0xFF, 0xFF, 0xFF) / 0xFF,
float4(0xFF, 0x55, 0x55, 0xFF) / 0xFF,
float4(0xFF, 0x55, 0xFF, 0xFF) / 0xFF,
float4(0xFF, 0xFF, 0x55, 0xFF) / 0xFF,
float4(0xFF, 0xFF, 0xFF, 0xFF) / 0xFF,
};
VERTEX_STUFF_W S_VERTEX(float3 p : POSITION, float2 tc : TEXCOORD0) {
VERTEX_STUFF_W OUT = (VERTEX_STUFF_W)0;
OUT.coord = mul(float4(p, 1), WorldViewProjection);
OUT.CT = tc;
return OUT;
}
float4 S_FRAGMENT(in VERTEX_STUFF_W VAR) : COLOR {
float4 src = tex2D(s_p, VAR.CT);
float4 tgt = float4(1, 1, 1, 1);
float current;
float minimum = 1.0;
int index = 0;
for (int i = 0; i < 16; i++) {
current = distance(src.xyz, colors[i].xyz);
if (current < minimum) {
minimum = current;
index = i;
}
}
float4 col = palette[index];
// apply saturation
float luma = dot(col.xyz, float3(0.2126729, 0.7151522, 0.0721750));
float3 sat = luma.xxx + saturation.xxx * (col.xyz - luma.xxx);
col = float4(sat, col.w);
return col;
}
technique Filter {
pass P0 {
VertexShader = compile vs_3_0 S_VERTEX();
PixelShader = compile ps_3_0 S_FRAGMENT();
}
}
Keep in mind that now, every shader has to have the saturation variable next to custom palette else the main shader will fail.
It might be possible with a third level of indirection to specify these in a single file to avoid updating all the files, but that has to be looked at.
I use Visual Studio Code with extension to make it easier:
Highlighting:
https://marketplace.visualstudio.com/items?itemName=slevesque.shader
Formatting:
https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools
If you get this error with the formatter:
Update this setting to the good path:
The superuser answer is pretty explanative: https://superuser.com/a/193255/140490
If you need to, use a translator: https://www.deepl.com/translator
And for the settings, it's up to you, the ranges are shown here:
Here's how you can optionally add parameters in a non intrusive way:
static const float4 palette[16] = {
float4(0x00 * 255 / 63, 0x00 * 255 / 63, 0x00 * 255 / 63, 0xff) / 0xff,
float4(0x00 * 255 / 63, 0x00 * 255 / 63, 0x2a * 255 / 63, 0xff) / 0xff,
float4(0x00 * 255 / 63, 0x2a * 255 / 63, 0x00 * 255 / 63, 0xff) / 0xff,
float4(0x00 * 255 / 63, 0x2a * 255 / 63, 0x2a * 255 / 63, 0xff) / 0xff,
float4(0x2a * 255 / 63, 0x00 * 255 / 63, 0x00 * 255 / 63, 0xff) / 0xff,
float4(0x2a * 255 / 63, 0x00 * 255 / 63, 0x2a * 255 / 63, 0xff) / 0xff,
float4(0x2a * 255 / 63, 0x15 * 255 / 63, 0x00 * 255 / 63, 0xff) / 0xff,
float4(0x2a * 255 / 63, 0x2a * 255 / 63, 0x2a * 255 / 63, 0xff) / 0xff,
float4(0x15 * 255 / 63, 0x15 * 255 / 63, 0x15 * 255 / 63, 0xff) / 0xff,
float4(0x15 * 255 / 63, 0x15 * 255 / 63, 0x3f * 255 / 63, 0xff) / 0xff,
float4(0x15 * 255 / 63, 0x3f * 255 / 63, 0x15 * 255 / 63, 0xff) / 0xff,
float4(0x15 * 255 / 63, 0x3f * 255 / 63, 0x3f * 255 / 63, 0xff) / 0xff,
float4(0x3f * 255 / 63, 0x15 * 255 / 63, 0x15 * 255 / 63, 0xff) / 0xff,
float4(0x3f * 255 / 63, 0x15 * 255 / 63, 0x3f * 255 / 63, 0xff) / 0xff,
float4(0x3f * 255 / 63, 0x3f * 255 / 63, 0x15 * 255 / 63, 0xff) / 0xff,
float4(0x3f * 255 / 63, 0x3f * 255 / 63, 0x3f * 255 / 63, 0xff) / 0xff,
};
#define BRIGHTNESS 1.333
#define CONTRAST 1.333
#define SATURATION 1.333
// this a re-implementation of CGA palettes from DOSBox Staging by https://github.com/aybe
// the idea of custom CGA palettes is originally an idea from https://github.com/johnnovak
#include "shader.code"
string name : NAME = "Filter";
string combineTechique : COMBINETECHNIQUE = "Filter";
static const float4 colors[16] = {
float4(0x00, 0x00, 0x00, 0xFF) / 0xFF,
float4(0x00, 0x00, 0xAA, 0xFF) / 0xFF,
float4(0x00, 0xAA, 0x00, 0xFF) / 0xFF,
float4(0x00, 0xAA, 0xAA, 0xFF) / 0xFF,
float4(0xAA, 0x00, 0x00, 0xFF) / 0xFF,
float4(0xAA, 0x00, 0xAA, 0xFF) / 0xFF,
float4(0xAA, 0x55, 0x00, 0xFF) / 0xFF,
float4(0xAA, 0xAA, 0xAA, 0xFF) / 0xFF,
float4(0x55, 0x55, 0x55, 0xFF) / 0xFF,
float4(0x55, 0x55, 0xFF, 0xFF) / 0xFF,
float4(0x55, 0xFF, 0x55, 0xFF) / 0xFF,
float4(0x55, 0xFF, 0xFF, 0xFF) / 0xFF,
float4(0xFF, 0x55, 0x55, 0xFF) / 0xFF,
float4(0xFF, 0x55, 0xFF, 0xFF) / 0xFF,
float4(0xFF, 0xFF, 0x55, 0xFF) / 0xFF,
float4(0xFF, 0xFF, 0xFF, 0xFF) / 0xFF,
};
VERTEX_STUFF_W S_VERTEX(float3 p : POSITION, float2 tc : TEXCOORD0) {
VERTEX_STUFF_W OUT = (VERTEX_STUFF_W)0;
OUT.coord = mul(float4(p, 1), WorldViewProjection);
OUT.CT = tc;
return OUT;
}
float3 ApplyBrightness(float3 input, float brightness) {
float3 result = input * brightness;
return result;
}
float3 ApplyContrast(float3 input, float contrast) {
float midpoint = pow(0.5, 2.2);
float3 result = (input - midpoint) * contrast + midpoint;
return result;
}
float3 ApplySaturation(float3 input, float saturation) {
float luma = dot(input.xyz, float3(0.2126729, 0.7151522, 0.0721750));
float3 result = luma.xxx + saturation.xxx * (input.xyz - luma.xxx);
return result;
}
float4 S_FRAGMENT(in VERTEX_STUFF_W VAR) : COLOR {
float4 src = tex2D(s_p, VAR.CT);
float4 tgt = float4(1, 1, 1, 1);
float current;
float minimum = 1.0;
int index = 0;
for (int i = 0; i < 16; i++) {
current = distance(src.xyz, colors[i].xyz);
if (current < minimum) {
minimum = current;
index = i;
}
}
float4 col = palette[index];
float brightness = 1.0;
#ifdef BRIGHTNESS
brightness = BRIGHTNESS;
#endif
float contrast = 1.0;
#ifdef CONTRAST
contrast = CONTRAST;
#endif
float saturation = 1.0;
#ifdef SATURATION
saturation = SATURATION;
#endif
float3 tmp = col.xyz;
tmp = ApplyBrightness(tmp, brightness);
tmp = ApplyContrast(tmp, contrast);
tmp = ApplySaturation(tmp, saturation);
return float4(tmp, col.w);
}
technique Filter {
pass P0 {
VertexShader = compile vs_3_0 S_VERTEX();
PixelShader = compile ps_3_0 S_FRAGMENT();
}
}
It looks like it will take time for me to learn all this. Where I come from, we don't know much about hardware, and I'm one of the few people there who know about DOSBox. I've learned the simplest things, like RGB and HEX color codes, but words like Compile, Vertex, Fragment, and many more are very Greek to me, because they're words I've learned quite recently, and it's not common everyday words in my home country. On to something else: I tested both the one with just the saturation adjustment, and the one with both the brightness, contrast and saturation adjustments. I set the saturation to 2.0 and also higher, but the result was not like with EGAfilter3 and EGAfilter5.
In the picture on the left, you see how it looks with the EGA palette, and double high saturation, with a CGA colors shader. Instead of a colorful result, I see that the existing EGA colors, apart from the gray tones, have been replaced by other colors, which creates the illusion that the EGA colors, apart from the gray tones, look stronger than before. The brown colour, for example, which is at 170_85_0, has become red, which is at 255_0_0, but otherwise there is as much gray and as little color as without saturation at 2.0. In the image to right, you see the same image with the EGAfilter3 shader, only that the brightness is set to 1.0, while the saturation is set to 2.0 (usually brightness is set to 1.2 and saturation to 1.6), there the image with EGA colors looks much better than the left image, plus the right image has the exact EGA colors. Is it possible to include the type of saturation, brightness and contrast adjustment as in EGAfilter3 and EGAfilter5, instead of the current one? You can test out these custom EGA filter shaders, if you like. I didn't make them, I found them on Vogons.
I don't know, maybe that the shader does not have a brown color...
Either use Shadertoy to easily develop/understand a shader then port it back, or use RenderDoc to debug DOSBox directly.
You may also want to reduce your post to only relevant stuff and make good use of formatting for the people reading you.
I have done my best to learn to understand such things, but I am not so lucky to be able to understand such things. Maybe I'll figure it out if I meet a computer expert one day who can teach me and show me how to do that while we're both in the same room, or if someone here posts their own tutorial videos. As we say in Norway: some people need to have everything in a teaspoon, which means that certain people (like me for example) will appreciate knowing and learning things in excessive detail.
CGA colors shaders have brown hues/colors, in fact all the colors in the world (16,777,216 in total; unlike EGAfilter.fx). Today I learned that the type of saturation I'm referring to is called vibrance, which only increases/decreases saturation, and not brightness and hue, like saturation does (I had to play around with Photoshop to find the answer). Unlike this cga_colors_default_palette.hlsl that you pasted a few days ago, when adjusting the vibrance (saturation) with EGAfilter3 or -5, it adjusted like it was asjusted before the original number of colors (64-16,777,216) is reduced down to 16 colors (or lesser) from the shader with the palette.
I think we can have both saturation and vibration, in addition to brightness and (if necessary) contrast.
Staging's ability to modify the color palette is very useful. I always like the look of a monitor with the contrast on max. Makes the dark colors really glow. With Staging I can tweak the colors to simulate a boosted contrast. and it looks great.
Listing here changes from DOSbox Staging 0.79 and 0.80 that I assume are not yet implemented in DOSbox-X:
4.1. Shader Reload Shortcut Tyrells' CRT shader collection, as well as GranMinigun's interpolating Catmull–Rom spline shader [0.80] 4.2. CGA Palette Override - (partially) implemented above? 4.3. Scaled Image Quality Improvements 4.4. High DPI on macOS (and Windows in 0.80) 4.5. Window Transparency Support 4.6. Frame Presentation Modes 5.3. Post-rendered screenshots [0.80] (in addition to pre-render screenshots)
7.3. Local Language and Keyboard Layout Detection Improvements - related to #3634
9.3. Configurable Modem Connect Speeds 9.4. Handling Options for Memory Faults in Buggy Games Add missing Windows 11 features to MORE command [0.81] dosbox-staging/dosbox-staging/pull/2142 (are there any other relevant/upgraded CMD.EXE or external command prompt commands in Windows 11, ReactOS, FreeDOS, OS/2, WinCE?)
Is your feature request related to a problem? Please describe.
No response
What you want
DOSBox Staging recently got some pretty cool new features. I still prefer DOSBox-X but can't deny some of these features would be great to have on this fork. Most desirable for me would be the "Parallel Port DAC Models" that let you specify the type of DAC module to emulate (Disney, Covox, etc.) and the EGA palettes (that lets you use Amiga or C64 palettes in DOS games).
Is there any chance of seeing those additions in particular added to DOSBox-X? If not, no problem at all but I just love this fork so much that I'd love to see it include these things if possible.
Describe alternatives you've considered
No response
Additional information
No response
Have you checked that no similar feature request(s) exist?
Code of Conduct & Contributing Guidelines