Closed Bomban1 closed 1 year ago
Moving to discussion, as there is no concrete technical implementation provided.
The way Godot's 2D shadows work don't make it possible to have shadows of finite length, both with PointLight2D and DirectionalLight2D. You need to use a custom shader for this which could draw finite-length shadows based on the SDF generated by LightOccluder2D nodes.
The lighting tools don't seem to have anyway to allow light penetration or soft shadows.
You can make shadows have a non-black color or enable soft shadows in 2D already. That said, what you're looking for is probably a "light level" system with tile-based lighting (as opposed to per-pixel lighting). See the paragraph below.
similar to Terraria's lighting system.
This lighting system is often CPU-based because the light data needs to be read back on the CPU for game logic purposes. In multiplayer, lighting is also computed on the server side with no GPU to speak of. This is also why Minecraft's lighting system is purely implemented on the CPU.
Describe the project you are working on
I'm making a 2D game with terrain made with a TileMap and I want to be able to make the light penetrate each tile a little bit, similar to Terraria's lighting system.
Describe the problem or limitation you are having in your project
The lighting tools don't seem to have anyway to allow light penetration or soft shadows.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
A setting in the inspector for LightOccluders that would allow a small amount of light to go through the object.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
I was thinking there could be some sort of slider that would allow a certain amount of light to pass through the Occluder based on the value of the slider.
If this enhancement will not be used often, can it be worked around with a few lines of script?
I'm pretty sure this feature can be done with a shader script or something like that, but I haven't figured out how to do it yet and I still think this feature will be helpful for amateurs (like me).
Is there a reason why this should be core and not an add-on in the asset library?
If somebody's new to Godot and I doubt they'll get some things from the asset library until they learn about it. Also, light penetration should be accessible without needing to download anything else because it'd very useful and versatile. For example, light penetration could also be used for soft shadows.