Vertex Displacement Shaders
In the last chapter, we explored a gallery of 2D shaders, and we studied how to apply various effects on our sprites, from basic hue-shifting and saturation adjustments to advanced visuals such as holograms or dissolves.
To continue these experimentations, we’re now going to focus on another common category of shaders – vertex displacement shaders. Those shaders, as the name implies, rely primarily on the vertex displacement technique, or in other words, the idea of using the vertex shader function in our code to slightly offset the position of the vertices of our model and simulate interesting deformations.
One of the big strengths of vertex displacement is that, because it is done in shaders, and thus on the GPU, it allows us to alter the model’s geometry very efficiently. It is, of course, limited – in particular, it can only transform pre-existing vertices, and yet it can produce quite impressive results when used well...