Highlighter Shader (3D)

The vertex() function remains unchanged as it does not affect the shine effect.

The fragment() function calculates the shine effect based on time and smoothly transitions the object’s albedo color towards the shine color.

To use this shader in Godot for a 3D object, create a new Spatial shader material in the Godot editor and assign this shader code to the material’s shader property. Apply the material to the 3D object you want to highlight, and adjust the shine_color, shine_speed, and smoothness parameters as needed to achieve the desired highlight effect.

 

This spatial shader will smoothly animate the shine effect over time on 3D objects, adding a visually appealing highlight. Customize the shader

Shader code
shader_type spatial;

uniform vec4 shine_color : hint_color = vec4(1.0, 1.0, 1.0, 1.0);
uniform float shine_speed : hint_range(0.1, 10) = 1.0;
uniform float smoothness : hint_range(0.1, 1.0) = 0.5;

void vertex() {
    // No changes to vertex function for this effect
}

void fragment() {
    float shine = abs(sin(TIME * shine_speed));
    float smooth_shine = smoothstep(0.0, smoothness, shine);
    ALBEDO = mix(ALBEDO, shine_color.rgb, smooth_shine);
}
Tags
Item Highlighter
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 MilkyDevs

LevelUp Shader (3D)

UI Shader (2D)

Related shaders

far distance water shader (sea shader)

Fire dissolve shader

Pixel Cloud Shader

Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments