This is a first simple yet effective vertex shader technique that produces a wobbling effect on the object's geometry. This shader produces animation effects on the geometric shape like a sine wave; this effect is implemented within the vertex shader. This recipe also demonstrates another animation technique that produces a water pond ripple effect.
For this recipe, we will reuse the existing Phong shading recipe from the previous chapter. Rename the shader files with a name of your choice; for this recipe, we will rename these to WobbleVertex.glsl
and WobbleFragment.glsl
. The wobble and ripple shader are both vertex shader-based recipes.
This section will provide the changes required to implement the vertex shader in order to produce the wobble effect. Modify the WobbleVertex.glsl
as per the following code; there is no change required for the fragment shader:
#version 300 es // Define amplitude for Wobble Shader #define...