Home Technical Talk

Vertex color in Max

Any experts with this that can give me some ideas?

I haven't really touched vertex colors until now, but I'm looking at it as a way to set up geometry-based masks for this geo-mixing system we have. It's really cool, we'll be able to blend between models/anims/materials on a per-vertex level, with artists manipulating the masks.

I'm wondering if there's a way to animate the vertex colors such that I could have a gradient move across the mesh. For example... I want to have a character's hand use white vert color, and the arm use black, with a gradient falloff between them across the wrist area. So far so good, I can bake a map into vert colors, no prob.

But then I want to take this falloff and travel it up the arm in an animation, so the falloff would end up at the elbow, with the bicep verts in black and the forearm/hand verts in white. I need to see that gradient travel up the arm.

I tried stuffing the vert colors in a UV channel and moving those UVs around, but all the white/black end-verts are crammed in the corners, no way to smoothly "pull" them out to travel into the falloff zone.

The other way I thought of to control this blending thing was to use soft-selections instead (Vol. Select mod can convert a bitmap into a soft-sel). That lets me move the gradient around just my Xforming the bitmap's UVs. But then I'm kind of stuck with only one mask per mesh.

Anyhow, just fishing for ideas. Maybe somebody knows something...

Replies

  • CrazyButcher
    Offline / Send Message
    CrazyButcher polycounter lvl 20
    I had that maxscript which copies vertex color into vertex uv (for max 5.1 and up) I will have it working for animated unwrap modifier copies later this day.

    so valid source or destinations are: vertex uvw, illum, alpha, color, current unwrap modifier
  • Eric Chadwick
    Thanks. Well I can easily copy from one channel to another with the new Channel Info utility (new since r7 I think?). So it might not be worth your time.

    The weird thing is that I can animate the UV offset of vert colors, because they can be in any UV channel. But I just can't really control it easily, offset isn't enough, because of the way the verts are arranged...

    Black is UVW(0,0,0), white is (1,1,1), and the verts getting the gradient values are pinched into a thin diagonal line between the two extremes. But to get the verts to travel through the middle zone, I'd have to be able to pull them out of one corner, send them across the diagonal, then bunch them into the opposite corner.

    After sleeping on it, I think I'll have to go with soft-selections instead (unless there's some other vertex-weighting method that might fit the bill).

    Thanks again Christoph.
  • KDR_11k
    Offline / Send Message
    KDR_11k polycounter lvl 18
    Planar map from the front, scale to zero in all but one dimension, make sure it's centered, shear by 45° in each flat dimension.
  • Eric Chadwick
    Hmm, cool idea, but...

    That gets me an even gradient from one end of the mesh to the other, but doesn't let me do a tight grad (on the wrist for example), nor does it seem to solve the scroll-animation issue. I don't see how it's solvable at this point. But maybe I'm just misunderstanding your idea.
  • CrazyButcher
    Offline / Send Message
    CrazyButcher polycounter lvl 20
    but can you copy with animation ?
    I would alter my tool so that you can copy vertex color to unwrap modifer, and it creates proper animation keys in the unwrap modifer.

    so you could paint a frame vertex colors, copy to unwrap at frame 0, then paint again, copy at another timepoint... probably below efficiency optimum, but would allow you to have animated uvs that you could set by painting

    give me a "go" or "no go" and I will change the script
  • Eric Chadwick
    I'm going to have to say "no go." It seems too cumbersome. I'm setting up a system for other artists to use, once the toolset is up and running. Sounds like too many hoops to jump through.

    We have a couple basic requirements...

    First off, the masks have to be baked into vertex-weight values. Requirement of current hdwr.

    Second, the masks have to be complimentary. In the end the masks are summed together, so every vertex's weights must sum to 1 (otherwise we get over- or under-contribution).

    To control the summing, I'm trying to keep the masks bitmap-based, since Photoshop (and its ilk) are the kings of mask control. Then I can use some method in Max to convert the bitmaps into vert weights.

    If using vertex color, I can bake diffuse into it using the Vertex Paint mod. So I could animate the diffuse's UVs to scroll the gradient, then bake each "frame" as a new UV set, then combine those with your tool into a single animated UV set. Sounds slow, and unforgiving, if I later want to change the gradient somehow.

    But maybe there's a way there...
  • CrazyButcher
    Offline / Send Message
    CrazyButcher polycounter lvl 20
    yeah it would be better if there was a direct "animated bake",
    like sampling the texturedata at given timesteps, like every n key. and store that in animated uvw.

  • Eric Chadwick
    OK, I'm going to go with Vol. Select modifiers, since I can easily animate the vert weights by scrolling bitmap UVs, totally wysiwyg.

    Thanks both of you for swinging around with me on this one.
  • CrazyButcher
    Offline / Send Message
    CrazyButcher polycounter lvl 20
    okay, but I had a look at max6's applyvc utility, and it comes with maxscript support (max5's doesnt unfortunately). so one could automate this process: bake vc with assignvc modifier, copy vc to uvw which is animated, remove assignvc modifier.
    you could enter how many frames you want and it will divide time accordingly and process in timesteps doing the above... of course it would be much faster in c++, but could work as maxscript solution, too.
Sign In or Register to comment.