Grid Based Lighting in XNA/Monogame
Posted
by
sm81095
on Game Development
See other posts from Game Development
or by sm81095
Published on 2013-06-23T21:59:36Z
Indexed on
2013/06/24
16:39 UTC
Read the original article
Hit count: 259
I know that questions like this have been asked many times, but I have not found one exactly like this yes. I have implemented a top-down grid based world in Monogame, and am starting on the lighting system soon. How I want to do lighting is to have a grid that is 4 times wider and higher, basically splitting each world tile into a 4x4 system of "subtiles". I would like to use a flow like system to spread light across the tiles by reducing the light by a small amount each time. This is kind of the effect I was going for:
http://i.imgur.com/rv8LCxZ.png
The black grid lines are the light grid, and the red lines are the actual tile grid, and the light drop-off is very exaggerated. I plan to render the world by drawing the unlit grid to a separate RenderTarget2D, then rendering the lighting grid to a separate target and overlaying the two.
Basically, my questions are:
- What would be the algorithm for a flow style lighting system like this?
- Would there be a more efficient way of rendering this?
- How would I handle the darkening of the light with colors, reducing the RGB values in each grid, or reducing the alpha in each grid, assuming that I render the light map over the grid using blending?
- Even assuming the former are possible, what BlendState would I use for that?
© Game Development or respective owner