Overview
Three visual effects that have been missing from PyramidPanic are:
- A unique post processing effect for a FogOfWar style feel
- The ability to add lights to the game
- Having a separate post processing effect for ghosts once a player dies
These features were added in a PostProcessing feature pull request, allowing all three to be taken advantage of efficiently.
Fog Of War
Fog of war was added to the game, allowing alive players to have a restricted view and knowledge of the world. This effect was accomplished by subclassing the Camera class and creating a FogOfWarCamera which renders the game with fog of war when active.
The style of the FogOfWar was desired to be a pixelated appearance to match the general art style of the videogame.

FogOfWarCamera
The camera used for the fog of war effect is FogOfWarCamera.h. This subclassed camera plugs into the SpriteRendererManager to take advantage of FrameBufferObjects and post processing effects to create the effect.

The effect can be broken up into three stages. First, all lights visible on the screen are located via the quad tree. Each light has a position, light strength and light colour which determines how it penetrates the fog of war. A black texture is generated which represents fog, with coloured circles representing the lights. The general game screen is rendered into a frame buffer, and then both the fog of war preprocessing texture and the rendered frame buffer texture are fed into a fog of war post processing effect.
Post Processing Effect
The two textures generated from the FogOfWarCamera are fed into the FogOfWar Shader. This shader takes the FogOfWar preprocessed texture, applies a gaussian blur to it, and then multiplies the preprocessed textured with the standard game rendering.
This effect allows for coloured lights in the preprocessed texture to let the rendered game seep through, being visible despite the fog. Places without lights do not have colour, and are instead rendered near black.
Light
'Light' can pierce the fog of war, allowing for not only breaks in the fog to appear, but these breaks to be colourized based on light colour and strength. The intention was for lights to be built in an efficient way for programmers to easily turn on and off lights for any object.
Light Component
The Light.cpp component subclasses Component for integration in the games component entity system. All gameobjects have multiple components. Lights have a setSize and setColor methods for customizing the strength and colour of any particular light. Lights have an OnStart, OnUpdate and OnEnd methods that get called automatically, allowing them to have unique effects such as changing colours over time or flickering.
Ghost Vision
Once a player dies, they become a ghost. Ghosts can fly through walls and possess various objects around the world. Ghosts do not see fog of war, and instead have the world rendered in a semi-grayscale blue-tinged hue.

GhostCamera
GhostCamera subclasses Camera and plugs into SpriteRendererManager to acquire the desired effect. It renders the game into a frame buffer object, then passes the rendered game as a texture into the ghost camera shaders.
Post Processing Effect
The effect is found in the shaders. It takes the color that should be rendered, averages it in order to get the grayscale, and then applies a grayscaled texture with a lerped blue value between the grayscaled blue and the rendered blue.
Posted on Utopian.io - Rewarding Open Source Contributors