Laboration 3

Procedural geometry, fractals, FBM/terrain generation

3a. Generate a fractal tree

The lab shell gives you a simple scene with a tree trunk, a somewhat narrowing cylinder. The cylinder is procedurally generated so you can customize it as you please (but you don’t have to).

We will be using the package “GLUGG” (OpenGL Utilities for Geometry Generation), which allows you to generate geometry with some helper functions, including translation, scaling, rotation, and a matrix stack. This allows you to use the stack for different recursion depths.

CodeBlocks project files are included. No project or makefiles for Linux och Mac are included at this time but it is possible to modify the ones from Lab 1. Noise functions are not included, but you can use the ones from lab 1.

Same archive as lab 1:

https://computer-graphics.se/TNM084/Files/TNM084-labs-2023.zip

Old version:

http://computer-graphics.se/TNM084/Files/TNM084-labs-2022.zip


3a1. Create a tree by adding the shape multiple times, recursively.

(Details on GLUGG)

What transformations did you use to create the tree?

Do you get performance degradation? At what depth?

3a2. Add randomness to add variation to the tree

It is up to you to decide how to create the randomness and how to apply it.

How did you use randomness for the tree? What difference did it make?

3b. Generate terrain using noise

A similarly simple lab shell gives you a mostly flat surface. Your task is to add detail to it. This can be done either on the CPU or on the GPU. We leave this an open choice, you do not have to make both.

3b1 Generate the terrain

You should decide on some method for generating a terrain with wide frequency spectrum like FBM. There are several possible methods, all with different features, performance, suitability for parallel implementation etc.

What kind of noise function did you use?

3b2 Compute normal vectors

Implement a method for computing normals. Watch the edges!

What method did you use?

How did you handle the edges?

3b3. Add one more feature to the terrain

Free choice from below. If you are running out of time, take an easy one.

1. Put a procedural texture on the terrain (easy)

2. Vary color/texture depending on height (easy to medium)

3. Vary color/texture depending on slope (medium)

4. Fix the lighting so the light source is in world coordinates.

5. Make the camera follow the surface so we can “walk on the surface” (somewhat harder but there can be simple variants)

6. Make objects follow the surface (similar to 5 but a but more sensitive to errors)

Since this is the free choice step, we will be tolerant to minor errors in the result.

© Ingemar Ragnemalm 2021