Skip to content

Recitation 07 Perlin Noise and Terrain

jijup edited this page Nov 17, 2026 · 4 revisions

Recitation 7: Perlin Noise and Terrain

Objectives

In Recitation 6 the vertex shader moved a few quads around. This week it builds a whole landscape. We hand OpenGL a flat grid of triangles, and the vertex shader lifts every vertex to a height computed from Perlin noise. The fragment shader, which is given, colours the result as a topographic map: blue for water, green and yellow for low land, brown and white for mountains, with contour lines every 0.1 in height.

The ideas behind this recitation come from two lectures. Keep them open while you work:

  • Lecture 9.2 (Perlin noise): gradients on a lattice, the dot products, the fade curve and the blending.
  • Lecture 10.1 (Fractals): octaves, fractional Brownian motion (fBm), the parameters H and lacunarity, the grid mesh, and the ridged multifractal. In this recitation you will:
  1. Build a grid mesh: two triangles for every cell of a flat grid.
  2. Write Perlin noise in GLSL, in the vertex shader.
  3. Add octaves of noise with fBm, and move every vertex up by the result.
  4. Write a ridged multifractal, a variation of fBm with sharp mountain crests (advanced). This is the first of three recitations that build up to Assignment 2. In the assignment you will compute the noise on the CPU and store it in a height map texture, so you will reuse the ideas from today, not the code as it is.

Figure 1 is what you will have at the end.

alt text


1. Getting the new exercise

You already have the repository. Do not clone it again. Open Git Bash inside your GraphicsLab2026 folder and run these four commands in order:

git add shaders
git commit -m "my shaders work"
git checkout -- CMakeLists.txt
git pull
  • git add shaders and git commit save last week's work into your own local history.
  • git checkout -- CMakeLists.txt restores my version of the top-level CMakeLists.txt, which has the line for this week's exercise.
  • git pull downloads this week's exercise, the terrain folder. Be careful with the third command. Typing git checkout -- . with a dot discards your changes to every file.

2. Building

  1. Open the CMake GUI, point it at your GraphicsLab2026 folder and its build folder as before, and click Configure, then Generate. This makes the new terrain project appear.
  2. Click Open Project to open the solution in Visual Studio 2019.
  3. In the Solution Explorer, right-click terrain and choose Set as Startup Project.
  4. Choose Release, then build and run with Ctrl+F5. The program opens an 800 x 800 window called Recitation 07: Noise Terrain. As in Recitation 6, the console shows
Compiling Vertex shader: Success
Compiling Fragment shader: Success
Linking shader program: Success

If a shader has a mistake, it prints Failed: with the GLSL compiler's message and a line number, and the program closes. Almost all of your work this week is in a shader, so keep an eye on the console.

The shaders are copied next to the program (into build/terrain/Release) every time you build. So after you edit a .glsl file, build again (Ctrl+F5 does that) before you run.


3. The starter code

Build and run the starter code before you change anything. You should get Figure 2: an empty window in the colour of map paper. That is expected. The grid has its vertices, but no triangles yet, so nothing is drawn.

alt text

3.1 The files

File What it does Status
main.cpp Opens the window, sets up the camera and reads the keys. given
Terrain.h Makes the grid, puts it on the GPU and draws it. Holds GRID_CELLS and NoiseSettings. Task 1, Task 3 (one number)
Shaders/terrain_vshader.glsl Computes the noise at every vertex and moves the vertex up. Tasks 2, 3 and 4
Shaders/terrain_fshader.glsl Colours by height, draws the contour lines and shades the slopes. given
Helpers/ShaderHelper.h, GlError.h, Matrices.h The same helpers as in Recitation 6, plus the camera matrices. given
Helpers/Capture.h, lodepng.h, .cpp Saves the screenshots (key P). given

3.2 The keys

Key What it does
1, 2, 3 Perlin noise, fBm, ridged multifractal
Up, Down one more, or one fewer, octave (from 1 to 10)
Left, Right turn the terrain
Space spin on and off
F wireframe on and off
P save a screenshot
Esc quit

After every key press the console prints the current setting, for example fBm noise, 5 octaves.

P saves screenshot_000.png, then screenshot_001.png, and so on, next to the program in build/terrain/Release. Rename each one to the file name asked for in Sections 8 and 9.

The program starts in mode 3, the ridged multifractal. Until you finish Task 4, ridged() simply returns fBm(), and until you finish Task 3, fBm() returns perlin(). So whenever you run the program, you see your newest result without pressing a key.

