|
ZillaTracer allows one to make a ray tracing of any scene in the Modelzilla viewport.
ZillaTracer makes use of POV-Ray, a free ray tracer. Ray tracing is a image rendering
technique with high visual realism, at the cost of high computational load. Note that
ZillaTracer is not intended to be general POV input file preparation tool. It simply adds
value the other applications using the Modelzilla framework by allowing the user to
make ray tracings of any model created by them.
The advantages of ray tracing
Big Images
For many people the entire value of ray tracing is it's ability to make arbitrarily large
images, with resolution sufficient for journal covers. Modelzilla's regular OpenGL
renderer is limited in image resolution because it makes use of specialized hardware that
has only so much memory. Because the ray tracer is working completely in software, it
isn't limited in image size.
Better Images
A ray tracer can cast shadows, do reflections and do better translucency.
How ray tracing works
The ray tracing rendering technique differs from the technique of the OpenGL rendering
library used by Modelzilla in that the geometrical information makes its way to the image
plate in the reverse direction. Rather than mapping triangles and lines to a grid of pixels,
a ray tracer individually maps each pixel to the elements of the scene that contribute to
its color. Because the ray tracer has a global picture of the scene, different elements in
the scene visually affect one another. Given a certain point of view and certain camera
projection system, an image plate can be mathematically set up within the geometrical
model. For each pixel in the image, a strait line modeling a ray of light is cast into the
scene. (Note that the ray tracer is working backwards here: the rays of light are cast from
the camera to the lights. This is done because the end goal of the ray tracer is to find the
total color value of a pixel. Tracing the other way is hit and miss as far as the pixels are
concerned.) If the ray is found to intersect some object in the scene, the ray is reflected
off to learn whether it intersects a light source. If the reflected ray is able to make it to
the source of light without going through another object, this pixel is illuminated
according to the details of the light. Otherwise, a shadow is cast here. But the ray tracer
doesn't stop there - it continues to search for more objects in the reflected ray's path. Any
objects it finds contribute to the color of the origin pixel because by reflection.
Additionally the ray is passed through the point of intersection through a bend according
to the object's index of refraction. The contributions of all these rays are summed to
total color value of the pixel. The ray tracer then moves on to a different pixel and
repeats the procedure.
|
|
Using ZillaTracer
ZillaTracer is essentially a fancy POV-Ray input file generator. We made it an
independent application module because ray tracing a scene is a fairly complex matter
with a fairly complex input specification. We would not be doing the ray tracer justice to
simply give Modelzilla a "POV dump" function. Therefore ZillaTracer has been created
to allow the user to specify ray tracing options on a per object basis. We hope to expand
this application module to allow the user to control other POV-Ray specific features such
as texture image maps, bumpiness, add specialized POV lights and to use special POV
cameras.
The POV-Ray input file is human readable and editable text. For the best
possible ray tracing, it is best to transfer as much information as possible from the
Modelzilla scene to a POV-Ray input file, and then import this into a specialized POV
input preparation program or edit it with a text editor.
ZillaTracer needs to be loaded from the applications panel of the Modelzilla
basic controls. Once it is loaded you will see that ZillaTracer user interface is divided
into two panels. The "Trace Settings" panel settings pertains to the generation of POV
input files and the running of POV-Ray to generate images. The "Shape Settings" panel
allows one to change the rendering attributes of each object in the scene separately.
|
|
Trace Panel
Before doing anything, fill in the trace options. ZillaTracer is designed so that once these
options are set up you can make multiple ray tracings without having to re-specify any of
the options. When you exit Modelzilla or use the "Save Settings" function, these options
are saved to disk and you will not have to re-enter them. To change an option, click on in
the list and the option setting controls will appear below the list.
Trace Options
-
POV Output File- this is the name of the file the "Dump POV file" function writes to.
Note that a different temporary file is used by other functions that need to create POV input.
-
POV Executable - this is the complete path to the POV ray tracer. If all you intend to
do is use the "Dump POV file" function, you will not need to set this option. This
information allows ZillaTracer to run POV-Ray.
-
Image Output File - this is the name of the image file that is written to by the "Trace to
file" function. Note that a different temporary file is used by other functions that
generate images.
-
Image Format - this specifies image format of the POV-Ray generated images, for the
"Trace to file" function. Options are PNG and TGA. We suggest you name your image
output file name extensions to correspond, because ZillaTracer will not do this for you.
-
Image Width/Image Height - this controls the size of the image used by "Trace to file"
and "Dump POV file". The setting is important even when not generating an image
because the POV-Ray camera must be set up to expect images of certain proportions.
The default settings for these values are 800 by 600, corresponding to the standard 4:3
aspect ratio. Wrong settings will result in a squished image.
-
Combine Viewpoint Transform - if this setting is true the viewpoint transformation will
be combined with the object transformations in the POV input file. This allows the
camera to have a simple orientation looking straight down the z-axis. This makes it
easier to adjust the lights and camera manually once the file has been generated.
-
POV-Spheres - if this setting is true the POV sphere primitives will be used when
possible. This reduces the POV input file size as compared with using a general triangle
set to represent spheres, and also gives smoother spheres because POV-Ray uses an
analytical sphere definition.
-
POV-Cylinders- See POV-Spheres.
-
Anti Alias - if this setting is true POV-Ray is told to anti alias the generated image,
which gives a smoother better image quality. This setting takes effect when running
POV-Ray from ZillaTracer.
Trace Functions
-
Dump POV file - this function generates a POV-Ray input file. The file is written to
the location given by the "POV Output File" setting.
-
Trace to file - this function generates a POV-Ray input file in a temporary location and
then runs POV-Ray to generate an image, stored to the location given by "Image Output
File".
-
Trace to viewport - this function generates a POV-Ray input file in a temporary
location and then runs POV-Ray to generate an image in a temporary location, then reads
in the image and places it in the Modelzilla viewport from which input file was
generated. This nice for doing a test trace and is a nice trick for demos.
|
The trace panel.
|
Shape Panel
The "Shape Settings" panel allows one to control the POV-Ray rendering attributes for
each object individually. This panel also controls which objects are included in the
POV-ray input. If no objects appear in the list, every object in the viewport will be
included in the POV-Ray input. Otherwise, the listed objects are included in the POV-
Ray input.
Shape Functions
-
Select Objects - this function selects the contents of the list.
-
To change object attributes, select it in the list. The POV-Ray attributes appear below.
-
Use the Make Default function to make the POV-Ray attribute of the object selected in the list
the template for new attribute sets, and for any object for not been explicitly specified.
Shape Attributes
Consult the POV-Ray manual to find out what each attribute means. They are mostly in
the 'finish' category. Note that POV-Ray offers many more attributes than those
controllable from ZillaTracer. ZillaTracer simply provides an easy way to manage the
most common rendering attributes, to get the user as close as possible
to the final input POV-Ray uses to generate beautiful images.
|
The shapes panel.
|
How POV-Ray input is generated
This describes what ZillaTracer does to generate the POV-Ray input file. This
information may be of interest for those wishing to hand edit the files. As much
information as possible is taken from the rendered objects and the viewport that they
reside in, to make the POV-Ray rendered image resemble as closely as possible the
image in the Modelzilla viewport. It is so accurate that the "Render to Viewport"
function overlays the OpenGL rendered image exactly.
Global Settings
The POV background color is a set up to a match the OpenGL background color.
Depth Cue
POV fog is made to match the OpenGL fog, although this can?t work exactly because the
POV fog goes right up to the camera. It is not possible to set a start point. To the fog
how you like it you may have to manually adjust the camera position in the POV file.
(Move it forward or back.)
Lights
The POV globalSettings{ambient} is set to match the OpenGL ambient light. The
OpenGL directional lights are translated to POV parallel light sources. At the time of
this writing only directional lights are handled, however expect that spotlights and point
lights will be translated as well soon.
Camera
The camera set up depends on the combineViewpointTransform switch. This setting
should normally be left on. If it is on, the transformation matrix that determines the point
of view is included in the transformation matrix for each object. This enables the POV
camera to look straight down the z axis, making it easier to understand the numbers for
manually changing the file. In this situation the global coordinate system is scaled to
match the right and up vectors of the camera. All other dimensional numbers are
within this scale system. If for some reason you want these numbers to be in the scale
system of the Modelzilla global coordinates, turn off the combineViewpointTransform
switch. In either case the camera is setup so it sits at the back OpenGL clipping plane,
and looks at the front OpenGL clipping plane.
Objects
Most objects are translated to POV mesh2 data types. POV-Ray has this type just for the
purpose of allowing other programs to export objects to POV. It is an indexed triangle
array system. All solid or surface objects in Modelzilla can bd represented by index
triangular arrays. The vertex and normal vectors translate directly into the POV data
type. Per vertex colors are translated to POV ray using the texture_indicies list. The
finish section of the POV texture is the same for every vertex, so this information is
factored out with a #declare statement. The finish information and interior information
come entirely from the set up in the ZillaTracer, since this information is irrelevant to the
regular OpenGL renderer. This information is included with each object.
POV has object types to define a sphere and a cylinder. In fact, POV has many kinds of
specialized objects because it was originally intended to be used as a separate system in
which users created input files by hand. ZillaTracer will use the POV sphere in cylinder
object types instead of the mesh2 type when it can, to cut down the file size and because
this gives smoother spheres and cylinders. Some Modelzilla application modules, such
as CAD-Zilla have specialized object types that map nicely to the POV object types, for
example the vector extrusion maps to the POV prism, and the solid union maps to the
POV union. (Note the POV is doing a different kind of solid boolean operation than does
CAD-Zilla. It uses a graphically based boolean operator the effects when it stops rays.
The CAD-Zilla boolean operators create new closed polyhedra.) Because ZillaTracer
doesn?t know about CAD-Zilla, it has no way to recognize these specialized object types,
so these are not mapped to the more specialized POV objects. Conceivably a tag system
could be used to get around this, but currently this is not done. There is no real
advantage in any case.
As of this writing, text is not mapped to POV text. And lines should be mapped to
narrow cylinders, but they are not.
| |
Running POV-Ray
First - ZillaTracer does not come with POV-Ray. You will need to download it from
the internet.
The Windows version of POV-Ray, and maybe the Mac one too, have graphical user interfaces
that are part of the same process as the renderer. When ZillaTracer starts up
POV-Ray, the POV-Ray GUI will come up too. As of now, we are unware of a way
to make the GUI not come up. Here's the important part: when POV-Ray finishes
rendering the process has to end for ZillaTracer to know the image is ready. Luckly,
POV-Ray has an option under the Render/On Compleation called "Exit on POV-Ray for Windows".
Make sure this is on!
The Windows version of POV-Ray also has a special security feature that is
supposed to stop malicious POV files from doing bad things. It will refuse to read
and write to most directories. Disable this feature! Options/Script I/O Rescritions, OFF!
|
POV-Ray rendering examples
Demonstrates various rendering tricks POV-Ray can do.
All of these pictures were made by simply changing rendering attributes within ZillaTracer.
No POV files were manually edited. The fact that ZillaTracer keeps these attributes
enables one to make lots of ray tracings quickly.
Click on the picture for larger verions.
The captions tell it all...
|
|
Highlights
|

Specular Highlights

Phong Highlights
|
Shadows
|

One light at high position for half shadow

Both lights at high position for full shadow
|
Translucency
|

Translucency with the transmission setting

Translucency with the filter setting
|
Refraction
|

The setup with index of refraction = 1

Index of refraction = 1.4

Lens shaped solid partially covering ribbon, ior=1.4
|
Reflection
|

Ribbons reflecting of a plate, with shadows on bottom
|