godot shader 控制 颜色绘制的 金典公式
// fragment 函数在每个像素上运行,逻辑与之前相同。
void fragment() {
float dist = length(UV - vec2(0.5, 0.5)); // 距离中心
float radius = 0.25;
float edge_width = 0.25; // 过渡宽度
float t = pow(smoothstep(radius - edge_width, radius + edge_width, dist), 2.0) * multiplier; #金典公式
ALPHA = t; // 透明度渐变
//ALBEDO = glow_color.rgb;
ALBEDO = vec3(t); // 灰度渐变
ALBEDO = mix(vec3(1.0), vec3(0.2), t); // 从亮到暗
}
浙公网安备 33010602011771号