A collection of shader and experiments using VEX Language. Here you are going to find:

If you want to know more, please consider vising the repository.

1. Constant Shaders

Constant shaded color and not affected by lighting. It is probably the most basic shader to produce.

Constant Color

A simple pure shaded color.

Learn more

Constant Texture

A simple pure shaded color from texture.

Learn more

2. Iridescence Shader

A simple iridescence effect inspired by the Goniochromism phenomenon, which varies its aspect based on the relationship between the surface normal and the camera angle. The visual beautification is due the pseudo noise function, that makes the aspect a little more appealing.

                
                  float NaiveNoise(vector freq, offset) {
                    // Naive noise function to make irregularity
                    return sin(2*PI*P.x*freq.x*2 + 12 + offset.x) +
                      cos(2*PI*P.z*freq.x + 21 + offset.x) *
                      sin(2*PI*P.y*freq.y*2 + 23 + offset.y) +
                      cos(2*PI*P.y*freq.y + 32 + offset.y) *
                      sin(2*PI*P.z*freq.z*2 + 34 + offset.z) +
                      cos(2*PI*P.x*freq.z + 43 + offset.z);
                  }
                
                vector iridescence(
                  float orient,
                    noiseMult;
                  vector freqA,
                    offsetA,
                    freqB,
                    offsetB
                ) {
                  // This function returns a iridescence value based on orientation
                  vector irid;
                  irid.x = abs(cos(
                    2*PI*orient*freqA.x + NaiveNoise(freqB, offsetB)*noiseMult + 1 + offsetA.x
                  ));
                  irid.y = abs(cos(
                    2*PI*orient*freqA.y + NaiveNoise(freqB, offsetB)*noiseMult + 2 + offsetA.y
                  ));
                  irid.z = abs(cos(
                    2*PI*orient*freqA.z + NaiveNoise(freqB, offsetB)*noiseMult + 3 + offsetA.z
                  ));

                  return irid;
                }
                
              

Iridescence Simple

A simple iridescent shader.

Learn more

3. Reading Data Points

Reading data points and attributes from .bgeo files and bringing into shaders for whichever purpose. The main function which brings the point data into the shader context is expandpointgroup, given a filepath and a group name. The result is an array of point IDs so we can iterate through it.

                
                  string DATA = "../path/to/file.bgeo";
                  string group = "group_name";
                  int p[] = expandpointgroup(DATA, group);
                
              

QRotation Field

A quaternion rotation field, using data points as centroids and respective normals as axes.

Learn more

Cristalize Normals

Transfer normals from the data points to the shader context, using voronoi distribution.

Learn more

Transfer Color

Transfer color radially from the data points to the shader context.

Learn more