Fake as much as possible
Real shadows are computationally expensive. We recommend that you implement fake shadow to show shadows on dynamic objects, without resorting to dynamic lights.
Real time shadows are most often generated using a technique known as a shadow map. The cost of scene geometry being rendered to the shadow map is comparable to the number of vertices drawn to it. So it is important to limit the number of shadow casting geometry, as well as real-time shadow casting lights.
Here are some ways to implement fake shadows:
- Use a 3D mesh, plane, or quad, that is placed under the character and applying a blurred texture to it.
- Use a Unity Built-in Render Pipeline feature to apply dynamic blob shadow using projector. This method is more expensive than using a quad under a character, and is not available in the Universal Render Pipeline that is recommended for mobile.
- Write custom shaders to create more sophisticated blob shadows.
In the proceeding screenshot of an example demo, Armies, shadow implementation is shown using shadow meshes.
Paint lighting information directly to textures. By painting some of the light shading into textures, we reduce the extra computation that extra lights require. Painting directly to textures also saves memory when baking the lights in your scene, because the scene needs less texture memory.
Use shaders or materials to simulate lighting. You can use custom materials to simulate light effects. For example, in the game level we might want our character to have rim lighting to improve their visibility and visual look. Instead of using lights to create this effect, you can use a shader effect to create the illusion of lights.
Shaders can provide lots of useful effects to add to the game. Look at the Best Practices For Shaders and Materials guide to learn more.