Jump to content

vex noise output bounds


ikoon

Recommended Posts

Please, how do you deal with the output bounds of noise in vex? I usually want them (-1,1) and I set turbulence and roughness, then I use to manually tune the amplitude.

I assume, that exact bounds is expensive and it can be done in two steps (generate > fit to min, max) but isn't there any practice that I am missing?

I was thinking about building approximate "hardcoded" lookuptable of [turbulence, roughness, attenuation], outputting the amplitude? Some minor overshoot is usually not a problem (or is desirable).

Link to comment
Share on other sites

In vops I just made an HDA for this called something like combined noises in it's various incarnations. They have the ranges for turbulent noise here. http://www.sidefx.com/docs/houdini/nodes/vop/turbnoise.html

You could go hardcore and make your own custom vex expression. https://www.sidefx.com/docs/hdk/_h_d_k__vex_op.html

Or you could make a vex library along the vop HDA lines. 

 

  • Thanks 1
Link to comment
Share on other sites

I believe what you are asking for is noise functions that are normalized over all dimensions, octaves and roughness. The Unified Noise VOP and Unified Noise Static VOP both return noise that is normalized for you.

Both Unified Noise type VOPs inside their code snippet include $HH/vex/include/pyro_noise.h to generate normalized noise results.

If you are writing your own vex (wrangles, vex shaders from scratch, etc) you can include pyro_noise.h and then use defined the noise functions within a fit range:

nwrap_sine()

nwrap_perlin()

nwrap_pperlin()

nwrap_simplex()

nwrap_sparse()

nwrap_flow()

nwrap_pflow()

nwrap_worleyFA()

nwrap_worleyFB()

nwrap_mworleyFA()

nwrap_mworleyFB()

nwrap_cworleyFA()

nwrap_cworleyFB()

nwrap_alligator()

They all share the same interface which is nice.

What's really cool about the pyro_noise.h vex file is that it also contains functions that return the statistical norm and min and max ranges for all the default vex noise functions. The results are also embedded in pyro_noise.h for you if you wish. This is the table built for you.

Returns the noise name, min value, max value, median value and a bit to say if it is not celular 1 or celular 0 (I think...). Then followed by a probability variance of these values. Note all the function variations are included in the file for your reference:

//-------------------------------------------------------------------------------
// The constants used in this module were generated with the call:
//
//    nstats(0.005, 10,20, 1000, (int)5e6, 0);
//
// which produces the following output:

#define ns_fperlin1    \
   nsdata ( "perlin"    , 0.248834   , 0.767147 , 0.488376  , 1 ) // +/- 0.0024
#define ns_vperlin1    \
   nsdata ( "perlin"    , 0.229499   , 0.761877 , 0.509742  , 1 ) // +/- 0.0024
#define ns_fperlin2    \
   nsdata ( "perlin"    , 0.136616   , 0.864593 , 0.499529  , 1 ) // +/- 0.0024
#define ns_vperlin2    \
   nsdata ( "perlin"    , 0.033912   , 0.946057 , 0.511009  , 1 ) // +/- 0.0025
#define ns_fperlin3    \
   nsdata ( "perlin"    , 0.0832587  , 0.920337 , 0.497705  , 1 ) // +/- 0.0024
#define ns_vperlin3    \
   nsdata ( "perlin"    , 0.0013614  , 0.996832 , 0.335704  , 1 ) // +/- 0.0032
#define ns_fpperlin1   \
   nsdata ( "pperlin"   , 0.272539   , 0.732348 , 0.493888  , 1 ) // +/- 0.0024
#define ns_vpperlin1   \
   nsdata ( "pperlin"   , 0.24574    , 0.7608   , 0.493501  , 1 ) // +/- 0.0024
#define ns_fpperlin2   \
   nsdata ( "pperlin"   , 0.128858   , 0.839149 , 0.521924  , 1 ) // +/- 0.0024
#define ns_vpperlin2   \
   nsdata ( "pperlin"   , 0.0974457  , 0.914321 , 0.492854  , 1 ) // +/- 0.0024
