• salvaom
  • First taste
  • Posts 4
  • Reputation 0
  • Member Since
  • Last Active
All Posts Topics Started Likes
OpenVDB for Maya and Arnold

I'm having a bit of trouble installing this for Maya 2015 and mtoa. I've downloaded it from the Tools page in this web and installed it through environment variables, instead of copy/paste all files by hand, but there's something not quite right.

At the moment, I've got OpenVDB loaded in Maya, the VolumeOpenVdbNodeMaya loaded and working as well and obviously mtoa. Here's some screenshots from my computer:

maya_vdb.JPG  viz.JPG  plug_ins.JPG 

The VDB was generated from the default attributes of a PyroFX explosion in Houdini and exported as .vdb.

The node translator is working, Arnold recognizes the volume, but as you can read in the arnold log (also attached): "00:00:00   764MB WARNING |   [volume_openvdb] could not find non-empty "grids" user data, cannot create volume".


I haven't found any installation guides for this, I though it was a matter of setting "MAYA_MODULE_PATH" on the folders containing a .mod file, "ARNOLD_PLUGIN_PATH" and "PATH" for the procedurals and shaders, and "MTOA_EXTENSIONS_PATH" for the extensions folder. Am I missing something?

0 0
Setting blendShape weights through Maya API
Thank you very much, it is much more clear to me now. I appreciate a lot you taking the time to explain. This one works like a charm now. Now I'm jumping into C++ now, so let's see how this goes.
0 0
Setting blendShape weights through Maya API
First of all, thank you very much for the help with this matter, I'm starting to learn API now by myself and I'm stumbling into some complications from time to time.
Regarding the matter of using the vertexCount as the base of my script, there is a reason for that. I have been unable to query all the weights of the baseWeights MPlug, because until it's painted with the Artisan tool or modified in any way, that array is empty. You can try to run this code to replicate my problem:

import maya.OpenMaya as om
import maya.cmds as cmds
pS1 = cmds.polySphere()
pS2 = cmds.polySphere()
bs = cmds.blendShape(pS1[0], pS2[0], name='bs')
p = om.MPlug()
sl = om.MSelectionList()
sl.add("%s.inputTarget[0].baseWeights" % bs[0])
sl.getPlug(0, p)
ids = om.MIntArray()
count = ids.length()
# Result: [] # 
weights = [0.0]*count
# Result: [] # 
for i in range(count):
    weights[i] = p.elementByPhysicalIndex(i).asFloat()
print weights
# Result: [] #

So I can't iterate through  the elements because the array is empty. If I flood the blendShape with any value, all those appear in the array.

For setting, I have run your piece of code and it does work much much faster, thanks a lot. Also, if it's not very complicated, I would love to know the difference between the logical and the physical index.
Plus, the reason I was appending the index with the weight inside the variable is because I am not sure if vertices in Maya can skip numbers ([1, 2, 5, ...]) and I wanted to make sure that each vertex ID was stored as well.
Again, thanks. I'll keep the xrange in mind also!
0 0
Setting blendShape weights through Maya API
I've come across this problem and I thought somebody here would be able to help me. I'm doing a little script for getting/setting the weights of a blendShape node in Maya, and the first thing I noticed is that is all stored in a MPlug that is an array, but the interesting thing is that that array is empty until each single value on the array is queried or setted:


I have the codes for getting and setting the weights per-vertex, but for some reason, setting the weights is really slow (9min/40.000vtx), just slightly faster than using maya.cmds.setAttr. I was wondering if I'm doing something wrong on my code or if there is a faster way of approaching this. This is my code for getting:


def getBaseWeights(self):
    ''' Returns the base weights
    time = dt.now()
    if not self.api:
    basePlug = self.getBaseWeightPlug()
    baseWeights = []
    for i in xrange(self.vertexCount()):
        w = basePlug.elementByLogicalIndex(i)
        weight = [i, w.asFloat()]
    print '@getBaseWeights took %s' % (dt.now() - time)
    return baseWeights

and this one for setting:


def setBaseWeights(self, weights, default=1, override=False):
    ''' Sets the baseWeights of a blendshape node.
    :param weights: An array with the weights to be set. The format must be 
     in the following form: [[vertex_number, value], ...]
    :type weights: list
    :param default: unused
    :param override: Overrides all weights with this value if not False
    :type override: (float, int)
    time = dt.now()
    if not self.api:
    basePlug = self.getBaseWeightPlug()
    for vNum, weight in weights:
        if vNum > self.vertexCount():
        if override and not isinstance(override, (float, int)):
            weight = float(override)
    print '@setBaseWeights took %s' % (dt.now() - time)

Is there any more agile way to accomplish this?

Thank you in advance!
0 0
count post selected

Add a Website Forum to your website.