Real GBA and DS-Phat colors

One thing I should point out is that, if you simulate a nonzero black level, then some negative colours are possible to implement, since they simply reduce the black level. This makes it possible to simulate out-of-gamut colours; see here for an extreme example, where this is used to show the spectrum (washed out with a grey background).

I uploaded my newest update to these shaders. I been working on these shaders for few weeks, and I have stories about it.

I have used white light flash to the GBA screen and results are pretty accurate in the shaders. When I flashed a white light to the GBA AGB-001, the gamma lever is high with the brightest light the screen can handle. It goes about lighter than 2.2 standard gamma on the shadow parts of each game I tested. Reds do come up more as well as green, and I even fix the blue color to the shaders. The GBA hardware also has color brightness changed when I play it in a low light environment. Changing the gamma in the shaders helps the display to emulate of what it’s trying to look on different light source. I always decide to use white light as a source I stead of lights that are warm because they boost up the red colors more and makes blue color slightly darker.

Although I did test the screen for about a month, I see about 99% of GBA color space from the shaders. As I mentioned that I can’t go slightly deeper to the blue colors due to not going outside of sRGB color space, It’s pretty close and identical to the real hardware. It looks pretty much the same to the real screen, regardless of having to change the gamma from the shaders, and it is possible to see every detail in the castlevania games on the GBA screen as well as GBA-SP AGS 001.

I would like to take photos of the real GBA screen to compare with the shaders, I don’t have good cameras to show the results. They look very cheap and always have problems with light intensity and shadows. Neither of the cameras I own can’t do well with the reflection, and not even with the screens with backlight like the NDS Phat. All I can do is post snapshots from the emulator to showcase all four shaders that emulates certain screens from handheld device. I may make a video at some point to showcase it.

As for NDS and PSP, I also made the whites more whiter from the previous version, and I made the colors and gamma more accurate to the real system. The PSP shader I made are based on the documents I posted of my earlier posts in this page. For both systems, the blue colors are a bit far from sRGB, I managed to emulate them very well while the GBA blue color is a tad close to the sRGB. The PSP should be identical based on the document I found for the screen.

Also, if you happen to own these handheld devices, try testing them and see if the color space fits. I never owned GBA Micro or PSP, so I don’t know what it looks in person. It should be more accurate than what VBA-M or No$GBA has to offer, and my previous versions as well. However, a few has their preferences, and that’s why I left my last LUT shader up due to having shadow and highlight details.

The latest version of these shaders has been added to the common-shaders repository, so they will be available from online updater’s Cg shader pack.

Thanks for uploading them in the repo. I updated the shader pack to have the GBA shader contain the light intensity settings so you can just adjust the gamma without going between low and high versions that was in the previous pack. I also added several .cgp presets that has two LCD shaders for GBA. One is for LCD2 from cgwg and the other one is from lcd-shader folder and I set the GBA shader to original gamma because of how I viewed the hardware with white lights and brighten the best close to my monitor. The NDS and PSP also has it’s own .cgp as a standalone and with cgwg’s lcd2. I also added vba-shader that has the same color gamut that VBA-M and my LUT produces because a few prefer this. It also has darken intensity to keep the red, green, and blue values the same when changing the gamma.

I also added photos of the shaders at the main post. The comparison section tries to compare with the actual art style. Mario Power Tennis has the green match to the GBA and NDS from the logo and there were a few spots that match too. Mermaid Melody shows more better match, the GBA and NDS closely match the magenta purple color of the character from the anime. Do note that the purple gets warmer if brought the screen at the warm color light.

The video footage is planned later on and I still plan to make few adjustments only to .cgps.

The handheld folder was rearranged to reflect the arrangement of other folders in the common-shader repository, so the presets are all kept in the top level of the folder while the shader files are placed inside of subfolders.

So the color shader files are now located in /handheld/shaders/color

They were also updated to version 7.4 as well.

