home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ray Tracing Box
/
RAY_CD.mdf
/
raytrace
/
form
/
docs
/
form.doc
< prev
next >
Wrap
Text File
|
1993-11-10
|
14KB
|
350 lines
LEGAL STUFF AND COPYRIGHT
The FORM program is not public domain software. It is copyrighted
software, Copyright (C) 1993 Andrew Rowbottom. It is however free
software, or what some people term 'Freeware'. You may use it for
whatever you wish, even using it to produce commercial pictures,
animations, sculptures, deep sea diving equipment, etc. You may NOT
however re-distribute modified versions of the executable nor
distribute any of the files in this distribution for a profit.
Since this software is free, it is supplied WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. It is supplied as it, in the hope the people will
find it useful.
CONFIGURING FORM
Most if not all the facilities in form can be specified in one of three ways,
1. Through command line switches, use form -? to get the most
upto date list of these.
2. Through an environment variable FORM, i.e. if you always use the
command line switches "-res2 -w" you can use the command
"set FORM=-res2 -w"
3. Through the FORM section of the sstools.ini file, virtually all
the command line switches have their equivalents in this section.
They are described in the example file, but the above two flags
would become:
screen_res=2
SaveBackgroundAsWhite=yes
COMMAND LINE OPTIONS
DISPLAY Switches
These command line switches affect how form uses the screen display
-bios[+-]
When this is enabled FORM uses bios to draw to the
screen, and even uses bios to switch to 320x200. Turn
this flag off for more speed. You may need to leave this
flag on if you are using a notebook.
-modex When enabled and -bios is NOT enabled FORM will use a VGA
ModeX method of accessing a 320x200 screen, faster than
BIOS and a little slower than standard access.
-vesa Use a vesa driver if found for Video Control, provided
since the autodetect routines crash windows normally!
steps:
1. load your vesa driver if need be
2. go into windows (if you want)
3. run "form -vesa" (is default)
There usually isn't any apparent slowdown.
You can use your manufacturer supplied Vesa driver, or a
public domain one such as "UNIVESA".
While a VESA driver is not required by FORM for most VGA
cards it is advisable to install one if you have one. For
example FORM mistakenly thinks that my machine at work
can use 800x600, but it can't, installing the supplied
vesa driver cures this problem and FORM correctly uses
640x480. Sometimes FORM will crash if running under
windows, this is caused by the autodetect methods,
installing a VESA driver before I run up windows cures
the problem.
-res[1|2|3] This flag sets the screen resolution used to display the form.
1 : screen display is 320x200 (default)
2 : screen display is one of 640x350, 640x400 or 640x480
depending on your video card and available extended memory
3 : screen display is one of 800x600, 1024x768 or 1280x1024
depending on your video card and available extended memory
-display[1|2|3|4] This flag tells FORM to draw your form at the end.
This is on by default, there are four drawing styles:
1 : display at end Wireframe
2 : display at end Flat
3 : display at end Gouraud(default)
3 : display at end Phong
-float[+-] This flag tells FORM to use a floating point scan line
conversion method, it improves the quality of the display
at the expense of speed. Only use on a 486 or for saving.
-q[0|1|2|3|4|5] Quality, very crude, try it on a single sphere and see
what you think.
OUTPUT Switches
These switches determine how FORM will save your form to disk.
-pov[-|+|1|2|3] If enabled FORM will produce a file called TEMP.POV
suitable for use with formvue.pov and the raytracer POV.
The output file can be in one of three "styles".
- : no temp.pov output file
+ : produce a temp.pov file (default)
1 : the form is made of individual objects, there is no heirachy
of objects, they are all specified relative to "world
coordinates"
2 : the form is made using composites, there is a strict
heirachy of objects which matches your input form file.
3 : the form is made using #declares (default), again there is a
strict heirachy of objects which matches your input form
file right down to the names, this file is quite compact
(relatively speaking), and it is fairly easy to apply
textures in the right place. This output style also creates
bounding boxes, speeding up raytracing a few times.
-pov_version=[1|2]
change pov version output is intrended for (version 2 is the only
one I've tested lately).
-plg[-|+] If enabled FORM will produce a file called TEMP.PLG
suitable for use with rend386 software.
- : no temp.plg output file
+ : produce a temp.plg file (default)
-save When enabled FORM will display your form at the end,
-save+ and save the screen display to a file called TEMP.GIF
-save+filename or TEMP.TGA, unless you specify a different filename
-save=filename
-save-
-w[+|-] save background as white -w[+-] flag
-g[+|-] If saving save the screen to a GIF file
-t[+|-] If saving save the screen to a TGA file
-spin=number COMMAND LINE FLAG only.
What do all computer graphics people do with an image
when they are bored? They spin it! Give a number and
FORM will display (and save if asked) the image so
that it turns a full circle in that many frames.
Not very useful without the -save= and -k- flags
if -save specified Files are named with trailing digits, i.e.
spin=9 takes save=abcdefgh and produces abcdefg#(.gif)
spin=9999 creates abcd####(.gif)
OTHER Switches
-k[+-] Pause at end of display. Default on, turn it off if you
are using the -spin option, or batch mode saving.
-path=dir1;dir2 Include directories to search for form files.
-dump [-|+] Produce a Debug Dump at end
-v [-|+] Overly Verbose and useless output
-? Help
-ems Use EMS memory for the ZBUFFER, (faster).
OUTPUT formats, and historical digression
When form was originally written it was designed to output text
files for input to POVRAY and to REND386, this used to be the only
way to actually see what had been created, but I got fed up with the
low quality of display from REND386 (although there is a lot to be
said for real time display), and didn't have the patience to wait for
a raytrace from POV every time, so I built in the screen display that
you have seen and now I use it all the time.
POV output
Pov output from FORM goes to a file temp.pov. The output file is
(usually :-) suitable for raytracing using the formvue2.pov sample
file. The form is always scaled so that it fits inside a unit box for
ease of placement. You can input textures inside FORM but you will
probably want to edit the output file to fine tune the textures.
PLG output
PLG output from FORM goes to a file temp.plg. The output file is
suitable for input to rend386 (sometimes known as DEMO3 or DEMO4).
This output is crude and not optimal at all. REND386 does give a fast
real time display, but a problem I have had is that if the form
starts getting complicated (which they do very rapidly) bits start to
disappear from the screen.
Motive
The FORM program was started in April '93 as an excercise in
using C++ and LEX and YACC it has grown from it's original modest
intentions.
TOOLS USED
The code was originally developed under DJDelories Gnu C++, but I
changed to Borland's C 3.1 compiler, debugger and profiler. The
source code has been kept under control by MKS RCS, which has saved
the code from being completly lost twice so far. I use GNU's FLEX and
BYACC, although I have had to modify the code to FLEX to provide
include file capability and fix other minor incompatibilities.
BORROWED, BEGGED AND STOLEN SOURCE CODE :-).
Since I hate re-inventing the wheel I have in the course of this
project used code from Graphics Gems (the source not the book) and
xxx's SVGAKIT. The Graphics Gems code proved a great source of
inspiration, and a good stepping stone to developing customised
algorithms since I could see if the idea worked first and then
rewrite for integer arithmetic.
SVGAKIT on the other hand is used practically as is. A very
useful package for IBM PC programmers.
TECHNICAL INFORMATION
I have rigged the code so that integers are used for most of the
drawing, giving somewhere around a five times increase in speed
compared against using floating point operations on a non 486. There
was a slight loss in quality, (try a single sphere at 320x200 res)
but it was worth it. I may improve the quality since I now know what
causes it, much rewritten code later!
The drawing method used is a simple polygonal ZBUFFER algorithm,
with gouraud shading. The polygons are rendered using integer
algoritms, including the depth, and intensity fields.
All other calculations in the system are performed using single
precision floating point.
Dos memory is used for the Zbuffer unless there isn't enough at
which point EMS memory is used. Failting that XMS memory is used,
this is copied to and from a single 64K cache in standard DOS memory.
This use of XMS is not the fastest possible, but what the heck -
it works!
If you want to see how long form takes to parse a file run with
the command line flags "-display- -plg- -pov-", no output is
generated, and so the time taken is simply the load and process time.
For those of you who are really interested the TGA file is
uncompressed with a 256 colour palette. It's only TGA because that
was the easiest. GIF is now my standard (ta fractint).
REGISTRATION (Part 2)
Personally I hate readme's that either don't tell you how to
register (or even if you should), or give you half a book on the
subject right at the beginning. This program is free, give it to your
friends if you think they may like it. I don't charge anything for
this program, it costs nothing, and is warranted to no purpose except
that it will occupy some space on your hard disk/floppy until
deleted. You get what you paid for.
PS. If no-one sends me e-mail, I'll conclude that this program is
rubbish and probably stop development.
CREDITS
The code for this program came from many sources,
UNIVESA and SVGAKIT came from Kendall Bennett.
FLEX the lexical analyser came from the GNU project
BYACC came from heaven knows where.
The GIF encoder is a very mutilated version of the one in
Fractint. Thanks to the stone soup team, for making their source
freely available. ( and for sstools.ini , you should see the
junk in mine!)
Thanks to the people who published code from Graphics Gemsxxx.
While very little of their code finally ended up in FORM many of
the display routines were originally tested using their code. The
Graphics Gems collection was a real godsend and should be in your
source code collection. It can be retreived from wuarchive.wustl.edu
somewhere in \graphics\graphics.
PANTEK Ltd for allowing me to release this code.
Stephen Todd and William Latham for the inspiration and a good book.
Andrew Pearmund for providing a much needed get_pixel function
without which FORM couldn't save any pictures, and for breaking
the program it every time I showed it to him.
Sue Cunningham for being with me, and constantly praising my
feeblest efforts at creativity, and finally showing me the sort
of form that could be created.
Future List (in no particular order, except the first two)
Bug fixing, I need to add brackets
I need to improve error checking
MUTATIONS - for an explanation see TODD & LATHAM, this is a
priority option!
Improved xms Zbuffer caching (not gonna do this, EMS is good enough)
add ems Zbuffer caching (done)
add disk Zbuffer caching
add memory screen images for those that don't have SVGA cards
(and for text only machines to run overnight)
Perspective. (well why not!)
A graphical interface, very much vapourware at the moment.
different language syntax - I'm not happy with the current
language implementation, if anyone has any ideas
for a better syntax let me know.
Portability to gnu cc compiler (for the hell of it)
Portability to other platforms (will happen after gnu cc port)
more output formats. (some other raytracers, polyray etc.)
Textures I am particulary open to suggestions regarding implementing
textures in POV. - (underway)
If I can do textures I may add truecolour facilities.
rummy@snaffle.demon.co.uk
Andrew Rowbottom