Arnold for Maya Forum
Rendering with Arnold in Maya using the MtoA plug-in.
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Arnold for Maya, Is there a way to read imported alembic files textures?

Message 1 of 5
1108 Views, 4 Replies

Arnold for Maya, Is there a way to read imported alembic files textures?


I am exporting .abc files from the software CityEngine. They contains multiple meshes with multiple shading trees and textures.

I read that alembic contains texture information hidden inside their hierarchy. Is there any way in Maya Arnold to read those textures and shaders and render them? (I am trying to use a workflow involving .abc files instead of .FBX because their size is much smaller). Right now the assets render white.

On this page Here there is a workflow indicated for VRay, I was looking for something similar, but in Arnold, where the textures only appear at render time.

Any help will be greatly appreciated. Many thanks


Labels (3)
Message 2 of 5

No. It looks like ArcGIS provided a custom script for reading materials and applying to them to the vray proxy object.

// Stephen Blair
// Arnold Renderer Support
Message 3 of 5
in reply to: giandosopaolo

Not quite what you're asking for, but this script might help:

Message 4 of 5

Do you mean reading them from the abc file or from where exactly? Any way to use the same workflow in Arnold (Maybe adapting the script)?

Message 5 of 5

Hi @ Stephen

Correct, this is the script for VRay.

I know a bit of python, but I guess this is written in pymel right?

Do you think it would be possible to convert it to arnold for maya, or it simply can not work with mtoa?

import os, math
import maya.cmds as cmds
import vray.utils as vray
from alembic import *

def getCityEngineMaterial(abcRoot, shaderPath):
p = filter(bool, shaderPath.split('/'))
n = abcRoot
for s in p:
n = Abc.IObject(n, s)
m = AbcGeom.IPolyMesh(n, Abc.WrapExistingFlag.kWrapExisting)
# get material compound prop
abcMeshUserProps = m.getSchema().getUserProperties()
return abcMeshUserProps.getProperty('material')

def getTexBitmap(prefix, abcFileDir, texName):
bufferName = 'bitmapBuffer_' + texName
existingTexBufs = vray.findByName(bufferName)
if len(existingTexBufs) == 0:
texBuf = vray.create('BitmapBuffer', bufferName)
#print "new BitmapBuffer = ", texBuf
filePath = os.path.join(abcFileDir, texName)
texBuf.set('file', filePath)
texBuf = existingTexBufs[0]
texBuf.set('color_space', 1)

uvgName = 'uvgen_' + prefix + '_' + texName
exUVGs = vray.findByName(uvgName)
if len(exUVGs) == 0:
uvg = vray.create('UVWGenChannel', uvgName)
v1 = vray.Vector(1.0, 0.0, 0.0)
v2 = vray.Vector(0.0, 1.0, 0.0)
v3 = vray.Vector(0.0, 0.0, 1.0)
t = vray.Vector(0.0, 0.0, 0.0)findByType("Node")
m = vray.Matrix(v1, v2, v3)
uvg.set('uvw_transform', vray.Transform(m, t))
# note: UVWGenMayaPlace2dTexture with mirror_v did not work (?)
uvg.set('uvw_channel', 0)
#uvg.set('duvw_scale', -1)
print uvg.params(True)
uvg = exUVGs[0]

texBitmapName = 'texBitmap_' + prefix + '_' + texName
exTexBitmaps = vray.findByName(texBitmapName)
if len(exTexBitmaps) == 0:
texBitmap = vray.create('TexBitmap', texBitmapName)
#print "new TexBitmap = ", texBitmap
texBitmap.set('bitmap', texBuf)
texBitmap.set('uvwgen', uvg)
texBitmap.set('tile', 1)
#print texBitmap.params(True)
texBitmap = exTexBitmaps[0]

return texBitmap

def convertMaterial(idx, mtlName, abcMatProps, abcFileDir):
vrayShdName = 'vrayShd' + str(idx)
brdf = vray.create('BRDFVRayMtl', vrayShdName)

vrayMtlName = 'vrayMtl' + str(idx)
vrayMtl = vray.create('MtlSingleBRDF', vrayMtlName)
vrayMtl.set('brdf', brdf)
diffuseColor = abcMatProps.getProperty('diffuseColor').getValue()
diffuseMaps = abcMatProps.getProperty('diffuseMap').getValue()
diffuseMap = diffuseMaps[0] # TODO: error handling

if diffuseMap == '':
brdf.set("diffuse", vray.AColor(vray.Color(diffuseColor[0], diffuseColor[1], diffuseColor[2]), 1.0))
brdf.set('diffuse', getTexBitmap('diffuse', abcFileDir, diffuseMap))

opacityMap = abcMatProps.getProperty('opacityMap').getValue()
if opacityMap != '':
texBitmap = getTexBitmap('opacity', abcFileDir, opacityMap)
brdf.set('opacity', texBitmap.output('out_alpha'))

return vrayMtl

def loadMaterials():
nodes = vray.findByType("Node")
for node in nodes:
mesh = node.get('geometry')
mesh.set('use_full_names', 1)
abcFile = mesh.get('file')
abcFileDir = os.path.dirname(abcFile)
abcArchive = Abc.IArchive(abcFile)
abcRoot = abcArchive.getTop()

mtl = node.get('material')
mtlName =

print mtl, mtl.params(True)
mtls = mtl.get('mtls_list')
shaderCount = cmds.getAttr(mtlName + '.shaderNames', size=True)
for si in range(0,shaderCount):
sufStr = '[' + str(si) + ']'
shaderPath = str(cmds.getAttr(mtlName + '.shaderNames' + sufStr))
abcMatProps = getCityEngineMaterial(abcRoot, shaderPath)
vrayMtl = convertMaterial(si, mtlName, abcMatProps, abcFileDir)
mtls[si] = vrayMtl

mtl.set('mtls_list', mtls)


Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators

Autodesk Design & Make Report