I am working on a new version of these shaders right now and done a lot of test with real hardware and adjust parts of the shaders. For NDS however. It’s 99% accurate for the color accuracy, however the colors may have their gamma for each red, green, and blue signals very slight difference like some modern phones. Few shades of colors show a minimal differences of color, but it is very close to the hardware and it shouldn’t matter that much. It could be because the gamma isn’t as completely straight or something. One other reason is it could be the LCD dots being bright. I don’t have an equipment of color calibration tools since they are very expensive but I simply use the Red, Green, and Blue image to the NDS Phat to show the color gamut. I used Photoshop for hours to match the colors from the system and also match my monitor brightness to the level of the system, even though whites on NDS doesn’t have perfect whites, especially on the bottom screen. It’s very close on the top screen so I was able to get accurate colors while staying on better white level. All colors look very perfect, with minor exceptions said from above. Nevertheless, it does look the best playing Super Mario 64 DS and compare both shader and real system that looks indistinguishable. Although, I had to put the gamma a little high because the shadow parts shows more on the hardware.

As for the GBA, I did flash the same white light to the screen and compare it again. The current shader looks slightly cold on parts of the image that shows less olive greens and yellows being more peach tone. I did work on the shader again and shows a bit more olive green and yellow just like the real system. I do use light intensity to 2.5 which is the basis of what I capture from the system with bright light, which is around 1.8 gamma. It looks very close to the current shader except a slight more noticeable with olives and yellows, mostly warm colors that should show on the hardware.

I did plan to make a video for a long time and I do plan to start on it. The new shaders should come out by a few days and see how it turns out.

Edit 11/22: I uploaded the new version. I did some tweaking on the NDS to get the colors more accurate as the progress went on, and it should be fine. The GBA shader should show a bit more yellow than peach.

I did add slang shaders in the package with existing .cgp and equivalent. I did create three separate GBA glsl shaders to have brightness adjusted since glsl doesn’thave menu settings at all. Preferences on light intensity are varied, so that’s the reason.

New pictures of those shaders will come up tomorrow and a video should come up in December.

Also, a user posted pics of GBA models that shows different vibrance like the shaders here, and has a video in the blog:

I found this from retrorgb website.

Edit 12/9: I am working on a new method of the GBA shader. I found out that all the color values of each, red, green, and blue change when display gamma or “light intensity” change and it would darken a bit, which made me wonder why parts of the image on certain games looks a bit dark on the shader, but pops put in the real screen, and it wouldn’t matter for the phosphurs on the screen. Like Pokemon games for example, some of the colors of the overworld sprites are supposed to pop in a bit more than how the current shader process. I would leave the display gamma settings work, and change the target gamma or “darken strength” from VBA shader, to change the gamma of the raw image before the actual color effect change. I’ll explain how the gba screen works.

The GBA screen, for each red, green, and blue color phosphurs and white, usually have their light kept a bit when light source gets a bit dark, but when it gets dark enough, the luminance goes down so all three colors goes dark as well as the white, unlike the shader implement with “light intensity” that darkens the red, green, and blue values but the white don’t get darken, as it shouldn’t, and some natural colors don’t get darken as much, which is why the current shader looks slightly dark on parts of any image, rather than keeping some of the luminance that is similar to the screen. I played the GBA on various light source, many times, and I see the full range of red, green, and blue pops in a bit, and some contrast shows a bit more there too. Even though I explained about that, the gamma still varies from light source depending on the brightness, but the luminance sort of plays in. In normal play on the hardware, it would look a bit like the default 1.8 “light intensity” from the shader, if played on a lit place that isn’t lighted directly from a light bulb, or the sun unless full cloudy. It can sound complicated, but that’s how it kinda works. I never seen a research document on those type of screens. In conclusion, some of the colors are supposed to pop in due to the value of rgb from the hardware being lighter and retain a bit than natural colors.

I did a test of switching between display gamma and target gamma, and found interesting results. While keeping the display gamma to 2.5, which is the basis of the actual color value from each rgb captured directly from the GBA hardeare., results may vary, because parts of the image can pop out more than it should, depending on the target gamma, so I had to play around a bit. I will post interesting results when testing this for the next week. I did test by putting display gamma to 2.2, and target gamma to somewhere similar to the default settings on current shader, and it can be balance with colors popping out, and each rgb colors should retain the intensity a bit more, just like I explained about. I do apologize if it sounds a bit complicated, but I do try to keep the shaders more accurate to the hardware and comparing them. I should release the final results next week as a christmas release.

