ITLACMDScientific Applications  Visualization Group
Visualization Software
Attractive Image NIST
 
Up Visualization Parallel Computing Data Mining Released Software

DIVERSE File Loaders



The software distributed here is freely available for down load and use. As a courtesy, it is requested that credit be given to the Scientific Applications and Visualization Group at NIST


Software Download: libpfsavg.tar.gz (47.9kb)

savg files loaded into perfly
savg files loaded into perfly

The SAVG DIVERSE file loader will read a data file with the extension ".savg" with the following format. Its defaults have been designed to provide the best rendering possible, at the possible expense of slower performance. Keywords allow the defaults to be changed to provide more efficient rendering.

The format of the file is a series of ASCII lines, one command or vertex per line. Everything after and including a pound sign (#) will be discarded. Keyword matching is case insensitive. Leading and trailing spaces or tabs are ignored, and multiple spaces or tabs count as a single space. Multiple blank lines (after comments are stripped) count as a single blank line and are ignored. Keywords can be abbreviated by their first three letters. If additional letters are supplied, they must match the initial substring of the keyword.

The SAVG utilities, documented elsewhere, are an easy way to generate and modify SAVG files.

SAVG keywords that create geometry

(bullet) lines [ r g b a ]

indicates that the vertex data following this keyword, up until the next keyword or end-of-data, will represent a single series of connected line segments. An error is raised if normals are supplied in the vertex data. There needs to be at least two data lines provided before the end of data for this primitive. If r b g a are supplied, the entire primitive will be drawn in this color. If not supplied, the most recently used color will be used if not also supplied with the vertex data.

(bullet) tristrips [ r g b a ]

indicates that the vertex data following this keyword, up until the next keyword or end-of-data, will represent a single tristrip. There needs to be at least three data lines provided before the end of data for this primitive. If r b g a are supplied, the entire primitive will be drawn in this color. If not supplied, the most recently used color will be used if not also supplied with the vertex data.

(bullet) polygons [ r g b a ][ n ]

indicates indicates that the vertex data following this keyword, up until the next keyword or end-of-data, will represent a series of one or more n sided polygons. If n is omitted, then a single polygon will drawn with as many sides as data lines that follow, but must be at least three. If n is provided, at least n data lines must be provided, and the total number of data lines must be evenly divisible by n. If r b g a are supplied, the entire primitive will be drawn in this color. If not supplied, the most recently used color will be used if not also supplied with the vertex data.

(bullet) points [ r g b a ]

indicates that the vertex data following this keyword, up until the next keyword or end-of-data, will represent a single series of points. An error is raised if normals are supplied in the vertex data. If r b g a are supplied, the entire primitive will be drawn in this color. If not supplied, the most recently used color will be used if not also supplied with the vertex data.

Vertex data for the above keywords are formatted as follows:

(bullet)

xv yv zv [ r g b a ] [ xn yn zn ]

where:

xv yv zv define a vertex position in 3 space

r g b a define a color and transparency (values range from 0 to 1)

xn yn zn define a normal at the position of the vertex

(bullet)

if "r g b a" is omitted, the most recently supplied color will be used.

(bullet)

if "xn yn zn" is omitted, no normals will be passed to pfBuilder for the primitive.

(bullet)

Note: All data lines for a single primitive need to be in the same format. For example, if the first data line for a primitive contains only a vertex, all subsequent data lines for this primitive can only supply vertex data. And if the first data line for a primitive contains a vertex and color, then all subsequent data lines for this primitive must supply a vertex and color.

SAVG keywords that affect how primitives are drawn:

(bullet) style filled | wireframe

indicates how primitives should be rendered. filled specifies that polygons and tristrips should be filled. wireframe specifies that polygons and tristrips should be rendered in wireframe. The specified style will affect all subsequent geometry until another style keyword is given. The default style is filled.

(bullet) pixelsize size

indicates the size of a point, or the width of a line, in pixels. The specified pixelsize will affect all subsequent geometry until another pixelsize keyword is given. If no pixelsize keyword is given, 1.0 is used. Note: size is a floating point number.

(bullet) shrinkage scale

indicates that each filled polygon or tristrip should be shrunk towards its center by scale. The smaller the value of scale, the smaller the objects. The specified shrinkage will affect all subsequent geometry until another shrinkage keyword is given. If no shrinkage keyword is given, 1.0, or no shrinkage, is used. Note: size is a floating point non-negative number less than or equal to one.

(bullet) striplength length

indicates the number of triangles per pfGeoSet- each pfGeoSet will have at most length triangles. Viewport culling is done at the pfGeoSet level, so bigger pfGeoSets will cull faster, but may send more geometry to be drawn that is outside of the viewing volume. Transparency sorting is also done at the pfGeoSet level, so the larger the pfGeoSet, the less accurate is the transparency rendering. For best transparency results set length to 1, the default. If length is set to 0, then no pfGeoSet subdivision will be performed, resulting in potentally large pfGeoSets. If multiple striplength commands are given, only the last one is used, and affects all primitives in the file.

(bullet) octree size children

The loader calls pfdBreakup to create a recursive spatial octree whose leaf nodes are pfGeodes. The octree parameters specify how to shape the tree. If multiple octree commands are given, only the last one is used, and affects all primitives in the file. If the octree command is not supplied, the default value of size is 0 (ignored), and the default value of children is 20. The parameters are described in more detail below.

The length of the diagonal of the bounding box surrounding each pfGeode will be less than size units, in model coordinates. Each pfGeode will contain up to children pfGeoSets.

Octree recursion stops when either the size or children condition is met. size can be set to zero, but then children must be greater than one. If size is greater than or equal to one, children can be set to one.

Making size larger will reduce culling and increase drawing time. Making children larger will increase culling time and decrease drawing time. To get the best values for a particular mode, try loading it with different octree values with perfly, and using the "z" key in perfly to see how much geometry is getting clipped and how much is getting draw that is outside of the viewing volume, and press the "show tree" menu button to see the structure of the octree. Also, use the DIVERSE dpf-bounds command to help set a realistic value for size based on the extent of the model data. Note: size is a floating point number, and children is an integer.

(bullet) preserveplanarquads

by default, planar quads are retessellated into flat tristrips by pfdBuilder. By specifying this keyword anywhere in the savg file, retessellation is disabled. Retessellation can increase the efficiency of the displayed geometry, but can also alter the underlying geometry; this can be important for wireframe displays, and for some lighting conditions.

SAVG keywords that affect console messages:

(bullet) planarpolygonchecking

if this keyword is present anywhere in the savg file, the loader will check all polygons to see if all vertices are in the same plane. If not, a message is written to the console at pfNotify's NOTICE level.

SAVG keywords that affect material properties. Each specified material will affect all subsequent geometry until another occurance of the same material keyword is given.

(bullet) transparency on | off | auto | default

specifies how transparent geometry should be rendered. By default, when a non-zero alpha value is supplied as a color for a primitive, transparency is enabled for that primitive- this is what the auto parameter specifies. The on parameter specifies that transparency should be enabled regardless of the primitive's alpha values. The off parameter specifies that transparency should be disabled regardless of the primitive's alpha values. The unfortunately named default parameter uses whatever transparency value was inherited from the global state.

(bullet) lighting on | off | auto | default

specifies how primitive lighting should be rendered. By default, lighting is enabled for 3D primitives and disabled for 2D primitives- this is what the auto parameter specifies. The on parameter specifies that lighting should be enabled. The off parameter specifies that lighting should be disabled. The default parameter uses whatever lighting value was inherited from the global state.

(bullet) colormode ambient | diffuse | emission | specular | ambient_and_diffuse | off | default

specifies what model to use for lighting. These calls map directly to DIVERSE's pfMaterial::setColorMode call. The default parameter uses whatever lighting model was inherited from the global state, which is usually ambient_and_diffuse.

(bullet) ambient r g b | default

specifies the value of ambient light if r g b are given, which are then passed to pfMaterial::setColor. r g b are floating point numbers between 0.0 and 1.0, inclusive. The default parameter uses whatever ambient color is inherited from the global state. How the ambient light value is used depends on the colormode selected.

(bullet) diffuse r g b | default

specifies the value of diffuse light if r g b are given, which are then passed to pfMaterial::setColor. r g b are floating point numbers between 0.0 and 1.0, inclusive. The default parameter uses whatever diffuse color is inherited from the global state. How the diffuse light value is used depends on the colormode selected.

(bullet) specular r g b | default

specifies the value of specular light if r g b are given, which are then passed to pfMaterial::setColor. r g b are floating point numbers between 0.0 and 1.0, inclusive. The default parameter uses whatever specular color is inherited from the global state. How the specular light value is used depends on the colormode selected.

(bullet) emission r g b | default

specifies the value of emissive light if r g b are given, which are then passed to pfMaterial::setColor. r g b are floating point numbers between 0.0 and 1.0, inclusive. The default parameter uses whatever emission color is inherited from the global state. How the emission light value is used depends on the colormode selected.

(bullet) alpha a | default

specifies the value of the alpha component if a is specified. The alpha value is a floating point number between 0.0 ands 128.0, inclusive. This range is used because it is what is used by the pfMaterial::setAlpha command. The default parameter uses whatever alpha value was inherited from the global state. How the alpha value is used depends on the colormode selected.

(bullet) shininess s | default

specifies the value of shininess component if s is specified. The shininess value is a floating point number between 0.0 ands 128.0, inclusive. This range is used because it is what is used by the pfMaterial::setShininess command. The default parameter uses whatever shininess value was inherited from the global state. How the shininess value is used depends on the colormode selected.

Examples:

(bullet) in code:

pfNode foo = pdfLoadFile("filename.savg") ;

(bullet) or on the command line:

diversifly filename.savg

Bugs:

(bullet) There are known bugs in DIVERSE 3.1's pdfBreakup and pfdBuilder utilities; SGI fixed the pfdBuilder bug in DIVERSE 3.1.1. A fixed version of pfdBreakup is included with the loader's source. The pfdBuilder bug causes objects to be drawn in a single color, and translucent objects to be drawn as opaque. A workaround, if you are using a pre-3.1.1 version of DIVERSE, is to duplicate a primitive, drawing it in a slightly different color, or modifying a vertex of a primitive so it is a slightly different color than the rest of the primitives.

This software is distributed as a compressed tar file.

Credits: Visualization: John Kelso Steven G. Satterfield Group Leader: Judith E. Terrill

For information about this application, contact John Kelso



Software Download: libpfsgb.tar.gz (45kb)

sgb files loaded into perfly
sgb files loaded into perfly

The purpose of the sgb file loader is to simplify the creation of a scenegraph using only an ASCII file. pfsgb.c is a scenegraph loader/builder with transforamations and instancing.

(bullet) usage: pfNode *foo = pfdLoadFile("foo.sgb") ;

A pfGroup node is created- under it are loaded nodes and files as specified in the sgb file.

A sgb file has the following format:

(bullet) # this is a comment

# blank lines, case, and extra white space is ignored

# The "active node" is the node under which other nodes are placed.

# Initially the top level group node is the active node.

# create a pfGroup, pfDCS or pfSCS node named "nodeName" under the activenode, and make it the new active node. An optional transformation can be given. The node name can be left unspecified by using the keyword NULL

(bullet) GROUP [ nodeName ]
(bullet) DCS [ nodeName [ x y z [ h p r [ s [ sy sz ] ] ] ] ]
(bullet) SCS [ nodeName [ x y z [ h p r [ s [ sy sz ] ] ] ] ]

# make the node named "nodeName" the active node- subsequent nodes and files will be placed under this node. If no node is specified, use the top level node

(bullet) UNDER [ nodeName ]

# load files named under the active node

# duplicate files are automatically instanced.

# Use the FILE command to load files and attach them to the scenegraph (make them visible).

# Use the LOAD command just to load files into the scenegraph.

# Use the ON command to make objects visible that have been loaded but not added to the scenegraph.

(bullet) FILE filename.ext [ filename.ext ... ]
(bullet) LOAD filename.ext [ nodeName ]
(bullet) ON nodeName [parentgroup]

#A nodename for each file is optional. This is a way to individually name each object that may lie under a group node.

# A parent group name for is ON statement is also optional. If not specified, the node is placed on the active node.

This software is distributed as a compressed tar file.

Credits: Visualization: John Kelso Steven G. Satterfield Adele Peskin Group Leader: Judith E. Terrill

For information about this application, contact John Kelso



Software Download: libpfifl.tar.gz (111.8kb)

ifl files loaded into perfly
ifl files loaded into perfly

The purpose of the ifl file loader is to load multiple copies of other files, with each file having its own individual transformation. Each file is loaded only once. Subsequent requests to load the file are made using instances of the original file. Transformations are also unique- i.e. two files (or the same file loaded with two names) loaded with the same transformation will be children of the same transformation node.

usage: pfNode *foo = pfdLoadFile("foo.ifl") ;

An ifl file has the following format:

(bullet) # this is a comment
(bullet) # load a file named "filename.foo" with a unique node name and an optional transformation. To not assign a name to the node, use the name "NULL" duplicate files are automatically instanced
(bullet) filename.foo name
(bullet) filename.foo name tx ty tz
(bullet) filename.foo name tx ty tz h p r
(bullet) filename.foo name tx ty tz h p r s
(bullet) filename.foo name tx ty tz h p r sx sy sx

transformed coordinate = scale*rotate*translate relative to a fixed coordinate system; for better culling, consider using the breakup pseudo-loader, such as:

perfly -W 1000 example.ifl.0,20,10.breakup

This software is distributed as a compressed tar file.

Credits: Visualization: John Kelso Steven G. Satterfield Group Leader: Judith E. Terrill

For information about this application, contact John Kelso



Software Download: libpfclean.tar.gz (2.3kb)

Libpfclean is a DIVERSE pseudo-loader that invokes pfdCleanTree on a previously loaded scenegraph. See the pfdCleanTree man page for more details. To use, append ".clean" to the name of the file to be loaded, such as:

diversifly --examine foo.ifl2.flatten.clean

Note that pseudo-loaders operate on their files in the order they're specified. In this case, foo.ifl2 is loaded, then the libpfflatten pseudo-loader is invoked, then the libpfclean pseudo loader.

Credits: Visualization: John Kelso Group Leader: Judith E. Terrill

For information about this application, contact John Kelso



Software Download: libpfflatten.tar.gz (2.3kb)

Libpfflatten is a DIVERSE pseudo-loader that invokes pfFlatten on a previously loaded scenegraph. See the pfFlatten man page for more details. To use, append ".flatten" to the name of the file to be loaded, such as:

diversifly --examine foo.ifl2.flatten.clean

Note that pseudo-loaders operate on their files in the order they're specified. In this case, foo.ifl2 is loaded, then the libpfflatten pseudo-loader is invoked, then the libpfclean pseudo loader.

Credits: Visualization: John Kelso Group Leader: Judith E. Terrill

For information about this application, contact John Kelso



Software Download: libpfgz.tar.gz (60.9kb)

The ".gz" pseudo-loader. Unzips a file, loads the unzipped file, then deletes the unzipped file. For example, to load a gzipped "flt" named "foo.flt.gz", containing the gzipped file "foo.flt", use:

pfdLoadFile("foo.flt.gz") ; or from the command line:

diversifly --examine foo.flt.gz

Set the environment variable PFGZTMPDIR to specify an existing directory to hold the unzipped file.

Credits: Visualization: John Kelso Group Leader: Judith E. Terrill

For information about this application, contact John Kelso



Software Download: libpfm4.tar.gz (3.4kb)

The ".m4" pseudo-loader. Preprocesses a file though m4, load the m4 output file, then deletes the output file. For example, to load an ifl file with m4 preprocessor commands named foo.ifl, use:

pfdLoadFile("foo.ifl.m4") ; or from the command line:

diversifly --examine foo.ifl.m4

Set the environment variable PFM4TMPDIR to specify an existing direcetory to hold the output file

Credits: Visualization: John Kelso Group Leader: Judith E. Terrill

For information about this application, contact John Kelso



Software Download: libpflod.tar.gz (5.5kb)

DIVERSE ".lod" file loader that enables level-of-detail switching. It reads an ASCII file, each line of which gives the name of file to load and a maximum distance to display the file:

filename distance

where filename is the name of a DIVERSE loadable file and distance is the range at which the object disappears and is replaced by the next object in the file. After the last object's range is exceeded no object is displayed. Distance must be a positive number, and increase with each consecutive filename.

Credits: Visualization: John Kelso Group Leader: Judith E. Terrill

For information about this application, contact John Kelso



Software Download: libpflgt.tar.gz (5.4kb)

DIVERSE ".lgt" file loader creates DIVERSE light source nodes for either directional lights, spot lights, or point source lights. These are created by defining a set of parameters in the *.lgt file.

Defining light sources

Light sources are described by a series of keyword oriented lines in .lgt files. The following lines are used by all three types of lights:

(bullet) lightType
(bullet) group nodename
(bullet) intensity inten
(bullet) color red green blue diffuse
(bullet) color red green blue ambient
(bullet) color red green blue
(bullet) location x y z

In addition, these are used only for spot lights:

(bullet) direction x y z
(bullet) dropOffRate rate
(bullet) cutOffAngle angle

Here are descriptions of each of these lines:

lightType:

(bullet) DirectionalLight
(bullet) PointLight
(bullet) SpotLight

group nodename:

(bullet) Specifies the name of the node in the scenegraph where the light source is to be loaded. The parameter nodename is the name of the node.

intensity inten:

(bullet) Specifies the intesity of the light. The parameter inten is a floating point value between 0 and 1.

color red green blue diffuse:

(bullet) Color for diffuse shading of objects. The parameters red, green, and blue are floating point values between 0 and 1. Default is ( 1.0 1.0 0.8 ).

color red green blue ambient:

(bullet) Color for ambient shading of objects. The parameters red, green, and blue are floating point values between 0 and 1. Default is ( 0.4 0.4 0.3 ).

color red green blue:

(bullet) Color for both diffuse and ambient shading of objects. The parameters red, green, and blue are floating point values between 0 and 1. Defaults are as indicated above.

location x y z:

(bullet) For PointLight and SpotLight sources this specifies the location of the light source in three-dimensional space. For DirectionalLight sources this specifies a vector that points at the infinite light source. The parameters x, y, and z are floating point values. Default is ( 0 0 0 ).

direction x y z:

(bullet) Specifies the a vector that gives the direction that the SpotLight source is pointing. The parameters x, y, and z are floating point values. Default is ( 0 1 0 ).

dropOffRate rate:

(bullet) For a SpotLight source, this specifies the exponent for the drop-off of the light intensity of the light as the cone of light spreads from the direction vector given by the direction line. The parameter rate is a floating point value. Default is 0.

cutOffAngle angle:

(bullet) Specifies the spread of the cone of a SpotLight source. The parameter angle is a floating point value in degrees betwee 0 and 180. Default is 40.

Credits: Visualization: Adele Peskin Group Leader: Judith E. Terrill

For information about this application, contact Adele Peskin



Privacy Policy | Disclaimer | FOIA
NIST is an agency of the U.S. Commerce Department.
Date created: 2001-11-01, Last updated: 2011-01-12.
Contact