If you’ve heard the terms “Pixel Lights” and “Vertex Lights” but weren’t quite sure what they meant, this article should help you get a basic understanding of the differences.
When working in Unity, you can choose between Forward or Deferred rendering. I won’t go deep into the differences of these two today, but may cover them in the future.
For this article, we’ll be working with Forward rendering. Most of my recent game development has been in VR, and forward rendering tends to be a great choice for VR games that need every ounce of performance they can get.
What’s the visual difference between Pixel & Vertex lighting?
Pixel Lights determine shading for each pixel of the object being shown. Vertex lights will calculate the lighting of each vertex and interpolate between them.
Sometimes vertex lighting is ‘good enough’ (more often when objects are further away). Sometimes it looks terrible and needs to be addressed.
To show the difference between per pixel & per vertex, here’s a visual example.
You can see our spotlight renders as you’d expect. Light is shone on the sphere and the ground below it.
With the vertex light, we see a totally different story.
How did I toggle this? – Render Mode
For the demo pictures above, I changed the “Render Mode” of the spotlight to “Not Important”
How many will be pixel lights?
You can force your lights to be pixel lights by setting them to “Important”. You generally don’t want to do this for all of your lights, but if you have a very ‘important’ light, you can force it to be a pixel light.
By default, the lights are set to Auto. In Auto mode, the lights are prioritized by intensity and distance from the object. Closer / brighter lights are rendered per pixel and the others are vertex lights.
The number of lights that will be set to a Pixel light is determined by your quality settings.
You can see the setting under the “Rendering” section. Here’s the default for “Good”.
Changing Quality Settings
To wrap this up, I wanted to show how this can matter when you change quality settings.
Here’s a cube with two spotlights on it set to Auto.
When I change the quality settings to Simple though, take a look at the change.
Remember “Simple” defaults to 1 pixel light.