Creating a noise texture using GLM
To create a texture for use as a source of noise, we need some way to generate noise values. Implementing a proper noise generator from scratch can be a fairly daunting task. Luckily, GLM provides some functions for noise generation that are straightforward and easy to use.
In this recipe, we'll use GLM to generate a 2D texture of noise values created using a Perlin noise generator. GLM can generate 2D, 3D, and 4D Perlin noise via the function glm::perlin
.
It is common practice to use Perlin noise by summing the values of the noise function with increasing frequencies and decreasing amplitudes. Each frequency is commonly referred to as an octave (double the frequency). For example, in the following image, we show ...
Get OpenGL – Build high performance graphics now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.