Files
spellforge/shaders/enemy_circle.gdshader
T
2026-07-20 10:56:52 +08:00

17 lines
674 B
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// 敌人实体圆:普通 alpha 混合 + 软边 + 高光边缘(区别于发光子弹)
// 应用于 EnemyManager 的 MultiMeshInstance2Dper-instance 颜色经 COLOR 传入)
shader_type canvas_item;
void fragment() {
float d = length(UV - vec2(0.5)) * 2.0; // 0=中心 1=边缘
float body = smoothstep(1.0, 0.82, d); // 软边实心圆
// 内高光:靠上方偏亮,营造球体体积感
vec2 hi = UV - vec2(0.38, 0.34);
float spec = smoothstep(0.42, 0.0, length(hi)) * 0.35;
vec3 col = COLOR.rgb + spec;
// 暗边描线
float rim = smoothstep(0.72, 0.95, d) * 0.25;
col = mix(col, col * 0.55, rim);
COLOR = vec4(col, COLOR.a * body);
}