Inside Velocity 2X: Lighting
If you’ve heard the music Joris de Man has created for Velocity 2X, you’ll know the great sense of energy, mood and atmosphere it conveys. We worked very hard to match that from a visual point of view with lighting and visual effects. Today I’ll talk you through some of the things we achieved with lighting.
Actually, you can listen to the music whilst you read:
Velocity 2X supports 20 dynamic lights in a single frame. This means that artists can put down hundreds of lights in an environment, as long as only 20 or less are visible at any given time. Besides hand-placed lights in the environment, the bombs, bullets, crystals, hazards and survivors all emit their own dynamic lights.
Lights emitted by explosions:
Pink lights emitted by crystals:
Kai’s 360 degree shooting emits blue light:
The lighting calculations are done in a novel way for Velocity 2X. Due to memory limitations on PS Vita, we couldn’t use normal maps. Instead we use the brightness intensity of the pixel that is being lit to determine how much light the pixel receives. Artists can therefore create environment assets which contain lighting information simply by making certain areas brighter than others.
If we take the colour intensity of each pixel in the texture (texel) then it gives you a number between 0 and 1 that can be used to determine how much light that pixel receives. This helped to keep our assets at high resolution without having to use separate assets for normal maps.
Having 20 dynamic lights was probably the toughest thing to achieve on Vita. We started with per-pixel lighting and had support for only 4 lights. As soon as we started increasing the number of lights, the frame rate started plummeting. In order to support 20 lights we had to use vertex lighting. This resulted in harsh and undesirable falloffs.
Notice how the lights emitted by crystals give the environment a hard edged look:
To avoid this we came up with an interesting way to calculate the intensity of light. First, we represented the radius of light much larger than its actual size in the game, and interpolated it to the distance between the light source and each vertex using a power curve. The actual light blending was still done per pixel and that gave us slightly better results. Notice the reduction in harsh edges compared to the previous image, but still not smooth enough:
Finally we increased the vertex resolution of our sprites to get the results very close to per-pixel lighting. You can still occasionally see harsh lighting fall offs, but they are so minor that it’s impossible to notice them unless you really know what you are looking for =)
From our perspective, having the lighting on Vita and PS4 indistinguishable from each other was the biggest technical achievement in Velocity 2X. It required much more than just the optimizations mentioned in this article, but boy the results are worth it!
We’ve heard lots of people ask whether the game looks as good on Vita as it does on PS4, and it absolutely does. In fact, the beautiful OLED screen really makes the colours pop!
Check out the lighting effects in the trailer below: