OutputVPS


The OutputVPS macro captures the contents of the view and outputs it to a device-independent vector PostScript file. The macro contains a user interface that appears in the Module Panel provided by the Data Viewer or Module Stack (as appropriate).

Four different types of output are available from the AVS/Express viewers: file output, field output, print output, and VRML output. They are derived from a single base group that provides the basic hooks into the rendering pipeline to get output from the view. There are two printing pipelines: one uses the AG Kit to draw 2D primitives and capture bitmaps of software rendered 3D primitives; the other uses OutputVPS to draw 2D and 3D primitives direct to the output file.

The OutputVPS macro writes a scene to a file using PostScript stroke, fill and text primitives. These are vector commands specified in continuous device coordinates, as opposed to raster commands which supply discrete images using a regular grid of pixel samples. Vector output files are likely to be smaller, faster to print, and of higher rendered quality, than a corresponding raster file. OutputVPS Facilities are provided to enable smooth color interpolation for 2D and 3D primitives, and smooth lighting for 3D surfaces.

Supported Features

These AVS/Express features are supported by the OutputVPS macro:

Cameras

• 2D, 3D, and multiple cameras

perspective/orthographic projections

clipping to the camera viewport

view background color

aspect control

Lights

ambient light

directional and bidirectional light

point light

Primitives and Modes

2D/3D points

2D/3D polylines, disjoint lines, and bounds

2D/3D surfaces

stroke/annotation text

Properties

cull (backface, frontface, flip normals)

jitter (for primitive priority)

object color

ambient and diffuse material properties

line width and point width

line style

Unsupported Features

These AVS/Express features are not supported in the OutputVPS macro:

Cameras

depth cueing

front and back clipping

Lights

spot light

Primitives

directed points (normals)

spheres

images

volumes

2D/3D textures

Properties

draw mode XOR

specular material properties

transparency material property

sphere subdivision

texture properties

cell data

annotation text attributes:

      • offset, leadline, radial, underline, bounds, vertical alignment and drop shadow

Hints for Using OutputVPS

Drawing with white background

The default object color is white, and the default highlight color is white. This means that the following default objects will be invisible in a scene rendered on a white background: 2D/3D lines, 2D/3D bounds, 2D/3D line and point outlines, 2D surfaces, 3D surfaces (No light, Background). You must set non-default object color to see these objects over a white background.

Default lighting and coloring

The default Color Subdivision is None (flat). To see the effects of smooth shading for vertex color interpolation and Gouraud lighting of 3D surfaces, you must switch Color Subdivision to Precompute or Postcompute.

Default hidden line and hidden surface removal using depth sorting

By default, OutputVPS uses depth sorting. The 3D scene is rendered with a simple Painter's algorithm: primitives are sorted according to their farthest depth value, then rendered from back to front. There is no splitting of intersecting lines or surfaces and thus intersecting lines and surfaces will not be rendered correctly. To reduce artifacts at the intersections of primitives, you must switch Depth Sorting to "NNS".

Backface cull

If there are closed 3D objects in your scene, you should switch the Cull property to Backface. This will remove approximately half the primitives in the object, reduce the computational load for transformations and lighting, reduce the output file size, and reduce printing time.

Editing the output file

Postcomputed Color Subdivision and Gamma Correction use constants defined in clear text at the head of the PostScript output file. Edit these lines to change the postcompute Color Tolerance and Gamma Exponent values:


/colorTol 0
.1 def


/gammaFactor 0.8 def

To reduce file size

•      remove objects from the scene

•      simplify objects to reduce the number of primitives

•      zoom-in to clip objects at the boundary of the viewport

•      enable backface culling for closed 3D objects

•      reduce Float Precision and/or Color Precision

•      use Color Mode option Greyscale if you do not require color hardcopy

•      either do not use Color Subdivision option Precompute,

•      or if you do, then increase the Color Tolerance parameter

•      do not use Depth Sorting option "NNS"

To reduce file generation time

•      reduce file size

•      disable lighting (surface mode No Light)

•      use simple lighting models (surface mode Flat)

•      reduce the number of lights

•      do not use point lights

•      use only white lights

•      do not the Precompute Gamma Correction option

To reduce printing time

•      reduce file size

•      either do not use Color Subdivision option Postcompute,

•      or if you do, increase the Color Tolerance parameter

•      do not use the Postcompute Gamma Correction option

Known Problems with OutputVPS

Outline modes do not render cleanly

Jittering of outlines does not give the correct priority to line primitives, using the simple depth sort HLHSR algorithm. Some outlines appear jagged and half the usual width, because one of the adjoining facets has been drawn over the outline. Note that when an object is locked, its coordinates are not transformed, thus they are not jittered.

OutputVPS Parameters and Arguments

Inputs

GDview_templ view_in

A view. The contents of this input are captured and written to the specified file.

Arguments and Parameters

file

This string parameter specifies the name of the output file that is created. Default value: /tmp/express.ps

Dynamic

This boolean parameter determines whether a new PostScript file is output each time the input view is rendered (TRUE), or whether the user must explicitly request a new file (FALSE). Default value: FALSE

Write PostScript

When the dynamic switch is FALSE, this one-shot parameter triggers the generation of a PostScript output file. When the dynamic switch is TRUE, the user interface for this parameter is removed.

Color mode

This enumerated parameter specifies the color format used in the output file. There are two options:

•      Color: (default) Each color is specified as an RGB triple in the output file. The output file can be rendered in color on a color printer, or in greyscale on a monochrome printer.

•      Greyscale: Each color is converted to a single intensity value. The output file can only be rendered in greyscale, on color or monochrome printer. Greyscale files will be smaller than those written with full color information.

