Godot Version 4.3.beta1
Question
Hey. Decided to make the player character (and every other character in the game) from bones and draw_line calls. Please don’t judge my decision. Anyway, (), I ran into an issue: for whatever reason the draw_line calls interact with light very strangely.
I’ll just show you a video:
The lines are lit in only the bottom half, with a very harsh edge. It’d be almost ok but the lighting also only works sometimes, and even though the light does stay with the player (as it’s eminating from his head), sometimes the lighting smooths out and sometimes it becomes harsh again.
Any help is appreciated. I’d be surprised if this wasn’t a sort of common issue as you’d think people would want to draw lines that interact with light. Though I couldn’t find any topics related to this specific issue.
If anyone knows anything related to this, please tell me. I’ll keep throwing myself at the problem for any potential fixes. I do still want the lines to interact with light, but in the smooth manner they do in some parts of the video.
Edit: here’s code for you.
← This draws a line to the connected bones of the bone the script is attached to. The property draw_color stays constant. The visual node I am drawing these on is a parent node which allows for the draw calls to not be affected by the rotation of the bone.
I don’t believe there’s anything special about this code, and is probably an issue with some setting or layering or light property or culling or shadow thing. Though, the game does not have shadows (not yet at least).
Edit 2: another thing I found:
When turning the light to red, It can be seen clearly that it’s not that the light is affecting some parts less but that it does not affect some parts at all (as they remain their original colour).
This does not seem to be any shadow-thing as the source of the light seems not to affect the angle of where the lines are lit.
I probably should also mention that I am using a CanvasModulate as the parent node of the whole scene to make the scene dark.
Edit 3: I’m editing this a lot but here’s something interesting I found:
The shadows go away when I try to debug the lighting by attaching the light to the bow, so that I could rotate it around to see if it is affected by where the light points at the lines from. So maybe this issue could be fixed by moving the light around slightly? That would be a totally stupid fix but if it works it works, and I wouldn’t be complaining. I’ll try that real quick and put the 4th edit up if it works.
Ok no that didn’t work either. Now I’m just noticing that for whatever reason movement fixes it. It wasn’t the light moving, but the bones moving. Every time I take out the bow in the game, or jump, or run, the issue also goes away. It’s a strange problem
This doesn’t mean though that my issue is yet fixed. I would like to have lights in my game, but I’ve decided to just continue working by removing lights entirely for now.