home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Current Shareware 1994 January
/
SHAR194.ISO
/
graphuti
/
smooth10.zip
/
SMOOTH.DOC
< prev
next >
Wrap
Text File
|
1993-10-13
|
11KB
|
271 lines
SMOOTH v1.0 - Surface Normal Smoothing Program
Copyright (c) 1993 - Jeff Burton / Master Tech Enterprises
---USERS GUIDE---
1.0 Introduction
SMOOTH is a utility that reads in raw triangle data, and calculates the
surface normals for each triangle. This "polygon patch" or "smooth
triangle" output can be used with a raytracing program to produce smooth
looking surfaces, instead of the flat "faceted" look you get with triangles
alone. Consider the difference between a geodesic dome and a smooth
sphere, and you'll have the idea.
SMOOTH can also create the code necessary for bounding boxes. Proper use
of bounding boxes can reduce the rendering time for complex scenes
comprised of many objects.
2.0 Input Requirements
The input data should consist of raw triangle data in groups of 9; three
numbers (x,y,z) per point, and three points per triangle. The data for each
triangle should be included on one line (See example below). There is an
option to quickly scan an input file to see if it conforms to SMOOTH's
input standards (See -c option). You may also have comments in your raw
data file indicated by a line that starts with a ; character. These will
be ignored by SMOOTH and not passed to the output. In future versions
these will be used to pass commands to SMOOTH.
Example of SMOOTH input file:
; This is a comment line and will be ignored by SMOOTH.
-1.00 2.00 -3.00 4.00 -5.00 6.00 -7.00 8.00 -9.00
10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00
3.0 Command Line Options
This section describes the command line options and their function. An
option may be given in upper or lower case, and is preceeded with a dash,
forward slash or backslash. Options may be grouped, as in "-rq".
3.1 -n|o|v|d|r|s|t|p : Output Formats
Several output formats are available via a command line switch and are
listed below:
-n : NFF (MTV)
-o : Vivid v1.0
-v : Vivid v2.0
-d : DKBTrace (STAR)
-r : Rayshade
-s : POV v0.5
-t : POV v1.0
-p : POV v2.0
An example of each of these formats is given in the accompanying file
SAMPLE.DOC. If no command line format option is specified, the output will
be in "raw" form; just the triangles and normals without any other text.
Not all the advanced features are available in every format. Check the
individual options to see if a particular format is supported.
(Note: "SMOOTH_TRIANGLES" in the current (2.10) version of DKBTrace don't
work. It's not this program, honest).
3.2 -c : Check Input File Option
Due to the rather strict input requirements (hope to have this fixed in the
next version) the -c command line option will scan the input file and make
sure it conforms to SMOOTH's input requirements. If SMOOTH cannot read the
data file the program will stop and the offending line number of the file
will be indicated. For example, entering 'SMOOTH -C TEST.DAT' would produce
the following results.
SMOOTH v1.0 - Surface Normal Smoothing Program
Copyright (c) 1993 - Jeff Burton / Master Tech Enterprises
Reading the triangle data in test.dat
Scanning the input file for errors.
123 triangles processed. File is OK!
SMOOTH indicated that it was able to correctly read the file and would be
able to process the triangle data. Remember that the only text allowed in
the raw triangle data is comments that start with the character ';'. Any
other text will cause truncated or strange results if processed.
3.3 -x : Surface Normal Output Mode
Sometimes it is desirable to simply convert the raw triangle data to
another format without including the surface normals. Using the -x command
line option will "turn off" the output of the surface normal data and
create regular triangles instead of smooth triangles. This feature is only
available in the following formats:
DKBTrace (STAR)
POV v0.5
POV v1.0
POV v2.0
Sample output (POV 1.0 format):
Without -x command line option:
//
// Persistance of Vision v1.0 Data File
//
// Created by SMOOTH v1.0 - Surface Normal Smoothing Program
// Copyright (c) 1993 - Jeff Burton / Master Tech Enterprises
//
smooth_triangle {
< 0.0000 8.8000 0.0000 > < 0.0000 -28.8767 -0.0000 >
< 6.3900 6.3800 0.0600 > < -24.0002 -19.5635 -3.5556 >
< 4.4800 6.3800 4.5600 > < -14.4201 -19.5469 -19.4753 >
}
With -x command line option:
//
// Persistance of Vision v1.0 Data File
//
// Created by SMOOTH v1.0 - Surface Normal Smoothing Program
// Copyright (c) 1993 - Jeff Burton / Master Tech Enterprises
//
triangle {
< 0.0000 8.8000 0.0000 >
< 6.3900 6.3800 0.0600 >
< 4.4800 6.3800 4.5600 >
}
3.4 -b : Bounding Box Output
Some raytracers are capable of surrounding a complex object with a simple
shape to reduce the time needed to render the object. When a ray is fired
at the scene it checks to see if it has intersected the bounding shape
first. If not, then the complex object can be skipped. If it does
intersect the bounding shape, then the ray is tested against the complex
object in side the box. Since the time to check the ray against the simple
shape is much less than checking it against complex objects, a time savings
is realized.
SMOOTH calculates the coordinates of a box shape that surrounds all the
triangles found in the input file. Using the -b command line option allows
SMOOTH to include that information in the output file. SMOOTH includes this
infomation in the comments at the beginning of the output file. Due to the
way SMOOTH calculates the bounding box coordinates, you may have to enlarge
the box a little to eliminate any clipping that may occur. This option
only works on POV v1.0 and POV v2.0 output formats.
3.5 -q : Quite Mode Option
Normally the program will display a count on the screen as the triangles
are read in. Using the -q option turns off the count during processing.
This is especially useful if you are redirecting the screen output of
SMOOTH to another device such as a printer or disk file.
3.6 infile : Input File Option
This is the full pathname of the file containing the raw triangle data.
3.7 outfile[.???] : Output File Option
This is the full pathname of the file that will contain the data generated
by SMOOTH. If you do not supply an extension, SMOOTH will automatically
supply an extension that is appropriate for the output format that you are
using. For example, a POV v1.0 output file would have the extension
'.pov', a DKB output file would have the extension '.dat' and a Vivid
output file would have the extension '.v '.
3.8 -?|h : Brief Usage Instructions
Using the -? command line option displays a brief help screen.
4.0 Memory Considerations
This information is from the documentation for the original smoothing
routine written by Mike Schoenborn.
Sorry, it's impossible to say (simply) exactly how much memory is required
to run this program. The memory requirements are determined by the number of
triangles and number of points, obviously, but also by how the triangles are
arranged, the number of points which are unique, which points belong to which
triangles...
Consider these two figures...
_______ _____________________________________
/ \ / \ / \ / \ / \ /
/ \ / \ / \ / \ / \ /
/_______\/________\ / \ / \ / \ /
\ /\ / -------------------------------------
\ / \ /
\/_______\/
6 triangles 6 triangles
7 unique points 8 unique points
6 points belong to only 2 tri's 2 points belong to only 1 tri
1 point belongs to 6 tri's 2 points belong to 2 tri's
4 points belong to 3 tri's
Since the program doesn't know how the input triangles are going to be
arranged, it can't plan ahead of time on how to balance the memory
allocation for the triangles, points, and (most awkwardly) the "belongs to"
information.
I've sent a data set of more than 5000 triangles through and the program
had no problem with it. It will definately handle a lot, but you just
can't be exact as to how much "a lot" actually is. If it does run out of
memory, it will abort with a message saying how much it did handle before
choking.
If you do run out of memory try to split up the data into multiple groups
and process each group seperately. If you go this route, consider the
layout of your data and keep in mind that the normals are calculated based
on adjoining triangles only. You could split your data, allowing a 1
triangle overlap at the split, process each group, then remove the overlap
duplicate data when you recombine the outputs.
5.0 Credit Where Credit is Due!
The original 'C' source code for the surface normal computations was taken
from the program 'SANDPAPER' written by Mike Schoenborn. The Vivid 1.0,
2.0 and POV v0.5 output formats were later added by Stephen Coy.
Many thanks to these people who created some of the code that went into
SMOOTH v1.0.
6.0 Legal Stuff (and its a shame to have to do this!)
SMOOTH is copyrighted freeware, and as such, may be used and distributed
without charge to the end user. I still retain all copyrights to the
source code with the exception of the public-domain code originally written
by Mike Schoenborn and Stephen Coy.
DISTRIBUTION
You may freely distribute SMOOTH in its original package as long as there
is no charge for this service. Distribution centers may distribute the
original SMOOTH package on disk as long as their is a charge of no more
than $5.00 US to the end user.
DISCLAIMER
This software is provided as is without any guarantees or warranty.
Although the authors have attempted to find and correct any bugs in the
package, they are not responsible for any damage or losses of any kind
caused by the use or misuse of the package. The authors are under no
obligation to provide service, corrections, or upgrades to this package.
7.0 Contacting the Author
If you would like to send me comments, bug reports, or possible
enhancements to SMOOTH you can write me at the following address:
Jeff Burton
415 Franklin Street
Paducah, KY 42003
You can also leave a message to JEFF BURTON in the RIME Ray Trace Forum.
Or you can leave a message to JEFF BURTON at the home of SMOOTH, the
Midnight BBS (502) 443-7514 14.4/v.42bis 24hrs.