threedb.controls.blender.camera

Control the camera. An example config file using this control can be found here: https://github.com/3db/3db/tree/main/examples/unit_tests/camera.yaml.

class threedb.controls.blender.camera.CameraControl(root_folder: str)

Bases: threedb.controls.base_control.PreProcessControl

Control that changes the camera that will be used to render the image

Continuous Dimensions:

  • view_point_x: The relative x coordinate of the camera (see the note below). (default range: [-1, 1])

  • view_point_y: The relative y coordinate of the camera (see the note below). (default range: [-1, 1])

  • view_point_z: The relative z coordinate of the camera (see the note below). (default range: [0, 1])

  • zoom_factor: Defines how much should we see of the object. A zoom_factor of 1 means we completely see the object with a little margin. Above 1 we are close. Below 1 we are further. (default range: [0.5, 2])

  • aperture: The aperture of the camera. (default range: [1, 32])

  • focal_length: The focal length of the camera. (default range: [10, 400])

Example images

Varying each parameter across its range.

Note

The camera uses the parameters as following:

  1. We set the aperture and focal_length

  2. We move the camera according to view_point_{x,y,z} and look at the object. These are the camera’s coordinates relative to the object.

  3. We move closer or further in order to satisfy the zoom_factor constraint

In most cases the final position of the camera will be quite different from the view_point parameter.

__init__(root_folder: str)

Construct a BaseControl

Parameters

root_folder – The folder containing all the data for this 3DB experiment. All paths are lative to his folder

apply(context: Dict[str, Any], control_args: Dict[str, Any])None

Modify the target give a combination of the inputs the control needs

Parameters
  • context (Dict[str, Any]) – A dictionary representation of the current scene.

  • control_args (Dict[str, Any]) – a dict containing an entry for each of the discrete and continuous parameters declared by the Control

  • the scene in-place (Modifies) –

  • return value. (no) –

unapply(context: Dict[str, Any])None

Undo the modification on a scene

Note

Most of the time, recreating a scene is very expensive, therefore, controls are asked to implement a reverse operation to undo their changes. Controls that need to store state in order to undo their actions should add data to the target object they received.

Parameters

context (Dict[str, Any]) – The description of the scene to render

threedb.controls.blender.camera.Control

alias of threedb.controls.blender.camera.CameraControl