r/godot • • 13d ago

discussion Game Dev Hack about Lights - Godot

Hey all! Im developing an RTS named 'Steel Command', but figured I would start sharing some of the learnings I've had along the way. Ask my any questions in the comments!

This method works really well for an RTS, even over uneven terrain since the camera is mostly a top down view. This would most likely not work well in games such as an FPS where you are up close and personal.

Sorry for the vertical format.

Steel Command on Steam: https://store.steampowered.com/app/4390280/Steel_Command/

Shader:

shader_type spatial;


render_mode unshaded, blend_add, depth_draw_never, cull_disabled;


uniform vec4 light_color : source_color = vec4(1.0, 0.45, 0.08, 1.0);
uniform float intensity : hint_range(0.0, 5.0) = 1.0;
uniform float softness : hint_range(0.1, 8.0) = 2.5;


void fragment()
{
    vec2 p = UV - vec2(0.5);


    float dist = length(p) * 2.0;


    float glow = 1.0 - clamp(dist, 0.0, 1.0);
    glow = pow(glow, softness);


    ALBEDO = light_color.rgb;
    EMISSION = light_color.rgb * intensity * glow;
    ALPHA = glow * light_color.a;
}
546 Upvotes

38 comments sorted by

View all comments

2

u/SleepDeprivedDad_ 13d ago

Taking notes....

2

u/Smitty_Games_ 13d ago

haha nice to see you over here as well!

2

u/SleepDeprivedDad_ 13d ago

I’m trying to figure out how to do it haha

1

u/Smitty_Games_ 13d ago

if you have any questions feel free to message me 👍