Category Archives

2 Articles

Telling an object not to cast shadows in Renderman RIS

by tomminor 0 Comments

I recently ran into an issue where I’d like to use a piece of geometry as a sky dome, seen through a glass window. This accidentally disabled my sun directional light, as it turns out the sky geometry was blocking it.

My usual fix was to add the “Indirect Lighting” attribute, but in this case it also prevented the rays refracted through the glass from reaching the sky dome geometry. After a bit of resarch I found https://renderman.pixar.com/view/TGT_REYES_Lighting, which explains Trace Sets as being the workaround to fix this.

The article already explains it well, but this is how I applied it in my case:

  1. Create a set with the geometry you’d like to not cast shadow
  2. In the attribute editor, make sure the set is selected and add the trace set attribute via Renderman >> Mark as Trace Group
  3. Now select the light you’d like to ignore this object, go to it’s Shadows tab and choose the trace set you just set up

trace_A

trace_B

Copy blendshape to similiar geometry script (Maya)

A quick script I wrote that helps you copy blendshapes from a target mesh to only the selected vertices of another mesh, which is useful if you have models with identical faces but different bodies (that are a single object).

For example, if you want to copy a face blendshape from a character onto a copy of the character with identical face geometry but different body topology, you would :

  1. Duplicate the character with different body topology.
  2. Select the original blendshape mesh that you want to transfer to the duplicate.
  3. Shift select the vertices on the duplicate character that you want to be affected (such as all the head vertices).
  4. Run my script.
  5. Blendshape >> Add the result to your skinned character.

I’m unsure if there is a better way of doing this, but this script worked for a simple cartoon character.

import maya.cmds as cmds
 
selection = cmds.ls(sl=True)
 
if len(selection) > 0:
    targetMesh = selection[-1]
    affectedVertices = selection[0:-1] # Assume the rest of the selection is made of vertices
    affectedMesh = cmds.listRelatives(cmds.listRelatives(affectedVertices[0], p=True), p=True)
 
    vtxSet = cmds.sets(affectedVertices, v=True, n="SelectionSet")
    print cmds.sets(vtxSet, q=True)
 
    # Move to origin
    cmds.move(32, 0, 0, affectedMesh, ws=True)
    cmds.move(32, 0, 0, targetMesh, ws=True)
 
    # Select target mesh and affected vertices
    cmds.select(cl=True)
    cmds.select(targetMesh)
    cmds.select(vtxSet, add=True)
 
    cmds.transferAttributes(transferPositions=1, transferNormals=1, transferUVs=2, transferColors=0, sourceUvSpace="map1", sampleSpace=3, searchMethod=0, flipUVs=0, colorBorders=1)
 
    cmds.hide(targetMesh)
 
    cmds.select(cl=True)
else:
    print "Select vertices to move and target mesh"