大家翻译一下
How it works
The fractal calculation follows a similar process as a normal Mandelbrot set using the same formula,
w' = wn + c, but instead of using standard complex numbers w and c are hyper-complex 'triplex' numbers with three components corresponding to the Cartesian x, y, and z co-ordinates.
The triplex number w is raised to a power n using the following terms:
w = {x, y, z}n = rn { sin(θn) cos(φn), sin(θn) sin(φn), cos(θn) }
where:
r = sqrt( x2 + y2 + z2 )
θ = atan2( sqrt( x2 + y2 ), z )
φ = atan2( y, x )
The fractal is ray traced using basically the same process as the 4D Quarternion Julia set fractal; for each pixel a ray is stepped into the scene by a small amount. The x, y and z co-ordinates of the ray at this point provide the input triplex number for the fractal equation, which is then iterated until the magnitude of the triplex number exceeds a bailout value (usually 4.0), or the maximum iteration count is reached.
At the end of the iteration loop a distance estimation function is used to calculate the closest point in any direction to the fractal surface. It is defined as:
distance estimation = 0.5 * |w| * log(|w|) / |δw|
where |w| is the magnitude of the triplex number w and δw is the derivative.
The distance estimation value is crucial to the ray tracing process. It tells us the maximum step distance the ray can move before we need to recalculate the fractal at the new location, which is far more efficient than a fixed step ray marching approach.
When the distance estimation value drops below a defined threshold, epsilon, we are within intersection distance of the approximate fractal surface. If this happens we calculate the vector normal based on the fractal surface gradient, which defines the shading of that point.