Function Overview

SDK ›› OpenGl ››
Parent Previous Next

Function Overview




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

They can be found under:


\Mari\Scripts\ExtensionPack_4R2\Shaders\FunctionLibrary\Modules\


BRDF



Computes the fresnel function using using the schlick approximation


Calculate the tangent and binormal from the input normal vector


Oren Nayar Diffuse


Ward Anisotropic Specular


Ward Isotropic Specular



CellNoises



EP_voronoi outline crack pattern


EP_voronoi cellular pattern generator


EP_voronoi cellular pattern


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


The fractal version of EP_voronoi_popcorn for more randomness


Color


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)


Returns black and white mask from source based on clipcolor


sRgb to Linear Conversion


sRgb to Linear Conversion


Linear to sRGB conversion


Linear to sRGB conversion


Kelvin to RGB


Distance


distance squared


real distance


quadratic distance


manhattan/taxicab/cityblock distance


chebychev


minkowski preset exponent 0.5


minkowski preset exponent 4


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

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




Gabor Noise



gabor noise function



Multifractals



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


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



inigo multi fractal noise


ridged multi fractal noise



Noises



Value 3D Noise


Perlin Noise 3D  ( gradient noise )

Return value range of -1.0->1.0

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


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


EP_Hermite3D

Return value range of -1.0->1.0

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


EP_Value3D_Deriv

EP_Value3D noise with derivatives

returns vec3( value, xderiv, yderiv, zderiv )


EP_PerlinSurflet3D_Deriv

Perlin Surflet 3D noise with derivatives

returns vec4( value, xderiv, yderiv, zderiv )


EP_Hermite3D_Deriv

EP_Hermite3D noise with derivatives

returns vec3( value, xderiv, yderiv, zderiv )


Noise type picker function

Noise is all returned in signed form -1,1

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


vector noise function range of -1.0->1.0


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



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



perlin noise


brownian fractal noise


EP_turbulence fractal noise


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


the stuff that ken musgrave calls "EP_vlnoise"


a variation of EP_fbm without hardcoded values and added functionality


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


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.


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



Compute a procedural 2D Dot pattern


Compute a procedural 2D stripe pattern


Compute a procedural 2D super ellipse pattern

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


Compute a procedural 2D weave shape pattern


Simple Checkerboard



Position



translate the position point in xyz


build a rotation matrix in the

desired axis to multiply the position point


scale the position point in xyz


tranform the position with translate,scale,rotation


Texture Scatter



                   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



         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


1D Random Function with Thresholding


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


simple Noise based cells


A very expensive, EP_voronoi based noise for seeding.



UV



Compute the UV rotation matrix


Compute the UV repeat and offset on the UV Coords


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


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)


performs all uv transformation based on a pivot defined per udim




Value



random float generator [0,1]


signed value of input


cosine value of input


threshold function for the givin value

a anti-aliased version of step for procedurals

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


Clamp value to 0...1 'float'


Utility Functions


threshold function for the givin float value with a feather value


threshold function for the givin vec4 with a feather value


EP_remap function for float


EP_remap function for color vec4 (color with alpha)


EP_remap function for color vec3








Value Interpolation



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


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.


smooth function using a combination of smoothstep and EP_boxStep


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


Created with the Personal Edition of HelpNDoc: Free EBook and documentation generator