Stats on the VEX noise() function.

   4003   0   0
User Avatar
Member
941 posts
Joined: July 2005
Offline
The VEX docs don't currently include any stats on the various noise functions.
Anyone writing a vex library dealing with noise has probably either guessed at those values, or simply generated their own. Generating your own is a bit of a pain though, so not everyone goes through with it.

I recently had to do some porting of the fBm() family of functions (from PRMan to VEX), and had to generate my own stats; so I'm including them here in case someone finds them useful…. (I also get to try posting images to the forum ).

I've only needed to do noise(), so it's the only one I have for now….
Also; I haven't done a power spectrum… but you're welcome to contribute



—————————————————————————-

At a glance:

—||————-|————-|————-|————-|
|| Average | Min | Max | StdDev |
—||————-|————-|————-|————-|
1D || 0.500622 | 0.230801 | 0.764858 | 0.078628 |
—||————-|————-|————-|————-|
2D || 0.500181 | 0.133608 | 0.872062 | 0.096241 |
—||————-|————-|————-|————-|
3D || 0.500015 | 0.080738 | 0.938078 | 0.100296 |
—||————-|————-|————-|————-|
4D || 0.499978 | 0.105358 | 0.943282 | 0.099715 |
—||——————————————————–



Histograms:
(normalized to the highest population.)
The data was gathered from 380160 samples covering ~100 units in each dimension. The distribution was random (using nrandom()). The number of samples is simply the number taken by Mantra to do a full D1 (740x486) frame at the default shading rate. The samples were then reassembled into 1000 “slots” using weighted averages.
The ranges shown are the absolute extremes recorded; this doesn't mean the can't be “eaten into” somewhat – we're talking about ~.01% of the hits landing at those extremes.




Mapping Curves:
Vex doesn't support arrays (yet? ), so you can't use the data directly. Luckily, these curves can be approximated pretty closely (well… the 1D case is not all that close, actually… but close enough?) with a “standard” power-ease function (likely the equiv of raising the result of VEX's smooth() function to some power, though I haven't checked this… so “caveat emptor”). The function mentioned in the graph below “itp_easep()” is just such an ease function, and has the following signature:

float itp_easep( float v1, float v2, float amount, float power);

