Unlike C or C++, VEX has different "contexts" for which you write programs. These contexts define how the function is to be used.
For example, one context is the "surface" context. Functions written in this context are used to calculate the color(s) of a surface during rendering. The "pop" context is a different context where functions are used to control the motion or attributes of particle systems. While a surface shader processes pixel color information, a custom particle node deals with particle velocities and positions. So the global variables and functions provided for each context are slightly different.
See common shading context features for information specific to the shading contexts.
Define a displacement shader with a program that moves a point on a surface before the surface is rendered.
Deprecated. Define a fog shader with a program that modifies the Cf, Of, or Af values to simulate atmospheric effects.
Define a light shader with a program called from surface or fog shaders to calculate the illumination of a surface.
Define a shadow shader by defining a program that’s called from surface or fog shaders to calculate the occlusion on a surface from a light source.
Define a surface shader with a program that sets the final color, opacity, and alpha of a surface being rendered.