Function Overview

SDK ›› OpenGl ››
Parent Previous Next

Function Overview




The following functions are exposed as part of MARI Extension Pack 3 R2 and can be called from nodes.

Please go to the File marked in the first line for more information


Noise functions



1D Random Function with Thresholding


float rnd1d_threshold(float x,float lo,float hi,float threshold,float threshold_bound);






simple Noise based cells


float udn(float x,float scale,float lo,float hi);






  Noise type picker function

  Noise is all returned in signed form -1,1

  returns type = 0:value,1:perlin,2:simplex,3:hermite


float NoiseType(vec3 p, int type);





Value Noise 3D

  Return value range of -1.0->1.0

  http:briansharpe.files.wordpress.com/2011/11/valuesample1.jpg


float Value3D( vec3 P );





  Perlin Noise 3D  ( gradient noise )

  Return value range of -1.0->1.0

  http:briansharpe.files.wordpress.com/2011/11/perlinsample.jpg


float Perlin3D( vec3 P );





  SimplexPerlin3D  ( simplex gradient noise )

  Perlin noise over a simplex (tetrahedron) grid

  Return value range of -1.0->1.0

  http:briansharpe.files.wordpress.com/2012/01/simplexperlinsample.jpg


  Implementation originally based off Stefan Gustavson's and Ian McEwan's work at...

  http:github.com/ashima/webgl-noise


float SimplexPerlin3D(vec3 P);




 

Hermite3D

  Return value range of -1.0->1.0

  http:briansharpe.files.wordpress.com/2012/01/hermitesample.jpg


float Hermite3D( vec3 P );





  Value3D_Deriv

  Value3D noise with derivatives

  returns vec3( value, xderiv, yderiv, zderiv )


vec4 Value3D_Deriv( vec3 P );





  PerlinSurflet3D_Deriv

  Perlin Surflet 3D noise with derivatives

  returns vec4( value, xderiv, yderiv, zderiv )


vec4 PerlinSurflet3D_Deriv( vec3 P );





  Hermite3D_Deriv

  Hermite3D noise with derivatives

  returns vec3( value, xderiv, yderiv, zderiv )


vec4 Hermite3D_Deriv( vec3 P );





vector noise function range of -1.0->1.0


vec3 vnoise(vec3 P);





fractional Brownian motion

Inputs:

p              position and approximate inter-pixel spacing

octaves        max # of octaves to calculate

lacunarity     frequency spacing between successive octaves

gain           scaling factor between successive octaves


float fBm(vec3 p, int octaves = 4, float lacunarity = 2.0, float gain = 0.5);




turbulence

Inputs:

p              position and approximate inter-pixel spacing

octaves        max # of octaves to calculate

lacunarity     frequency spacing between successive octaves

gain           scaling factor between successive octaves


float turbulence(vec3 p, int octaves = 4, float lacunarity = 2.0, float gain = 0.5);





perlin noise


vec4 DT3D_PerlinNoise(vec3 Po, vec4 colorA, vec4 colorB, float frequency, float threshold, bool invert, int unsign, int modSet, bool clamping);





turbulence fractal noise


vec4 DT3D_TurbNoise(vec3 Po, vec4 colorA, vec4 colorB, float frequency, int octaves, float lacunarity, float gain, float threshold, bool invert, bool clamping);





vector-valued Perlin noise on 3-D domain.


float vsnoise(vec3 p);





The stuff that Ken Musgrave calls "VLNoise"


float VLNoise (vec3 Pt, float scale);





brownian fractal noise


vec4 DT3D_fBmNoise(vec3 Po, vec4 colorA, vec4 colorB, float frequency, int octaves, float lacunarity, float gain, float threshold, bool invert, bool clamping);





A Variation of FBM without hardcoded values and added functionality


float rmfBm (vec3 P, float octaves, float lacunarity, float gain, float amp, float freqOffset);





A Variation of FBM without hardcoded values and added functionality

Most incoming values are smoothed so this function is suitable for non-constant in-values.


float smoothfBm (vec3 P, float octaves, float lacunarity, float gain, float amp, float freqOffset);





A Variation of Vector FBM without hardcoded values and added functionality

Most incoming values are smoothed so this function is suitable for non-constant in-values.


float smoothVfBm (vec3 P, float octaves, float lacunarity, float gain, float amp, float scale, float freqOffset);





A Variation of Vector FBM, generally with better performance but different results than smoothVfbm


