
The wood texture that I have created is simply an offset to a cosine noise function. For any 3D point P(x,y,z), the wood texture is obtained by using cos(P.x + turbulence(P))/2+0.5. The last two numbers are used to clamp the result to [0, 1]. The final color produced by this wood function is modulated with a brown RGB color value. The turbulence() function above is created by adding up the values of noise with different octaves. Each successive noise added should have twice the previous frequency (thus an octave) and half the amplitude. For noise i, the frequency is 2^{i} and the amplitude is p^{i}, where p is the persistence of the noise. Each successive addition of an octave will include noisier details to the result.
Since wood textures normally stretch in a certain direction, I stretched the wood texture by multiplying a texture vector T(tx, ty, tz) where each element is the texture repeat factor for that axis e.g. T(2, 0.5, 1) will repeat texture in Xaxis twice, stretch texture in Yaxis by 2 times, and no change texture in Zaxis. We obtain the result R by multiplying this vector T with the point P(x,y,z) as such: R = (tx*x, ty*y, tz*z). So then how do we obtain the noise function? I used the gradient noise method to generate the pseudorandom noise values, similar to what Ken Perlin has suggested in his 1985 paper. A 3D grid with vertices at integer values is defined. Each vertex on the grid has a value of 0 and has an associated pseudorandom gradient vector. To obtain a value of any point within the grid, a trilinear interpolation (total of 7 linear interpolations) is applied on the 8 grid vertices surrounding the given point. Basically, given any point in the 3D space of the grid, I am now able to return the noise value associated with the point. An important characteristic of this noise function is that it must be pseudorandom and not really random i.e. it must return the same “random” noise value when the same (x,y,z) values are supplied. Note: As this is part of a group project, this 3D wood texture is created by modifying a distributed raytracer done by my groupmate Neo Jiet Shern. 
Copyright © 20032017 Skeel Lee. All works are original ones by Skeel, unless otherwise stated.
