mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 09:35:34 +00:00
Laser
This commit is contained in:
parent
8e5c575917
commit
75c0a7d994
11 changed files with 813 additions and 293 deletions
23
Shaders/minimal_laser.gdshader
Normal file
23
Shaders/minimal_laser.gdshader
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
shader_type spatial;
|
||||
render_mode unshaded, blend_add, cull_disabled, depth_draw_opaque;
|
||||
|
||||
uniform vec3 beam_color : source_color = vec3(1.0, 0.2, 0.2);
|
||||
uniform float glow_radius = 0.2; // fraction of cylinder radius
|
||||
uniform float noise_speed = 1.0;
|
||||
uniform float flicker_strength = 0.2;
|
||||
|
||||
void fragment() {
|
||||
// Compute distance from center axis
|
||||
// Cylinder UV: Y goes along height, X around circumference
|
||||
float d = length(UV - vec2(0.5, 0.0)); // UV.x = around circumference, UV.y along height
|
||||
|
||||
// Glow: smooth edge
|
||||
float alpha = smoothstep(0.5, 0.5 - glow_radius, d);
|
||||
|
||||
// Optional flicker along the beam (animated by Y)
|
||||
float flicker = sin(UV.y * 20.0 + TIME * noise_speed) * flicker_strength;
|
||||
alpha = clamp(alpha + flicker, 0.0, 1.0);
|
||||
|
||||
ALBEDO = beam_color;
|
||||
ALPHA = alpha;
|
||||
}
|
||||
1
Shaders/minimal_laser.gdshader.uid
Normal file
1
Shaders/minimal_laser.gdshader.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://cd8n7vsgxkfib
|
||||
Loading…
Add table
Add a link
Reference in a new issue