0

I'm looking for a 2 or 3 parameters math formula with the following characteristics:

  • Simple (the fewest amount of operations the better)
  • Random output (non-periodic)
  • Normalized (Meaning the output will never be outside a given range; doesn't matter the range since once I know the range I can just divide and add/subtract to get it into the 0 to 1 range I'm looking for)
  • White noise (the more samples you get the more evenly distributed the outputs get across the range of possible output values, with no gaps or hotspots, to the extent permitted by the floating-point standard)
  • Random all the way down (no gradual changes between output values even if the inputs are changed by the smallest amount the float standard will allow. I understand that given the nature of randomness, it is possible two output values might be close together once in a while, but that must only happen by coincidence, and not because of smoothness or periodicity)
  • Uses only the operations listed bellow (but of course, any operations that can be done by a combination of the ones listed bellow are also allowed)

I need this because I need a good source of controllable randomness for some experiments I'm doing with Cycles material nodes in Blender. And since that is where the formula will be implemented, the only operations I have available are:

  • Addition
  • Subtraction
  • Multiplication
  • Division
  • Power (X to the power of Y)
  • Logarithm (I think it's X Log Y; I'm not very familiar with the logarithm operation, so I'm not 100% sure if that is enough to specify which type of logarithm it is; let me know if you need more information about it)
  • Sine
  • Cosine
  • Tangent
  • Arcsine
  • Arccosine
  • Arctangent (not Atan2, but that can be created by combining operations if necessary)
  • Minimum (Returns the lowest of 2 numbers)
  • Maximum (Returns the highest of 2 numbers)
  • Round (Returns the closest round number to the input)
  • Less-than (Returns 1 if X is less than Y, zero otherwise)
  • Greater-than (Returns 1 if X is more than Y, zero otherwise)
  • Modulo (Produces a sawtooth pattern of period Y; for positive X values it's in the 0 to Y range, and for negative values of X it's in the -Y to zero range)
  • Absolute (strips the sign of the input value, makes it positive if it was negative, doesn't do anything if it's already positive)

There is no iteration nor looping functionality available (and of course, branching can only be done by calculating all the branches and then doing something like multiplying the results of the branches not meant to be taken by zero and then adding the results of all of them together).

TiagoTiago
  • 31
  • 3
  • What is your input domain? Any float number, or some limited range like e.g. [0,1]? What is the distrbution over the input domain? This is important for the “white noise” requirement you wrote. Are you aware that changes “by the smallest amount the float standard will allow” are indeed *very* small changes for subnormal numbers close to zero. Do you really mean to be this strict, and if so, why? – MvG Sep 05 '14 at 10:58
  • I guess you can assume the input values will be in the lower range, most of the time not going past or even close to 100.0 or -100.0 . But it would be nice to not have to worry about keeping the inputs in an specific range. – TiagoTiago Sep 05 '14 at 19:06
  • Regarding the white noise requirement; I guess it doesn't need to be 100% perfect, but the closest to that the better. – TiagoTiago Sep 05 '14 at 19:08
  • And about the resolution thing; that is just to make sure I'm not getting any localized biases – TiagoTiago Sep 05 '14 at 19:10
  • "The range of possible output values" is approximately logarithmically distributed. Do you instead want a uniform distribution of real numbers, but approximated as a floating-point value? – sh1 Sep 08 '14 at 07:08
  • That sounds right, yeah. Otherwise the results would have an over-representation of values in the lower range when compared to values in the higher range. It's my understanding that despite the presence of a rounding operator, I'm only able to have values be treated as floats in this environment (maybe it's double precision floats, but either way, floats; and trying to manually recreate other formats on top would be too inefficient). – TiagoTiago Sep 09 '14 at 01:51
  • Ok, according to https://blender.stackexchange.com/questions/14151/does-cycles-gpu-rendering-use-single-or-double-floating-point-precision , it's not double, just single precision floats. – TiagoTiago Sep 09 '14 at 02:01

0 Answers0