[Maya/Shader Node] Calcute mesh compress and stretch


#1

Hi all, I am working on a shader node which has a function to convert mesh compression to visible color, I met a problem during get the rest position of each vertex during deformation, for example, if I want to get the deformation info for a single triangle on a head-like polymesh, I need to have the current shape and the origianl shape (shape means three vertices positons) for this triangle, but through shader input, I can easily get the current world positon of each vertex, but I have no idea about getting the vertex position without deform or saying the original positon of this vertex, so thank you for your kind reply!

PS : I use C++ API and Maya 2017


#2

wont help with your question but SouP does have a node like this…

scroll down to the tension map…
http://soup-dev.com/examples.html


#3

Thanks man, I will take a look!


#4

I think I might try it like this

  1. get the original shape by traversing the graph upstream from the final mesh

  2. calculate the face area for each original face and cache it

  3. calculate the on-the-fly face are for each face as well

  4. Bake the ratio of areas into a new UV channel. You could try to do the ratio of U extents and V extents as separate colors, but I’d try the basic one first. Each face’s UVs should be discontinuous (ie, no shared UVs at vertices).

  5. Your shader just converts the special UV channel into pseudocolor to display the squash ratio


#5

Thanks a lot! I will try it.