Creating a seamless noise texture
It can be particularly useful to have a noise texture that tiles well. If we simply create a noise texture as a finite slice of noise values, then the values will not wrap smoothly across the boundaries of the texture. This can cause hard edges (seams) to appear in the rendered surface if the texture coordinates extend outside of the range of zero to one.
Fortunately, GLM provides a periodic variant of Perlin noise that can be used to create a seamless noise texture.
The following image shows an example of regular (left) and periodic (right) 4-octave Perlin noise. Note that in the left image, the seams are clearly visible, while they are hidden in the right image.
In this example, we'll modify the code from the previous recipe to produce a seamless noise texture.
Getting ready
For this recipe, we'll start with the code from the previous recipe, Creating a noise texture using GLM.
How to do it...
Modify the code from the previous recipe in the following way.
Within...