3.3 The noise settings

At the top of Terrain.h:

const int   GRID_CELLS = 48;     ///< cells per side, so (GRID_CELLS + 1)^2 vertices (Task 3: make it 256)
const float GRID_SIZE = 8.0f;    ///< the grid covers [-4, 4] x [-4, 4]
 
struct NoiseSettings {
    int mode = 3;                ///< 1 Perlin, 2 fBm, 3 ridged multifractal
    int octaves = 5;             ///< K
    float H = 1.0f;              ///< roughness: larger is smoother
    float lacunarity = 2.0f;     ///< L: frequency gain per octave
    float baseFrequency = 0.5f;  ///< noise cells per world unit at octave 0
    float heightScale = 0.8f;    ///< world height of a noise value of 1
};

Terrain::draw() sends every field of NoiseSettings to the vertex shader as a uniform with the same name, as time and id were sent in Recitation 6. The Questions in Section 8 ask you to change some of these numbers. Remember to build again after each change.

3.4 How the terrain is drawn

The world is z-up: the grid lies in the x-y plane, and heights go along z.

  1. Once, in Terrain::genGrid(): make (GRID_CELLS + 1) x (GRID_CELLS + 1) vertices, evenly spaced over [-4, 4] x [-4, 4], all with z = 0. Put them in a VBO, and the triangle indices in an element buffer (EBO). This is new: instead of repeating a vertex for every triangle that uses it, we store each vertex once and describe each triangle by the numbers of its three vertices. The draw call is glDrawElements() instead of glDrawArrays().
  2. Every frame, in the vertex shader, for every vertex:
vec2 p = vposition.xy * baseFrequency;   // where to read the noise
height = ...;                            // perlin(p), fBm(p) or ridged(p), by mode
float z = 0.0;                           // TODO Task 3b

height is an out variable. The GPU interpolates it across each triangle, and the fragment shader picks the colour from it. 3. Every pixel, in the fragment shader: the colour from the height, a darker line every 0.1 in height, and some shading from the slope of the triangle.

So the colours show the noise even before the vertices move. You will use this in Task 2.


4. Task 1: The grid mesh (15%)

Open Terrain.h and find ///TODO Task 1 in genGrid(), about line 47. The vertices are already made, row by row: first the bottom row from left to right, then the next row, and so on. So vertex (i, j), in column i and row j, is number

i + j * N,      where N = GRID_CELLS + 1 is the number of vertices per side.

The cell (i, j) is the square between columns i and i + 1 and rows j and j + 1. Its four corners are:

c = a + N ---- d = c + 1
  |          / |
  |        /   |
  |      /     |
a ------------ b = a + 1          with a = i + j * N

Figure 3 shows a small example with N = 4 (3 x 3 cells). For the cell (1, 2): a = 1 + 2 · 4 = 9, b = 10, c = 13 and d = 14, so its two triangles are (9, 10, 14) and (9, 14, 13).

alt text

TODO Task 1: loop over all cells, j and i from 0 to GRID_CELLS - 1, and push six indices for each cell into indices, the two triangles (a, b, d) and (a, d, c):

for (int j = 0; j < GRID_CELLS; ++j)
    for (int i = 0; i < GRID_CELLS; ++i) {
        unsigned int a = i + j * N;
        // b, c and d from a, as in the drawing
        // push a, b, d, then a, d, c
    }

How to add the indices. indices is a std::vector<unsigned int>: a C++ array that grows as you add to it, not a linked list. You have seen push_back() already, in the vertex loop above. It adds one value at the end:

indices.push_back(a);
indices.push_back(b);
indices.push_back(d);   // first triangle
// and three more for the second triangle

Six push_back() calls per cell work fine. A shorter way adds three values in one call:

indices.insert(indices.end(), { a, b, d });

insert() takes two arguments:

  • where to put the new values: indices.end() is the position just after the last element, so the values go at the end, as with push_back();
  • what to put there: { a, b, d } is a list of values in braces, copied in that order. Either way, the three numbers of one triangle must be next to each other, because OpenGL reads the indices three at a time: indices 0, 1, 2 are the first triangle, 3, 4, 5 the second, and so on.

Note that the loops stop at GRID_CELLS - 1, not at N - 1: there is one more vertex per side than there are cells. Both triangles go counterclockwise when seen from above.

The line after the TODO counts the indices, numIndices = indices.size(), and draw() passes that number to glDrawElements(). That is why the window was empty: there were 0 indices.

