1
$\begingroup$

turbulence function

From my understanding, the turbulence in Perlin noise is to accumulate Perlin noise of different frequencies with different weights. Based on this understanding, the return value of turbulences should have the same range of color (or pixel).

However, in some implementations (Ray Tracing: The Next Week) the range of turbulence doesn't match the range of [0, 1]

double turb(const point3& p, int depth=7) const {
    auto accum = 0.0;
    auto temp_p = p;
    auto weight = 1.0;

    for (int i = 0; i < depth; i++) {
        accum += weight*noise(temp_p);
        weight *= 0.5;
        temp_p *= 2;
    }

    return fabs(accum);
}

The initial value of weight is 1, and the range of noise is [-1, 1]. So it is possible that after the first iteration, accum became 1, and the following iterations could make it larger than 1.

I also read through the related part in the original paper, however, the pseudocode seems very similar:

function turbulence(p)
  t = 0
  scale = 1
  while (scale > pixelsize)
      t += abs(Noise(p / scale) * scale)
      scale /= 2
  return t

And it seems like the color representation in Perlin's original paper is also in the range of [0, 1] according to the the following line:

For example, one possible pixel for the variable list [red green blue] is [0.5 0.3 0.7].

So I'm wondering if the turbulence function is designed this way because of the extremely low probability of returning a value that is out of range. Or am I missing something?

Noise function

Also, the description of Noise() function in the original paper is pretty confusing. Perlin didn't explicitly write about the range of the returning value. But he used it this way:

By evaluating Noise() at visible surface points of simulated objects we may create a simple "random" surface texture (figure Spotted.Donut) : color = white * Noise(point)

So I'm assuming it should be [0, 1] which make the expression white * Noise(point) in the range of [0, 1]

However, an abs() function is added in the turbulence function.

$\endgroup$
3
  • $\begingroup$ Would a starting weight of 0.5 make more sense ? It should accumulate to near one after several loops (e.g. 1/2 + 1/4 + 1/8 + 1/16, etc) $\endgroup$
    – PaulHK
    Commented Nov 28, 2022 at 2:31
  • $\begingroup$ @PaulHK I actually tried this before. I kept all implementations of Ray Tracing: The Next Week the same and changed the weight as you mentioned. But the output image will be significantly dimmer. And surprisingly, the original implementation never gives a return value that is greater than 1. $\endgroup$
    – ttzytt
    Commented Nov 28, 2022 at 4:03
  • $\begingroup$ Yes I've noticed that too with Perlin, I don't think the distribution of values is evenly distributed. This algorithm summing multiple of them together biases that distribution even further, depending on number of iterations. $\endgroup$
    – PaulHK
    Commented Nov 28, 2022 at 6:19

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.