Create fake shadow using blob shadow projector: Unity tutorial

In this article, we will see how to create fake shadow using blob shadow projector in unity applications. The fake shadow costs much less on performance as compared with real time shadows; thus, provides considerably high FPS on low configuration device or mobile phones.

Set up Scene

I have set up a simple scene for the example. The real time shadows are displayed in the scene.

Turn off material shadow

Change the Cast Shadows property to off from the Mesh Renderer component of the Sphere.

Create shadow with Blob shadow Projector

Add blob shadow projector in the scene

  • Import Standard Assets in the project. You can find the standard assets in the asset store.
  • Add the BlobShadowProjector.prefab (Assets -> Standard Assets -> Effects -> Projectors -> Prefabs) in the scene.

Customize BlobShadowProjector Object

  • Set the position of blob shadow projector on the top of the Sphere object.
  • Blob shadow projector is attached with a Projector component. Customize its properties like clipping plane, field of view or shadow material upon your choice.
  • Attach below script to blob shadow projector object. Set player variable as Sphere Object in the editor (drag and drop). Now, it will follow the Sphere object.

Ignore Player object

We don’t want to have shadow on the Sphere object itself. So wee need to set the projector to ignore this object.

  • Create a new layer (IgnoreBlobShadow) and change Sphere object to this layer. Name the layer of your choice.
  • Click on the Ignore Layers property of Projector component and select the above layer that was applied to the Sphere.

Run

Set up is now complete. Run the project to see the effects.

Hope you gen an idea about creating fake shadows using blob shadow projector. Please post your comments for queries and feedback. Thanks for reading.

Share Button
The following two tabs change content below.
Gyanendu Shekhar is a technology enthusiast. He loves to learn new technologies. His area of interest includes Microsoft technologies, Augmented reality, Virtual reality, unity3d and android development.

Gyanendu Shekhar

Gyanendu Shekhar is a technology enthusiast. He loves to learn new technologies. His area of interest includes Microsoft technologies, Augmented reality, Virtual reality, unity3d and android development.

Leave a Reply

Your email address will not be published. Required fields are marked *