Wall Shadows in Blockwick 2

blockwick_2_half_walls

The idea of short walls was conceived fairly early in the design process, but would require the use of a custom shader if the idea was to work and aid in the illusion of depth.

The first step was to build alpha texture that could be used as a mask. Since the walls are static in each scene we needed only generate the mask once when the puzzle scene is loaded. To do this we create an appropriately large texture based on texture and screen resolutions and render the alpha of each wall sprite to that new texture. Voila.

Second, each frame the scene is rendered normally. After which, a second camera renders only the shadows using a shader that offsets the shadows vertically and multiplies the sprite texture by the mask texture to mask out any pixels that are not over a wall sprite.

That’s it! Fast, easy shadows that look 3D.