top of page

Prop Set

Python script that creates a back drop and basic lighting for prop turn arounds.

User Guide

Run the script in Maya by opening it in the script editor or creating a custom shelf button. Running the script will create an infinite backdrop, a sky, key, fill and rim light, and a camera. Everything created with this script has the prefix "PS," including a group with all the lights, camera, and geometry created and a layer that holds the skydome light.

Screenshot (99).png

Results

Script

####################### Create Prop Set ###########################
##
## Create a Backdrop, Lights, and Camera for Prop rendering
##     Manually change common render settings
##     Manually adj lights and cam as needed
##
## Created by Abby O'Malley
## Follow me on instagram! @aabrbty
## Reach out for questions/comments!
##
##############################################################################
import maya.cmds as cmds
import mtoa.utils as mutils

### Globals ###
PFX = "PS_"
if cmds.objExists(f"{PFX}*"):
  cmds.delete(f"{PFX}*")
if cmds.objExists("PropSet"):
  cmds.delete("PropSet")   
### Clean up Obj ###    
def cleanup(obj):
  cmds.select(obj)
  cmds.DeleteHistory()
  cmds.FreezeTransformations()
   
### Create Backdrop ###
def Backdrop():
  BackdropName = f"{PFX}Backdrop"
  cmds.polyCube(n= f"{BackdropName}")
  cmds.move(0,-.5,0, f"{BackdropName}.scalePivot", f"{BackdropName}.rotatePivot")
  cmds.move(0,.5,0)
  cmds.scale(117,45,60)
  cmds.delete(f"{BackdropName}.f[0:1]",f"{BackdropName}.f[4:5]")
  cleanup(f"{BackdropName}")
  cmds.polyBevel3(f"{BackdropName}.e[2]", offset=18, segments = 16)
  cmds.scale(1.638, z=True)
  cmds.scale(1.455, y=True)
  cmds.move(4.522, z=True)
  cmds.polySoftEdge(f"{BackdropName}", a=180)

  ## Assign AiSS to Backdrop ##
  BackdropTXT = cmds.shadingNode('aiStandardSurface',n = f"{BackdropName}_TXT", asShader=True)
  AiSSSet =  cmds.sets( renderable=True, noSurfaceShader=True, empty=True, n= f"{BackdropName}set");
  cmds.connectAttr( BackdropTXT+".outColor", AiSSSet+".surfaceShader", force=True)
  cmds.select(f"{BackdropName}")
  cmds.hyperShade(assign = BackdropTXT)

### Create Lights ###
def Lights():    
  ## Key Light ##
  mutils.createLocator('aiAreaLight', asLight=True)
  keylight = cmds.rename('aiAreaLight1', f"{PFX}Key")
  cmds.select(f"{PFX}Key")
  cmds.move(21.517,6.564,25.303)
  cmds.rotate(-2.726,45,0)
  cmds.scale(8.902,8.902,8.902)
  cmds.setAttr(f"{PFX}KeyShape.color", 1, .888, .829)
  cmds.setAttr(f"{PFX}KeyShape.intensity", 1135.516)
  cmds.setAttr(f"{PFX}KeyShape.exposure", 1.250)
  cmds.setAttr(f"{PFX}KeyShape.aiSamples", 3)
  cmds.setAttr(f"{PFX}KeyShape.aiTranslator", "disk", type="string")
   
  """
  ## Fill Light - Directional ##
  cmds.directionalLight(rot=(-30,-45,0), intensity=2.111, rgb=(.692,.728,1))
  fill = cmds.rename("directionalLight1", f"{PFX}Fill")
  cmds.move(-17.402,22.710,20.709)
  cmds.scale(10.733,10.733,10.733)
  cmds.setAttr(f"{PFX}FillShape.aiExposure",-0.750)
  cmds.setAttr(f"{PFX}FillShape.aiSamples", 3)
  cmds.setAttr(f"{PFX}FillShape.aiCastShadows",0)
  cmds.setAttr(f"{PFX}FillShape.aiCastVolumetricShadows",0)
  """
   
  ## Fill Light - Area ##
  mutils.createLocator('aiAreaLight', asLight=True)
  area01 = cmds.rename('aiAreaLight1', f"{PFX}Fill")
  cmds.select(f"{PFX}Fill")
  cmds.move(-24.333, 15.946, 25.303)
  cmds.rotate(-12.935, -35.536, -2.759)
  cmds.scale(8.902, 8.902, 8.902)
  cmds.setAttr(f"{PFX}FillShape.color", .860, .876, 1)
  cmds.setAttr(f"{PFX}FillShape.intensity", 1135.516)    
  cmds.setAttr(f"{PFX}FillShape.exposure", 1)
  cmds.setAttr(f"{PFX}FillShape.aiSamples", 3)
  cmds.setAttr(f"{PFX}FillShape.aiTranslator", "disk", type="string")

  ## Rim Light ##
  mutils.createLocator('aiAreaLight', asLight=True)
  rimlight = cmds.rename('aiAreaLight1', f"{PFX}Rim")
  cmds.select(f"{PFX}Rim")
  cmds.move(0, 29.103,-22.901)
  cmds.rotate(-24.143,180, 0)
  cmds.scale(8.902, 8.902, 8.902)
  cmds.setAttr(f"{PFX}RimShape.color", 1, 1, 1)
  cmds.setAttr(f"{PFX}RimShape.intensity", 1431.516)
  cmds.setAttr(f"{PFX}RimShape.exposure", .894)
  cmds.setAttr(f"{PFX}RimShape.aiSamples", 2)
  cmds.setAttr(f"{PFX}RimShape.aiDiffuse", .992)
  cmds.setAttr(f"{PFX}RimShape.aiIndirect", 2.129)
  cmds.lightlink(b=True, light= f"{PFX}Rim", object= f"{PFX}Backdrop")
   
  ## Skydome Light ##
  mutils.createLocator('aiSkyDomeLight', asLight=True)
  area01 = cmds.rename('aiSkyDomeLight1', f"{PFX}Skydome")
  cmds.select(f"{PFX}Skydome")
  cmds.move(0, 0, 0)
  cmds.rotate(0, 0, 0)
  cmds.scale(1, 1, 1)
  cmds.setAttr(f"{PFX}SkydomeShape.color", .664, .687, .750)
  cmds.setAttr(f"{PFX}SkydomeShape.intensity", .2)
  cmds.setAttr(f"{PFX}SkydomeShape.exposure", 0)
  cmds.setAttr(f"{PFX}SkydomeShape.aiSamples", 2)
   
  cmds.select(f"{PFX}Skydome")
  cmds.createDisplayLayer(n=f"{PFX}Skdome_LAY")
   
### Create Camera ###
def Camera():
  cmds.camera(n=f"{PFX}rendCAM", fl=50, hfa=1.417, vfa=.945, fs=5.6, coi=21.401)
  cmds.move(0.607, 15.036, 51.905)
  cmds.rotate(-10.796, 0, 0)
  cmds.scale(2, 2, 2)
  cmds.setAttr ("defaultArnoldRenderOptions.AASamples",4)
  cmds.setAttr ("defaultArnoldRenderOptions.GIDiffuseSamples", 2)

def GroupSet():
  cmds.select(f"{PFX}*")
  cmds.group(n= "PropSet")
  cmds.select(cl=True)
   
### MAIN ###    
def Main():
  Backdrop()
  Lights()
  Camera()
  GroupSet()

Main()

bottom of page