Bernard Hwang

Level Designer

Dev Blog - MechDog - Visuals

DevBlog, Solo ProjectBernard HwangComment

Small solo projects like MechDog provide great opportunities to explore new techniques, so I decided to try something different for the game's visual style. This dev blog entry will be less about design and more about art.

Everything you see in this post is work in progress.

Textures

Normal Maps

Applying a normal map on sprites allows the sprites to appear like they have height changes.

Physically Based Rendering

With Unity 5's PBR shader, I applied Unity's 'Standard' material on the sprites to be able to control how the sprites react to light.

using PBR and normal map

Lighting

I tested out different lighting approaches to see which I preferred.

2D Lighting

I initially tried a 2d lighting solution. The 2d light caster only casted light in areas not behind 2d collider marked as shadowcasters. It was fairly simple to implement, but it was difficult to tweak values like light strength and fade off distances.

A big drawback with 2D lighting is that it is not fast enough. For animated sprites to cast accurate shadows, each frame has to have its own 2d collider shaped like the frame. The 2d lights had a hard time matching the speed at which the sprite animations were changing.

3D Lighting

I then tried using Unity's built-in 3d lights for shadows. After assigning 3d shadow casters to each sprite and allowing sprites to receive shadows, the visuals really started to look good. I still had to make a 3d mesh for each frame of a sprite animation so that all frames could cast accurate shadows, but the shadows were cast much faster than the 2d lights.

A big plus with this method is that I am able to get sprite tiles to cast shadows on themselves by placing shadowcasters that extrude to in front of the sprite. In the image below, you can see two different light sources affecting one sprite with a clear divide created by a shadowcaster.