This project is read-only.

Occluded Lighting

May 23, 2012 at 8:01 AM

I am trying to do lighting by making a hull over each of my tiles like so,

But what I really want to achieve is Occluded Lighting, with more like this effect here,

getting a bit stuck trying to work out how to achieve this, does anyone have any suggestions?

May 24, 2012 at 6:34 PM
Edited May 24, 2012 at 6:41 PM

Yeah, I know what you mean. Here's the deal, though... there's three different types of lighting: Solid, Illuminated, and Occluded.

Solid is going to black out everything behind and on top of the shadow hulls.

Illuminated is going to black out everything behind the shadow hulls, but leave area covered by shadow hulls unaffected.

Occluded is going to do a kind of mix of the two (visually speaking). It blacks out everything behind and on top of the shadow hulls, except the first hull, which will remain illuminated. So, if you lined up a light, a tile, and another tile behind that tile, then the first tile would be illuminated and the second tile would be occluded (in shadow).

The easiest way to get a close-enough effect would be to use the illuminated effect instead of solid or occluded. However, that would cause the entire back wall to be illuminated as well (but not the area between the back wall and the front wall).

If you wanted to reproduce exactly what you have in your picture, you would use the occluded effect AND create hulls shaped like the walls in your scene. If you have a hull per tile, each tile will cast a shadow on the other tiles, which you do not want.

May 25, 2012 at 8:28 AM
Edited May 25, 2012 at 8:36 AM

Thanks for the reply,

I kinda got something close to what I want... Wrote a bit of code to check if there isn't a wall piece closer to the lightsource, and if there isn't render that wall piece.

Awkward to explain, but easy to show..


I considered making a hull for each wall, but I wanted the player to be able to interact and move the tiles, and I was unsure how to generate complex shaped hulls easily..