float VLfBm (vec3 P, float octaves, float lacunarity, float gain, float amp, float scale);





Compute a procedural 2D dot pattern


float nb_dots2D(vec2 uv, float Scale)





Compute a procedural 2D stripe pattern


float nb_stripes2D(vec2 uv, float Scale)





Compute a procedural 2D super ellipse pattern


float nb_superEllipse2D(vec2 uv, float Scale, float Corner)





Compute a procedural 2D super shape pattern


float nb_superShape2D(vec2 uv, float Scale, float angle, float a, float b, float m, float n1, float n2, float n3, out float gradient)





Compute a procedural 2D weave shape pattern


void nb_superWeave2D(vec2 uv, float contrast, out float d0, out float d1, out float f0, out float f1)



MultiFractal Functions




inigo multi-fractal

Inputs:

p              position and approximate inter-pixel spacing

octaves        max # of octaves to calculate

lacunarity     frequency spacing between successive octaves

gain           scaling factor between successive octaves


float iqmf(vec3 p, int octaves = 4, float lacunarity = 2.0, float gain = 0.5);





ridged multi-fractal

Inputs:

p              position and approximate inter-pixel spacing

octaves        max # of octaves to calculate

lacunarity     frequency spacing between successive octaves

gain           scaling factor between successive octaves

offset         a factor to offset the octaves


float ridgedmf(vec3 p, int octaves = 4, float lacunarity = 2.0, float gain = 0.5, float offset = 1.0);





inigo multi fractal noise


vec4 DT3D_InigoNoise(vec3 Po, vec4 colorA, vec4 colorB, float frequency, int octaves, float lacunarity, float gain, float threshold, bool invert, bool clamping);





ridged multi fractal noise


vec4 DT3D_RidgedNoise(vec3 Po, vec4 colorA, vec4 colorB, float frequency, int octaves, float lacunarity, float gain, float offset, float threshold, bool invert, bool clamping);



Voronoi Functions



A very expensive, voronoi based noise for seeding.


float udnVor(float x,float scale,float lo,float hi, float threshold, float threshold_bound);






CellularNoiseLib.glslc

voronoi cellular pattern


vec4 DT3D_CellularNoise(vec3 Po, vec4 colorA, vec4 colorB, float frequency, float jitter, float stepSize, float threshold, bool invert, int outSet, int distSet, int modSet);





  Generate grid cells random noise, returns value random cell values


vec4 CellNoise( vec3 gridcell );





voronoi outline crack pattern

float voronoiStep(float f2f1, float stepsize, vec3 pos1, vec3 pos2, vec3 pp);



   

 voronoi cellular pattern generator


 void voronoi(vec3 position, float jitterD, int distype, out float f1, out float f2, out vec3 pos1,  out vec3 pos2, out vec3 f1cell, out vec3 f2cell);





Generates a popcorn like shape, if inverted it has similarities with veins

You might have to do forward declarations of voronoi() in your function file


vec4 voronoi_popcorn(vec3 position,float lrg_Shp_Itr,float sml_Shp_Itr,float lrg_Shp_Scale,float sml_Shp_Scale,float lrg_Shp_Amp,float sml_Shp_Amp,        float width,int distSet);





The fractal version of voronoi_popcorn for more randomness


vec4 popcorn_Frac(vec3 position,float lrg_Shp_Itr,float sml_Shp_Itr,float octaves,float lacunarity, float octGain,float lines_width,float lines_widthAdd,float lrg_Shp_Scale,float sml_Shp_Scale,float lrg_Shp_Amp, float sml_Shp_Amp,int distSet,int outSet);



Gabor Noise Functions



gabor noise function


vec4 DT3D_GaborNoise(vec3 Po, vec4 colorA, vec4 colorB, float frequency, vec3 orientation,

                                        float bandwidth, float truncate, float impulses, int seeds, int typeSet);



Position Modification Functions



translate the position point in xyz


vec3 translate( vec3 P, vec3 trans);





 build a rotation matrix in the

 desired axis to multiply the position point


mat3 rotation(float angle, vec3 axis);





scale the position point in xyz


vec3 scale( vec3 P, vec3 scale);





tranform the position with translate,scale,rotation


vec3 positionTransform(vec3 P, vec3 Trans, vec3 Rot, vec3 Scale);





UV Modification Functions




Compute the UV repeat and offset on the UV Coords


vec2 nb_uvMod(vec2 uv, float repeat, vec2 uvRepeat, vec2 uvOffset)





