Topics for v2.x

Topics for v1.x

Shader functions


The shader port in Plane9 have a few predefined functions and defines

Defines
NameDescription
PIThe value of pi 3.14159265358979323846
PI2Two times the value of pi 6.283185307179586232


Functions
NameDescription
float3 _hsv2rgb(float3 HSV)Converts a HSV value to a RGB value
float3 _hsv2rgb(float h, float s, float v)Converts a HSV value to a RGB value
float _perm(float pos)Permutation value. Basically a random value but uses the values defined by perlin
float _perm(float2 pos)Permutation value. Basically a random value but uses the values defined by perlin
float _noisefast(float p)Fast perlin noise from a 1d point. This is a perlin noise approximation and it does have artifacats if used on its own. It is however fast
float _noisefast(float2 p)Fast perlin noise from a 2d point. This is a perlin noise approximation and it does have artifacats if used on its own. It is however fast
float _noisefast(float3 p)Fast perlin noise from a 3d point. This is a perlin noise approximation and it does have artifacats if used on its own. It is however fast
float3 _noisegradientfast(float p, float d)Gradient of a fast noise 1d value
float3 _noisegradientfast(float2 p, float d)Gradient of a fast noise 2d value
float3 _noisegradientfast(float3 p, float d)Gradient of a fast noise 3d value
float _fbmfast(float p, int octaves, float lacunarity = 2.13628142, float gain = 0.5)Fractal sum of a 1d point
float _fbmfast(float2 p, int octaves, float lacunarity = 2.13628142, float gain = 0.5)Fractal sum of a 2d point
float _fbmfast(float3 p, int octaves, float lacunarity = 2.13628142, float gain = 0.5)Fractal sum of a 3d point
float _turbulencefast(float p, int octaves, float lacunarity = 2.13628142, float gain = 0.5)Tubulence for a 1d point
float _turbulencefast(float2 p, int octaves, float lacunarity = 2.13628142, float gain = 0.5)Tubulence for a 2d point
float _turbulencefast(float3 p, int octaves, float lacunarity = 2.13628142, float gain = 0.5)Tubulence for a 3d point
float _ridgedmffast(float p, int octaves, float lacunarity = 2.13628142, float gain = 0.5)Ridged multifractal of a 1d point
float _ridgedmffast(float2 p, int octaves, float lacunarity = 2.13628142, float gain = 0.5)Ridged multifractal of a 2d point
float _ridgedmffast(float3 p, int octaves, float lacunarity = 2.13628142, float gain = 0.5, float offset = 1.0)Ridged multifractal of a 3d point
void _voronoi(float2 position, out float f1, out float2 pos1, out float f2, out float2 pos2, float jitter = 0.9, int type = 0)Worly Noise / Voronoi. f1/pos1 is the distance and poistion of the closest point. f2/pos2 is the distance to the next closest point. 0=Normal,1=Manhattan Distance, 2=Chebyshev distance
void _voronoi(float3 position, out float f1, out float3 pos1, out float f2, out float3 pos2, float jitter = 0.9, int type = 0)Worly Noise / Voronoi. f1/pos1 is the distance and poistion of the closest point. f2/pos2 is the distance to the next closest point. 0=Normal,1=Manhattan Distance, 2=Chebyshev distance


In the above functions the arguments are as follows
NameDescription
OctavesThe number of octaves of noise to sum together. Higher value creates more details but is slower
LacunarityFor each octave of noise the frequency of the noise is increased by this amount. Prefereably avoid integer values since it reduces aliasing artifcats
GainFor each octave of noise the gain is increase by this amount