For producing parametric surfaces for Gray, I developed a small command line tool that generates a 3D model from a parametric function.

To use the tool download it and run it using 3 functions of the parameters u and v for each x,y and z coordinate. Here is the complete input arguments for the tool:

Parametric.exe x y z umin umax vmin vmax un vn outfile.xml format

x function of u and v
y function of u and v
z function of u and v
umin minimum value of u
umax maximum value of u
vmin minimum value of v
vmax maximum value of v
u division along u parameter
v division along v parameter
outfile.xml output model filename
format output model fileformat (GRAY or K3D)

example:

Parametric.exe u sin(u/pi) v -2*pi 2*pi -2 4 100 100 test.xml GRAY

The tools is for Windows, but the C++ source code can be requested if you need to compile for your own platform.

Download: Parametric.zip

I added some .bat files as examples. Below is the “Twisted Torus”