# Lecture 005

## Procedural Texture

Reason for procedural texture:

• low memory usage

• infinite resolution

• no need to parameterize surface (like solid texture - 3D texture)

## Noise Functions

### Value Noise

Simple Value Noise can be defined as a function

F : \mathbb{R}^n \to [0, 1]

Limitations:

• not random enough: minimal and maxima on lattice

• slow to look up due to interpolation needed

### Perlin Noise

Perlin Noise: generate derivative and use Hermite Interpolation to get curve.

It is easy to change frequency and amplitude of perlin noise. It generates higher frequency and look up is efficient.

Limitation:

• lattice still visible for absolute value of perlin noise (we can clearly see where is 0, so you can tell it is minimum)

• look up $O(2^n)$ instead of $O(4^n)$ for $n$ dimensions, an improvement but simplex noise can have $O(n)$.

• not rotation invariant

See Blog by Andrew Kensler at Pixar for more.

### Spectral Synthesis

The idea is that you combine functions $f$ with some weight $w_i$.

When $w_i$, $s_i$ are set so that "increasing frequencies have decreasing amplitude" (e.g. $w_i = 2^{-1}, s_i = 2^{i}$), we call it "fractal sum"

When $s_i = 2^i$, we call it "octave".

If we let $f(p)$ be our noise function, we get fractional brownian motion.

### Turbulence

Turbulence: Same as fBm, but sum absolute value of noise function

Fractals Dimensions: say you have a fractal image, then the image is two dimension. However, the fractals can have non-integer dimension. In the case of an image, it can be $2.2$ or something below $3$. This is because we can see fractal fold in itself within one pixel infinite amount of times. So mathematician decided to invent fractional dimension. What we got is $2.9$ dimensional fractal is rougher than $2.1$ dimensional fractal.

We can compose different fractals. Domain Distortion: A sample of the “warped ridges” terrain model in Bryce 4: the “ridges” model distorted with fBm. Domain Distortion: A sample of the “warped slickrock” terrain model in Bryce 4: fBm constructed from one minus the absolute value of Perlin noise, distorted with fBm

### Worley Noise

Worley Noise: is the procedural to generate voronoi diagram

Amazing realtime demos using fractal noise:

• http://www.iquilezles.org/www/articles/morenoise/morenoise.ht m

Some notes from today's lecture:

We discussed high-dynamic-range (HDR) imaging when going over environment maps. Here are some slides from 15-463 going over this topic in detail: http://graphics.cs.cmu.edu/courses/15-463/lectures/lecture_05.pdf

One thing I did not mention about environment maps is their representation using spherical harmonics. We won't see much about this in this course, but if you are interested, here are some key papers: https://dl.acm.org/doi/10.1145/566654.566612, https://dl.acm.org/doi/abs/10.1145/383259.383271

These are two technical reviews on procedural noise modeling: https://diglib.eg.org/handle/10.2312/egst.20101059.001-019, https://onlinelibrary.wiley.com/doi/full/10.1111/cgf.12276

I rushed through the math of fractals, including the various definitions of fractal dimension. If you are interested in this topic, I suggest this pretty accessible textbook: https://www.amazon.com/Fractal-Geometry-Mathematical-Foundations-Applications/dp/0470848618 [I actually used this a lot as an undergrad, as my undergrad thesis was on using fractal dimensions to model real-world textures for vision applications!]

Also, during yesterday's recitation, we spent some time going over how Fermat's principle can be used to derive the laws of both reflection and refraction, and how we can describe those in a unified way using the half-vector. Here are a few references on these topics:

A detailed discussion of the use of Fermat's principle for reflection: https://dl.acm.org/doi/10.1145/142920.134082

A discussion of how the half-vector (and its generalized variant involving refractive indices) can be used to express both reflection and refraction: https://dl.acm.org/doi/10.5555/2383847.2383874

Papers on using the half-vector law to find the point on a surface connecting two other points through a specular reflection (first paper) or refraction (second paper): https://dl.acm.org/doi/abs/10.1145/3386569.3392408, https://dl.acm.org/doi/10.1145/1531326.1531398

The problem of connecting two points through a specular reflection on some intermediate surface goes back to ancient times, and is classically known as Alhazen's billiard problem: https://en.wikipedia.org/wiki/Alhazen%27s_problem

If you want to study geometric optics (and Fermat's principles) in real depth, then the following summer course and textbook are good resources (the first paper I linked above is drawn largely from this textbook): https://www.fields.utoronto.ca/programs/scientific/12-13/Marsden/FieldsSS2-FinalSlidesJuly2012.pdf, https://www.google.com/books/edition/The_Optics_of_Rays_Wavefronts_and_Causti/6IhGUHZRHUAC

Table of Content