PixelLightMapper

Author: Alex Vendelbo Ringgaard (Talzor)

Thanks to: Yoggy

Description
A pixel based light mapper for Unity. I.e. instead of casting rays from lightsources into the world, it will cast rays from all texels in each light map to the light source.

Usage
Place the script in the Editor folder and run the wizard from GameObject/Lightmap Wizard (Pixel).

The light mapper supports both point, spot and directional lights and while it doesn't match them completely it's usually a fairly good approximation.

The objects 2nd UV set should be uniquely laid out (or the 1st UV set if the 2nd isn't used) (Note that most of Unity's primitives aren't uniquely UV mapped)

Options:
 * lightmapMode (default ALL): Determines what objects are lightmapped.
 * ALL: All objects in the scene with a lightmap shader is lightmapped
 * SELECTION: Only directly selected objects are lightmapped
 * SELECTION_OR_CHILD: Only selected objects and thier children are lightmapped


 * Smoothing (default 1): Determines how much the final lightmaps should be smoothed. When smoothing a texel tcenter the lightmapper looks at all texels that are at within smoothing distance from tcenter (including tcenter) and averages the color (texels that have recieved no light is ignored).
 * Save Light Maps (default false): Should the lightmaps be saved after being generated. If false all lightmaps will revert on reimport which is good if your testing out difference light setups and doesn't want to loose the old lightmaps just yet.


 * Alpha Lookup (default false): If true the light mapper whill look at the alpha of all the surfaces from a texel and to the light source and modify the light intensity accordingly. (E.g. if the light passes through a surface with an alpha of 0.4 only 60% of the light will get through to the surface behind). Also surfaces with an alpha value will only receive the light that doesn't pass through. (E.g. a surface with an alpha of 0.25 will only recieve 25% of the light hitting it);


 * No Directional Shadow (default false): If this is true directional light will always be applied regardless of colliders. Use this for indoor scene where the "roof" whould block all directional light.


 * Layer Mask (default everything): The layers that light rays should be blocked by/test alpha against.


 * Ambient Color (defaut black): A color that is added to all texels.