Message 1 of 1
Severe memory overhead when using command "polyColorPerVertex"

Not applicable
05-07-2019
08:37 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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:
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.