By the way, I did watch My Life in Gaming newest video, RGB 208 for Gameboy library and with GBA included. They showed off the screens of the GBC, GBA, and the GBA SP ags-001. Coury mentioned that the GBA has a bit darker screen luminance than on the GBC and SP 001. I know the SP 001 is exactly the same as the one from original GBA, since it has better glass protection, but for GBC, I see some slight difference in colors, and it looks a bit close to my shaders than what gambatte produces, but for now, at least the gambatte has a bit more contrast. I don’t own a GBC nor any flashcards for it to show raw RGB, so I don’t know how it would look in person right now. Coury also showed off the GBA Micro and said about the colors being washed out a bit when comparing with SP 101. It may share similar color gamut as for the GBA or NDS phat, but I don’t know since I don’t own that model either. The video is very interesting to watch, seeing the screens in action with more professional shoots.

Merry Christmas everyone! I just released the truly new version of these shaders, and I made a video about those.

[QUOTE=Pokefan531;53293]Merry Christmas everyone! I just released the truly new version of these shaders, and I made a video about those.[/QUOTE]

Nice work. :slight_smile:

I have submitted pull requests to common-shaders and slang-shaders so that the updated color shaders will be included in the Online Updater.

It’s been a while since I last updated the shader pack. During the hiatus, I’ve been using several programs and re-calibrate my sources.

I switched my vga adapters when I had my graphic cards swapped. My screen is LCD and compatible with sRGB specs, but only has VGA input. Before swapping adapters, I had clipping problems with the screen of where I barely see any contrast on Mario Kart 8 loading screen background, and I would have to use the driver to play around the contrast settings because of clipping on blacks and whites. I noticed this problem few months after the previous shader release. Though, it was not as aggressive as Full Range clipping on Limited range mode. The new adapter can display the whole scale of rgb values without any clipping on default display settings, which makes better precision of color accuracy when copying colors from handhelds to my monitor.

I’ve used tools for color accuracy like photoshop and using the color mangler shader to see the results. I used a light to flash the GBA screen that is identical to 6500k whites to the screen. The GBA Red, Green, and Blue colors do vary by light temperature, so I usually use the white light. The white color is very identical, so colors are better and more accurate from the screen. I even played around with several light bulbs with color temperatures and also do the color temperature in photoshop to see the identical results. The white light seems very helpful to get the exact rgb colors. I do red and green first since the color values are inside the sRGB range and so I put them in the shader and look at the values in Photoshop before putting the blue color. Since the blue color is outside of the sRGB range, I would have to subtract the red value on the blue color to get more accurate blue hues and saturation. I would fill in the blue and green values to the blue color to achieve better results with pure white color in the shader. After that, it is more pleasing than the last update.

The red color is less saturated as seen, but supposed to be slightly warmer instead of being cool, which caused some colors to appear cool and the new version fixes that. The green color, while all colors appears less saturated than the sRGB, the green is more saturated than what the previous release has. It is warmer as it’s supposed to be, and it gives off more acceptable colors that is comparable to the actual screen with white light flashed into it. The blue color, even though it is out of bound of most monitors as of date, it appears more bluish as it’s supposed to and tries to match the blue color from gba.

How the real screen looks when I tried to flash it has tricks. When the screen gets dark, the color luminance decreases instead of having the gamma dark it, because my previous shader has a dark parameters that changes gamma after applying the color correction, which gives inaccurate results as it changes the colors instead of preserving it. I switch it to change the inner gamma as the gba does, which means the screen’s gamma is changed before applying color correction to help preserve it. Speaking of the gamma, the gamma can go to around 2.2 depends of the light source on where it’s hitting at. If you shoot it from the bottom or the center of the screen, the gamma doesn’t change and goes around to standard 2.2. If you shoot it from above, the gamma change and it gets darker, but if shot from the tip of the top, it gets more dark. Shooting from right to left has smaller situation. I would translate this from the new shader’s parameters on darken screen, that 0.0 is bottom or center, 1.0 is above, and 2.0 from the top edge. Its kinda like seeing the TN panel when looking at different angles that changes the gamma, but in GBA’s case, it only changes of where the light is emitting from, and also transflective LCDs does not invert colors that the TN panels do. You can play Castlevania games with things being more visible if played outdoors or played in a well lit room. I set 0.5 the default for balance on darken image for bright games. Although it is slightly lighter than the previous release, it is kinda supposed to be on that average for an average light without counting the sun or be close to the light bulbs.

