Monday, May 11, 2015

opengl - How do I implement occluded lighting in a block-based 2D game?



I want to have 2D lighting that can be blocked by in-game objects. My game has a top-down view and all game objects are described by rectangles.


Let's say I have a 10x10 world and I place a light at 1x1 and walls all around that light. I want to be able to see the light source at 1x1, but not anywhere else, because it's blocked by the walls.


I've heard of casting light rays works, but how does that really work?




No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...