Art Design

Unity URP Custom Pass

To help emulate the Retro style of games, a custom pass was added to the Unity Engine. Thanks to the Scriptable Render Pipeline, a custom pass can be injected into any step of the render pipeline. To create the pixelation effect, a specified object layer is not rendered during the normal opaque rendering. Right before transparent objects are rendered, a new texture is created and all objects on the specific object layer are rendered to the new texture. That texture is then downscaled by a specified factor and upscaled to the correct resolution. After pixelating the rendered objects, a sobel filter is applied to each object, giving a black outline around the object. This is done by using the depth texture to compare the depth of the object to it’s surroundings. If the difference is great enough, the pixels around the object are turned black. This texture is combined with the texture in the render buffer and the normal pipeline is resumed.

Positives and Not-so-positives

The benefits of this style is that not all objects are pixelated, allowing for interesting combinations of pixelated and non-pixelated objects. It also performs much better when compared to using a shader that must make a render pass for each object that you want to pixelate (which for me would have been in the hundreds). The one major downside is that the render pass has to occur before transparents are rendered, meaning transparent objects cannot be pixelated. This mostly comes into effect for particle systems, which in Unity are rendered as transparent even when the materials used are opaque. While another pass could be made to pixelate the transparent objects on a different object layer once all normal transparent are rendered, the black outline cannot be recreated as transparents do not write to the depth texture.

Shader Graphs

The models and textures used for this project were from multiple sources and due to this, had some inconsistencies. They all had different textures that would have required extensive work to recreate. So when they were imported into Unity, I needed to create a custom shader that would allow me to balance their colors. This was done by creating one shader that first remaps the textures to different high and low color levels. It is then blended with a color to achieve to allow for a similar color pallet among different objects. Finally, this value is multiplied by a scalar to the emissions node to help for visual clarity and achieve the bright day lighting levels without having to balance lighting throughout the level.