Note: the images on this site are converted to .png from the original outputted .bmp

** Beer Lambert Law**

**Procedural Textures**

- Started with 2D noise implementation.
- Expanded to 3D to create solid textures.
- Implemented by adding a texture class to the renderer and adding a texture field to objects and the scene.
- on intersecting an object the object’s texture pointer is added to a hit intersection
- raytrace() checks to see if the texture is null.
- The texture is displayed by scaling the material’s color with the texture’s noise function’s result.
- The textures use one of two noise functions, Perlin and Worley
- I use perlin for textures that need more randomness and worley for ones that follow a pattern

**Perlin Noise**

- Based on java version found here: http://cs.nyu.edu/~perlin/noise/
- selects noise value based on a permutation table of values from 0 to 255
- permutation table defaults to the table in the java implementation
- the permutation table can also be randomly seeded in my implementation with PerlinNoise.seed(unsigned int)
- Perlin Noise takes a Vector3 position and returns the noise value at that position in the range 0-1
- Perlin Noise can be generated two ways. The first is using the PerlinNoise.getNoise(Vector3) function
- The second is PerlinNoise.turbulence(Vector3, float size), which returns smoothed noise.
- Size is the initial amplitude, which is halved in a loop.
- turbulence uses the getNoise function scaled by size and returns the added result

- Wood Texture
- to create a wood texture, I use the following formula:
- n = 20*PerlinNoise(position)
- texture = n – floor(n);

- Marble Texture
- to create a marble texture, I use the following formula:
- scale = position*period
- noise = scale.x + scale.y + scale.z + power*turbulence(scale, size)
- texture = abs ( sin(noise*PI) );

- Cloud Texture
- for the cloud texture, I simply return the result of the turbulence function.
- texture = turbulence(pos, turbSize)
- I use the cloud texture for the background skyColor by adding a texture field to the Scene() class

**Worley Noise**

- My implementation is based on the java version here: http://aftbit.com/cell-noise-2/
- it has a function WorleyNoise.Noise(Vector3, int, int, std::vector<float>,int)
- the parameters are the position of the noise to be evaluated, the seed for the random number generator, an int representing which distance function to use, a vector of the distances of features points from the position, and an int representing which combination of closest feature selection to use.
- it uses a cube representation of the texture
- generates a LCG random number (Linear congruential generator)
- Determine a number of feature points
- use Poisson distribution to randomly place the points in the cube
- pick the closest point to the position inputed

- Distances:
- There are 3 choices for distance and combination functions
- The Euclidian, Manhattan, and Chebyshev distance functions
- the choice of:
- D1 – return closest,
- D2 – return 2nd_closest – closest,
- and D3 – return 3rd_closest – closest

**Final image with 10 by 10 sampling and depth of 10**

- Left Omanyte: Worley Noise(Manhattan distance, D3 combining), Ashikhmin material
- Center Omastar: Perlin Noise(Marble texture), Ashikhmin material
- Right: Perline Noise(Wood texture), Ashikhmin material
- Front Helix Fossil: Fresnel Material
- Sky: Perlin Noise(cloud texture)
- ground: Worley noise(Euclidian distance, D1 combining), Lambert Material

Advertisements