Run the program. You should get a flat green square: every vertex is at height 0, which the colour ramp paints as flat ground. Press F to see the triangles (Figure 4). Every cell should be split by one diagonal, from bottom left to top right.

alt text


5. Task 2: Perlin noise (20%)

Open Shaders/terrain_vshader.glsl. Your work for Tasks 2, 3 and 4 is marked ///TODO Task 2a, 2b, 3a, 3b and 4. Read the slides on Perlin noise in Lecture 9.2 before you start.

Perlin noise puts a random gradient, a unit vector, on every corner of an integer lattice. At a point p, each of the four corners of the cell around p "votes" with the dot product of its gradient and the vector from the corner to p. The four votes are then blended smoothly. The noise is 0 at every lattice corner, and rises and falls smoothly in between.

gradient(corner) is given. For an integer corner ivec2(i, j) it returns a random unit vector, and always the same one for the same corner. Do not change it.

5.1 TODO Task 2a: The fade curve

The blend weights should not grow in a straight line from one corner to the next. Then the slope of the noise would jump at every cell border. Instead we bend them with the quintic fade curve (Perlin 2002):

fade(t) = 6t^5 - 15t^4 + 10t^3

It goes from 0 to 1 like t, but it starts and ends flat. Complete fade(). GLSL has no ^ for powers, so multiply, for example t * t * t * (t * (t * 6.0 - 15.0) + 10.0). Write 6.0, not 6, in float expressions.

5.2 TODO Task 2b: The noise

Complete perlin(p) in four steps (Figure 5):

  1. The cell. The corner below and left of p is ivec2 c0 = ivec2(floor(p));. The other three corners are c0 + ivec2(1, 0), c0 + ivec2(0, 1) and c0 + ivec2(1, 1). An ivec2 is a vector of two ints. Add an ivec2 to an ivec2, never a vec2.
  2. Where p is inside the cell. vec2 d = p - floor(p);. Both components are between 0 and 1.
  3. The four votes. For each corner, the dot product of its gradient with the vector from that corner to p. For the corner c0 that vector is d itself. For c0 + ivec2(1, 0) it is d - vec2(1.0, 0.0), and so on:
float s = dot(gradient(c0), d);
float t = dot(gradient(c0 + ivec2(1, 0)), d - vec2(1.0, 0.0));
// u for the corner (0, 1), and v for the corner (1, 1), the same way
  1. Blend. First along x, on the bottom edge and on the top edge, then along y between the two:
float st = mix(s, t, fade(d.x));
float uv = mix(u, v, fade(d.x));
return mix(st, uv, fade(d.y));

GLSL calls linear interpolation mix(a, b, w). It is a + w (b - a): a when w = 0, and b when w = 1.

alt text

Run the program. The grid is still flat (the vertices move in Task 3), but now it is coloured by the noise: blue where the noise is low, green and yellow where it is high, with smooth contour lines (Figure 6). With baseFrequency 0.5, the 8-unit grid spans 4 noise cells, so you see about four blobs across.

Small kinks in the thin contour lines are fine. The noise is computed only at the vertices and interpolated in between, and Task 3 makes the grid finer.

alt text

If you see squares or stripes instead of blobs, check the four corner offsets and the four vectors: each corner must use its own.


6. Task 3: fBm and displacement (20%)

Perlin noise has bumps of only one size, about one noise cell wide. Real terrain has big hills, smaller hills on them, and rocks on those. Fractional Brownian motion adds copies of the noise, each with more and smaller bumps. Each copy is called an octave. See the slides "fBm Revisited: Add Octaves" to "fBm in Code" in Lecture 10.1.

6.1 TODO Task 3a: fBm

fBm(p) = sum over k = 0 .. K-1 of   L^(-k H) · perlin(L^k · p)
  • K is octaves (5), L is lacunarity (2) and H is the roughness (1). All three are uniforms.
  • Frequency L^k: octave k has L^k times more bumps than octave 0.
  • Weight L^(-k H): octave k is smaller. With L = 2 and H = 1 the weights are 1, 1/2, 1/4, 1/8, 1/16. Figure 7 shows the five octaves in 1D, on the left, and their running sum, on the right. The first octave sets the shape. Each further octave adds smaller detail.

alt text

Complete fBm(p) with a loop. Keep the frequency in a variable and multiply it by lacunarity after each octave:

float value = 0.0;
float frequency = 1.0;
for (int k = 0; k < octaves; ++k) {
    value += /* the weight of octave k */ * perlin(frequency * p);
    frequency *= lacunarity;
}
return value;

