Function Overview




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

They can be found under:


\Mari\Scripts\MariExtensionPack_XX\Shaders\FunctionLibrary\Modules\



BRDF



  • float EP_fresnel(vec3 I, vec3 N, float ior);

Computes the fresnel function using using the schlick approximation


  • void EP_tangentVectors(vec3 N, float anisotropicRotation, out vec3 X, out vec3 Y);

Calculate the tangent and binormal from the input normal vector


  • float EP_orenNayar(vec3 I, vec3 N, vec3 L, float roughness);

Oren Nayar Diffuse


  • float EP_wardAnisotropic(vec3 N, vec3 I, vec3 L, vec3 X, vec3 Y, float SpecularRoughness, float Anisotropy);

Ward Anisotropic Specular


  • float EP_wardIsotropic(vec3 N, vec3 I, vec3 L, float SpecularRoughness);

Ward Isotropic Specular



CellNoises


  • vec4 EP_CellNoise( vec3 gridcell );


  • float EP_voronoiStep(float f2f1, float stepsize, vec3 pos1, vec3 pos2, vec3 pp);

EP_voronoi outline crack pattern


  • void EP_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);

EP_voronoi cellular pattern generator


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

 EP_voronoi cellular pattern


  • vec4 EP_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);

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


  • vec4 EP_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);

The fractal version of EP_voronoi_popcorn for more randomness


Color


  • vec4 EP_fullVibrance(vec4 inputColor,float max, float min, float power);

Used in Color Range to Mask Node to Oversaturating the colors to make picking more precise enhancing picked color ranges by applying a vibrancy function for saturation

default values for color range to mask are (inputcolor,0.2,0.3,3.5)


  • float EP_col2Mask(vec4 Source,vec4 ClipColor, float MaxError);

Returns black and white mask from source based on clipcolor


  • vec4 EP_sRgb2Linear(vec4 Color);

sRgb to Linear Conversion


  • vec3 EP_sRgb2Linear(vec3 Color);

sRgb to Linear Conversion


  • vec4 EP_linear2sRgb(vec4 Color);

Linear to sRGB conversion


  • vec3 EP_linear2sRgb(vec3 Color);

Linear to sRGB conversion


  • vec3 EP_Kelvin2Rgb(float Kelvin);

Kelvin to RGB


Distance


  • float EP_dist_Squared(float x, float y, float z);

distance squared


  • float EP_dist_Real(float x, float y, float z);

real distance


  • float EP_dist_Quadratic(float x, float y, float z);

quadratic distance


  • float EP_dist_Manhattan(float x, float y, float z);

manhattan/taxicab/cityblock distance


  • float EP_dist_Chebychev(float x, float y, float z);

chebychev


  • float EP_dist_MinkovskyH(float x, float y, float z);

minkowski preset exponent 0.5


  • float EP_dist_Minkovsky4(float x, float y, float z);

minkowski preset exponent 4


  • float EP_dist_Minkovsky(float x, float y, float z, float e);

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


Environment

  • vec3 EP_envLatMap2D(uvec4 sampler, vec3 dir);

Sample the environment texture for a latitude longitude map in the supplied direction for reflection mapping




Gabor Noise



  • vec4 EP_GaborNoise(vec3 Po, vec4 colorA, vec4 colorB, float frequency, vec3 orientation, float bandwidth, float truncate, float impulses, int seeds, int typeSet);

gabor noise function




Misc



  • float EP_D_evenCount(float input);

returns the number of even numbers


  • float EP_D_oddCount(float input);

returns the number of odd numbers


  • bool EP_D_ParityTest(float input);

Returns true if the input is an even number


  • vec2 EP_D_cart2pol(float x, float y);

cartesian to polar coordinate conversion


  • vec2 EP_D_pol2cart(float rho, float phi);

polar to cartesian coordinate conversion


  • float EP_D_rand(int Seed,float max);

Generates Random Number in a Range of 0 and Max. Min is just another seed value


  • float EP_D_RandomRange(int seed, float min, float max);

Generates Random Number in a Range or min to max


  • vec2 EP_D_Disorder(int seed,float disorderRadius,float disorderAngle);

Disorder


  • float EP_D_Discrete_AB(float A, float B, float Probability,int Seed);

Discreet A B

Returns A or B based on a Seed and Probability e.g

if randomNumber_generated_by_Seed >= Probability return A, else B


  • float EP_D_Discrete_AB_compareBase(float A, float B, float Probability,float CompareBase);

Discreet A B

Returns A or B based on a Base Value and Probability e.g

if Base >= Probability return A, else B



Multifractals



  • float EP_ridgedmf(vec3 p, int octaves, float lacunarity, float gain, float offset);

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 EP_iqmf(vec3 p, int octaves, float lacunarity, float gain);

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



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

inigo multi fractal noise


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

ridged multi fractal noise



Noises



  • float EP_Value3D( vec3 P );