#define ns_fpperlin3   \
   nsdata ( "pperlin"   , 0.0777629  , 0.911734 , 0.50605   , 1 ) // +/- 0.0024
#define ns_vpperlin3   \
   nsdata ( "pperlin"   , 0.0191109  , 0.982488 , 0.402437  , 1 ) // +/- 0.0025
#define ns_fsimplex1   \
   nsdata ( "simplex"   , 0.0135945  , 0.980643 , 0.503308  , 1 ) // +/- 0.0024
#define ns_vsimplex1   \
   nsdata ( "simplex"   , 0.00470505 , 0.979253 , 0.508709  , 1 ) // +/- 0.0024
#define ns_fsimplex2   \
   nsdata ( "simplex"   , 0.100222   , 0.909426 , 0.494677  , 1 ) // +/- 0.0024
#define ns_vsimplex2   \
   nsdata ( "simplex"   , 0.0576417  , 0.958953 , 0.491143  , 1 ) // +/- 0.0024
#define ns_fsimplex3   \
   nsdata ( "simplex"   , 0.15302    , 0.850784 , 0.497038  , 1 ) // +/- 0.0024
#define ns_vsimplex3   \
   nsdata ( "simplex"   , 0.0434933  , 0.970121 , 0.315176  , 1 ) // +/- 0.0076
#define ns_fsparse1    \
   nsdata ( "sparse"    , -1.05121   , 1.41258  , 0.437552  , 1 ) // +/- 0.0024
#define ns_vsparse1    \
   nsdata ( "sparse"    , -1.84633   , 1.41258  , 0.563931  , 1 ) // +/- 0.0025
#define ns_fsparse2    \
   nsdata ( "sparse"    , -1.85569   , 1.8013   , 0.514998  , 1 ) // +/- 0.0027
#define ns_vsparse2    \
   nsdata ( "sparse"    , -2.28436   , 2.08765  , 0.520132  , 1 ) // +/- 0.0025
#define ns_fsparse3    \
   nsdata ( "sparse"    , -2.34351   , 2.43843  , 0.49609   , 1 ) // +/- 0.0174
#define ns_vsparse3    \
   nsdata ( "sparse"    , -2.71525   , 2.64793  , 0.504632  , 1 ) // +/- 0.0256
#define ns_fflow1      \
   nsdata ( "flow"      , 0.191786   , 0.838335 , 0.476434  , 1 ) // +/- 0.0024
#define ns_vflow1      \
   nsdata ( "flow"      , 0.156953   , 0.847188 , 0.498596  , 1 ) // +/- 0.0024
#define ns_fflow2      \
   nsdata ( "flow"      , 0.110068   , 0.907473 , 0.489255  , 1 ) // +/- 0.0024
#define ns_vflow2      \
   nsdata ( "flow"      , 0.019407   , 0.977013 , 0.330133  , 1 ) // +/- 0.0032
#define ns_fflow3      \
   nsdata ( "flow"      , 0.0972697  , 0.879663 , 0.514725  , 1 ) // +/- 0.0024
#define ns_vflow3      \
   nsdata ( "flow"      , 0.0789278  , 0.909136 , 0.506907  , 1 ) // +/- 0.0024
#define ns_fpflow1     \
   nsdata ( "pflow"     , 0.192796   , 0.835272 , 0.483768  , 1 ) // +/- 0.0024
#define ns_vpflow1     \
   nsdata ( "pflow"     , 0.192727   , 0.834885 , 0.481012  , 1 ) // +/- 0.0024
#define ns_fpflow2     \
   nsdata ( "pflow"     , 0.0875699  , 0.872108 , 0.526021  , 1 ) // +/- 0.0025
#define ns_vpflow2     \
   nsdata ( "pflow"     , 0.0681927  , 0.928206 , 0.502054  , 1 ) // +/- 0.0025
#define ns_fpflow3     \
   nsdata ( "pflow"     , 0.0931273  , 0.896028 , 0.506575  , 1 ) // +/- 0.0024
