Shaders Shader to lighten or darken a sprite?

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.

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;

varying vec2 vTc;
void main() {
  vec4 irgba=texture2D(gm_BaseTexture,vTc);
  float luminance=dot(irgba.rgb,vec3(0.2125,0.7154,0.0721));

// Draw event in my object
if (shader_is_compiled(shadGrayScale))
Last edited:
Sweet! Great video, and it works great! I'll post the code here for anyone who stumbles on this thread.

// obj_brightness Create
shader = shd_brightness;
u_brightness = shader_get_uniform(shader, "brightness");

// obj_brightness Draw
var brightness = 0.5 // range -1 to +1
shader_set_uniform_f(u_brightness, brightness);
draw_self(); // make sure obj_brightness has a sprite

// shd_brightness.fsh
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform float brightness;
void main()
    vec4 base_col = v_vColour * texture2D( gm_BaseTexture, v_vTexcoord );
    gl_FragColor = vec4(base_col.rgb + brightness, base_col.a);