Pixel lights and shadows

Hello, I am making a pixel-art game and right now I am looking for a way to add some lights on levels but the whole topic was always confusing for me even in other engines.
So far, I found a great light system, but I don’t feel like I cam fully use it in my game. The problem is that I don’t understand, how to change shadow resolution(?), so it will look more pixel-art-like (just make shadow pixels bigger).
I found some article about light made with Unity systems and I wonder if something similar is possible on Defold:

It is definitely needs a lot of work with shaders to understand something, but I started to learn them just today…

2 Likes

A basic light system is the one thing that I’m missing the most in Defold.
I hope that a simple 2d light system will be on the near roadmap.

Godot has - in my opinion - a very easy system ( https://www.youtube.com/watch?v=6lximAlvBoE ).

1 Like

I watched the Godot video. It looked really easy for the game dev to use, no need for any (written) programming. Magic.

In Defold you have to set up buffers, material metadata data, write shaders (vertex code, fragment code), render code. You need to work out how to get the ‘lights’ to work seamlessly with each other and the rest of the game code. All the different bits tend to be scattered all over the code base. Any changes or additions will require you to completely understand everything you have done so far so you can add in the new bit. The more you add the more confusing, spaghetti like and flaky it can get.

Assets are great and it is superb the time and effort that has gone into them (same with the rest of Defold). Using these jumps you straight to trying to work out how to make it work in your game. Here it is a case of trying to work out interdependencies across the code base. Assets have API’s to go through, however there will be side effects which are complicated and essential to understand how to integrate the asset code into the game code.

So how to create what is in the Video in Defold? I do not know. I am confident that there is much of this that I don’t understand. The Defold team are fantastic so maybe they will magic this up.

If you want a more of a no-code approach then Godot looks like a great choice; dunno I have not used it. I quite like writing code.

3 Likes

I have the same difficult to manage a simple light system. I hope a day a light 2d component that could be easily usable inside my projects without making sprites that emulates lights

2 Likes

Yes, and that is - in my opinion - not an easy task to understand and to code all that stuff.
Not like all the other LUA scripting for the game logic.

Godot has other things I don’t like. Overall I realy like Defold I must say.

The are doing an excellent job. And as far as I have read, they already worked on it in the past.
Since I found now many topics asking for that feature, maybe it will be on the roadmap in the near future - who knows.

1 Like

This is how light and shadows works at almost every engine. Difference is they are hiding those things from developers and you don’t know what is going on.
If you don’t understand how something works, you can’t optimize it. Also they have to cover every scenario, this is why most of these solutions are bulky, slow or big( file size and memory). I’m not saying they are bad, all I’m saying is I highly recommend you to learn the basics. Don’t be afraid to try and fail.

This is totally opposite of the Defold’s philosophy. Defold has just building blocks.

4 Likes

Hmm, guys, does the simple light and shadows example works for you? I have show smaller occluder plus shadows are flickering. 1.9.2, windows

Yes, but on the other hand - engines suppose to hide things from developers, because that’s what they kind of are. Defold philosophy is really the opposite of nodes philosophy in Godot (damn, I even seen a “ladder” custom node today that really creates a patametrized ladder 3d model with colder and script). But for lights - developers really just are looking for few simple solutions. If they want something more unique (or more performant) they have to dig deeper anyway in any engine even those offering Global Illumination solutions. It’s a never ending debate :grin:

2 Likes

I’m not against it. It would be very nice to have even for a quick prototype. I’m just trying to encourage them to learn the fundamentals.

5 Likes