EDIT:
Actually, I just realized that my little itp_easep() function (which I wrote a loooong time ago) is not very standard at all!
So; here goes the definition of that function (it's just two power functions joined in the middle, with one half the reverse of the other:

float itp_easep(float t1, float t2, float tcurr, float k) {
float tmp=clamp((tcurr-t1)/(t2-t1),0,1);
if(tmp<=.5)return pow(tmp*2,k)*.5;
return 1-(pow((1-tmp)*2,k)*.5);
}

A power of 1 gives linear interp, 2 is close to what you get with smooth(), and so on. Values <1 (but >0) go the other way.
So… nope; using the power version of vex::smooth() would *not* give the same results.
This puppy is circa 1994 or so… and I have *no idea* what drove me to write it that way; but there you have it. :roll:
However; it does a much better job of approximating the curves than the standard smooth/ease functions.

EDIT_END





The data:
This is in “.clip” format so you can read them directly into chops.
These are 100-step (step=0.01) histograms, so the curves will look smoother than the ones above.


###############################################################
# 1D float
###############################################################
# Total Samples: 380160
# Range:
# Average: 0.500622
# Variance: 0.006182
# Standard Deviation: 0.078628
# Highest Pop: 4753.738000
###############################################################
{
rate = 100
start = 0
tracklength = 101
tracks = 2
{
name = F1_H
data = 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.002245 0.002058 0.001192 0.001001 0.004763 0.030034 0.026079 0.027418 0.045455 0.061347 0.080178 0.092453 0.081482 0.097738 0.097027 0.128490 0.136344 0.165633 0.222066 0.251421 0.288365 0.329452 0.418484 0.575634 0.626735 0.633711 0.777054 1.000000 0.771945 0.709348 0.607841 0.517840 0.410206 0.319801 0.279858 0.255485 0.224064 0.143933 0.096267 0.130723 0.100700 0.107149 0.076993 0.070557 0.060141 0.073390 0.071131 0.046027 0.029878 0.013330 0.013560 0.005117 0.001055 0.000903 0.000264 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
}
{
name = F1_S
data = 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000198 0.000379 0.000484 0.000573 0.000993 0.003641 0.005940 0.008358 0.012366 0.017775 0.024844 0.032996 0.040181 0.048799 0.057354 0.068683 0.080705 0.095309 0.114889 0.137058 0.162484 0.191532 0.228431 0.279187 0.334448 0.390324 0.458839 0.547011 0.615076 0.677621 0.731216 0.776876 0.813045 0.841242 0.865918 0.888445 0.908202 0.920893 0.929381 0.940907 0.949786 0.959234 0.966022 0.972243 0.977546 0.984017 0.990289 0.994347 0.996982 0.998157 0.999353 0.999804 0.999897 0.999977 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
}
}



###############################################################
# 2D float
###############################################################
# Total Samples: 380160
# Range:
# Average: 0.500181
# Variance: 0.009262
# Standard Deviation: 0.096241
# Highest Pop: 1790.664000
###############################################################
{
rate = 100
start = 0
tracklength = 101
tracks = 2
{
name = F2_H
data = 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000028 0.000122 0.000162 0.000106 0.000218 0.000059 0.000274 0.000655 0.001485 0.002255 0.003588 0.004288 0.007439 0.012203 0.015884 0.025352 0.034406 0.044183 0.062476 0.082840 0.098359 0.117990 0.149053 0.184533 0.215427 0.244724 0.286298 0.314445 0.361522 0.407039 0.452586 0.505367 0.548137 0.590472 0.647604 0.706804 0.759548 0.812172 0.872257 0.919622 0.958349 1.000000 0.963377 0.922290 0.891017 0.834239 0.793038 0.728635 0.679059 0.609597 0.548920 0.496146 0.453007 0.399705 0.353106 0.315705 0.278033 0.247265 0.204562 0.177298 0.151885 0.130074 0.103540 0.079676 0.059687 0.043629 0.031968 0.023804 0.016086 0.013229 0.009592 0.004379 0.003043 0.001847 0.001343 0.000534 0.000460 0.000264 0.000123 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
}
{
name = F2_S
data = 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000001 0.000007 0.000014 0.000019 0.000029 0.000032 0.000044 0.000074 0.000141 0.000244 0.000406 0.000601 0.000939 0.001493 0.002215 0.003366 0.004928 0.006935 0.009772 0.013534 0.018001 0.023359 0.030128 0.038508 0.048291 0.059404 0.072405 0.086685 0.103103 0.121587 0.142140 0.165090 0.189982 0.216797 0.246206 0.278304 0.312796 0.349679 0.389290 0.431052 0.474573 0.519985 0.563734 0.605618 0.646081 0.683965 0.719979 0.753068 0.783906 0.811589 0.836516 0.859048 0.879620 0.897771 0.913806 0.928143 0.940769 0.951998 0.961288 0.969339 0.976237 0.982144 0.986846 0.990464 0.993175 0.995156 0.996608 0.997689 0.998419 0.999020 0.999455 0.999654 0.999792 0.999876 0.999937 0.999962 0.999982 0.999994 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
}
}



###############################################################
# 3D float
###############################################################
# Total Samples: 380160
# Range:
# Average: 0.500015
# Variance: 0.010059
# Standard Deviation: 0.100296
# Highest Pop: 1578.500000
###############################################################
{
rate = 100
start = 0
tracklength = 101
tracks = 2
{
name = F3_H
data = 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000037 0.000123 0.000422 0.000685 0.001248 0.002510 0.003916 0.004811 0.006070 0.010295 0.018088 0.025762 0.035861 0.044110 0.060203 0.074378 0.090974 0.122607 0.147435 0.174825 0.206790 0.236697 0.279901 0.324030 0.363813 0.411561 0.465354 0.513959 0.567751 0.622045 0.675084 0.735716 0.801255 0.849787 0.889913 0.929477 0.963542 0.993425 1.000000 0.996568 0.954767 0.925325 0.894760 0.852170 0.816884 0.749992 0.702860 0.648880 0.578882 0.520851 0.469637 0.424586 0.383052 0.329244 0.297550 0.256724 0.219398 0.187291 0.155669 0.125576 0.100248 0.079951 0.065369 0.047995 0.037169 0.026767 0.022329 0.015738 0.010870 0.007720 0.004606 0.001779 0.000838 0.000864 0.000229 0.000373 0.000049 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
}
{
name = F3_S
data = 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000002 0.000007 0.000024 0.000052 0.000102 0.000204 0.000364 0.000560 0.000807 0.001226 0.001962 0.003011 0.004470 0.006266 0.008716 0.011744 0.015447 0.020437 0.026438 0.033554 0.041971 0.051606 0.062999 0.076188 0.090996 0.107748 0.126689 0.147609 0.170719 0.196038 0.223516 0.253462 0.286076 0.320665 0.356887 0.394720 0.433940 0.474375 0.515079 0.555642 0.594504 0.632168 0.668588 0.703274 0.736524 0.767051 0.795660 0.822071 0.845634 0.866834 0.885950 0.903232 0.918823 0.932225 0.944336 0.954786 0.963716 0.971339 0.977675 0.982787 0.986867 0.990121 0.992782 0.994736 0.996249 0.997338 0.998247 0.998888 0.999330 0.999644 0.999832 0.999904 0.999938 0.999973 0.999983 0.999998 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
}
}



###############################################################
# 4D float
###############################################################
# Total Samples: 380160
# Range:
# Average: 0.499978
# Variance: 0.009943
# Standard Deviation: 0.099715
# Highest Pop: 1548.046000
###############################################################
{
rate = 100
start = 0
tracklength = 101
tracks = 2
{
name = F4_H
data = 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000012 0.000246 0.000742 0.000847 0.000844 0.001279 0.001694 0.002297 0.003345 0.006180 0.009538 0.010703 0.016767 0.022965 0.028571 0.039932 0.051898 0.067403 0.086093 0.108445 0.137303 0.169761 0.205641 0.251942 0.292746 0.340985 0.391007 0.432982 0.486582 0.545669 0.601162 0.667632 0.724835 0.780553 0.846369 0.892391 0.927311 0.942968 0.965462 0.979918 1.000000 0.983420 0.976504 0.949250 0.921267 0.887076 0.836389 0.778718 0.715137 0.660345 0.599298 0.542786 0.479091 0.433089 0.381252 0.342628 0.290684 0.249994 0.207826 0.184367 0.152494 0.129394 0.105463 0.081894 0.062983 0.046957 0.035568 0.028333 0.020613 0.014703 0.010851 0.007759 0.005321 0.003733 0.001372 0.000911 0.000664 0.000444 0.000656 0.000376 0.000093 0.000059 0.000064 0.000002 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
}
{
name = F4_S
data = 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000010 0.000040 0.000073 0.000107 0.000158 0.000225 0.000316 0.000449 0.000695 0.001074 0.001499 0.002165 0.003077 0.004212 0.005798 0.007860 0.010538 0.013958 0.018266 0.023720 0.030464 0.038633 0.048642 0.060271 0.073817 0.089350 0.106550 0.125880 0.147557 0.171438 0.197960 0.226754 0.257762 0.291384 0.326835 0.363673 0.401132 0.439486 0.478413 0.518138 0.557205 0.595997 0.633706 0.670304 0.705543 0.738769 0.769704 0.798113 0.824346 0.848153 0.869715 0.888747 0.905952 0.921097 0.934708 0.946256 0.956187 0.964443 0.971767 0.977825 0.982965 0.987155 0.990408 0.992910 0.994775 0.996188 0.997314 0.998133 0.998717 0.999148 0.999456 0.999667 0.999816 0.999870 0.999906 0.999933 0.999950 0.999976 0.999991 0.999995 0.999997 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
}
}
Mario Marengo
Senior Developer at Folks VFX [folksvfx.com] in Toronto, Canada.
  • Quick Links