Pro/ENGINEER to POV-Ray Translator

Version 2.0


Table of Contents


DESCRIPTION

back to TOC

slp2pov translates Pro/ENGINEER .slp files in "Render" format to .inc files for use with POV-Ray where the individual .inc files have the same base name as the original .slp file. Within each .inc file, the program creates a single POV-Ray object whose name is the base name of the input file converted to upper case.

The file generated contains "declare" definitions for all colors in the render file making it easy to adjust the color of an object. These color definitions can either be the original rgb values specified in the .slp file or may be mapped to the closest POV-Ray color in which case POV-Ray color names are used. Each objects color definitions may also be written to a seperate color include file to make editting of the colors easier.

The translator also provides the capability to generate a scene file based upon user input of a few parameters such as; image orientation, camera look_at point, camera placement, etc. These inputs are specified via a textual menu printed to the screen at the end of the file processing.


OPERATING ENVIRONMENT

back to TOC

slp2pov which contains a command line interface will run under Windows 3.1, Windows 95, or Windows NT in a DOS Window. It will also run under DOS if DOS has been configured with a DPMI server.

PROGRAM OPTIONS

back to TOC

-h
Print help
-v
Print the version of the program.
-b
Generate a POV-Ray box object representing the bounding box of the object(s) in the .slp file. To be used for the initial scene creation to speed up rendering time.
-c color_include_file_path
This option will cause the rgb color definitions present in the .slp file to be replaced with the closest POV-Ray color defined in the specified include file. (See -t)

If a scene file is generated, it will contain an "include" statement containing this color file pathname.

-C
For each .slp file generate a .col file in addition to the .inc file. The .col file will only contain the color definitions for the object in the .inc file. The .inc file will contain an include statement to reference this .col file. This option will make it easier to edit the colors for include files so large that because of their size will not load into a text edittor.
-d
For large files this option provides feedback that something is happening. During both the input file processing and the generation of the output file, one dot (.) will be printed to the screen for every 1000 triangles.
-i
By default, the translator will process every .slp file specified on the command line regards of whether a .inc file already exists on disk. This option will instruct the translator to ignore files for which a .inc file already exists.
-t tolerance
Specifies how close an rgb color definition in the .slp file has to be to a color in the color include file for them to be considered the same.
-T
This option will cause the color definitions to be treated as textures rather than pigments. This is intended for users who have rgb colors defined in one include file for use with the translator and corresponding texture definitions in another include file which will be used when doing the rendering.
-f
Generate all flat triangles. By default the translator will generate smooth triangles for those whose corner normals are different.
-r
Output the translated data with regards to a right hand coordinate system which is the Pro/ENGINEER default. By default the translator will generate right hand coordinate data.
-l
Output the translated data with regards to a left hand coordinate system which is the POV-Ray default.
-p 2|3 (2 - default)
The -p 2 option will generate an include file for use with POV-Ray 2.2 where all triangles of the same color are grouped together in a single union block. The -p 3 option intended for use with POV-Ray 3.0 groups the triangles using POV-Ray's new "mesh" object. According to the POV-Ray 3.0 documentation, mesh objects are handled more efficiently.
-s
This option is used to have the translator to automatically generate a POV-RAY scene file for the .slp files based upon a small number of user specified parameters. After processing of the .slp files the user is presented with a textual menu from which the scene parameters are set.
-n
By default the scene file generated by the use of the -s option contains numerous comments. This option causes the generation of these comments to be suppressed.

EXAMPLE 1

back to TOC

The following will translate the geometry in the Pro/ENGINEER generated render file "box.slp" to a file named "box.inc".
slp2pov -c ...path.../colors.inc -l box.slp
The rgb color value will be replaced with the name of the closest color in the colors.inc file and the geometry will be adjusted for use in POV-Ray using its default left-hand coordinate system.

The following segment of text shows how to use the .inc file in a POV-Ray scene:

#include "box.inc"

object {BOX}

EXAMPLE 2

back to TOC