For the weight, use pow(lacunarity, -float(k) * H). GLSL's pow() takes floats only, and k is an int, so it must be converted with float(k).

6.2 TODO Task 3b: Move the vertex

At the end of main() in the same shader, replace float z = 0.0; so that the vertex goes up by the noise:

float z = heightScale * height;

That is the whole displacement. The vertex keeps its x and y, and only z changes. A surface like this, one height for every (x, y), is called a height field. It cannot have overhangs or caves.

6.3 Task 3c: A finer grid

Run the program. The terrain rises, but it looks blocky, with flat facets and zigzag contour lines. The noise is computed only at the vertices. Between them, the triangles are flat. A grid of 48 cells cannot show bumps smaller than about two cells. In Terrain.h, change

const int GRID_CELLS = 256;

This is the line at the top of Terrain.h, marked (Task 3: make it 256). It is not a TODO. Build again. Now you have hills and valleys with smaller bumps on them (Figure 8).

alt text

Press Down until there is 1 octave, then Up one at a time, and watch the detail appear. Keys 1 and 2 switch between Perlin noise and fBm. Key 3 shows fBm too, until Task 4.


7. Task 4: Ridged multifractal (advanced) (15%)

fBm looks the same everywhere: its valleys are as rough as its hills. Real mountains have sharp crests and smooth valleys. The ridged multifractal (Musgrave, Texturing and Modeling, chapter 16) gets both with two ideas. See the slides from "fBm Is the Same Everywhere" to "fBm vs Ridged" in Lecture 10.1.

Idea 1: crests from the zero lines. Perlin noise crosses zero along curved lines. |n| turns every zero crossing into a sharp V. 1 - |n| flips the V into a sharp peak, and squaring makes the peak sharper still (Figure 9).

alt text

Idea 2: detail only where it is high. In fBm every octave adds the same amount of detail everywhere. The ridged multifractal adds detail only where the terrain is already high. Each octave gets a weight between 0 and 1, and the weight comes from the octave before.

Think of the weight as a dimmer switch for detail. Octave k sets the dimmer for octave k + 1:

  • Where octave k is high, near a crest, the dimmer is fully on (w = 1). The next octave adds all of its detail.
  • Where octave k is low, in a valley, the dimmer is turned down (w < 1). The next octave adds only part of its detail. Figure 10 shows this in 1D. In (a), the green line is the signal of octave 0 and the dashed orange line is the weight it gives to octave 1. The weight is 1 over every crest and dips in the valleys (shaded). In (b), the grey line is octave 1 as it comes out of the noise, and the red line is the same octave after it is multiplied by that weight. On the crests the two lines are the same. In the valleys the red line is lower and flatter.

alt text

The rule for the dimmer is w = clamp(2 * signal, 0, 1) (Figure 11):

  • A signal of 0.5 or more gives w = 1, full detail. Since the signal is (1 - |n|)², that is wherever |n| is below about 0.29, a wide band around every crest. The factor 2 is what makes this band wide, so the crests get their detail on their sides too, not only at the very top.
  • A signal of 0.25 gives w = 0.5, half the detail. A signal near 0 gives almost no detail.
  • clamp keeps w at most 1. So the weight can only take detail away. A crest never gets more detail than fBm would give it. alt text

The weights also pass down the octaves. The weight of octave 2 comes from the signal of octave 1, which was already multiplied by the weight of octave 1. So a valley that octave 0 turned down tends to stay turned down in the higher octaves, and keeps its smooth floor at every scale.

This matches real landscapes. Valleys fill with sediment, which smooths them, while crests are bare rock that weathers into sharp, jagged shapes.

Figure 12 shows the same thing in 2D. On the left, the signal of octave 0: its white lines are the crests. In the middle, the weight it gives to octave 1: bright (1) almost everywhere, and dark only in the middle of the valleys. On the right, the result after 5 octaves: rough, branching crests and smoother, darker valleys.

alt text

TODO Task 4: complete ridged(p). Start with result = 0.0, weight = 1.0 and frequency = 1.0. For each octave k:

  1. float signal = 1.0 - abs(perlin(frequency * p));
  2. Square it: signal *= signal;
  3. Multiply it by the weight: signal *= weight;
  4. Add it with the same weight as in fBm: result += signal * pow(lacunarity, -float(k) * H);
  5. The weight for the next octave: weight = clamp(2.0 * signal, 0.0, 1.0);
  6. As in fBm: frequency *= lacunarity; After the loop, return result * 0.8 - 1.0, so the heights sit around [-1, 1] like those of fBm.

