[Closed] Setting vertex colors in separate modifier
Hi there,
I am writing a script that bakes illumination into vertex colors. So far I have used the polyop functions to put the colors into the base ePoly object, but for more flexibility I would prefer to have the colors put into a modifier higher in the stack (after a number of transforms).
Looking through the max modifiers and the help, I cannot see any modifiers with maxscript access that will allow me to set colors for individual vertices. Does anyone here know where I could look?
Thanks!
I don’t think you can, you could try to copy the vert colors from the baseobject with a channelInfo copyChannel higher up the stack, but I don’t know if that defeats the whole purpose of your quest… If you need it badly, maybe contact Grant Adam / http://www.rpmanager.com/otherGear.htm he seems to know about vertex colors…
I presume you don’t want a edit mesh mod on top of your stack…?
-Johan
Hi again Johan, and thanks for the fast answer
Actually, I didn’t know that the EditMesh mod supported vertex colors, I assumed it ignored them, like the EditPoly mod. I need the modifier inside the stack (most often wedged between skin and turbosmooth mods), and I am not sure if a mesh modifier will be a problem or not. Hopefully not! I will try it out and see how it goes.
And I don’t think I will bother Grant with this, I’m emailing him enough as it is!
Cheers!
I am having a hard time cracking through to the Edit_Mesh() modifier. I can’t seem to access its mesh property or find any other method for setting its vertex colors. Does anyone know if I’m heading up a blind alley with this modifier?
Thanks!
I would think the help file has the answer you seek…
Constructor[b][b]
Edit_mesh …
[/b][/b]Properties [left]There are no additional properties for Edit_Mesh.
[/left]
[left]
[/left]
[left]Looks like selections are all that are accessible…
[/left]
[left]
[/left]
Unwrap UVW can perhaps be used:
vcs=unwrap_uvw()
addModifier obj vcs
vcs.setVC true
…
…
vcs.setVertexPosition time vertex_index normalized_color
…
normalized_color=vcs.getVertexPosition time vertex_index
vcs.reset() will copy existing vertex colors into the modifier, but requires user input… if this operation is needed, I guess you can just iterate over the vertices and copy them one by one.
Hi there Steinar (From Norway, do I know you??)
I will try that out, thanks!
I would make a copy of the object you’re working on, collapse it… do the vertex color baking and copy the VC Map Channel on top of the original object. That should work fairly fast.
-Johan
Johan, that’s my plan B Since the character/objects might have TurboSmooth or other modifiers that change polycounts, I must parse through them first, disabling them, before creating a snapshot.
I’m doing a character script at the moment, but I will return to this in a week or so…