How does it work? Summary: It is 1 pre-baked lighting map that is quickly re-rendered when any given bucket become dirty. This is done by slicing up images of lights into 16x16 chunks and placing each chunk into a cell on a grid that is overlayed over the tilemap. When re-rendering of a light-source needs to be done, we only re-render the cells that that light touches. As an added efficiency bonus, each 16x16 image chunk has meta-data associated with it. Including the highest and lowest RGB values. In this way I can additively blend together stacks of lights in a given cell. Then when one light is deleted, I have TWO re-render options: Option1: If no overflow is detected, SUBTRACT the bitmap you are deleting from the pre-baked lighting map. Option2: If overflow exists, Re-Add all of the bitmap's with a given [cell/stack] on the grid. Then decide if the re-rendered stack is overflowing. What do I mean by overflow? If we have two pixels: [200] AND [045] And add them to get: [245] If we want to get back to [200], we can subtract [045] HOWEVER, if we have two pixels: [200] & [177] And add them to get: [377] Well.... RGB max value is 255... so it gets capped at 255. AKA. Overflow. When overflow occurs, we cannot work backwards. We cannot subtract [177] from [255] to get back to [200].
Saturday, January 11, 2014
The new lighting is here:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment