# A Rough Attempt at Birdseye Maple

There are two main steps involved in simulating birdseye maple
1. Simulating the grain pattern
2. Simulating the color pattern

#### Simulating the Grain Pattern

The grain pattern can be simulate using a 3-D field of noise. Where the values of the noise field have probability (1-d) of being between 0 and N and probability of d of being in the range spike - spike + N. The range of influence of the points of noise must also be strongly localized. In the following images the ranges are 7 units in z, 2 deg's in theta and 5*RingWidth in r. However, because the range of these points of noise are localized, large peturbations over 30 units in z are not possible. In order to compensate for this the axis of Log is peturbed in x and y by a noise function of z, with range 30, before the initial calculation of the points distance from the axis is performed.

#### Simulating the Color Pattern

Unfortunatly the grain pattern alone does not yield a good birdseye pattern when the surface is cutting through the log tangentially to the radius. In addition to the color interpolations discussed previously an additional interpolation must be performed as a final step. If we assume that the initial interpolations have yielded a pulp color C with which to color that pixel. The final interpolation will be between that color and the color GrainMax. The factor for that interpolation is a function of the magnutude of the peturbation of R and the direction of the surface normal of the surface cutting thruogh the log at that point. The properties of this function that we are looking for are:
• If the peturbation is low, ie the point does not fall in an area of influence of a spike, the function should be 0.
• If the peturbation is high, the point is influenced by a spike, the function should return a value prortional to the dot product of the surface normal and a vector in the direction from the z-axis to that point.
The method used employed here is as follows:
• Create a vector, V, with z component = N, and x and y components given by
x = Peturbation * cos(theta)
y = Peturbation * sin(theta)
• Make V a unit vector
• Create a new V1 = V x k, where k is a unit vector in the direction of z
• Rotate V1 90 degrees about the z-axis to have point(within a sign) back in the direction of V
• Take the asbsolute value of the dot product of V1 and the unit surface normal. This will yield a value, t, betwee 0 and 1.
At first glance this might appear to be the value we want. However, close inspection of actuar birdseye shows that in the center the color moves back towards the pulp color. This is accomplished by using the above result, t, as input to a gaussian distribution with a mean of 0.65 and sigma = 0.1, and using G(t) as the interpolation factor

##### G(t) = e-1/2((t - mean)/sigma)2
Some values of this function on the range [0.1, 1.0] are
```t     G(t)
0.1   2.69959e-07
0.2   4.00653e-05
0.3   0.00218749
0.4   0.043937
0.5   0.324653
0.6   0.882497
0.7   0.882497
0.8   0.324652
0.9   0.0439368
1.0   0.00218748
```

What function provides a rapid shift from pulp color to grain color at the edge of the birdseye. Within the center the color shifts back towards the pulp color.