A small example with numbers. Follow two points through the first two octaves:

point on a crest point in a valley
octave 0: noise n 0.05 0.5
octave 0: signal (1 - |n|)² × w₀, with w₀ = 1 0.95² ≈ 0.90 0.5² = 0.25
weight for octave 1: w₁ = clamp(2 × signal, 0, 1) clamp(1.80) = 1 clamp(0.50) = 0.5
octave 1: noise n 0.3 0.3
octave 1: signal (1 - |n|)² × w₁ 0.49 × 1 = 0.49 0.49 × 0.5 = 0.245
weight for octave 2: w₂ 0.98 0.49

In octave 1 both points get the same noise value, but the valley adds only half as much detail as the crest. Its weight for octave 2 is still about half, so octave 2 will damp it again.

Run the program. You should get sharp, branching ridges between smoother valleys (Figure 13). Press 2 and 3 to compare fBm and the ridged multifractal.

alt text

Take three screenshots with P, one for each mode, and rename them perlin.png (key 1), fbm.png (key 2) and ridged.png (key 3). You need them for the submission.


8. Check yourself

  • The terrain project appears in your solution and builds with no errors.
  • The console shows Success three times when the program starts.
  • Your starter output matches Figure 2.
  • After Task 1, you see a flat green square, and F shows a regular triangle grid with no long stray triangles (Figure 4).
  • After Task 2, the flat grid shows smooth blobs, with no squares, stripes or straight edges along the cell borders (Figure 6).
  • After Task 3, you have hills with smaller bumps on them, and the bumps grow as you add octaves (Figure 8).
  • After Task 4, keys 1, 2 and 3 show three different terrains, and key 3 has sharp ridges (Figure 13).
  • You have saved perlin.png, fbm.png and ridged.png, answered the five questions in Section 9 and saved their screenshots.

9. Questions (25%, 5% each)

Each question asks you to make one small change, run the program and look at the result. Then:

  • take a screenshot with P and rename it to the file name given;
  • answer the question in a few sentences in answers.txt. Start every question from your final code, and undo the change before the next one. Remember to build again after every change, in a .glsl file or in Terrain.h.

Question 1: No fade. In fade(), return t instead of the quintic. Press 1 for plain Perlin noise. What do you see along the cell borders, and why? Then try the cubic 3t^2 - 2t^3 (no screenshot): here it looks almost the same as the quintic. What does the quintic curve give that the cubic does not (Perlin 2002), and where would that difference show? Hint: compare the slope and the curvature of the three curves at t = 0 and t = 1. Recitation 8 computes the shading from the slope of the terrain. (save as no_fade.png)

Question 2: Bigger and smaller hills. In Terrain.h, change baseFrequency from 0.5 to 0.25, then to 1.0, and press 2 for fBm. What does baseFrequency change? How is it related to the size of the hills? Hint: p = vposition.xy * baseFrequency, and a noise cell is 1 unit wide in p. How wide is it in the world? (save as big_hills.png for 0.25 and small_hills.png for 1.0)

Question 3: A coarse grid. Set GRID_CELLS back to 48 and press 2 for fBm with 5 octaves. With lacunarity 2 and baseFrequency 0.5, how many noise cells lie along one side of the 8-unit grid at the finest octave? Use this number to explain why GRID_CELLS = 48 is not enough. Hint: the finest octave is k = 4. Its frequency is baseFrequency times L^4 noise cells per unit. (save as coarse_grid.png)

Question 4: Rough and smooth. In Terrain.h, change H from 1.0 to 0.5, then to 1.5, and press 2 for fBm. What does H do? Then, with H back at 1.0, press Up until you have 10 octaves. Why do the octaves beyond about 7 hardly change the picture? Hint: work out the weight L^(-k H) of octave 7. And how many vertices per unit does the 256 grid have, compared with the number of noise cells per unit of octave 7? (save as rough.png for H = 0.5 and smooth.png for H = 1.5)

Question 5: Ridges without weights. In ridged(), replace the line that sets the next weight with weight = 1.0;, and press 3. Compare with your ridged.png. Where do the crests of the ridged multifractal come from? What changed in the valleys, and why? Hint: with the weight always 1, does a valley get more or less detail from the higher octaves than before? (save as no_weight.png)


10. Submission

Submit through the Recitation 7 assignment in MS Teams by Monday 23 November, 11:59pm.

Marks are based on attendance and a completed submission. The TA reviews a sample of submissions in detail. The weightings below show how the work is distributed and what the TA looks at.

