x^2+y^2+z^2=4,vector(h,s,v)=vector(sin([pi*[x+sin(pi*y)+n]]),1,1)


Graph of the formula

This fragment program computes the hue. The hsv value is converted to rgb in a seperate pass after the surface is rendered and copied to a texture.

!!ARBfp1.0

TEMP R0;

PARAM U0 = program.local[0];

PARAM C0 = {
3.141592653589793115997963468544,
1.000000000000000000000000000000,
0.000000000000000000000000000000,
0.000000000000000000000000000000
};

MUL R0.x, C0.x, fragment.texcoord[0].y;
SIN R0.y, R0.x;
ADD R0.x, R0.y, U0.x;
ADD R0.y, fragment.texcoord[0].x, R0.x;
MUL R0.x, C0.x, R0.y;
SIN R0.y, R0.x;
MOV_SAT R0.x, C0.y;
FRC result.color.x, R0.y;
MOV result.color.y, C0.y;
MUL result.color.z, C0.y, fragment.color.primary.z;
MOV result.color.w, C0.y;

END