F=x^2+y^2+z^2+sin(4*x)+sin(4*y)+sin(4*z)-1

The equation below draws a series of planes at z = {-1.5,-1,-.4,0,.5,1}, clipping the plane to were F < 0 and coloring the plane according to the value of F.

z=a,vector(r,g,b)=vector(sqrt(-F),0,0),in(a,set(-1.5,-1,-0.4,0,0.5,1))

The following two equations draw level curves of constant x and z on the surface F = 0.

0=F,sin(a*z)>0.96

0=F,sin(a*x)>0.96

a=slider([50,150])


Graph of the formula

The fragment program which clips the surface to draw the level curves of constant z is given by:

!!ARBfp1.0

TEMP R0;
TEMP R1;

PARAM C0 = {
2.000000000000000000000000000000,
4.000000000000000000000000000000,
1.000000000000000000000000000000,
0.000000000000000000000000000000
};

MUL R0.x, fragment.texcoord[0].x, fragment.texcoord[0].x;
MUL R0.y, fragment.texcoord[0].y, fragment.texcoord[0].y;
MUL R0.z, fragment.texcoord[0].z, fragment.texcoord[0].z;
MUL R0.w, C0.y, fragment.texcoord[0].x;
SIN R1.x, R0.w;
MUL R0.w, C0.y, fragment.texcoord[0].y;
SIN R1.y, R0.w;
MUL R0.w, C0.y, fragment.texcoord[0].z;
SIN R1.z, R0.w;
ADD R0.w, R0.y, R0.z;
ADD R0.y, R0.x, R0.w;
ADD R0.x, R1.x, R1.y;
ADD R0.z, R1.z, -C0.z;
ADD R0.w, R0.x, R0.z;
ADD R0.x, R0.y, R0.w;
RSQ R0.y, -R0.x;
RCP R0.z, R0.y;
KIL -R0.x;
MOV_SAT R0.x, R0.z;
MOV_SAT R0.y, C0.w;
MUL result.color.x, fragment.color.primary.x, R0.x;
MUL result.color.y, fragment.color.primary.y, R0.y;
MUL result.color.z, fragment.color.primary.z, R0.y;

END