Home Unity

Vertex color based on displacement

polycounter lvl 20
Offline / Send Message
MikeF polycounter lvl 20
So i'm doing some experiments in muscle simulation and one feature i'd like to have included (mainly for debugging) would be to see how much displacement is occurring based on vertex color

and example would be:
flex bicep, the peak of the bicep at its most flexed position would be bright yellow, and falloff to a dark red

something like this:
http://vimeo.com/19604678

I'm thinking something shader based, but perhaps there's a more programmatic approach if anyone has any ideas on where to start here.

Replies

  • Lamont
    Offline / Send Message
    Lamont polycounter lvl 16
    Hmm, thinking... this would be shader based.

    How is your rig set up? And does it work in Unity already?
  • Farfarer
    Well if you're doing muscle simulation, I imagine it's using morph targets of some kind?

    You can easily calculate the length of displacement from original to morphed position and pass that in to the vertex colour of the mesh (at the same time you're putting your morphs in).
  • MikeF
    Offline / Send Message
    MikeF polycounter lvl 20
    sorry guys, totally forgot i made this thread.
    rig is functional in unity, its a mix of joints and blend shapes.
    two animations control the deformation, one for bending at the elbow, and another to control morphing. Both animations are synced to run on a simple gui slider that samples them.

    Not quite sure how i'd go about transferring the displacement information into vertex coulor though
Sign In or Register to comment.