1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-06-04 10:47:13 +08:00

feat: 更新激光材质和着色器参数,优化激光效果

This commit is contained in:
2025-08-27 14:59:27 +08:00
parent 9127692146
commit 2e1d15a0a0
2 changed files with 7 additions and 9 deletions
+3 -7
View File
@@ -3,14 +3,10 @@ uniform vec4 color: source_color;
uniform float laser_width: hint_range(0.01, 1.0) = 0;
uniform float soft_edge: hint_range(0.0, 0.5) = 0.5;
void fragment() {
float textureWidth=float(textureSize(TEXTURE,0).x);
float textureHeight=float(textureSize(TEXTURE,0).y);
float radius=textureHeight/2.0;
float radiusU=radius*TEXTURE_PIXEL_SIZE;
float dist = distance(vec2(0.5,clamp(UV.y,radiusU,1.0-radiusU)),UV);
float dist = abs(UV.x - 0.5);
float core = 1.0 - smoothstep(0.0, laser_width, dist);
float edge=1.0 - smoothstep(laser_width, laser_width + soft_edge, dist);
float alpha = max(core, edge);
float edge = 1.0 - smoothstep(laser_width, laser_width + soft_edge, dist);
float alpha = max(core, edge);
COLOR = color;
COLOR.a = alpha;
}