How to make tiles with occluders visible?

Godot Version

4.2.2

Question

I currently have two tile maps in the scene, one for the floors and walls and such, and one for objects that are going to be on the floor. I set up an occlusion polygon in the tile editor in the tilemap for a wooden box, and it casts a shadow just fine. The problem is, the wooden box itself is also a shadow! How can I make it cast a shadow while itself still being lit up?

1 Like

I found a solution, but I don’t like it…

I created a second PointLight2D node on the lantern that was a copy of the first one, except I changed the Item Cull Mask in the Range and Shadow to be 2 instead of one. I then created a second Occlusion layer in the TileMap that was a copy of the first one, and changed the first layer (Occlusion Layer 0) to be set to Light Mask 3, and I set the second layer (Occlusion Layer 1) to Light Mask 1. This let’s the object be lit up while still casting a shadow.

I am really hoping that this is a ‘stupid solution’ and that someone here knows a better way to do this…

1 Like

Thank you! Using the Item Cull Mask in both the Range and Shadow is what made this finally work for me as well. In case anyone else is lost and comes across this, this is what I did:

  1. set up one light2d node and a tilemap node, and have their light cull mask and light mask be on the same layer. This is your ‘normal’ tilemap, which displays shadows how you want.
  2. set up another light2d node and a tilemap node, but have this tilemap be a copy of the first one with an occlusion layer, and set their light cull masks and light mask on the same layer (something like layer2, if for step 1 you have them on layer1). This second tilemap is solely lit up by the second light2d node, and the light2d node does not affect anything else in the scene.

Doing it this way is probably pretty tedious, but it also makes it so the ‘visible’ tiles from step 2 are always lit up, and the first tilemap occludes shadows like you want.