#define ns_vpflow3     \
   nsdata ( "pflow"     , 0.0427369  , 0.940558 , 0.509313  , 1 ) // +/- 0.0024
#define ns_fworleyFA1  \
   nsdata ( "worley"    , 0          , 0.742495 , 0.0740117 , 0 ) // +/- 0.0024
#define ns_vworleyFA1  \
   nsdata ( "worley"    , 0          , 0.742495 , 0.0740117 , 0 ) // +/- 0.0024
#define ns_fworleyFA2  \
   nsdata ( "worley"    , 0          , 1.15271  , 0.108373  , 0 ) // +/- 0.0256
#define ns_vworleyFA2  \
   nsdata ( "worley"    , 0          , 1.15271  , 0.108373  , 0 ) // +/- 0.0256
#define ns_fworleyFA3  \
   nsdata ( "worley"    , 0          , 1.18895  , 0.159684  , 0 ) // +/- 0.0256
#define ns_vworleyFA3  \
   nsdata ( "worley"    , 0          , 1.18895  , 0.159684  , 0 ) // +/- 0.0256
#define ns_fworleyFB1  \
   nsdata ( "worley"    , 0          , 0.902963 , 0.118548  , 0 ) // +/- 0.0025
#define ns_vworleyFB1  \
   nsdata ( "worley"    , 0          , 0.902963 , 0.118548  , 0 ) // +/- 0.0025
#define ns_fworleyFB2  \
   nsdata ( "worley"    , 0          , 1.24931  , 0.108399  , 0 ) // +/- 0.0256
#define ns_vworleyFB2  \
   nsdata ( "worley"    , 0          , 1.24931  , 0.108399  , 0 ) // +/- 0.0256
#define ns_fworleyFB3  \
   nsdata ( "worley"    , 0          , 1.1101   , 0.118099  , 0 ) // +/- 0.0181
#define ns_vworleyFB3  \
   nsdata ( "worley"    , 0          , 1.1101   , 0.118099  , 0 ) // +/- 0.0181
#define ns_fmworleyFA1  \
   nsdata( "mworley"    , 0          , 0.587001 , 0.0971886 , 0 ) // +/- 0.0025
#define ns_vmworleyFA1  \
   nsdata( "mworley"    , 0          , 0.587001 , 0.0971886 , 0 ) // +/- 0.0025
#define ns_fmworleyFA2  \
   nsdata( "mworley"    , 0          , 1.29428  , 0.314845  , 0 ) // +/- 0.0059487
#define ns_vmworleyFA2  \
   nsdata( "mworley"    , 0          , 1.29428  , 0.314845  , 0 ) // +/- 0.0059487
#define ns_fmworleyFA3  \
   nsdata( "mworley"    , 0          , 1.56603    ,0.398481  , 0 ) // +/- 0.0124397
#define ns_vmworleyFA3  \
   nsdata( "mworley"    , 0          , 1.56603    ,0.398481  , 0 ) // +/- 0.0124397
#define ns_fmworleyFB1  \
   nsdata( "mworley"    , 0          , 0.618887 , 0.178215   , 0 ) // +/- 0.00249998
#define ns_vmworleyFB1  \
   nsdata( "mworley"    , 0          , 0.618887 , 0.178215   , 0 ) // +/- 0.00249998
#define ns_fmworleyFB2  \
   nsdata( "mworley"    , 0          , 1.25947  , 0.183175   , 0 ) // +/- 0.0153326
#define ns_vmworleyFB2  \
   nsdata( "mworley"    , 0          , 1.25947  , 0.183175   , 0 ) // +/- 0.0153326
#define ns_fmworleyFB3  \
   nsdata( "mworley"    , 0          , 1.45466    , 0.161667 , 0 ) // +/- 0.0213142
#define ns_vmworleyFB3  \
   nsdata( "mworley"    , 0          , 1.45466    , 0.161667 , 0 ) // +/- 0.0213142
