Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

Severe memory overhead when using command "polyColorPerVertex"

Severe memory overhead when using command "polyColorPerVertex"

Anonymous
Not applicable
349 Views
0 Replies
Message 1 of 1

Severe memory overhead when using command "polyColorPerVertex"

Anonymous
Not applicable

I have a mesh file in obj format, and a color list defines the color of each vertex. 

Maya does not render vertex color, so I wanted to try the method in this link:

https://knowledge.autodesk.com/support/maya/learn-explore/caas/CloudHelp/cloudhelp/2016/ENU/Maya/fil...

where a colorSet should be created.

To import the vertex color, I wrote a script as follows:

 

import maya.cmds as mc;

fn_mesh = "D:/data/bunny.obj";
fn_color = "D:/data/bunny_color.txt";

# import mesh file
n = mc.file(fn_mesh, i=True);

# read color
with open(fn_color, "r") as f:
    for line in f:
        data = line.split();
        i = data[0];
        r = float(data[1]);
        g = float(data[2]);
        b = float(data[3]);
        selname = "Mesh.vtx[" + i + "]";
        mc.select(selname, r=True);
        mc.polyColorPerVertex( rgb=(r, g, b) );
print ('finished');

 

However, the script showed a great memory overhead, and I find the polyColorPerVertex command caused it.

 

The test data attached is a mesh with 30k vertices, and the color file contains the first 5k color values, which however, had already used up all my computer memory.

Is the commond misused here? Or is there any other method to implement this? Thanks!

The version used is Maya 2018 student.

 

0 Likes
350 Views
0 Replies
Replies (0)