The NFF file format was initially designed by Eric Haines for use with the SPD (Standard Procedural Database) software, a package designed to create a variety of databases for testing rendering schemes. For more information about SPD see "A Proposal for Standard Graphics Environments," IEEE Computer Graphics and Applications, vol. 7, no. 11, November 1987, pp. 3-5.
To enable NFF to describe volumetric primitives, a simple extension has been added to the original design. An NFF file may contain the following:
v from Fx Fy Fz at Ax Ay Az up Ux Uy Uz angle A hither H resolution Rx Ry
where Fx Fy Fz is the eye location, Ax Ay Az is the position that is to be the center of the image (i.e. what you are looking at), Ux Uy Uz is a vector defining which direction is up, A is the angle (in degrees) from the left edge of the image to the right edge, H is the distance to the hither plane (this is not used in the cap_vol renderer), and Rx Ry is the resolution in pixels of the image to be produced. The data are not assumed to be normalized (e.g. the from-at distance does not have to be 1). Also, vectors are not required to be perpendicular to each other. A view entity must be defined before any objects are defined.
b R G B,
where R G B is a color specification. If no background color is given, a default of black (0,0,0) is used.
l Px Py Pz [ R G B ],
where Px Py Pz is the position of the light source and R G B is an optional color for the light emitted by the light source. All lights must be defined before any objects are defined. Lights emit white light (1,1,1) if no color is specified.
f R G B Kd Ks S T IR
where R G B is the color of the surface, Kd is the diffuse reflectance of the surface, Ks is the specular reflectance of the surface, S is the shininess of the surface, T is the transparency of the surface, and IR is the index of refraction of the surface. Usually, 0 <= Kd <= 1 and 0 <= Ks <= 1, though it is not required that Kd + Ks = 1. The surface becomes more shiny as S increases, and it should always be greater than or equal to one. The transparency of the surface T should fall between 0 and 1, with a T value of 0 being an opaque object and a value of 1 being a totally transparent object. The index of refraction is the density of the surface material and determines how much the light will bend at the interface between this surface and the other surfaces in the scene. In the cap_vol renderer, the adjacent surface is always considered to have an index of refraction of 1. In general, an index of refraction between 0.5 and 2.0 provides a reasonable amount of refraction.
The surface shader description format is:
surface shader "shadername" instance_list end
where shadername is the name of the shader to be used, and instance_list is a list of 0 or more instance variable definitions. An instance definition can be one of:
c Bx By Bz Br Ax Ay Az Ar,
where Bx By Bz is the base point of the cones axis, Br is the radius of the cones axis at the base point, Ax Ay Az is the apex point of the cones axis, and Ar is the radius of the cones axis at the apex point. Note that the base and apex cannot be coincident for a cone.
s Cx Cy Cz R,
where Cx Cy Cz is the center point for the sphere, and R is its radius.
p N P1x P1y P1z ... PNx PNy PNz,
where N is the number of vertices in the polygon, and the P1x P1y P1z ... PNx PNy PNz are the N vertices for that polygon.
p N P1x P1y P1z N1x N1y N1z ... PNx PNy PNz NNx NNy NNz,
where N is the number of vertices in the polygon, and the P1x P1y P1z N1x N1y N1z ... PNx PNy PNz NNx NNy NNz are the N vertices and normals for that polygon. For the ParVis volume renderer, N must be 3.
voxel filename [ format formatstring ] origin Px Py Pz extent Ex Ey Ez volume_attributes
where filename is the name of the file or directory that contains the volume data, formatstring specifies the format of the volume data, Px Py Pz is the location of the origin of the volume in 3D space, and Ex Ey Ez is the extent in the x, y, and z dimensions that the volume occupies. The volume attributes are ignored if a data shader has been specified. If no shader has been specified, the volume attributes should be zero or more of the following:
The format of the volume data is specified by the formatstring argument. The format string can specify either a raw floating point data format, a raw byte data format, the HDF format, or the VoxelView format. Both the HDF and the VovelView formats contain information about the dimensions within the data files themselves, so the format strings used to specify those formats are ``hdf'' and ``voxelview'' respectively. The raw floating point and byte data sets require the dimensions and possibly the range of the data values in the data set. Their format strings take the form ``rawXxYxZ N:M'' and ``rawbyteXxYxZ N:M'' respectively, where X, Y, and Z represent the dimensions of the data set, and N and M represent the minimum and maximum data values that are of interest within the data set.
plane Px Py Pz Nx Ny Nz,
where Px Py Pz is a point on the plane and Nx Ny Nz is the normal to the plane. Each plane defines a half space (half of the entire 3D space) which is visible and a half space that is not visible. The half space that is visible is defined to be the side of the clipping plane that the normal points to. These clipping planes are applied to primitives by using the operations described above. This application must follow the format:
and prim csgtree,
where prim is either a single primitive as described above or a list of such primitives, and csgtree is an expression composed of planes combined by CSG operators. The list of primitives associated with the given CSG tree is defined as follows:
list primlist endlist
where primlist is a list of one or more NFF primitives. The CSG expression csgtree can be an arbitrary number of clipping planes combined by following the recursive rules:
csgtree == plane
or
csgtree == and csgtree csgtree
or
csgtree == or csgtree csgtree
or
csgtree == not plane