The following will translate all the .slp files in the directory ignoring those for which a .inc file already exists. The color definitions for each file, which will use POV-Ray color names, will be written to a seperate color file. The triangles will be grouped using the POV-Ray Ver 3 mesh object and will be written in regards to a right-handed coordinate system which is the default behavior when not specified.
slp2pov -c ...path.../colors.inc -C -i -p 3 *.slp

EXAMPLE 3

back to TOC

The following will do the same as the last example except that after the processing of all the .slp files, a textual menu will be displayed to be used to set a small number of parameters which will be used to automatically generate a POV-Ray scene file. This scene file can then be used to render the Pro/ENGINEER objects.
slp2pov -c ...path.../colors.inc -C -i -p 3 -s *.slp

SCENE GENERATION

back to TOC


Using the -s option, the translator will generate a POV-Ray scene file which can be rendered to generate a rendering of the objects. The scene file is automatically generated based on a small number of parameters specified by the user. These parameters are input through the use of a textual menu displayed after all the .slp files have been translated.

The following is an example of the text menu:

1 - Scene Orientation : landscape
2 - Camera Type : perspective
3 - Camera Look At Point : center
4 - Camera X & Y Rotation : -35.26, 45.00
5 - Camera Distance : 10.00
6 - Background Color : Black
7 - Floor : opaque - Color : Blue
8 - Floor Distance : 0.50
9 - Objects cast shadows : yes
w - Write POV-Ray Scene File
q - Quit

Enter Option :

Scene Menu Options

back to TOC


Scene orientation
The orientation of the scene can be specified by entering a "p" or "l" for portrait or landscape.
Camera Type
This option allows one of three different camera types to be selected; perspective, orthographic, or wide angle. This option only appears when the -p 3 option is specified from the command line.
Camera Look at Point
The camera for the scene is allowed to point at two possible positions, the origin or the geometric center of the objects. The geometric center is calculated by determining the center of the bounding box around all the objects in the scene.
Camera Rotation
The positioning of the camera is specified by two rotations which determine a ray along which the camera is placed. The first is the rotation of the camera about the x axis. The second is the rotation about the y axis. Regardless of whether a left or right handed coordinate system is specified, a value pair of <0,0> for the x & y rotations will result in the camera being located such that the positive x axis extend towards the right and the positive y axis towards the top of the screen.

The rotations follow the left or right handed rotation rule. For example a rotation pair of <-35.26,45> in a right-handed coordinate system will result in the same view as a rotation pair of <35.26,-45> in a left-handed coordinate system.

The distance of the camera from the look at point along the ray, specified by the two rotations is predefined to be some multiple of the distance across the diagonal corners of the bounding box. The exact multiple is specified by another option.

Camera Distance
The value specified by the camera distance is multiplied by the distance across the diagonals of the objects bounding box to determine the actual distance of the camera from the look_at point. The value is also used in the camera's "direction" vector to "zoom in" to the scene by the same amount.

Using values between 5 and 10 tend to eliminate the perspective effect that might ordinarily occur when the camera is placed too close to the objects.

Background Color
This option is used to specify the color for the background. In this current release of the translator, no checking is done to determine whether the color is a legitimate POV-Ray color.
Floor
By default the scene contains no floor which is a plane normal to the Y axis at some distance from the origin. If a floor is specified it can be one of of four types; opaque, mirrored, checkered or textured. In the case of an opaque or textured floor, a legitimate POV-Ray pigment or texture must be specified. The checkered floor requires two pigments to be specified.

Note: The checkered floor also has a slightly reflective finish. Because reflections do not show up well with a pure White pigment, it is recommended that a very light Gray such as Gray90 or Gray95 be used instead of White. By the same token, Gray05 or Gray10 may be a better choice than Black.

Floor Distance
Once a floor is specified, an additional menu option will appear to specify the distance of the floor from the origin. A positive value will place the floor plane above the origin while a negative value will place the floor beneath the origin.
Object Shadows
By default, all objects will cast shadows. This option can be turned off in which case none of the objects will cast shadows.
Write Scene File
Selecting this option allows a scene file to be generated automatically based on the current values of the various scene parameters. The user will be prompted for a name to be applied to the scene file. If the program does not detect a suffix, it automatically appends a ".pov" to the name.

SAMPLE SCENE

back to TOC


