So we use some shaders that blend based on vert color. I’ve built a little menu to help get people started by randomizing vertex colors on an object. I added to this menu a button that randomly raises or lowers individual vertex colors’ value by either subtracting or adding somewhere between -.25 and .25.
The problem I’ve run in to is that this can, in some cases, give vertices a color value outside of the 0-1 range which does odd things in our engine.
My question is, can you clamp these numbers after (and this is important) the color set is already created? I know you can clamp a color set when its created and I’ve tried all the variants of that to no avail. As far as I can tell, once you’ve created a color set you can’t clamp it. I’m hoping somebody here can prove me wrong.
For the already-created vertex colors, couldn’t you just run through the verts, checking for out-of-bounds colors, and clamping/modifying accordingly? eg. vertex #2 is R1.2 G1.1 B1.05, you could reduce the rgb by max(r, max(g, b)) uniformly.
I’m not a Maya user, but I imagine this sounds logical.
When a Vertex Color Set is created you can tell Maya to clamp the values between 0-1, otherwise, when you add or subtract from the current value you can manually clamp the result in your script.