@@ -138,8 +138,9 @@ def render_image(self, *, params: RenderParams, output_path: Path):
138
138
exec (code , {"bpy" : bpy }, dict ())
139
139
140
140
# Import a glTF file. Note that the Blender glTF importer imposes a
141
- # 90- degree rotation along X-axis when loading meshes. Thus, we
141
+ # +90 degree rotation around the X-axis when loading meshes. Thus, we
142
142
# counterbalance the rotation right after the glTF-loading.
143
+ # TODO(#39) This is very suspicious. Get to the bottom of it.
143
144
bpy .ops .import_scene .gltf (filepath = str (params .scene ))
144
145
bpy .ops .transform .rotate (
145
146
value = math .pi / 2 , orient_axis = 'X' , orient_type = 'GLOBAL'
@@ -151,9 +152,8 @@ def render_image(self, *, params: RenderParams, output_path: Path):
151
152
scene .render .filepath = str (output_path )
152
153
scene .render .resolution_x = params .width
153
154
scene .render .resolution_y = params .height
154
- aspect_ratio = params .focal_y / params .focal_x
155
155
scene .render .pixel_aspect_x = 1.0
156
- scene .render .pixel_aspect_y = aspect_ratio
156
+ scene .render .pixel_aspect_y = params . focal_y / params . focal_x
157
157
158
158
# Set camera parameters.
159
159
camera = bpy .data .objects .get ("Camera Node" )
@@ -169,6 +169,10 @@ def render_image(self, *, params: RenderParams, output_path: Path):
169
169
# Set the clipping planes using {min, max}_depth when rendering depth
170
170
# images; otherwise, `near` and `far` are set for color and label
171
171
# images.
172
+ # TODO(#38) This clipping logic fails to implement kTooClose.
173
+ # When there is geometry within [near,far] clip but outside [min,max]
174
+ # depth, we should return zero (too close) not maxint (too far). Fix
175
+ # the code here and add regression tests for both too-close and -far.
172
176
camera .data .clip_start = (
173
177
params .min_depth if params .min_depth else params .near
174
178
)
@@ -181,17 +185,9 @@ def render_image(self, *, params: RenderParams, output_path: Path):
181
185
params .center_y - 0.5 * params .height
182
186
) / params .width
183
187
184
- # TODO(bassamul.haq/zachfang): Currently, `camera.data.angle` will not
185
- # be set if the values of fov_x and fov_y are different. The code path
186
- # needs to be tested.
187
- if params .fov_x == params .fov_y :
188
- camera .data .lens_unit = "FOV"
189
- camera .data .angle = params .fov_x
190
- else :
191
- _logger .warning (
192
- f"fov_x { params .fov_x } != fov_y { params .fov_y } . "
193
- "'camera.data.angle' is not set."
194
- )
188
+ camera .data .lens_unit = "FOV"
189
+ camera .data .angle_x = params .fov_x
190
+ camera .data .angle_y = params .fov_y
195
191
196
192
# Set image_type specific functionality.
197
193
if params .image_type == "color" :
@@ -294,7 +290,7 @@ def create_depth_node_layer(self, min_depth=0.01, max_depth=10.0):
294
290
295
291
# Convert depth measurements via a MapValueNode. The depth values are
296
292
# measured in meters, and thus they are converted to millimeters first.
297
- # Blender scales the pixel values by 65535 (2^16 -1) when producing an
293
+ # Blender scales the pixel values by 65535 (2^16 -1) when producing a
298
294
# UINT16 image, so we need to offset that to get the correct UINT16
299
295
# depth.
300
296
assert (
0 commit comments