About Gray

Gray (Greiners Raytracer) is a hobby/research project of mine. It is a program that simulates light to produce computer generated images. The technique used is called ray tracing, where a large number of rays are cast against mathematical 3D models to simulate the interaction between light and materials. The result is beautiful computer generated images, like the ones we are used to see in special effects in movies.

Parametric Surface Tool

ProgrammingPosted by Søren Greiner Wed, February 03, 2010 14:15:56
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)


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.


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

Fill in only if you are not real

The following XHTML tags are allowed: <b>, <br/>, <em>, <i>, <strong>, <u>. CSS styles and Javascript are not permitted.
Posted by Søren Greiner Sun, February 28, 2010 11:05:17

Well thank you very much, it's always nice when people find some use or interest in the small programs I make. To read the XML files I currently use expat
( which has a very simple interface. It is stream based so you register some callback functions and get notified when it finds start tags and end tags in the file. Another reader I have used is libxml2 which parses the files as a tree structure that then can be inspected by iterating through nodes.
Whenever I use wxWidgets for my crossplatform GUI things I use the built in wxWidgets XML parser which also is tree-oriented (but actually is built around expat). My main reason for using expat in small programs is that I dont't like to make small projects depend on huge frameworks like wxWidgets unless I really have to.
When I write XML files, I usually just fprintf directly to the files without using any libraries.

Posted by D-POWER Sun, February 28, 2010 09:44:48

I've just downloaded your tool ,it is really interesting .You did an amazing job!
I wonder what library are you using to parse xml files ?