When I flash the screen from the light source, the screen is a bit brighter due to less contrast, and the contrast is lower because the light brightens the black a bit. What I did is copy the black color too to match it after matching the rgb colors and then use Photoshop to clip down the blacks to give me the right rgb color values and it was needed to make icc profiles and to color mangler with default gamma settings. That way, it gives me more accurate results when I compare the screen. Display_Gamma does change the colors after adjusting everything, which is what made me change the darken screen method.

The NDS is backlit, so it’s easy to copy the colors to the screen. I would have to dim my monitor to match the white luminance for more precise results. The NDS phat has a slightly warmer whites and the bottom is a bit more warmer, so I just use Photoshop to balance the white color on the test image for the top screen. The blue colors seems to be a tiny bit dim by default. While the contrast is a bit less, it’s not as much as the gba transflective screen is and I still get comparable results. Of courses it is better than previous release, and I did remove the gamma parameter setting on any shader other than gba or palm, which I will get to.

I did get better PSP results from displaymate page and used the color gamut chart to Photoshop to use rulers, snaps, and grids and adjust them to get the UV values for red, green, blue, and white, and convert the UV to XY to use the converted value to Photoshop’s color profile settings to make an ICC file for color correction, and you can view of how the ICC file would look like by clicking passing profile or color profile settings. I then copied the color values to red, green, and blue to the shader for precise. I did that method since I don’t have any PSP and displaymate page is reliable.

For Cgp, Glslp, and Slangp, please have the color correction loaded after the LCD shader since the actual screens have different rgb colors as demonstrated.

Also, the same website has Palm phone color space and palm is devices have transflective screen as the gba, but have a similar color space, in between GBA and NDS saturation. You can use the palm shader on a palm is emulator, if a libretro core of that exist. I wouldn’t say it’s the same as gba or NDS because the colors are a bit more saturated outside the red hue, and the gba has the least saturation on reds, while the NDS has more saturated reds than the gba, which is why the red is brighter than gba or palm. From the displaymate page, it does have gamma of 2.6, and I added an option to switch gamma from 2.2 for palm shader.

Not sure if I am trying to make sense on all this since I never wrote that big of a documentary for those screens and tricks, but I do try to explain of how those screen works for color correction. The new gba shader still looks good without the gamma change and can be safe to add on the next GBI version. I will release new and updated images soon, and I also packed the new shader with the new LUT that hunterk has made last month and I decided to use it as a new out from before and better and more efficient than my previous LUTs from two years ago.

Also, note that the mGBA and Gambatte doesn’t have the green colors fully scaled, and they both reached to 251 out of 255, so the colors can change slightly, but can be unnoticeable. I would have to load up the image-adjustment first to have both gamma to 2.2 and only have the green value up to 1.015 to fix that before applying the color shaders. It doesn’t happen to desmume.

New version:


The new LUT tonemapping version doesn’t seem to work correctly for me, with any of the three shader formats, at least on my PC with a GTX 970.

It seems all bright colors are getting turned to black:

In any case, I went ahead and pushed all the shaders to Github and opened pull requests to have them added to the official repositories.

Ugh, that LUT shader is going to make me pull my hair out -_- That happens worse on some GPUs than others, but I thought I had it licked with the crummy conditional I added. You can try playing around with that part to see if there’s a value that works for you. If so, let me know and send a PR and I’ll get it merged.

Have any of you tried to set LUT size to 32 in parameter setting? 32 Lut size is needed.

I’m just using the presets that were included, which set the LUT size to 32 when you load them.

I found that the GLSL and Slang versions work if you use the LUT shader code included in the zip, which seems to be the initial version from 5/29:

The Cg version found in the zip file is identical to the current one in common shader so it still has the problem. The GLSL version seems to work up until this commit:

If I put image-adjustment in the first pass and set luminance to 0.99, then it displays correctly:

I think I found the problem. The output would be black when imgColor.b was 1.0, it seemed to cause a problem with the color mixing.

Clamping mixer to 1.0 seems to fix this issue. I’ll push that fix to the LUT shader in each of the PRs I have open.

EDIT: Changed the clamp to 32.0 to fix a regression with the blue channel.

1 Like

