|
21 | 21 |
|
22 | 22 |
|
23 | 23 | class Camera(objects.Object3D): |
24 | | - """ Base class for all types of cameras. |
25 | | - |
26 | | - Args: |
27 | | - min_render_distance (float): The minimum rendering distance for the camera `m`. |
28 | | - `Default = 0.1` |
29 | | -
|
30 | | - max_render_distance (float): The maximum rendering distance for the camera `m`. |
31 | | - `Default = 1000.0` |
| 24 | + """Base class for all types of cameras. |
32 | 25 |
|
| 26 | + Args: |
| 27 | + min_render_distance (float): The minimum rendering distance for the camera |
| 28 | + `m`. `Default = 0.1` |
| 29 | + max_render_distance (float): The maximum rendering distance for the camera |
| 30 | + `m`. `Default = 1000.0` |
33 | 31 | """ |
34 | 32 |
|
35 | 33 | min_render_distance = tl.Float(0.1) |
@@ -71,28 +69,54 @@ class UndefinedCamera(Camera, UndefinedAsset): |
71 | 69 |
|
72 | 70 |
|
73 | 71 | class PerspectiveCamera(Camera): |
74 | | - """ A :class:`Camera` that uses perspective projection. |
| 72 | + """A :class:`Camera` that uses perspective projection. |
75 | 73 |
|
76 | 74 | Args: |
77 | | - focal_length (float): The focal length of the camera lens in `mm`. |
78 | | - `Default = 50` |
79 | | -
|
80 | | - sensor_width (float): Horizontal size of the camera sensor in `mm`. |
81 | | - `Default = 36` |
82 | | -
|
| 75 | + focal_length (float): The focal length of the camera lens in `mm`. `Default |
| 76 | + = 50` |
| 77 | + sensor_width (float): Horizontal size of the camera sensor in `mm`. `Default |
| 78 | + = 36` |
| 79 | + shift_x (float): Principal point horizontal offset defined as fraction of |
| 80 | + sensor width. `Default = 0.0` |
| 81 | + shift_y (float): Principal point vertical offset defined as fraction of |
| 82 | + sensor height. `Default = 0.0` |
83 | 83 | """ |
84 | 84 |
|
85 | 85 | focal_length = tl.Float(50) |
86 | 86 | sensor_width = tl.Float(36) |
87 | | - |
88 | | - def __init__(self, |
89 | | - focal_length: float = 50, |
90 | | - sensor_width: float = 36, |
91 | | - position=(0., 0., 0.), |
92 | | - quaternion=None, up="Y", front="-Z", look_at=None, euler=None, **kwargs): |
93 | | - super().__init__(focal_length=focal_length, sensor_width=sensor_width, position=position, |
94 | | - quaternion=quaternion, up=up, front=front, look_at=look_at, euler=euler, |
95 | | - **kwargs) |
| 87 | + # Changing shift_x and shift_y is currently not supported in kubric. However, |
| 88 | + # these values can be changed if only blender support is necessary as changing |
| 89 | + # these will impact the blender camera principal point offsets. |
| 90 | + shift_x = tl.Float(0.0) |
| 91 | + shift_y = tl.Float(0.0) |
| 92 | + |
| 93 | + def __init__( |
| 94 | + self, |
| 95 | + focal_length: float = 50, |
| 96 | + sensor_width: float = 36, |
| 97 | + shift_x: float = 0.0, |
| 98 | + shift_y: float = 0.0, |
| 99 | + position=(0.0, 0.0, 0.0), |
| 100 | + quaternion=None, |
| 101 | + up="Y", |
| 102 | + front="-Z", |
| 103 | + look_at=None, |
| 104 | + euler=None, |
| 105 | + **kwargs |
| 106 | + ): |
| 107 | + super().__init__( |
| 108 | + focal_length=focal_length, |
| 109 | + sensor_width=sensor_width, |
| 110 | + position=position, |
| 111 | + quaternion=quaternion, |
| 112 | + up=up, |
| 113 | + front=front, |
| 114 | + look_at=look_at, |
| 115 | + euler=euler, |
| 116 | + shift_x=shift_x, |
| 117 | + shift_y=shift_y, |
| 118 | + **kwargs |
| 119 | + ) |
96 | 120 |
|
97 | 121 | @property |
98 | 122 | def field_of_view(self) -> float: |
|
0 commit comments