Value 3D Noise


  • float EP_Perlin3D( 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 EP_SimplexPerlin3D(vec3 P);

EP_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


  • float EP_Hermite3D( vec3 P );

EP_Hermite3D

Return value range of -1.0->1.0

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


  • vec4 EP_Value3D_Deriv( vec3 P );

EP_Value3D_Deriv

EP_Value3D noise with derivatives

returns vec3( value, xderiv, yderiv, zderiv )


  • vec4 EP_PerlinSurflet3D_Deriv( vec3 P );

EP_PerlinSurflet3D_Deriv

Perlin Surflet 3D noise with derivatives

returns vec4( value, xderiv, yderiv, zderiv )


  • vec4 EP_Hermite3D_Deriv( vec3 P );

EP_Hermite3D_Deriv

EP_Hermite3D noise with derivatives

returns vec3( value, xderiv, yderiv, zderiv )


  • float EP_NoiseType(vec3 p, int type);

Noise type picker function

Noise is all returned in signed form -1,1

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


  • vec3 EP_vnoise(vec3 P);

vector noise function range of -1.0->1.0


  • float EP_fbm(vec3 p, int octaves, float lacunarity, float gain);

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 EP_turbulence(vec3 p, int octaves, float lacunarity, float gain);

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



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

perlin noise


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

brownian fractal noise


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

EP_turbulence fractal noise


  • float EP_vsnoise(vec3 P);

EP_vsnoise(p) - vector-valued perlin noise on a 3-d domain.


  • float EP_vlnoise (vec3 P, float scale);

the stuff that ken musgrave calls "EP_vlnoise"


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

a variation of EP_fbm without hardcoded values and added functionality


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

a variation of vector EP_fbm, generally with better performance but different results than EP_smoothVfBm


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

a variation of EP_fbm without hardcoded values and added functionality

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


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

a variation of vector EP_fbm without hardcoded values and added functionality

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



Pattern



  • float EP_dots2D(vec2 uv, float Scale);

Compute a procedural 2D Dot pattern


  • float EP_stripes2D(vec2 uv, float Scale);

Compute a procedural 2D stripe pattern


  • float EP_superEllipse2D(vec2 uv, float Scale, float Corner);

Compute a procedural 2D super ellipse pattern

Source: http://en.wikipedia.org/wiki/Superellipse


  • float EP_superEllipse2D(vec2 uv, vec2 Scale, float Corner);

Compute a procedural 2D super ellipse pattern

Source: http://en.wikipedia.org/wiki/Superellipse


  • void EP_superWeave2D(vec2 uv, float contrast, out float d0, out float d1, out float f0, out float f1);

Compute a procedural 2D weave shape pattern


  • float EP_checker(vec2 uv, float repeat);

Simple Checkerboard


  • float EP_scratches(vec2 uv,int segments,float segmentOffset, float Curl, int uLayers, vec2 Frequency, vec2 Lacunarity, int Seed, float Rotation,float fiMult,float LayerAttenuation);

Fibres



  • float EP_Shape(vec2 uv, int PatternNumber, float InputPatternSpecificA, float InputPatternSpecificB, float InputScale, float InputScaleX, float InputScaleXMultiplier, float InputScaleY, float InputScaleYMultiplier,float patternRotate,float cropTop,float cropBottom,float cropLeft,float cropRight,float cropRotation);

Shape Generator



  • vec4 EP_shuffleMaps(vec2 uv, float v, vec4 weightMap,uvec4 textureMap,float size,float kl,float sa,float sb,float ssa,float ssb,float minusf);

Used in Gradient from Image to lookup random points





Position



  • vec3 EP_translate( vec3 P, vec3 trans);

translate the position point in xyz


  • mat3 EP_rotation(float angle, vec3 axis);

build a rotation matrix in the

desired axis to multiply the position point


  • vec3 EP_scale( vec3 P, vec3 scale);

scale the position point in xyz


  • vec3 EP_positionTransform(vec3 P, vec3 Trans, vec3 Rot, vec3 Scale);

tranform the position with translate,scale,rotation


Texture Scatter



  • vec4 EP_texScatterUVX4(

                    vec2 UV, float scale, float ScaleRnd, float ScaleRndWeight,

                    float frequency, float layers, float noise_scale_A, bool forceTile,

                    float jitter_scale, float rot_min,  float rot_max, int BlendMode,

                    vec4 TexSize, vec4 RndSize, float HSVSeed, float ValueOffset,

                    float LayerAttenuation, float A_minH, float A_maxH, float A_minS,

                    float A_maxS, float A_minV, float A_maxV, vec4 HSMix, vec4 ValMix,

                    float clampValues, uvec4 textureA, int textureA_AlphaMode, bool UseMapB,

                    uvec4 textureB, int textureB_AlphaMode, bool UseMapC, uvec4 textureC,

                    int textureC_AlphaMode, bool UseMapD, uvec4 textureD, int textureD_AlphaMode,

                    vec4 Map_Weight, vec4 Clumping, vec4 invert, vec4 Fade, vec4 Hardness, vec4 roundness

                );


Texure Scattering with 4 Images



  • vec4 EP_texScatterUVX1(

          vec2 UV,  float scale, float ScaleRnd, float ScaleRndWeight,

          float frequency, float layers, float noise_scale_A, bool forceTile,

          float jitter_scale, float rot_min, float rot_max, int BlendMode,

          float MapASize, float HSVSeed, float ValueOffset, float LayerAttenuation,

          float A_minH, float A_maxH, float A_minS, float A_maxS, float A_minV,

          float A_maxV, float HSMixA, float ValMixA, float clampValues,

          uvec4 textureA, int textureA_AlphaMode, float Clumping_MapA,

          float invert_textureA, float FadeA, float HardnessA, float roundnessA

        );

Texure Scattering with 1 Image


  • float EP_trnd1d_threshold(float x,float lo,float hi,float threshold,float threshold_bound);

1D Random Function with Thresholding


  • void EP_voronoi_simple(vec3 position, float jitterD,out vec3 f1cell,float threshold,float threshold_bound);

EP_voronoi cellular pattern generator fromCellularNoise.glslc but a little simplified for better performance and with a threshold.


  • float EP_udn(float x,float scale,float lo,float hi);

simple Noise based cells


  • float EP_udnVor(float x,float scale,float lo,float hi, float threshold, float threshold_bound);

A very expensive, EP_voronoi based noise for seeding.



UV



  • mat2 EP_uvRotation(float angle);

Compute the UV rotation matrix


  • vec2 EP_uvMod(vec2 uv, float repeat, vec2 uvRepeat, vec2 uvOffset);

Compute the UV repeat and offset on the UV Coords


  • vec2 EP_patchCoord(vec2 uvCoord, float x, float y);

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 EP_patchRotate(vec2 uvCoord, float angle, float pivotU, float pivotV);

rotates the uvs per patch, feed in state.uv ( no fract() )

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


  • vec2 EP_relUVTransform(vec2 uvCoord, float RotationAngle, vec2 Offset, vec2 Repeat, float pivotU, float pivotV,bool perUdimPivot);

performs all uv transformation based on a pivot defined per udim




Value



  • float EP_rnd_1d(vec2 x);

random float generator [0,1]


  • float EP_signedValue(float f2f1);

signed value of input


  • float EP_cosineValue(float f2f1);

cosine value of input


  • float EP_Threshold(float threshold, float value);

threshold function for the givin value

a anti-aliased version of step for procedurals

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


  • float EP_clamp_0to1(float v);

Clamp value to 0...1 'float'


  • float EP_sq(float x);

Utility Functions


  • float EP_softThreshold(float threshold, float bound, float value);

threshold function for the givin float value with a feather value


  • vec4 EP_softThreshold(float threshold, float bound, vec4 value);

threshold function for the givin vec4 with a feather value


  • float EP_remap(float value, float oldMin, float oldMax, float newMin, float newMax, float multiplier,bool clmp);

EP_remap function for float


  • vec4 EP_remap(vec4 value, vec4 oldMin, vec4 oldMax, vec4 newMin, vec4 newMax, vec4 multiplier,bool clmp);

EP_remap function for color vec4 (color with alpha)


  • vec3 EP_remap(vec3 value, vec3 oldMin, vec3 oldMax, vec3 newMin, vec3 newMax, vec3 multiplier,bool clmp);

EP_remap function for color vec3


  • float EP_atan2(in float y, in float x);

Commonly used atan2 function


  • float EP_sum(vec4 V);

Sum Up x,y and z


  • float EP_Luminance(vec3 color);

OSL Luminance


  • float EP_Contrast(float value_input,float contrast,float pivot);

OSL Contrast


  • vec3 EP_Contrast(vec3 value_input, float contrast, float pivot);

OSL Contrast


  • float EP_Bias(float f, float b);

OSL Bias


  • float EP_BiasandGain(float f, float b, float g);

OSL Bias and Gain


  • vec4 EP_Levels(vec4 value, float inBlack,float inMid,float inWhite,float outBlack, float outWhite, int inMidMode, int clampMode, bool red, bool green, bool blue);

Functionalized Mari Levels


  • vec3 EP_Levels(vec3 value, float inBlack,float inMid,float inWhite,float outBlack, float outWhite, int inMidMode, int clampMode, bool red, bool green, bool blue);

Functionalized Mari Levels


  • float EP_Levels(float value, float inBlack,float inMid,float inWhite,float outBlack, float outWhite, int inMidMode, int clampMode);

Functionalized Mari Levels



Value Interpolation



  • float EP_AAStep(float threshold, float varyingVal);

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


  • float EP_boxStep(float low, float high, float value);

the EP_boxStep function is somewhere between step and smoothstep. it is the

result of the convolution of a box filter with a step edge.


  • float EP_rsmooth(float x, float a_n, float b_n);

smooth function using a combination of smoothstep and EP_boxStep


  • float EP_freqSmooth(float d, float x, float a_n, float b_n);

frequency smooth function using combination of smoothstep and EP_boxStep to smooth out noise frequencies.


Created with the Personal Edition of HelpNDoc: Free HTML Help documentation generator