I am glad that is fixed. I packed your fix .cg shader. I also did small tweaks to few colors to GBA and NDS. Both now show some small differences between each other as it’s supposed to. NDS is slightly more saturated than GBA. I’ve done several methods to do better precise to capture color spaces without having colorimeter tools as I can’t afford those in current state. I also updated the LUT textures too. This version and the one before had luminance slightly lower to have the exact yellow color and luminance as without lowering it, the red value in yellow color exceeded 255 value and so, the white is very close to maximum luminance in textures. Same link as the first and last update post.

Edit: I also have the texture for the GBA without the gamma altering. “GBA-Unaltered_Gamma.png” I just have the texture incase if you want to use on other projects that doesn’t use shaders and don’t want gamma or curve alteration.

1 Like

Hey Pokefan,

I’m trying to implement your color shader equations in FPGA hardware for my GBA HDMI project, The issue is, my color corrected output when compared to your GBA colors and NDS are slightly off, this is based off RGB measurements in MS paint on the images you posted and my own screen captures from my FPGA.

I started to think I messed up the processing chain in the FPGA, but then I compared your unfiltered image to my unfiltered RGB output from the GBA HDMI board. The RGB values in your unfiltered images are way off from my captured RGB output. For example, in the red DK letters on the DK King of Swing intro screen. Your unfiltered RGB values are {229,32,33}, whereas mine are {227,0,21}. Similar errors are found for all the unfiltered colors. To make sure my capture device wasn’t introducing error, I sent out known colors from the FPGA and the captured values were +/- 1 to the coded values which means it’s close enough for this purpose. All of this would definitely explain why my color corrected output is different than yours.

Did you alter the images after you captured them? Otherwise, this makes me think the emulator you’re using is introducing a color error somehow. I’m close to certain my unfiltered RGB values are correct, they are taken directly from a real GBA’s video data bus.

Is there a strategic way to modify the color correction coefficients to account for the differences in our starting unfiltered RGB values? I’ve tried tweaking it myself, but seem to always make it worse.

Thanks for any input, I really love the results of your shaders! Let me know if I can provide any data to clarify things, or to help out your own shader efforts.

I used image viewer and mgba to compare, and I put a custom image-adjustment first on mgba since the white on mgba is (255,251,255) and I had to increase the green very slightly to get correct colors. I used hunterk’s color-mangler shader which is similar to icc profile, but just adding RGB values and the shader is gamma corrected unlike the colorimeter shader.

Also, I got a new ips monitor with superior quality and got an sRGB profile to use on photoshop and reshade LUT shader. I have to redo the GBA and NDS shader in the last few weeks because my last monitor was colder and wasn’t actually sRGB standard, and its icc profile reversed the colorspace. My new one does it completely better and I redid the shader. It should come out in few days after checking few spots.

As for the pictures, my first post has pictures that was from last December, and I last updated my shaders in early August. In mGBA, all I did is capture screenshot without GPU to do raw capture, and used photoshop to have them in montage to load them in Retroarch by image viewer and just throw in my shaders.

Also before, when I load my shaders into my other devices like Shield Tablet K1, which has sRGB mode, colors are a bit different when I had my last monitor, but now are very identical with my new one.

Thanks for getting back to me so quickly.

I’ve tried tweaking the individual color channels (which is what it sounds like you initially did in mgba), this let me match your output but only for certain color tones.

I didn’t realize the pictures were from December, I’ll wait for your next shader update before I go crazy trying to make mine match :stuck_out_tongue:

Just my luck that I would fix it right after I posted the question.

Even though our unfiltered RGB values are different, your coefficients still work great! Turns out at some point in the color correction pipeline, I accidentally assigned the blue 8-bit bus some of the green pixel data…I guess I need more sleep.

So far I’ve put in GBA-colors, VBA, NDS, PSP. I’ll probably make the 9 color coefficients user programmable, with a couple of profiles to save the coefficients.

1 Like

In Color-Mangler shader, how it works is the Red, Green, and Blue primaries have rgb values in each of them. It has to be low values for other colors in RGB primaries (R:77,G: 08,B:15) to fit to 100% pure white reach without overexposing. It looks a lot dark without gamma correction (196,20,38). The color-mangler shader does have to brighten the RGB primaries and luminance (226,83,108). Display_Gamma is the one that does gamma correction in a final output. This is from my last version for the red color.