Developer

How to Render Quill with Opacity in Arnold

How to Render Quill with Opacity in Arnold

We export vertex color in Alembic. In Alembic, the color set name is “rgba”.

To use vertex color and opacity of Quill assets in Arnold is not easy. Please follow the steps below:

  1. Export Quill to Alembic.
  2. Import Quill Alembic file to Maya. how-to-use-quill-in-maya
  3. Select mesh node. Under “Arnold” tab, uncheck “Opaque”, and check “Export Vertex Color”. enable-opacity-and-rgba

  4. Create Arnold user attributes for opacity data. Open script editor, under “Python” tab, paste in script below, change the shape node string as needed. In the example script, my node name is “Txt_mesh”. Run the script.
       
       #Alembic
       import maya.cmds as cmds
       numVertices = cmds.polyEvaluate(v=True)
       opacities = []
       for i in range(numVertices):
           attr = "Txt_mesh.colorSet[0].colorSetPoints[{}].colorSetPointsA".format(i)
           opacities.append(cmds.getAttr(attr))    
       cmds.addAttr("Txt_mesh", dataType="doubleArray", longName="mtoa_varying_perVertexOpacity")
       cmds.setAttr("Txt_mesh.mtoa_varying_perVertexOpacity", opacities, type="doubleArray" )
       
     

    run-script

  5. Create Arnold shader, and assign it to Quill mesh.
  6. Set vertex color by using “aiUserDataColor” node, type in color attribute: rgba. Connect this node to “Base Color”(depends on your shader setup). set-vertex-color

  7. Set opacity by using “aiUserDataFloat” node, type in “perVertexOpacity”. Connect this node to “Opacity.R”, “Opacity.G” and “Opacity.B”. set-opacity

  8. If you also want to view the vertex color and opacity in Maya viewport, go to “Mesh Component Display” tab of a mesh node in Attribute Editor. Check “Display Colors”, and choose “None” for “Display Color Channel”. show-rgba-in-viewport

Download sample Maya scene.