Website powered by

Maya Script

### 360 Render Camera Setup ###

# IMPORTANT NOTE: Once the 6 new cameras are created,
# you must manually change the FILM ASPECT RATIO setting
# of each new camera to a value of 1. This will ensure the
# cameras all have a 90 degree angle of view.

#Select desired camera and run script to create 360 camera rig

import maya.cmds as cmds

cam=cmds.ls(sl=True)

cmds.duplicate(cam)
cmds.rename("spherical_front")

cmds.duplicate("spherical_front")
cmds.rotate( 0, '90deg', 0, os=True, r=True)
cmds.rename("spherical_left")

cmds.duplicate("spherical_left")
cmds.rotate( 0, '90deg', 0, os=True, r=True)
cmds.rename("spherical_back")

cmds.duplicate("spherical_back")
cmds.rotate( 0, '90deg', 0, os=True, r=True)
cmds.rename("spherical_right")

cmds.duplicate("spherical_right")
cmds.rotate( '90deg', '90deg', 0, os=True, r=True)
cmds.rename("spherical_top")

cmds.duplicate("spherical_top")
cmds.rotate( '180deg', 0, 0, os=True, r=True)
cmds.rename("spherical_bottom")

cmds.group('spherical_front', 'spherical_left', 'spherical_back', 'spherical_right', 'spherical_top', 'spherical_bottom', n='spherical_cam_group')
camlist=['spherical_front', 'spherical_left', 'spherical_back', 'spherical_right', 'spherical_top', 'spherical_bottom']

for each in camlist:
cmds.setAttr("%s.focalLength"%each, 12)
cmds.setAttr("%s.template"%each, 1)

#Constrain spherical rig to main camera
cmds.parentConstraint(cam,'spherical_cam_group', mo=True)

#Make resolution square
resolutionheight=cmds.getAttr("defaultResolution.height")
cmds.setAttr("defaultResolution.width", resolutionheight)
cmds.setAttr("defaultResolution.aspectLock", 1)