POV-Ray : Newsgroups : povray.bugreports : Bug in noise function : Re: Bug in noise function Server Time
24 Jun 2024 08:31:28 EDT (-0400)
  Re: Bug in noise function  
From: Ron Parker
Date: 25 Aug 1999 09:38:07
Message: <37c3f1bf@news.povray.org>
On Wed, 25 Aug 1999 13:57:01 +0300, Margus Ramst wrote:
>There seems to be a bug in the various noise functions. It exhibits itself as
>banding after a certain _negative_ distance, along any axis, from the origin.
>This distance varies depending on the noise function: it is around 78.125 for
>1/f noise (granite), 312.5 (78.125*4) for DNoise and Agate noise, and around
>10000 for Perlin noise (bozo, bumps, spotted).
>Furthermore, in 1/f and DNoise the bug seems to become more pronounced at
>78.125*2 and 78.125*4

The problem is in texture.c, at the top:

/* Ridiculously large scaling values */

|#define MINX (-10000)
|#define MINY MINX
|#define MINZ MINX

The noise function only works in positive domains, so it first translates 
your coordinate by -<MINX, MINY, MINZ> before computing noise.  As you can 
see, this breaks at -10000.  Granite breaks at such a low offset because of 
this:

|  VScale(tv1,EPoint,4.0);
|
|  for (i = 0; i < 6 ; freq *= 2.0, i++)
|  {
|    VScale(tv2,tv1,freq);
|    temp = 0.5 - Noise (tv2);

As you can see, your sample point will be scaled by up to a factor of 128.
Surprise, surprise: 10000/128=78.125.  Obviously, the larger your sample 
point is, the more iterations of the 1/f code will be over 10000.  If you
determined this by experimentation, I'm impressed. :)

The fix is clearly to modify MINX and recompile.  Why it's set so low is 
anybody's guess.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.