IBM Visualization Data Explorer User's Reference

[ Bottom of Page | Previous Page | Next Page | Table of Contents | Partial Table of Contents | Index ]

Camera

Category

Rendering

Function

Constructs a camera for viewing an object.

Syntax


camera = Camera(to, from, width, resolution, aspect, up,
                perspective, angle, background);

Inputs
Name Type Default Description
to vector or object [0 0 0] look-to point
from vector or object [0 0 1] position of camera
width scalar or object 100 width of field of view (for orthographic projection)
resolution integer 640 horizontal resolution of image (in pixels)
aspect scalar 0.75 height/width
up vector [0 1 0] up direction
perspective flag 0 0: orthographic projection
1: perspective projection
angle scalar 30.0 view angle (in degrees) (for perspective projection)
background vector or string "black" image background color

Outputs
Name Type Description
camera camera resulting camera

Functional Details

This module differs from AutoCamera in that it specifies a "look-from" point for viewing an object (AutoCamera specifies a direction from which to view an object).

to

specifies a point in the scene that appears at the center of the image; the default is the origin of world space. This parameter can also be specified as an object, in which case the center of the object serves as the look-to point.

Note: This parameter cannot have the same value as from (see below).

from

specifies the location of the camera; the default is [0 0 1]. This parameter can also be specified as an object, in which case its value is the center of the object's bounding box.

Note: This parameter cannot have the same value as to (see above).

width

functions only for an orthographic projection (see perspective below). It specifies the width of the field of view, in world coordinates. If this parameter is specified as an object, the module uses a value that is slightly larger than the diagonal of the object's bounding box.

resolution

specifies the width of the image in pixels.

aspect

specifies the height-to-width ratio of the image.

up

specifies a vector that will be aligned with the vertical axis of the image.

perspective

specifies the method of projection used in rendering object: perspective (0) or orthographic (1).

Perspective projection

This method produces a realistic rendering of objects, but does not preserve their exact shape and measurements (e.g., parallel lines usually do not project as being parallel). The camera is positioned at the vertex of the viewing angle (see angle below). The two end-points of that angle are the left and right sides of the image area. Thus the wider the angle, the greater the amount of object space that can be fitted into the viewing area.

Note: The width parameter has no effect on perspective projection.

Orthographic projection

This method produces a somewhat artificial view of an object (the distance between the front and back of an object appears small compared to the distance between the object and the camera), but it preserves exact scale measurements and parallel lines. The size of the object can be changed only by width (the default is a field of view slightly greater than the width of the object).

The angle parameter has no effect on orthographic projection.

In orthographic projection, only the direction of the from-to vector is important, not its magnitude. The object's distance does not affect its size in the image, which can be changed only with the width parameter. In perspective projection, the object's size can be changed only by changing from or angle (because width is ignored).

For more information on these projection methods, consult a text on computer graphics.

angle

specifies the viewing angle in degrees. The vertex of this angle is to.

background

specifies the color of the image background as either an RGB color or a color-name string. The string can be any of the defined color-name strings (see Color).

Example Visual Programs

FlyThrough.net (uses the macro InterpolatePositionsMacro.net)
FlyThrough2.net

See Also

 AutoCamera,  AutoColor,  Direction,  Render


[ Top of Page | Previous Page | Next Page | Table of Contents | Partial Table of Contents | Index ]
[Data Explorer Documentation | QuickStart Guide | User's Guide | User's Reference | Programmer's Reference | Installation and Configuration Guide ]

[Data Explorer Home Page | Contact Data Explorer | Same document on Data Explorer Home Page ]


[IBM Home Page | Order | Search | Contact IBM | Legal ]