Hello guys,

Just a quick post to talk about one of the issues I encountered in Unity while working on the PC version of Fractal Space. It’s just to help other developers who might encounter the same problem and wonder how to fix it.

The Problem

We are in Deferred Rendering. In some cases, when a Realtime Light set to cast Shadows is rendered on far edges of the screen, the lighting can completely disappear:


This problem does not occur if the Realtime Light is set to No Shadows.  But we need Shadows in this situation, so we can’t simply remove them.

The False Hope

In Unity, the number of maximum dynamic lights is capped by the Max Pixel Lights parameter in the Project Settings -> Quality Settings. Let’s set this parameter to 1000 to test. The Render Mode parameter on each light allows you to priorize lights over others by flagging them as Important or Not Important.

Setting the Render Mode of these particular lights to Important should fix that.

Ah… wait, no, it still happens.

In Deferred Rendering, the Max Pixel Lights parameter doesn’t apply; it’s only valid in Forward Rendering.

Then, what’s the real solution?

The Real Solution

It seems like Unity considers a light as “Useless” if the following conditions are met:

  1. Light’s Shadows are set to Hard Shadows or Soft Shadows
  2. The light currently casts 0 Shadows

Meaning, that, regardless of any gigantic Pixel Light Count and Render Mode set to Important, the light will no longer be rendered if it is currently casting no shadows.

That’s actually problematic if you require shadows on a realtime light that is moving around, and still want to limit shadow casters count in your scene for optimization.

It’s not a perfect solution, but it works until we get a final fix; if you wish to never encounter this problem at runtime, you need to ensure you have at least 1 shadow casted from your realtime light at all times.

I hope this helps if you have the same issue while working on your projects – if you have any better solution or suggestions, feel free to comment here 🙂

Charles, from Haze Games.

Haze Games

Game designer & Unity C# Developer at Haze Games, working on Fractal Space.


Leave a Reply

Avatar placeholder

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.