Blend the two surfaces together with a custom shader – drawing silhouettes where appropriate.
Draw actors (player, enemies, portals) to an actor surface.
Draw occluding tiles (statues, pillars, upper tiered floors) to an occlusion surface.
We pull this off using the following steps: The core goal of this idea is to NOT draw pixels of the occluded sprite and instead, draw some type of silhouette. Silhouettes, Surfaces and Shaders – Oh My! Not cool! We want to be able to see that the player is behind the statue. Here’s an example of the problem, notice how the player disappears behind the statues. So, what is the problem we’re trying to solve? When the player (or any NPC) walks “behind” something in the level, we’d like see a silhouette rather than nothing. The occlusion methods described in this article only apply to tile-based collision systems. Instead, everything was based on tiles, using tile-based collision techniques. In Dungeon Rustlers we did not use objects for in-level props. In addition, some levels have multiple tiers with the possibility for catwalks covering lower tiers. Within a level, there were tiles that the player and enemies could walk behind – such as pillars. In Dungeon Rustlers, I wanted the player to still be able to see sprites when they were behind certain tiles. It has many useful features and one in particular we’ll talk about today: custom shaders.