J
JapanGamer29
Guest
Hi all, I've been using image_blend to highlight puzzle pieces in my game, but it only works well with some colors, not others.
I have a grayscale shader which I found here ages ago, and I'm able to change the values so that it lightens or darkens, but I can't figure out how to remove the graying.
It would be great to adapt this or get something similar that keeps the color and just changes the brightness. Can anyone help? Thanks.
I have a grayscale shader which I found here ages ago, and I'm able to change the values so that it lightens or darkens, but I can't figure out how to remove the graying.
It would be great to adapt this or get something similar that keeps the color and just changes the brightness. Can anyone help? Thanks.
GML:
//shadGrayScale.vsh
attribute vec4 in_Position;
attribute vec2 in_TextureCoord;
varying vec2 vTc;
void main() {
gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * in_Position;
vTc = in_TextureCoord;
}
//shadGrayScale.fsh
varying vec2 vTc;
void main() {
vec4 irgba=texture2D(gm_BaseTexture,vTc);
float luminance=dot(irgba.rgb,vec3(0.2125,0.7154,0.0721));
gl_FragColor=vec4(luminance,luminance,luminance,irgba.a);
}
// Draw event in my object
if (shader_is_compiled(shadGrayScale))
{
shader_set(shadGrayScale);
draw_self();
shader_reset();
}
Last edited: