Item Highlighter

How to use:

Add shader to Next Pass in the Surface Material of the MeshInstance

Shader code
shader_type spatial;
render_mode unshaded, depth_draw_never;

uniform vec4 shine_color : hint_color = vec4( 1.0, 1.0, 1.0, 1.0 );
uniform float cycle_interval : hint_range(0.5, 5.0) = 1.0;
uniform float shine_speed : hint_range(1.0, 5.0) = 3.0;
uniform float shine_width : hint_range(1.0, 100.0) = 3.0;

void fragment( )
{
	vec3 vertex = ( CAMERA_MATRIX * vec4( VERTEX, 1.0 ) ).xyz;
	float width = shine_width * 0.001 * cycle_interval;
	float frequency = floor( sin( vertex.z * cycle_interval + TIME * shine_speed * cycle_interval ) + width );
	ALBEDO = shine_color.rgb;
	ALPHA = clamp( ( 1.0 - dot( NORMAL, VIEW ) ) * frequency * shine_color.a, 0.0, 1.0 );
}
Tags
collectable, glint, highlight, item, shine
The shader code and all code snippets in this post are under MIT license and can be used freely. Images and videos, and assets depicted in those, do not fall under this license. For more info, see our License terms.
guest

3 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
matsakis27
matsakis27
4 months ago

It would be amazing if there was a 2D version of this <3

GammaGames
GammaGames
4 months ago
Reply to  matsakis27

I went looking and found something similar, uploaded it to the site: https://godotshaders.com/shader/2d-shine-highlight/?post_id=3807

Jimbow
Jimbow
4 months ago

I love this so much!