DE

Implementation of a stencil shader

March 2020

Stencil Shader Preview

In video games it often happens that characters or objects of particular interest are occluded by more unimportant things like the scenery. To show the player anyways I created a utility shader. The shader is a combination of a vertex displacement shader and a stencil shader.

The stencil shader uses the stencil buffer to keep the player object permanently visible.

The vertex displacement shader makes sure that the vertices of a sphere are displaced over time in a noise pattern. This creates a bubble effect around the player. This bubble is also animated and is dynamically scaled as soon as the object is hidden.

Back to the overview