Natural Vision Shader for Retroarch

I just ported this small simple shader to cg and uploaded to the repository of common-shaders. I got rid of part of the code that only blurred the output, so it only works over the pixel colors.

It’s a shader to be used as a first pass without scaling, that is, using 1x as scale factor and nearest filter. That’s because it only works on the pixel colors. I think it’s a useful shader for games that have bland colors. Many psx games suffer from this.

Some screens I took using this shader combined with Super-xBR. Dino Crisis 2 and RER are known for having very bland colors when emulated (on TVs people are used to increase color saturation until it’s satisfactory):

I must have missed this when you posted it, but it looks very nice. Those shots really pop. Do you have any comparison shots before/after?

yeah, can’t really judge without seeing an unfiltered picture. so the shader raises the color by a given power but not in RGB like usual but in YIQ. this gives better results for color boosting?

I forgot to post. The first two screens can be compared here: http://screenshotcomparison.com/comparison/158046/picture:0

Oh yeah, looks much more vibrant.

I’m also curious about the choice to do the modification in YIQ space. Does it help to linearize the RGB before conversion?

To tell you the truth, I don’t know.

I just ported this shader and got rid of the blur code inside. It was developed to be used with ePSXe and the author is ShadX I think, from the comments.

I was looking around and I found some tutorials for photo editing where they described this method. but they used the Lab color space instead. I think the original shader author decided to use YIQ though since it’s similar regarding the separation of luminance and color planes and way easier to implement.

I was asking myself the same thing. don’t know too much about color space theory though but it seems to give a better contrast. if it’s okay with hyllian I would provide a parameterized version of this shader with adjustable boost and gamma values.

here is an example, I used some very high boost values on purpose to make the difference obvious. on the left side without and on the right with linearized gamma:

original

Y=2.0, I=1.0, Q=1.0

Y=1.0, I=2.0, Q=2.0

Y=2.0, I=2.0, Q=2.0

Feel free to add any params/features.

I needed more time than expected since I didn’t want to make false assumptions so I was reading a little bit into color space theory. but it’s finished now. this is what I changed:

  • added 5 paramters: Gamma In, Gamma Out, Luma, Orange-Cyan, Magenta-Green
  • used some more precise values for the RGB to YIQ conversion matrix and recalculated the inverse one

and the last thing is interesting. I haven’t seen the original code of this shader only Hyllians adaptation, but there is a big oversight in the code. after we manipulate the YIQ planes the result can be a triplet which is out of bounds of the YIQ range. on first sight one may think that this is no issue because if we convert it back to RGB too high or low values will just be clamped in the output. but there is the problem, invalid YIQ colors can actually be mapped to valid RGB colors. here is a demonstration, again I used very high parameters on purpose to make it more visible:

original

unclamped - clamped to YIQ range

and the download link. I didn’t rename it, I think it should replace the existing file: https://mega.nz/#!3YgngBIT!KzPfpxp5kYQETUbpnPpnHsTLDmvdUL_FyNAmnh-YLA0

ps: if someone wants to read about color space theory too, here are two good introductions I used for my research:

http://www.ryanjuckett.com/programming/rgb-color-space-conversion/

Oh yeah, unclamped loses a lot of detail when it goes out of range.

the modified version is now on github. if anyone used natural vision in some custom presets, you should note that the default behavior is now different. if you want it to behave like the original (apart from the clamped values fix described above), you should set Gamma In and Gamma Out to 1.0 and all three adjustment values to 1.2

I like it!!! Ciao.