0 votes

Godot Version Reference: V3.0.6.stable.official.8314054

It's so simple and yet so hard at the same time, I burned my brain pretty bad and thought, maybe someone can help me with this, so let me explain in a sentence:

Basically, how can we program the light occluders to ignore tiles based on their Ysort? Or maybe the light nodes with the occluders?

I am having a problem with isometric tiles and the shadows generated by the light occluders, the shadows either blend with tile or don't let the light pass correctly, I am sure this is a common topic.

QA on similar topics:
https://godotengine.org/qa/1588/how-to-disable-self-shadowing-in-2d

https://godotengine.org/qa/35474/implementation-of-2d-shadow-culling-for-player-line-of-sight

https://godotengine.org/qa/23818/how-can-make-tilemap-walls-with-occluder-show-and-cast-shadows

https://godotengine.org/qa/25920/2d-isometric-lighting

The self shadowing breaks the depth illusion, how one would tell the light occluder, "Hey, don't shadow this tile because he has a higher Y than you."

The light system is pretty robust but this situation limits it pretty badly. I tried multiple ways like segmeting a tileset of only light occlusions, made an entire polygon, a open square, man I tried everything and could not find a solution.

I'll keep trying until I come wtih a efficient solution and post here, but I am out of ideas right now.

Thanks in advance for any suggestion or tricks,

asked Dec 30, 2018 in Engine by The_Black_Chess_King (265 points)

So, for anyone following this, I have made it work for my project, but, I used the shadows only for the scenario, that means only for the tilemap, any player or object is going to have another type of shadow, not generated by the LightOccluder, much like oldschool pre-rendered shadows.

So, what I did is split up the light occlusion into 2 layers:

Layer 1 -> Walls (The occlusion poly should encapsulate the outer part of the wall)
Layer 2 -> Floors (The occlusion poly should only mark the bottom of the wall)

If I want the a lamp behind a wall, I simply uncheck the wall layer, the light only affects the floor tiles now. But the catch is, for every light in the game, I need two lights, one that will affect the walls and the other the floor. There's still some limitations, but I am getting nice results so far,

But that does not solve all the problems, some overlapped shadows break the depth illusion, I just need to be careful with the light placement position.

-My hopes are that in the future, Godot will have a feature more easy to implement for handling shadows with YSort, or something like it.

Better solution ->> Use layering with the tilemaps, if you duplicate the lamps you will loose A LOT OF PERFOMANCE, as of right now, light2d is a impacts heavily on perfomance.

Create layers to hide or show the light, behind or above walls. Like WALL1, WALL2, WALL3. It is WAY BETTER than my last attempt.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.