home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TopWare 18: Liquid
/
Image.iso
/
liquid
/
top2088
/
ply2pop.txt
< prev
next >
Wrap
Text File
|
1994-03-27
|
4KB
|
86 lines
We've included a command line utility called PLY2POP.EXE, which
is a program that converts a POLYRAY depth-encoded ray traced file
into a file that is usable by POPOUT.
In his POLYRAY ray tracer, Alexander Enzmann was clever in that
he added the capability to save a ray traced image in a format that
contains information specifying the distance of each point from the
viewer. Unfortunately, this format is not quite compatible with
the depth information that POPOUT expects in the Source File.
POLYRAY outputs a full-color, Type 2 Targa file with the depth
encoded in the red and green channels. PLY2POP reads one of these
depth encoded files, and converts it to a Type 3 greyscale Targa
file, where depth is represented as intensity; the brighter the
intensity, the closer the point is to the viewer. This is how
POPOUT expects depth to be encoded.
The EXAMPI2.BMP file was created by first using POLYRAY, invoking
it with the following command:
polyray cube.pi -o cube.tga -u -p z
The '-u' switch directed POLYRAY to output a Type 2 (uncompressed)
Targa file, and the '-p z' switch instructed it to include depth
information.
PLY2POP was then run to convert the image to a POPOUT-compatible
image with the following command:
ply2pop cube.tga exampi2.tga
The above command generated a Type 3 Targa file. PLY2POP will
automatically scale the input depth encoded image to maximize the
number of greyshades produced. This Targa file can be read
directly by POPOUT as a Source File. To make the image viewable
using Paintbrush (which can't read Targa format), we converted
it to BMP using the TGA2BMP utility with the following command:
tga2bmp exampi2.tga exampi2.bmp 256
Note that by doing this, you can view the EXAMPI2 image with
Paintbrush, but it is no longer suitable as a POPOUT Source
File.
PLY2POP accepts 2 parameters. The first parameter
is the file name of the Type 2 Targa image created by POLYRAY.
The second parameter is the filename of the file you want
PLY2POP to create (this will be your Source File in POPOUT).
The EXAMPO3.BMP and EXAMPO4.BMP files were created using the
registered version of POPOUT, with EXAMPI2.TGA as the Source File.
We converted the EXAMPO3 and EXAMPO4 POPOUT Destination FIles to
BMP format just so Paintbrush can read them.
Note: POPOUT will not accept 256-color BMP files as valid Source
Files. There is actually a reason for this. The vast majority
of POPOUT users generate their Source File drawings using
Paintbrush. That's a fact. Since Paintbrush can only save
16 unique colors (the rest are just dithered versions of the
fixed set of 16), we decided that life would be much easier if
POPOUT only accepts 16-color BMP images. For users who want
to generate stereograms with more than 16 levels, we move into
a different category. These more complex stereograms are more
successful when the Source File has been generated using a
ray tracing program of some sort. The format of choice of
the popular ray tracers is Targa.
The following is a listing of the 'CUBE.PI' file used to
create the image using POLYRAY:
// create a simple cube using Alexander Enzmann's POLYRAY ray tracer
viewpoint {
from <0, 35, 0>
at <0,0,0>
up <0,1,0>
angle 20
resolution 320, 240
aspect 4/3
}
background <0, 0, 0>
light <-50,10, -5>
light < 10,20, -10>
include "..\colors.inc"
object { box <-2, -2, -2>, <2, 2, 2> shiny_red rotate <25, -30, 35>}