#define ns_fcworleyFA1  \
   nsdata( "cworley"    , 0          , 0.587747   , 0.0978262, 0 ) // +/- 0.0025
#define ns_vcworleyFA1  \
   nsdata( "cworley"    , 0          , 0.587747   , 0.0978262, 0 ) // +/- 0.0025
#define ns_fcworleyFA2  \
   nsdata( "cworley"    , 0          , 0.901443   , 0.320862 , 0 ) // +/- 0.00593521
#define ns_vcworleyFA2  \
   nsdata( "cworley"    , 0          , 0.901443   , 0.320862 , 0 ) // +/- 0.00593521
#define ns_fcworleyFA3  \
   nsdata( "cworley"    , 0          , 0.843453   , 0.406956, 0 ) // +/- 0.00592824
#define ns_vcworleyFA3  \
   nsdata( "cworley"    , 0          , 0.843453   , 0.406956, 0 ) // +/- 0.00592824
#define ns_fcworleyFB1  \
   nsdata( "cworley"    , 0          , 0.619793   , 0.178844, 0 ) // +/- 0.0025
#define ns_vcworleyFB1  \
   nsdata( "cworley"    , 0          , 0.619793   , 0.178844, 0 ) // +/- 0.0025
#define ns_fcworleyFB2  \
   nsdata( "cworley"    , 0          , 0.849381   , 0.185333, 0 ) // +/- 0.00514269
#define ns_vcworleyFB2  \
   nsdata( "cworley"    , 0          , 0.849381   , 0.185333, 0 ) // +/- 0.00514269
#define ns_fcworleyFB3  \
   nsdata( "cworley"    , -0.0114286 , 0.776565   , 0.165661, 0 ) // +/- 0.0114286
#define ns_vcworleyFB3  \
   nsdata( "cworley"    , -0.0114286 , 0.776565   , 0.165661, 0 ) // +/- 0.0114286
#define ns_falligator1 \
   nsdata ( "alligator" , 0          , 0.897279 , 0.13911   , 0 ) // +/- 0.0024
#define ns_valligator1 \
   nsdata ( "alligator" , 0          , 0.931199 , 0.132454  , 0 ) // +/- 0.0024
#define ns_falligator2 \
   nsdata ( "alligator" , 0          , 0.981734 , 0.117792  , 0 ) // +/- 0.0025
#define ns_valligator2 \
   nsdata ( "alligator" , 0          , 0.980294 , 0.126717  , 0 ) // +/- 0.0024
#define ns_falligator3 \
   nsdata ( "alligator" , 0          , 0.993732 , 0.117951  , 0 ) // +/- 0.0032
#define ns_valligator3 \
   nsdata ( "alligator" , 0          , 0.992102 , 0.128566  , 0 ) // +/- 0.0025
#define ns_fperlin4 \
   nsdata ( "perlin"    , 0.0168713 , 0.998413  , 0.507642  , 1 ) // +/- 0.0073
#define ns_vperlin4 \
   nsdata ( "perlin"    , 0.00576016 , 1.025    , 0.518260  , 1 ) // +/- 0.0037
#define ns_fpperlin4   \
   nsdata ( "pperlin"   , 0.154528   , 0.828153 , 0.511577  , 1 ) // +/- 0.0024
#define ns_vpperlin4   \
   nsdata ( "pperlin"   , 0.149949   , 0.853128 , 0.49744   , 1 ) // +/- 0.0024
#define ns_fsimplex4   \
   nsdata ( "simplex"   , 0.0943673  , 0.912882 , 0.503625  , 1 ) // +/- 0.0064
#define ns_vsimplex4   \
   nsdata ( "simplex"   , 0.13602    , 0.848679 , 0.510355  , 1 ) // +/- 0.0025
#define ns_fsparse4    \
   nsdata ( "sparse"    , -2.18691   , 2.46426  , 0.476393  , 1 ) // +/- 0.0064
#define ns_vsparse4    \
   nsdata ( "sparse"    , -2.59173   , 2.50891  , 0.506553  , 1 ) // +/- 0.0145
