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.PreProcessControlControl 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. Azoom_factorof 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])
Note
The camera uses the parameters as following:
We set the
apertureandfocal_lengthWe 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.We move closer or further in order to satisfy the
zoom_factorconstraint
In most cases the final position of the camera will be quite different from the
view_pointparameter.-
__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¶