The following is a sample scene generated by the translator. The scene contains numerous comments to aid the user in understanding what is happening.

// The following two "includes" contain standard color
// and texture definitions.

#include "colors.inc"
#include "textures.inc"

// The camera defined below is positioned based upon the
// specified rotations about the X and Y axis.

// The ratio of the right to up vectors should match
// the ratio of the width and height of the rendered
// image.

// The direction vector may be adjusted to zoom the
// camera in or out. Z values greater than 10.00 will
// cause the camera to zoom in while values less
// than 10.00 will cause the camera to zoom out. 

camera {
  location < 13.361, 14.491, 12.078>
  right <-4/3,0,0>
  up <0,1,0>
  direction <0,0,10.00>
  look_at < -0.000,  1.137, -1.280>
}

// By default, at least two point light sources are
// defined for the scene. The first is positioned
// directly above the camera's point_at location
// while the second is located at the camera
// location.

// The lights are given an rgb value of <1,1,1>.
// If the scene is not bright enough, try increasing
// the rgb values; for example <1.25,1.25,1.25>.

light_source { < -0.000, 18.509, -1.280> color rgb <1,1,1> }

light_source { < 13.361, 14.491, 12.078> color rgb <1,1,1> }

// The background is used to set the color of the Background

background { color Black }

// The following are the Pro/ENGINEER objects translated from
// the .slp files.

#include "p12_3456.inc"
object { P12_3456 }

#include "p12_3457.inc"
object { P12_3457 }


SCENE ASSUMPTIONS

back to TOC


Because the scene generation is meant to quickly and easily generate an initial scene with a minimum of user input, a number of assumptions are made. These assumptions are outlined below.

Camera Positioning

While several of the scene options involve the camera, the actual distance of the camera from the camera look at point is based upon the length of the diagonal acoss the corners of the bounding box around all the objects multiplied by the camera distance value.

Lights

Two light sources are used in the scene unless a "mirrored" floor is specified in which case an additional light source is used. Of the initial two light souces, one is positioned at the camera location and the second is positioned above the camera's look_at point. Like the positioning of the camera, the distance is governed by the bounding box. Specifically, the distance of the light above the look_at point is 8 times the length of the diagonal across the corners of the bounding box.

When a mirrored floor is specified, a third light source is positioned underneath the floor. At the same time, the floor is given a "no_shadow" parameter. The intent of this is to illuminate the bottom of the objects so that they can be seen in the mirror.


KNOWN LIMITATIONS

back to TOC


Color/Texture Names

When generation a scene file the program will prompt for color or texture names depending upon the option choosen. At present, the program does no checking to guarantee that the color or texture name entered is in fact a correct one.

Color Include Files

When parsing the colors.inc file, the translator looks for red, green, and blue color definitions for each color. The POV-Ray 3.0 colors.inc file contains color definitions based upon other previously defined colors. The current version of the translator will not correctly parse this file! Either use the POV-Ray 2.2 colors.inc file or edit the POV-Ray 3.0 colors.inc file to ensure each color is defined with explicit rgb values.

File Names

POV-Ray identifier names are made up of the characters a thru z, the digits 0 thru 9 and the _(underscore). The name may be a maximum of 32 characters long and must start with a character.

Because the object names are derived from the base filename of the .slp file, this base name must follow the above conventions. When generating a .slp file from within Pro/ENGINEER, the default name that is given to the file is the original Pro/ENGINEER filename with a ".slp" suffix. Since many companies use numeric part numbers for their part and assembly files, many of them containing dashes "-", this default name will not work. In this case preceed the name of the .slp file with a single character and replace the "-"s with "_"s.

For example, assume the Pro/ENGINEER part file name is "12-3456.prt". When generating the .slp file for this part the default name given to the file would be "12-3456.slp" which when translated through slp2pov would result in a POV-Ray include file with the name "12-3456.inc" containing an object with the name "12-3456". When POV-Ray parses the scene file it will object to this name. The solution is to proceed the name with a letter and replace the "-" with a "_" so that the name of the .slp file might be "p12_3456.slp". This will result in a POV-Ray object name of "P12_3456" which will work correctly!