Compute the UV rotation matrix


mat2 nb_uvRotation(float angle)





relUVTransform

Performs all UV Transformation based on a pivot defined per UDIM


vec2 relUVTransform(vec2 uvCoord, float RotationAngle, vec2 Offset, vec2 Repeat, float pivotU, float pivotV);





patchCoord

Returns one offset coordinate per patch/udim

Useful for example to set pivots per patch

x and y represent offsets from the default coordinate (lower left corner of each patch)

uvCoord should be STATE.UV


vec2 patchCoord(vec2 uvCoord, float x, float y);





Rotates the UVs per Patch, feed in State.UV or equivalent

pivotU and pivotV can be used to set rotational pivot on a patch (corner, center)

Output is UV Vec2


vec2 patchRotate(vec2 uvCoord, float angle, float pivotU, float pivotV);






Value Functions



bias function on a given value


float pxslBias( float bias, float value );





gain function on a givin value


float pxslGain( float gain, float value );





threshold function for the givin value


float pxslThreshold(float threshold, float value);





threshold function for the given float value with a feathering value


float softThreshold(float threshold, float bound, float value);





threshold function for the given color with a feathering value


vec4 softThreshold(float threshold, float bound, vec4 colorInput)





Remap Function for Floats, vec4s and vec3s


float remap(float input, float OldMin, float OldMax, float NewMin, float NewMax, float Multiplier);

vec4 remap(vec4 input, vec4 OldMin, vec4 OldMax, vec4 NewMin, vec4 NewMax, vec4 Multiplier);

vec3 remap(vec3 input, vec3 OldMin, vec3 OldMax, vec3 NewMin, vec3 NewMax, vec3 Multiplier);




Compute the square of a given value.


float nb_sq(float x)





 signed value of input


 float signedValue(float f2f1);




 cosine value of input


float cosineValue(float f2f1);






 random float generator [0,1]


  float rnd_1d(vec2 x);





   Enhancing picked Colorranges by applying a vibrancy function for Saturation


vec4 fullVibrance(vec4 inputColor,float max, float min, float power)





Value Interpolation Functions




Box filtered Step function

The boxstep function is somewhere between step and smoothstep. It is the result of the convolution of a box filter with a step edge.


float boxStep(float low, float high, float value);





Smooth function using combination of smoothstep and boxstep to smooth out values


float rsmooth(float x, float a_n, float b_n);





Frequency Smooth function using combination of smoothstep and boxstep to smooth out noise frequencies.


float FreqSmooth(float d, float x, float a_n, float b_n)






a anti-aliased version of step for procedurals  

'threshold' is constant , 'value' is smoothly varying


float aastep(float threshold , float value);





Anti-aliased step for procedurals where 'threshold' is constant and 'varyingVal' is smoothly varying


float nb_AAstep(float threshold, float varyingVal)



Distance Functions


 distance squared

 float dist_Squared(float x, float y, float z);


 real distance

float dist_Real(float x, float y, float z);


 quadratic distance

float dist_Quadratic(float x, float y, float z);


 manhattan/taxicab/cityblock distance

float dist_Manhattan(float x, float y, float z);


 chebychev

float dist_Chebychev(float x, float y, float z);


 minkowski preset exponent 0.5

float dist_MinkovskyH(float x, float y, float z);


 minkowski preset exponent 4

float dist_Minkovsky4(float x, float y, float z);


 minkowski, general case, slow, maybe too slow to be useful

 exp = 0.5f MinkovskyH, exp = 1.0f Manhattan, exp = 2.3f Squared

 exp = 4.0f Minkovsky4, exp = 20.0f Chebychev  

float dist_Minkovsky(float x, float y, float z, float e);


Color Functions


 Kelvin to RGB, converts a Kelvin value to a (s)RGB value

 vec3 Kelvin2Rgb(float Kelvin);





 Returns luminance of input RGB

 float Luminance(vec3 color);




sRGB to Linear conversion (vec3, vec4)

vec4 sRgb2Linear(vec4 Color);

vec3 sRgb2Linear(vec3 Color);




Linear to sRGB conversion (vec3, vec4)

vec4 linear2sRgb(vec4 Color);

vec3 linear2sRgb(vec3 Color);



Returns black and white mask from source based on clipping color


float col2Mask(vec4 Source,vec4 ClipColor, float MaxError);




Created with the Personal Edition of HelpNDoc: Create HTML Help, DOC, PDF and print manuals from 1 single source