2D Shine Highlight

Found on reddit, thought I’d share it here too. Has 3 params:

  • shine_color: A color (can be transparent!)
  • shine_speed: How quickly it passes
  • shine_size: how wide it is
Shader code
shader_type canvas_item;

uniform vec4 shine_color : hint_color = vec4(1.0);
uniform float shine_speed : hint_range(0.0, 10.0, 0.1) = 1.0;
uniform float shine_size : hint_range(0.01, 1.0, 0.01) = 0.01;

void fragment() {
	COLOR = texture(TEXTURE, UV);
	float shine = step(1.0 - shine_size * 0.5, 0.5 + 0.5 * sin(UV.x - UV.y + TIME * shine_speed));
	COLOR.rgb = mix(COLOR.rgb, shine_color.rgb, shine * shine_color.a);
collectable, glint, highlight, item, shine
The shader code and all code snippets in this post are under CC0 license and can be used freely without the author's permission. Images and videos, and assets depicted in those, do not fall under this license. For more info, see our License terms.

More from GammaGames

Fake Interior Shader

Related shaders

2D Controlled Shine Highlight With Angle Adjustment

3D Pixel art outline & highlight Shader (Post-processing/object)

3D Pixel art outline/highlight Shader (Old)

Notify of

Newest Most Voted
Inline Feedbacks
View all comments
11 months ago

how do i make it cycle faster?

10 months ago

Hey all, I just put out an “improved” version of this shader here that allows you to adjust the progress and angle of the shine animation.