fix LCD3x to match GBA / NDS screen
Opened this issue · 0 comments
GoogleCodeExporter commented
Problem:
The current LCD3x is too saturated and bright for GBA games.
-----------------
Solution:
Change filter coeffs, decrase saturation and add contrast.
------------------
changed filter coeffs (half of current values):
const float brighten_scanlines = 8.0;
const float brighten_lcd = 2.0;
-------------------
changed main function:
void main() {
vec2 angle = vTexCoord * omega;
float yfactor = (brighten_scanlines + sin(angle.y)) / (brighten_scanlines +
1.0);
vec3 xfactors = (brighten_lcd + sin(angle.x + offsets)) / (brighten_lcd + 1.0);
const vec3 coef = vec3(0.299, 0.587, 0.114);
vec4 color = texture2D(rubyTexture, vTexCoord);
color = ((color-0.5)*1.1+0.5); /* adjust contrast to +10% */
vec3 gray = vec3(dot(color.rgb, coef));
gl_FragColor.rgb = yfactor * xfactors * vec3(mix(color.rgb, gray, 0.35)); /*
-35% saturation*/
}
---------------
Note:
Result may be different on every device. I compared side by side my NDS and my
phone (Huawei Ascend P6) running MyBoy emulator and the colors match
subjectively 95% with this change.
Original issue reported on code.google.com by adriano....@gmail.com
on 16 Jul 2014 at 12:08