- Follow step 1 and step 2 in Steps to use Shadow Receiver with Projector.
- Create an empty game object and attach “ProjectorManager” script to it. You can find the script file in “FastShadowReceiver/Scripts/Util” folder.
- Setup the ProjectorManager component as in Setup Projector Manager section.
- Attach “AutoProjector” script to your Projector object (or prefab), so that it can be automatically registered to the ProjectorManager at runtime.
- Create MeshTree and MeshShadowReceiver as described on Steps to use Shadow Receiver with Projector (steps 3 to 7), if you want to project shadows on non-flat surface. You can skip this step if you don’t need shadows on non-flat surface of the large environment object. ProjectorManager has similar functionality as InfinitePlaneShadowReceiver and RaycastPlaneShadowReceiver. It can create quadrangle polygons to draw shadows. So, you don’t need to create a shadow receiver object unless the large environment object has non-flat surface.
- If you created a MeshShadowReceiver at step 5, register the MeshShadowReceiver object to ProjectorManager, and assign some layers to ‘Receiver Layer Mask’. The MeshShadowReceiver will be duplicated at runtime accordingly to match active projector instances. Also, one of the layers in ‘Receiver Layer Mask’ will be assigned to each duplicated shadow receiver. If you have many projectors in your scene, It is better to assign as many layers as possible to ‘Receiver Layer Mask’. For more details, please have a look at “RandomSpawn – Mesh” demo.
Links