Tcl-SIPP provides a Tcl command interface to SIPP, the SImple Polygon Processor library. This provides a command interface for creating 3-dimensional scenes and rendering them using a scan-line z-buffer algorithm. The Tcl interpretive programming language is used to provide a powerful, yet simple interface to this library. The scene may be written to either a PPM format file, as defined by the PBMPLUS toolkit or a RLE file, as defined by the Utah Raster Toolkit.
Tcl-SIPP follows the calling conventions of the Tcl shell provided with Extended Tcl. The command line is:
tsipp [-q] [[-f] script]|[-c command] [args]
See the TclX manual page for details of the arguments and flags.
The following data structures are used by Tcl-SIPP:
{{1.2 1.4 0.1 0} {2.1 2.3 1.6 0} {2.4 6.1 2.6 0} {2.9 1.1 3.6 1}}
Be careful, many commands take lists of the above data types, which are themselves lists.
Various resources are created during the definition of a scene, these resources are referenced in the Tcl code with handles. A handle is similar to a file id number returned by the open system call. It is an abstract entity that provides a reference to a resource that is internally managed. The following handles for the following resources are provided:
When a delete operation is performed on a handle, a use count is decremented, the resource is not actually release unless the use count goes to zero. Thus a handle to a object that has been added as a subobject of another object may be deleted with out release the subobject.
These commands provide for the definitions of polygons and the creation of surfaces from the polygons. There is a vertex stack for defining polygons and a polygon stack for defining surfaces. The surfaces are referenced by surface handles.
If a vertex in the polygon is already defined in a previous polygon that belongs to the same surface, the same vertex will be referenced, i.e. vertices shared between polygons are only stored once, but they must be repeated when defining the polygons.
specular is a value between 0.0 and 1.0 which is the fraction of color specularly reflected.
c3 is the shininess of the surface where 0.0 is the most shiny and 1.0 is the most dull.
color is a list containing the red, green and blue values for the surface. Each being a number between 0.0 and 1.0.
opacity describes the opacity of a surface. 0.0 means totally transparent, 1.0 means totally opaque. May be a list of red, green and blue opacity values or a single value to be used for all color channels. Optional, default is 1.0.
diffuse is a value between 0.0 and 1.0 specifying how much light that is reflected diffusely from the surface.
specular is a value between 0.0 and 1.0 which is the fraction of color specularly reflected.
spec_exp is the exponent in the specular highlight calculation. It specifies how "shiny" the surface is. Useful values are about 1 to 200, where 1 is a rather dull surface and 200 is a very shiny one.
color is a list containing the red, green and blue values for the surface. Each being a number between 0.0 and 1.0.
opacity describes the opacity of a surface. 0.0 means totally transparent, 1.0 means totally opaque. May be a list of red, green and blue opacity values or a single value to be used for all color channels. Optional, default is 1.0.
smoothness is a value between 0 and 1 that describes how smooth the surface is. This parameter controls both diffuse and specular reflections. 0 means a dull surface while 1 means a very smooth and shiny one.
metalness is also a value between 0 and 1. It describes how metallic the material is. It controls among other things how much of the surface color should be mixed into the specular reflections at different angles. 0 means a non-metal while 1 means a very metallic surface.
color is a list containing the red, green and blue values for the surface. Each being a number between 0.0 and 1.0.
opacity describes the opacity of a surface. 0.0 means totally transparent, 1.0 means totally opaque. May be a list of red, green and blue opacity values or a single value to be used for all color channels. Optional, default is 1.0.
specular is a value between 0.0 and 1.0 which is the fraction of color specularly reflected.
c3 is the shininess of the surface where 0.0 is the most shiny and 1.0 is the most dull.
scale is a factor which determines the size of the wood pattern depending on the size of the texture coordinate system in relation to the world coordinate system. You will have to experiment some to get this right.
basecolor is a list containing the red, green and blue values for the wood base. Each being a number between 0.0 and 1.0.
ringcolor is a list containing the red, green and blue values for the wood rings.
opacity describes the opacity of a surface. 0.0 means totally transparent, 1.0 means totally opaque. May be a list of red, green and blue opacity values or a single value to be used for all color channels. Optional, default is 1.0.
specular is a value between 0.0 and 1.0 which is the fraction of color specularly reflected.
c3 is the shininess of the surface where 0.0 is the most shiny and 1.0 is the most dull.
scale is a factor which determines the size of the marble pattern depending on the size of the texture coordinate system in relation to the world coordinate system.
basecolor is a list containing the red, green and blue values for the base material. Each being a number between 0.0 and 1.0.
stripcolor is a list containing the red, green and blue values for the interspersed material.
opacity describes the opacity of a surface. 0.0 means totally transparent, 1.0 means totally opaque. May be a list of red, green and blue opacity values or a single value to be used for all color channels. Optional, default is 1.0.
specular is a value between 0.0 and 1.0 which is the fraction of color specularly reflected.
c3 is the shininess of the surface where 0.0 is the most shiny and 1.0 is the most dull.
scale is a factor which determines the size of the granite pattern depending on the size of the texture coordinate system in relation to the world coordinate system.
color1 and color2 is a list containing the red, green and blue values for the base material. Each being a number between 0.0 and 1.0.
stripcolor is a list containing the red, green and blue values for the interspersed material.
opacity describes the opacity of a surface. 0.0 means totally transparent, 1.0 means totally opaque. May be a list of red, green and blue opacity values or a single value to be used for all color channels. Optional, default is 1.0.
ambient is a value between 0.0 and 1.0 which determines how much of the base color of a surface that is visible when it is not illuminated by any lightsource.
specular is a value between 0.0 and 1.0 which is the fraction of color specularly reflected.
c3 is the shininess of the surface where 0.0 is the most shiny and 1.0 is the most dull.
scale is a factor which determines the size of the pattern depending on the size of the texture coordinate system in relation to the world coordinate system.
opacity describes the opacity of a surface. 0.0 means totally transparent, 1.0 means totally opaque. May be a list of red, green and blue opacity values or a single value to be used for all color channels. Optional, default is 1.0.
scale is a factor which determines the size of the granite pattern depending on the size of the texture coordinate system in relation to the world coordinate system.
BUMPS indicates that only bumps standing out from the surface are visible, the rest of the surface is smooth.
HOLES indicates that only bumps going into the surface are visible, the rest of the surface is smooth. If neither HOLES or BUMPS or specified, then both are assumed to be on.
The texture is 3-dimensional, so it is possible to create cube planets or even planets with cut-out parts that still have surfaces that resemble the earth surface. The texture is not scalable, and is designed to be used with texture coordinates in the range -1.0 to 1.0, e.g. a unit sphere. Of course the world coordinates need not have the same order of magnitude.
specular is a value between 0.0 and 1.0 which is the fraction of color specularly reflected.
c3 is the shininess of the surface where 0.0 is the most shiny and 1.0 is the most dull.
opacity describes the opacity of a surface. 0.0 means totally transparent, 1.0 means totally opaque. May be a list of red, green and blue opacity values or a single value to be used for all color channels. Optional, default is 1.0.
These commands are provided for creating and manipulating objects. An object is referenced by an object handle.
These commands create primitive objects of specific shapes.
Each object primitive which can be created in SIPP has an argument that describes what kind of texture coordinates should be assigned to the surface of the object. This parameter can have one of the following predefined values:
Texture is the texture mapping algorithm to use for the object. The NATURAL texture mapping is a two dimensional mapping with the x coordinate going around the small circle and the y coordinate going around the large circle.
An object handle that references the new object is returned.
Texture is the texture mapping algorithm to use for the object. The NATURAL' texture mapping is CYLINDRICAL.
An object handle that references the new object is returned.
Texture is the texture mapping algorithm to use for the object. The NATURAL' texture mapping is CYLINDRICAL.
An object handle that references the new object is returned.
Texture is the texture mapping algorithm to use for the object. The NATURAL texture mapping is SPHERICAL.
An object handle that references the new object is returned.
Texture is the texture mapping algorithm to use for the object. The NATURAL texture mapping is SPHERICAL.
An object handle that references the new object is returned.
Texture is the texture mapping algorithm to use for the object. The NATURAL texture mapping is similar to CYLINDRICAL but the x coordinate is not taken from projection on a cylinder but is evenly distributed around the perimeter. An odd thing in all the 2D mappings (all except WORLD) for the prism is that the top face will have texture coordinates (0.0, 1.0) while the bottom will get (0.0, 0.0).
An object handle that references the new object is returned.
Texture is the texture mapping algorithm to use for the object. The NATURAL texture mapping is similar to CYLINDRICAL but the x coordinate is not taken from projection on a cylinder but is evenly distributed around the perimeter. An odd thing in all the 2D mappings (all except WORLD) for the block is that the top face will have texture coordinates (0.0, 1.0) while the bottom will get (0.0, 0.0).
An object handle that references the new object is returned.
Texture is the texture mapping algorithm to use for the object. The NATURAL texture mapping is similar to CYLINDRICAL but the `x' coordinate is not taken from projection on a cylinder but is evenly distributed around the perimeter. An odd thing in all the 2D mappings (all except WORLD) for the cube is that the top face will have texture coordinates (0.0, 1.0) while the bottom will get (0.0, 0.0).
An object handle that references the new object is returned.
Curvelist a list of indices into vertexlist that defined the curve. Each element of the list contains a list of 4 indices. These indices are zero based. For example:
{{0 1 2 3} {4 4 5 7} {6 7 8 9}}
shaderhandleis handle to a previously created surface shading specification.
Texture is the texture mapping algorithm to use for the object. The texture coordinates are a bit special for these surfaces. SPHERICAL and CYLINDRICAL mappings are not applicable, and NATURAL mapping will apply to the piece of surface created by each Bezier curve separately. The NATURAL mapping uses the curve parameter u along each curve as x coordinate and goes from 0 to 1 around the perimeter of the rotational surface on the other axis
An object handle is returned.
Patchlist is list of indices into vertexlist that defined the patch. Each element of the list contains a list 4 lists. Each of these lists contain 4 indices. The indices are zero based. For example:
{{ 0 1 2 3} {35 36 37 38} {28 29 30 31} {21 22 23 24}} {{21 22 23 24} {14 15 16 17} { 7 8 9 10} { 0 1 2 3}} {{ 3 4 5 6} {38 39 40 41} {31 32 33 34} {24 25 26 27}} {{ 6 5 4 3} {13 12 11 10} {20 19 18 17} {27 26 25 24}}}
Shaderhandle is handle to a previously created surface shading specification.
Texture is the texture mapping algorithm to use for the object. The texture coordinates are a bit special for the Bezier patches. CYLINDRICAL and SPHERICAL coordinates are not applicable, if they are specified, SIPP will use NATURAL anyway. The NATURAL mapping is a two dimensional mapping using the surface parameters u and v, see figure below. Note that these parameters range from 0 to 1 within each patch!
An object handle is returned.
If the file contains descriptions of patches, these patches will be tesselated into resolution by resolution polygons and installed in a sipp object as one surface.
If the file contains descriptions of curves, a rotational surface will be created by rotating these curves about the y-axis. The resulting surface will be tesselated into polygons and installed in a sipp object as one surface.
Texture is the texture mapping algorithm to use for the object. The texture coordinates are a bit special for the Bezier patches. CYLINDRICAL and SPHERICAL coordinates are not applicable, if they are specified, SIPP will use NATURAL anyway. The NATURAL mapping is a two dimensional mapping using the surface parameters u and v, see figure below. Note that these parameters range from 0 to 1 within each patch!
An object handle that references the new object is returned.
Focal the focal ratio of the "camera". This is the ratio between the distance from the viewpoint to the screen and half the screen height. A large focal factor will result in a wide angle view while a small factor will give a telescopic effect.
screen | | s viewpoint | *-----------------------| d | | | focal = s / d
If any of the parameters is omitted or has a empty value, then that parameter is defaulted. A camera handle is returned. If a camera is not created, the default camera, STDCAMERA, is used.
These commands are used for rendering to files defined by the PBMPLUS toolkit, either PPM files for fully rendered images or PBM files for line images.
The optional flag -flag is used to do interlaced rendering, which is useful for animations. If -ODD is specified, the odd scanlines are rendered, if -EVEN is specified, then even scanlines are rendered. If -BOTH is specified or the flag is omitted, then all scanlines are rendered. Interlaced rendering is not allowed if mode is LINE.
These commands are used to open, manipulate and render to RLE files as defined by the Utah Raster Toolkit.
set image [SippRLEOpen "|getx11" "w"]
The optional flag -flag is used to do interlaced rendering, which is useful for animations. If -ODD is specified, the odd scanlines are rendered, if -EVEN is specified, then even scanlines are rendered. If -BOTH is specified or the flag is omitted, then all scanlines are rendered. Interlaced rendering is not allowed if mode is LINE.
A few more useful commands.
signal default SIGINT