17 lines
674 B
Plaintext
17 lines
674 B
Plaintext
// 敌人实体圆:普通 alpha 混合 + 软边 + 高光边缘(区别于发光子弹)
|
||
// 应用于 EnemyManager 的 MultiMeshInstance2D(per-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);
|
||
}
|