home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 9
/
CD_ASCQ_09_1193.iso
/
news
/
2315
/
raymathe
/
raylathe.doc
< prev
next >
Wrap
Text File
|
1993-04-24
|
8KB
|
188 lines
RayLathe v 1.20 (c) 1993 Koehler
DESCRIPTION:
RayLathe is a text based tool that allows you to create three
dimensional objects using the metaphor of the carpenter's lathe. The
objects are created as #declare'd composite's for POVRAY 1.0 (p.k.a.
DKB) or Vivid 2.0 ray tracing programs.
The data is given as X, Y, THICK. X and Y are the coordinates of
the end point of the line of a cut on the lathe. THICK is the
thickness of the surface of the object. This obviously differs from a
real lathe were the object is solid. We can, however, do things a real
lathe can't: undercut an area. See example #2 below. The values for
THICK are: -1 for POVRAY=solid / Vivid=paper-thing object (renders
quickest, no undercutting allowed in POVRAY), 0 for 'move to' (like
starting a new block of wood a distance from the current one), and
anything greater than 0 for the actual thickness of the shell of the
object. The last entry must be '-1 -1 -1' to signify end of object.
Comments may be added after the '-1 -1 -1' line.
EXAMPLE #1
We will make an object that looks like a pulley. Figure A shows
the coordinates with lines showing the cut surface. Figure B is the
data set for Figure A. Figure C is a view of the pulley looking into
the groove.
Fig. A Fig. B Fig. C
5 | * * 2 1 0 <-note move-to . .
4 | |\ /| 5 5 -1 |\ /|
3 | | *---* | 3 3 -1 | .---. |
2 | | | 5 3 -1 | |
1 | * * 6 5 -1 | |
+ - - - - - - - - - 6 1 -1 | |
0 1 2 3 4 5 6 7 8 9 -1 -1 -1 | .---. |
|/ \|
. .
EXAMPLE #2
Contrary to a real lathe, this lathe can undercut surfaces. For
example we can make something that looks [barely] like a sun umbrella.
Remember to use thickness when undercutting else the solid object will
fill in the inside of the umbrella. Also, use a thickness of 0 when
moving from the tip of the umbrella (point 3) into the center (point 4)
when drawing the post (line between 4 and 5).
Fig. D Fig. E
3 .
/ / !
/ / !
/ / !
/ / !
2 . !
|4-----------------------------5 |-------------------------------
1 |-------------------------------
. !
\ !
\ !
\ !
\ !
.
APPLICATION NOTES:
Another program is included to convert uLathe (by Daniel S. Baker
CompuServe: 71551,2300) .LAT files to .DAT files used by RayLathe to
generate the objects. uLathe is an excellent object creator for
windows. I was disappointed that the output was not usable by any of
the ray tracers for building whole scenes. Ta-Da! Hopefully RayLathe
code can be integrated as an export option for uLathe.
The objects themselves are a series of cuts (the line between the
specified points of data). uLathe presents each cut as a number of
flat facets about the X axis. For ray tracing, multiply the number of
cuts by the number of facets. Thats a lot. I observed that any given
cut would acutally look like a cone (or cylinder if parallel). This
reduces the number of objects tremdously and thus speeds ray tracing +
smoother about the X axis. Unfortunately there is not much I can do
with sharp edges of the cuts. The candle in particular doesn't seem to
suffer. Be careful with curved surfaces. I have kicked ideas around
about A) generating smooth triangles more like uLathe B) making curves
with tori.
For POVRAY the texture LatheWorkTex must be defined for the
resulting object. See the included example .POV file. At the end of
the file created by RayLathe are two #declare's (Location and Look_At)
which are vector definitions for where to put the camera and where to
aim the camera.
To use them in POVRAY:
In steady of: location <1 2 3> you can use: location Location
look_at <3 2 1> look_at Look_At
Usage: LAT2RAYL candle <- Converts uLathe CANDLE.LAT
RAYLATHE <candle.dat >candle.inc <- Creates candle POVRAY object
RAYLATHE -v <candle.dat >candle.vo <- Creates candle Vivid object
Then create the scene (.pov or .v) and render.
ADDITIONAL BOTHER:
See also CHAIN (which generates a chain of links), SHADE (which
generates pleated lamp shades), DIAMOND (which generates a cut gem,
plus creates the rest of the .POV file: view, light, floor), GEAR
(guess), STAR (which generates 3D stars with several attributes),
FNT2POV (which converts Grasp/Pictor/compatible fonts to objects using
many options), and SHP2DKB (which should become SHP2PV) which takes
AutoCad .SHP font files and generates stroke-type font objects. At
this time all of the programs listed in this paragraph are for POVRAY
only.
With all of these programs, just play around with the variables to
generate new shapes. For example, generating many long points on the
star looks like the spokes of a bicycle wheel. Many short points on a
large radius star looks like a circular saw blade. Use your
imagination and please post any ideas or neat works (with source) for
the world to enjoy. As you can tell I don't like building single
objects; I'd rather build a factory that can spit out 'what if' objects.
Trial size soap box: Please include source when sending programs
or objects. Even if its sloppy, it can only help others. Follow the
lead of the people who brought us DKB in the first place. We wouldn't
have a POVRAY now otherwise! Many thanks to those who do post!
I can be reached at YOU CAN CALL ME RAY RBBS (708) 358-5611.
"Its my world and you're welcome to it".
Ken Koehler (4-24-93)
CIS 72740,1161
Enclosed are these files:
RAYLATHE.C C source
RAYLATHE.EXE MS-DOS executable for object generator
RAYLATHE.DOC This file
LAT2RAYL.C C source
LAT2RAYL.EXE uLathe .LAT to RayLathe .DAT converter
CANDLE.LAT uLathe .LAT file containing shape data
CANDLE.POV Sample POVRAY file to generate the test image
SNIFTER.LAT uLathe .LAT file containing shape data
SNIFTER.V Sample Vivid file to generate the test image
Credits:
Doug Downs (finally a local tracer! found on PC-OHIO) got me
interested in uLathe (by Daniel S. Baker CompuServe: 71551,2300)
which is a great (windows) modeler for lathing the objects. I was
disappointed there was no way to export the data for ray tracing.
Appearantly I got wound up enough to write this package. I'm into
POVRAY, but Doug is into Vivid ("Tastes great, Less filling"). Only
recently got Vivid running. Until then Doug provided the .V and the
testing.
Revision History:
03-24-93 1.00 KJK New. Inspired by uLathe.
03-28-93 1.01 KJK Attempting Vivid output for Doug Downs.
04-11-93 1.10 KJK Releasable Vivid output version.
Noticed THICK in Vivid not supported! Must fix.
04-11-93 1.11 KJK Cured black speckles in POVRAY output.
04-14-93 1.12 KJK Allow 0 length cones (rings) for Vivid.
04-15-93 1.13 KJK Enable THICK for Vivid. Print line # of .DAT file for
each element.
04-24-93 1.20 KJK Since they are necessary when thickness is used,
simulate cone/rings for POVRAY.