MirrorReflectionLightmapped

Author: Aras Pranckevicius

Description
This is shader+script to make perfectly reflective mirrors that have a texture and a lightmap. Use the "FX/Mirror Reflection Lightmapped" shader on an object, attach the MirrorReflection script to it and there you are.

Works on three texture cards (Radeon 7000, GeForce3/4Ti, Intel 8xx). Requires Unity Pro.

Usage
Prerequisites: This technique requires Unity Pro.


 * Create a material that uses the shader below (FX/Mirror Reflection Lightmapped).
 * Use this material on a plane-like (i.e. flat) object.
 * Attach the MirrorReflection script to the same object.

You can supply a main texture (uses 1st UV set) and a lightmap texture (uses 2nd UV set). Main texture's alpha channel (combined with material color alpha channel) defines the "reflectivity" of surface. So if you want to make reflective water puddles, just draw them into texture's alpha.

Notes:
 * The reflection happens along object's "up" direction (green axis in the scene view). E.g. the builtin plane object is suitable for use as a mirror. If you experience weird reflection, check whether your mirror object is oriented correctly.
 * Reflection calculations use Main Camera (i.e. camera tagged as Main Camera). Be careful not to have multiple cameras tagged as Main in the scene, as you won't know which one is picked up!

Example
A small package including an example scene showing MirrorReflectionLightmapped can be found here:
 * [[Media:MirrorReflectionLightmapped.unityPackage.zip|MirrorReflectionLightmapped.unityPackage.zip]]