fresnel.camera

Overview

fresnel.camera.Camera

Defines the view into the Scene.

fresnel.camera.fit

Fit a camera to a Scene

fresnel.camera.orthographic

Orthographic camera

Details

Cameras.

class fresnel.camera.Camera(_camera=None)

Defines the view into the Scene.

Use one of the creation functions to create a Camera:

See also

examples/00-Basic-tutorials/04-Scene-properties

Tutorial: Setting scene properties

TODO:

More advanced camera tutorials (when more advance camera functions are available)

The camera is a property of the Scene. You may read and modify any of these camera attributes.

position

the position of the camera (the center of projection).

Type

tuple[float, float, float]

look_at

the point the camera looks at (the center of the focal plane).

Type

tuple[float, float, float]

up

a vector pointing up.

Type

tuple[float, float, float]

height

the height of the image plane.

Type

float

basis

three orthonormal vectors defining the camera coordinate basis in the right-handed order right, look direction, up (read only)

Camera space is a coordinate system centered on the camera’s position. Positive x points to the right in the image, positive y points up, and positive z points out of the screen. Camera space shares units with Scene space.

TODO: Move description of spaces to an overview page and create figures. TODO: Use numpy arrays for camera vectors?

fresnel.camera.fit(scene, view='auto', margin=0.05)

Fit a camera to a Scene

Create a camera that fits the entire hight of the scene in the image plane.

Parameters
  • scene (Scene) – The scene to fit the camera to.

  • view (str) – Select view

  • margin (float) – Fraction of extra space to leave on the top and bottom of the scene.

view may be ‘auto’, ‘isometric’, or ‘front’.

The isometric view is an orthographic projection from a particular angle so that the x,y, and z directions are equal lengths. The front view is an orthographic projection where +x points to the right, +y points up and +z points out of the screen in the image plane. ‘auto’ automatically selects ‘isometric’ for 3D scenes and ‘front’ for 2D scenes.

fresnel.camera.orthographic(position, look_at, up, height)

Orthographic camera

Parameters

An orthographic camera traces parallel rays from the image plane into the scene. Lines that are parallel in the Scene will remain parallel in the rendered image.

position is the center of the image plane in Scene space. look_at is the point in Scene space that will be in the center of the image. Together, these vectors define the image plane which is perpendicular to the line from position to look_at. Objects in front of the plane will appear in the rendered image, objects behind the plane will not.

up is a vector in Scene space that defines which direction points up (+y direction in the image). up does not need to be perpendicular to the line from position to look_at, but it must not be parallel to that line. height sets the height of the image in Scene units. The image width is determined by the aspect ratio of the image. The area width by height about the look_at point will be included in the rendered image.

TODO: show a figure