Part Weight
Task 1: the grid mesh (Section 4) 15%
Task 2: Perlin noise (Section 5) 20%
Task 3: fBm and displacement (Section 6) 20%
Task 4: ridged multifractal (Section 7) 15%
Questions, with their screenshots (Section 9) 25% (5% each)
perlin.png, fbm.png and ridged.png 5%
Total 100%

Submit one zip file named lastname_rec7.zip, laid out like this:

lastname_rec7/
├── code/      your Terrain.h and Shaders/terrain_vshader.glsl
└── output/    ten screenshots and your answers:
               perlin.png         key 1, after Task 4
               fbm.png            key 2, after Task 4
               ridged.png         key 3, after Task 4
               no_fade.png        Question 1
               big_hills.png      Question 2, baseFrequency 0.25
               small_hills.png    Question 2, baseFrequency 1.0
               coarse_grid.png    Question 3
               rough.png          Question 4, H = 0.5
               smooth.png         Question 4, H = 1.5
               no_weight.png      Question 5
               answers.txt        your answers to the five questions in Section 9

Do not include the build folder.


11. If something goes wrong

  • The terrain project is not in the solution. You have not rerun Configure and Generate since pulling. Go back to Section 2.
  • The window stays empty after Task 1. No indices were pushed. Check that you push 6 indices per cell into indices, before the line numIndices = ....
  • Long stray triangles across the grid, or a crash. The loops run one cell too far. They must stop at GRID_CELLS - 1: write i < GRID_CELLS, not i <= GRID_CELLS or i < N.
  • Holes in the grid, or triangles missing in wireframe. A triangle uses the wrong corners. Check b, c and d against the drawing in Section 4.
  • The console shows Failed: and the program closes. A shader did not compile. The message names the line, for example ERROR: 0:42: ... is line 42 of the vertex shader. Common causes in this recitation:
    • pow(lacunarity, -k * H) with the int k. Write -float(k) * H.
    • c0 + vec2(1, 0): an ivec2 plus a vec2. Write c0 + ivec2(1, 0).
    • fade(d) with the vec2 d. Call fade(d.x) and fade(d.y).
    • a missing ;, or a misspelled variable name.
  • You changed a shader or Terrain.h but nothing changed. Build again before you run.
  • Squares, stripes or a checkerboard in the noise. Check the four corner offsets and the four vectors from the corners to p. Each corner must use its own.
  • Straight creases along the cell borders. fade() still returns t.
  • The terrain is coloured but flat after Task 3. You forgot TODO Task 3b: z is still 0.
  • fBm looks like Perlin noise, only taller. The frequency is not multiplied by lacunarity after each octave, or you call perlin(p) instead of perlin(frequency * p).
  • Blocky terrain with zigzag contour lines. GRID_CELLS is still 48. See Task 3c.
  • The ridged terrain is almost all mountains or snow. You forgot * 0.8 - 1.0 at the end of ridged().
  • The ridged terrain looks like fBm. The abs() is missing, or ridged() still returns fBm(p).
  • The console shows Could not open file: Shaders/terrain_vshader.glsl. The program cannot find its shaders. Run it from Visual Studio with Ctrl+F5, not by double-clicking an old copy of the program.
  • You cannot find your screenshots. They are next to the program, in build/terrain/Release.
  • The window does not open and the console mentions OpenGL 3.3. The graphics driver is too old. Update it, or use a lab machine.

Acknowledgements

The material in this recitation follows our lectures on noise and fractals:

  • Lecture 9.2 (Perlin noise): the lattice gradients, the dot products, the fade curve and the blending, used in Task 2.
  • Lecture 10.1 (Fractals): fBm, the parameters H and lacunarity, and the ridged multifractal, used in Tasks 1, 3 and 4. References:
  1. K. Perlin. 1985. An image synthesizer. SIGGRAPH Computer Graphics 19, 3, 287 to 296.
  2. K. Perlin. 2002. Improving noise. ACM Transactions on Graphics 21, 3, 681 to 682.
  3. F. K. Musgrave. Procedural fractal terrains. In D. S. Ebert et al., Texturing and Modeling: A Procedural Approach (3rd ed.), chapter 16. Morgan Kaufmann, 2003. The starter code is adapted from the Perlin noise and terrain recitations of the previous offering of this course. AI tools were used to help write the code and the figures, and to help draft the text of this recitation. All content was reviewed, edited and tested by the course instructor.

Clone this wiki locally