Enhancing Dedalord’s Skiing Fred for Tegra 4
Our ill-fated hero goes turbo-speed to escape the ever more tenacious Grimmy, slamming unfortunate bystanders in his way and making more unnecessary enemies in the process. Dedalord enhanced the game to take advantage of the power of Tegra 4. Mariano Merchante explains how they did it.
Hi! I’m Mariano Merchante, Technical Artist at Dedalord. When we had the opportunity to look at Tegra 4’s graphics capabilities, we decided to explore its potential and take advantage of it in our latest Game, Skiing Fred. To upgrade Skiing Fred’s graphics, we had to face some fun challenges involving shaders, lighting and effects inside Unity, which I’ll further describe.
Some context first: our freckled main character Fred is constantly escaping Grimmy, his cute and deadly antagonist. Fred ends up stranded in the middle of snowy mountains and has to use any means to avoid meeting his demise such as an outhouse door that doubles as a snowboard, snowmobiles and even prehistoric birds.
The game starts with Fred making his way around a hazard ridden track, dodging deadly traps, explosive penguins and precipices while chased by Death itself!
-When we started upgrading the game’s graphics for Tegra, we definitely wanted to give the characters a softer look. The previous shader was an unlit texture with color tinting, and because we decided to use Unity’s lighting system, we had the opportunity to make it look good. With a little bit of research we decided to use a fake BRDF lookup table to fake the lighting of the character surface, a method used by a lot of other game developers, such as Madfinger. We decided to use the incidence of the camera (NdotE) instead of half direction (NdotH), so that we could focus on rim light instead of specularity. This later proved to be useful to highlight the snow track’s turns and twists in the snow shader.
The game scenes are predominantly covered in snow. In real life, snow is not just full white: it has a lot of subtle tints that tend towards blue in shaded areas, ice crystals glitter under certain conditions, etc. However, simplified snow is portrayed with a white/bluish color, which became a problem at the moment of designing some effects (such as additive!).
But with Tegra 4 we could use more advanced shaders to give the snow a chilly feeling. We ended up reusing our character shader with a nice and “faked up” BRDF lookup texture but with a twist: a bump map that had high frequency noise to simulate flakes, mapped in worldspace coordinates to prevent some stretching from the race track uvs. To exaggerate the snow shader, our main directional light has a low angle of incidence with respect to the floor.
Thanks to a bug, we discovered that the shader with no texture assigned looked awesome! So we took advantage of that and implemented it as an additional effect to the blizzard weather event. It looks chillingly cold:
Since we decided to use Unity’s lighting system, we really wanted to add dynamic lights to some of the events that occur in the game, such as the meteor shower and lightning storm. The only reasonable way to implement this was through vertex lights; we needed a lot of illumination sources and the performance would drop considerably otherwise.
However, we quickly hit a limitation: Unity supports up to 4 simultaneous vertex lights (at the moment of development). Fortunately for us, because our game is essentially a runner, we already knew the order in which lights appeared, so we used that information to cull lights and force Unity to activate the closest 4 lights to the player. We also added a intensity fade when enabling/disabling lights which gave it a nice, smooth transition.
As a secondary detail, we added a snowmobile spot light when the player is inside a cave, and because it is just one small light (and caves had less visible objects) we could afford using a pixel light with some culling options to just affect the snow track and some decorations.
Having more GPU power with Tegra 4 gave us a bigger particle budget, which we took advantage of by adding weather effects such as rain and fire embers, and more particle count in other effects in general. Taken together with the dynamic lights previously discussed, these details really added to the feeling of chaos and danger in the game.
One important feature we wanted to have was shadows for the main character, Fred. Fortunately, Unity had just implemented shadows for mobile, and by enabling it, it “just worked” with Tegra 4 in terms of performance. It needed some fine tuning and culling, mainly because there are a lot of objects in the scene and we only wanted to cast shadows on the snow track, but overall it was straightforward, and the framerate drop was small in comparison to other devices.
And that’s it! We did a lot of tweaking and upgrading of other ingame effects and shaders mostly minor such as the snowboards’ shader. We’re amazed at the capabilities of Tegra 4, which enabled us to boost up visuals without needless hassle while maintaining a stable and smooth framerate at all times.