Background mode

This enumerated parameter specifies how the background of the scene will be rendered. There are three options:

•      White: (default) Force the scene to be rendered on a white background. This typically means that the printer does not apply any color or shading to the background.

•      Black: Force the scene to be rendered on a black background.

•      Keep: Use the view background color specified in the AVS/Express viewer, as the PostScript background color.

Size

This enumerated parameter specifies the paper size for the output. There are five options:

•      EPS (user): (default) Encapsulated PostScript format, where the user can specify the dimensions of the output, and the resulting file can be embedded in other documents. The width and height are specified by two parameters for the OutputVPS module (see below). The user interfaces for the width and height are visible when EPS is selected.

•      A (letter): Use (standard US) letter paper size (280mm x 216mm)

•      B (ledger): Use ledger paper size (432mm x 280mm).

•      A4: Use (standard European) A4 paper size (297mm x 210mm).

•      A3: Use A3 paper size (420mm x 297mm).

•      A0: Use A0 paper size (1189mm x 841mm).

Width (mm)
Height (mm)

These integer parameters specify the width and height of EPS size output. Default values: 160mm x 120mm

Float precision

This integer parameter specifies the floating point precision used to write real values to the output file. The values include spatial coordinates and transformations, but not colors. This integer parameter must be in the range 1 to 8 inclusive.

Default value: 4

Color precision

This integer parameter specifies the floating point precision used to write color values to the output file. The color values can be gray, red, green or blue. This integer parameter must be in the range 1 to 8 inclusive.

Default value: 2

Color Subdivision

This enumerated parameter specifies how the color is interpolated for polylines and surfaces, in 2D and 3D, with per-vertex color or lighting of 3D surfaces. When subdivision is enabled (precompute or postcompute), the subdivision proceeds until a color tolerance is reached (see below). This adaptive method gives the best quality results without subdividing primitives with small color gradients. There are three options:

•      None (flat): (default) No color interpolation is performed. The output polyline and triangle primitives are drawn with constant color per-segment, or per-facet. Incoming vertex colors are averaged to produce the segment or facet color, where necessary.

•      Precompute: The OutputVPS module subdivides line segments and triangles that have per-vertex color from data mapping, or as the result of lighting 3D surfaces. The subdivision generates many smaller primitives with linearly interpolated color. Precomputing the subdivision increases the output file size, and the subdivision cannot be changed during printing.

•      Postcompute: Special interpolation macros are written to the output file, together with the color tolerance parameter. Primitives are written with color per-vertex information in the PostScript output. The subdivision is made at print time, in the PostScript processor. This gives high quality output, with small file size, at the expense of slower printing. The color tolerance parameter can be edited by hand to change the color resolution after the file has been generated.

Color tolerance

This real parameter specifies the absolute difference in color space, for the color subdivision algorithms: precompute and postcompute. In Postcompute mode, the color tolerance is written to the output file. In precompute mode it is used by the OutputVPS module to subdivide the line segments and triangle facets which have per-vertex color. This real value must be in the range 0.0 to 1.0. Smaller values signify a finer subdivision. Values close to zero will force a very large number of primitives to be generated, either precomputed in the output file (large file, slow printing), or postcomputed internally within the printer (slow printing). A value of 1.0 will not cause any subdivision to occur, even when it is enabled by the subdivision flag. The color tolerance user interface is not displayed for color subdivision None.

Default value: 0.1

Depth Sort

•      "Default": A simple sort by the minimum z coordinate of each primitive object. While this is well suited for many applications, it can result in visual artifacts in complex scenes.

•      "NNS": Newell, Newell and Sancha hidden surface removal algorithm. When a possible visual artifact is detected, the algorithm first tries to interchange the conflicting primitives. If there is still a conflict (consider the case of intersecting triangles), then one of the primitives is split along the line(s) of intersection.

Gamma Correction

This enumerated parameter specifies how final colors are modified to take account of non-linear effects in the printing device, or perhaps to match the non-linear effects of the same scene displayed on a raster monitor. The gamma factor is an exponential factor applied to each color component independently (gray, red, green, blue). There are three options:

•      None: No gamma correction is performed. Color values are assumed to behave linearly.

•      Precompute: (default) The OutputVPS module modifies all color values (gray, red, green, blue), before writing the values to the file. Thus precomputed gamma correction is applied after precomputed color subdivision, but before postcomputed color subdivision. This means that postcomputed linear interpolation may not give the expected appearance. Precomputed gamma marginally slows file generation, but does not affect file size. The precomputed gamma factor cannot be changed after the file has been generated.

•      Postcompute: The gamma exponent is written to the output file, and an exponential function is set for color transfer in the printer. Each rendered color is then gamma corrected at print time. Postcomputing the gamma correction only increases the file size by a few bytes, but it will slow down printing. The gamma factor can be edited by hand after the file has been generated.

Gamma exponent

This real parameter specifies the gamma factor to be applied to color components, either precomputed in the output file, or postcomputed by the printer during printing. This real value must be greater than 0.0. A value of 1.0 leaves color unchanged, values between 0.0 and 1.0 darken the colors, and values greater than 1.0 lighten (desaturate) the colors. The gamma exponent user interface is not displayed for gamma correction: None.

Default value: 1.8

Orientation

This enumerated parameter specifies the page layout. There are two options:

•      Landscape: (default) The x-axis of the scene device coordinates is oriented along the longer side of the paper.

•      Portrait: The x-axis of the scene device coordinates is oriented along the shorter side of the paper.

Examples

     Examples.Graphics Display.VPS1

See also

OutputField
OutputFile
OutputVRML