Files
tekton/assets/shaders/outline3d.gdshader
T

21 lines
601 B
Plaintext

shader_type spatial;
render_mode cull_front, unshaded;
// Controls the width of the outline
uniform float outline_thickness : hint_range(0.0, 0.5) = 0.03;
// Controls the color of the outline
uniform vec4 outline_color : source_color = vec4(0.0, 0.0, 0.0, 1.0);
void vertex() {
// The core of the inverted hull method:
// We push the vertices outward along their normal vectors.
// Since front faces are culled, this creates the outline border.
VERTEX += NORMAL * outline_thickness;
}
void fragment() {
// Apply the solid outline color
ALBEDO = outline_color.rgb;
ALPHA = outline_color.a;
}