PDA

View Full Version : setting a mesh's vertex alpha through code?


Hobbs
06-09-2011, 03:33 AM
Is there an accurate way to set a selected verts vertex alpha amount through code?

meshop.setvertalpha uses the map channel, so you could be assigning to any number of verts, so its not very accurate.

Does someone have a more accurate solution?


Thanks

denisT
06-09-2011, 07:17 AM
Is there an accurate way to set a selected verts vertex alpha amount through code?

meshop.setvertalpha uses the map channel, so you could be assigning to any number of verts, so its not very accurate.

Does someone have a more accurate solution?


why setvertalpha is not accurate for you? build default map faces for alpha channel and use geo vertex indexes to set the alpha values.

Hobbs
06-09-2011, 03:27 PM
basically we are creating new faces through

meshop.extrudefaces

then taking those new verts, and attempting to put alpha on them. The problem is, that since there is no mapping etc on those verts, the mapping channel verts do not align with geo verts, causing undesired results.

An easier solution, would be if we could get the actual vert indice that corrisponds to the face data of the newly created faces and apply the vertex alpha to them directly, like you would in an engine/exporter. But i'm not sure how to accomplish that in max without rebuilding the whole mesh? Which is not an option unfortunately.

slimeburger
06-15-2011, 11:18 AM
I wrote a script last week that did that exact thingy:
fn SetVertexColor targetColor mapChannel =
(
target = selection[1]
vertlist = target.selectedverts
polyop.setVertColor target mapchannel vertlist targetColor
)
the mapChannel value for vertex alpha is -2
simples

Hobbs
06-15-2011, 04:00 PM
Thanks slimeburger, i am already using a similar technique though.

The problem i was running into is that since we were creating new verts, the mapping verts of channel -2 was not matching up with the mesh verts, as mapping and geo verts do not align indexly. We found a work around with detatching the object, so our chance for error was minimal.

CGTalk Moderation
06-15-2011, 04:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.