Browse Source

Export orthographic cameras using 'screenwindow'.

tags/blender-2-79
Jan Walter 9 months ago
parent
commit
71374b526b
2 changed files with 13 additions and 7 deletions
  1. BIN
      blend/rs_pbrt_010.blend
  2. 13
    7
      io_scene_pbrt/export_pbrt.py

BIN
blend/rs_pbrt_010.blend View File


+ 13
- 7
io_scene_pbrt/export_pbrt.py View File

@@ -130,7 +130,7 @@ class PbrtExporter:
# export camera(s)
if self.camObj != None:
self.camData = self.camObj.data
if self.camData.type == "PERSP":
if self.camData.type == "PERSP" or self.camData.type == "ORTHO":
for obj in self.scene.objects:
data = obj.data
if obj.type == 'CAMERA':
@@ -504,13 +504,19 @@ class PbrtExporter:
self.scale_length * target[2]))
self.pbrtFile.write(" %s %s %s # up\n" %
(up[0], up[1], up[2]))
self.pbrtFile.write('Camera "perspective"\n')
aspect = resolution[0] / float(resolution[1])
if aspect >= 1.0:
fov = 2 * math.degrees(math.atan(16.0 / (aspect * lens)))
else:
fov = 2 * math.degrees(math.atan((aspect * 16.0) / lens))
self.pbrtFile.write(' "float fov" [ %s ]\n' % fov)
if obj.data.type == "ORTHO":
self.pbrtFile.write('Camera "orthographic"\n')
swy = obj.data.ortho_scale / (2.0 * aspect)
swx = aspect * swy
self.pbrtFile.write(' "float screenwindow" [ -%s %s -%s %s ]\n' % (swx, swx, swy, swy))
if obj.data.type == "PERSP":
self.pbrtFile.write('Camera "perspective"\n')
if aspect >= 1.0:
fov = 2 * math.degrees(math.atan(16.0 / (aspect * lens)))
else:
fov = 2 * math.degrees(math.atan((aspect * 16.0) / lens))
self.pbrtFile.write(' "float fov" [ %s ]\n' % fov)
if aperture_size > 0.0 and (dof_distance > 0.0 or dof_object != None):
focaldistance = dof_distance
if dof_object != None:

Loading…
Cancel
Save