#define ns_fflow4      \
   nsdata ( "flow"      , 0.0541632  , 0.942907 , 0.501736  , 1 ) // +/- 0.0025
#define ns_vflow4      \
   nsdata ( "flow"      , 0.0834745  , 0.893131 , 0.514653  , 1 ) // +/- 0.0024
#define ns_fpflow4     \
   nsdata ( "pflow"     , 0.144938   , 0.852499 , 0.501408  , 1 ) // +/- 0.0024
#define ns_vpflow4     \
   nsdata ( "pflow"     , 0.155242   , 0.840548 , 0.5022    , 1 ) // +/- 0.0024
#define ns_fworleyFA4  \
   nsdata ( "worley"    , 0          , 1.19425  , 0.314428  , 0 ) // +/- 0.0024
#define ns_vworleyFA4  \
   nsdata ( "worley"    , 0          , 1.19425  , 0.314428  , 0 ) // +/- 0.0024
#define ns_fworleyFB4  \
   nsdata ( "worley"    , 0          , 1.53913  , 0.1402    , 0 ) // +/- 0.0512
#define ns_vworleyFB4  \
   nsdata ( "worley"    , 0          , 1.53913  , 0.1402    , 0 ) // +/- 0.0512
#define ns_fmworleyFA4  \
   nsdata ( "mworley"   , 0.00495732 , 1.7116   , 0.482286  , 0 ) // +/- 0.0068835
#define ns_vmworleyFA4  \
   nsdata ( "mworley"   , 0.00495732 , 1.7116   , 0.482286  , 0 ) // +/- 0.0068835
#define ns_fmworleyFB4  \
   nsdata ( "mworley"   ,-0.0163645  , 1.42481  , 0.159796  , 0 ) // +/- 0.0163645 
#define ns_vmworleyFB4  \
   nsdata ( "mworley"   ,-0.0163645  , 1.42481  , 0.159796  , 0 ) // +/- 0.0163645
#define ns_fcworleyFA4  \
   nsdata ( "cworley"   , 0.0274073  , 0.690122 , 0.521913  , 0 ) // +/- 0.00249996
#define ns_vcworleyFA4  \
   nsdata ( "cworley"   , 0.0274073  , 0.690122 , 0.521913  , 0 ) // +/- 0.00249996
#define ns_fcworleyFB4  \
   nsdata ( "cworley"   , 0          , 0.647968 , 0.156623  , 0 ) // +/- 0.00587861
#define ns_vcworleyFB4  \
   nsdata ( "cworley"   , 0          , 0.647968 , 0.156623  , 0 ) // +/- 0.00587861
#define ns_falligator4 \
   nsdata ( "alligator" , 0          , 0.994222 , 0.117762  , 0 ) // +/- 0.0032
#define ns_valligator4 \
   nsdata ( "alligator" , 0          , 0.991346 , 0.125998  , 0 ) // +/- 0.0025
#define ns_fsine1      \
   nsdata ( "sine"      , 0          , 1        , 0.5       , 1 ) // +/- 0
#define ns_fsine2      \
   nsdata ( "sine"      , 0          , 1        , 0.5       , 1 ) // +/- 0
#define ns_fsine3      \
   nsdata ( "sine"      , 0          , 1        , 0.5       , 1 ) // +/- 0
#define ns_fsine4      \
   nsdata ( "sine"      , 0          , 1        , 0.5       , 1 ) // +/- 0

#define ns_vsine1      \
   nsdata ( "sine"      , 0          , 1        , 0.5       , 1 ) // +/- 0
#define ns_vsine2      \
   nsdata ( "sine"      , 0          , 1        , 0.5       , 1 ) // +/- 0
#define ns_vsine3      \
   nsdata ( "sine"      , 0          , 1        , 0.5       , 1 ) // +/- 0
#define ns_vsine4      \
   nsdata ( "sine"      , 0          , 1        , 0.5       , 1 ) // +/- 0

 

 

  • Like 9
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...