How can I best simulate headlight beams, in a night-time scenario, in Godot 4?
The components I have are all sprite-based - a top-level car sprite, a shadow sprite (that is offset based on time-of-day, and changes), and a lane sprite (the D) that is attached to the car. This is on top of a road-bitmap, that will itself have its darkness/brightness adjusted based on time-of-day. The components:
I can think of three ways that might work:
- Add a new sprite, (toggleable, with adjusted opacity) and offset it in front of the car sprite.
- Use actual tiny 2D point-source lights (all I know about Godot's lighting, is that it exists).
- Add a shader - somewhere... I'm definitely not conversant in shaders - maybe it would go on the road bitmap, with a bunch of tiny coordinates?
I'm fairly sure option 1 would work - adding a new sprite to the node-stack, offset ahead of the car sprite. I'd have to play around with Z-levels, etc, but think it would work.
Option 2 presumably would work, but would you have issues with performance (likely several dozen sprites on the screen at once).
Option 3 - not sure I like the idea of shaders, but it so often seems to be the answer - "just use a shader!" :)
For the record, originally the shadow-sprite was going to be a shader, but a blurry dropdown-shadow shader that I found turned out to have hideous performance. I'm told that's a general problem with blurry shaders, as they have nested for-loops that drive performance down. So would a bunch of blurry headlight shaders do the same thing?
I'm not looking for a photo-realistic effect, just something that shows the concept that it's got headlights on at night. I am looking to keep FPS up, of course.

