Complex UV Layout in Maya
Over the last couple of years UV layout in Maya has changed for the better. In this course we're going to be taking a look at some of those changes as we UV map an entire character
# 1 16-12-2013 , 09:45 AM
Registered User
Join Date: Dec 2013
Posts: 52

OBJ Sequance to Blendshapes

Does anyone of you know plug-ing or script that would convert OBJ sequence to blendshapes instead of importing them as separated meshes with keyed visibility ?

I have found one from Gnomon Workshop Tuts but it's a way too old and it doesn't work for 2014!

user added image


Last edited by GeorgiStamenov; 16-12-2013 at 09:48 AM.
# 2 16-12-2013 , 10:02 PM
Registered User
Join Date: Aug 2011
Location: Sliema Malta
Posts: 497
Try checking out CGMonks and their CGMToolbox. In the TDTools section there is a script that will do exactly what you are saying. Best of luck.

Attached Thumbnails
# 3 18-12-2013 , 10:02 AM
Registered User
Join Date: Dec 2013
Posts: 52
Thanks again Chavfister I will try it and let you know if it work out.

# 4 20-12-2013 , 11:29 PM
Registered User
Join Date: Aug 2011
Location: Sliema Malta
Posts: 497
Glad I could help. I use this to sort my blendshapes out of faceshift for export into cryengine for the Facial Editor. Works well.

# 5 22-12-2013 , 02:10 PM
Registered User
Join Date: Dec 2013
Posts: 52
Hey Chavfister,

How it is exactly you do blendshapes from OBJ sequance? Have you ever try to do it ?
I assume it's somewhere in Deformer as you showed on the picture but I can't make it work.

Would be great if you enlighten me really fast.

# 6 23-12-2013 , 10:13 PM
Registered User
Join Date: Aug 2011
Location: Sliema Malta
Posts: 497
I wish I could show you more. Currently my family has banned me from my PC over Christmas. I will be back in full motion before New Years.

# 7 23-12-2013 , 10:23 PM
NextDesign's Avatar
Technical Director
Join Date: Feb 2004
Posts: 2,988
Why can't you just import them all, select all the imported objects, then select the main object, and create a blendshape?


Imagination is more important than knowledge.
# 8 24-12-2013 , 12:12 AM
Registered User
Join Date: Aug 2011
Location: Sliema Malta
Posts: 497
He has a vertex cache on a head out of faceshift I am assuming. It is not sep meshes.

# 9 24-12-2013 , 10:51 AM
Registered User
Join Date: Dec 2013
Posts: 52
@Chavfister - I have connected the developer of the CGM Toolbox and he said that there isn't such a function ,which would convert OBJs into blendshapes (animation).

I am trying to skip the animation part. I have just tried your advice (importing the OBJ (which are about 650) of the skin flapping) but it doesn't work because I have them as blenshapes but without them been animated to switch within every frame. So I have 650 blendshapes that I have to animated manually.

I need script or plug-in which will get the OBJ sequence and automatically converted into animated blendshapes. A script pretty similar to a script they used in Gnomon tut about trees. Where they transfer animation from tree generator to Maya by exporting OBJ sequence and convert it to animated blendshapes.

I have to do this just because the character is already animated and I have not time to go back.

My plan was:

1. Get the character model into new project and burn some caches : flapping, facial expressions from faceshit
2. After I have both caches I am applying them both on the model and paint the weight of the caches. As is follows : facial cache influence face only and flapping cache for the rest of the body. Then I burn another cache with both caches on.
3. There is the part where I have to change the true origin of cache. When I try to attach this cache to the rigged character and set " Input Mesh Attract " it kind of works. Works till the moment the character start making more dynamic movements and the ncloth does crazy. I know that I have increase sub_steps on the solver and so on but then everything becomes a way to slow to work with. Simply impossible I would say. So at the end it doesn't work!
4. Then I would go for exporting the cache to OBJ sequence and converting these OBJs to blendshapes and then transfer the blendshapes with their animation on the already rigged and animated character, because as long as I know blendshapes work with vertex values from the character mesh itself. I think this means that it doesn't matter how the body will deform the blendshapes will work.

I am attaching link to test video so you guys get to know my character better ! user added image
flapping_test_01 - YouTube

I know on this shot the flapping looks rather meaningless then needful but the real shot is CS so it will be noticeable ! I need to have this flapping effect for sure.

PS. Wire deformer wouldn't work in the dynamic manner I want it .


Merry Christmas

# 10 24-12-2013 , 11:18 AM
LauriePriest's Avatar
Moderator
Join Date: May 2003
Location: London
Posts: 1,001
What exactly are you trying to do ?
Your approach sounds strange, you have some character animation, and what are you trying to do with it ?


FX supervisor - double negative
# 11 24-12-2013 , 01:29 PM
Registered User
Join Date: Dec 2013
Posts: 52

What exactly are you trying to do ?
Your approach sounds strange, you have some character animation, and what are you trying to do with it ?

I am trying to apply flapping effect which you are seeing on the video on already rigged and animated character !

Ncloth doesn't work and I have no idea what else will work !

I thought blendshape is a good idea !

Do you have better ones ?

# 12 24-12-2013 , 08:03 PM
Registered User
Join Date: Aug 2011
Location: Sliema Malta
Posts: 497
What you need is a Mel script that will step frame, duplicate mesh, then delete history to save that mesh state. Then you can use the td tools script to apply the blend shapes to a target mesh. Not sure what the command is to step frames in Mel but it would only be at max a ten line Mel script to get this running. Laurie might have the answers on this. All else can be done with commands echoed out in the script editor and using the ls -sl and setting the current time and having it increment in a ++. I mainly program in C so it is me brainstorming outside of Mel but I believe it will be the same incremental call in Mel. Once you have it increment ing you can just run it over the scene and get your meshes and then use com toolbox for the rest. As previously mentioned I am banned from my PC during Christmas time so testing this out I unfortunately can't do or I would actually type the full script out for you. You'll figure it out. Keep at it.

# 13 26-12-2013 , 04:26 AM
NextDesign's Avatar
Technical Director
Join Date: Feb 2004
Posts: 2,988
I quickly wrote up a script that should do what you want.

Select your blendshapes, then your target object. Move to the frame that you wish the animation to begin and run the script. This will create keyframes of each blendshape activated for a single key. You will probably need to space out the keys, but it should get you 99% of the way there.

Code:
// Multiple objects to keyframed blendshape - (C) John Mather (NextDesign) 2013
// Author page: https://www.creativecrash.com/users/john-mather
// Usage: 1) Select your blendshapes, then your target object. 
//        2) Move to the frame that you wish the animation to begin and run the script.

string $sel[] = `ls -sl`;

if (size($sel) > 0)
{
    string $blendshapes[] = `blendShape -origin "local"`;
    
    string $blendshape = $blendshapes[0];
    int $nWeights = `blendShape -q -wc $blendshape`;
    string $targets[] = `blendShape -q -t $blendshape`;
    int $t = `currentTime -q`;
    
    // create a keyframe with all attributes set to 0
    setKeyframe -t $t -ott "step" $blendshape;
    
    $t++;
    
    for ($weight = 0; $weight < $nWeights; $weight++)
    {
        string $bsAttr = $blendshape + "." + $targets[$weight];
        
        if ($weight == 0)
        {
            // set the first weight's value to 1. ignore anything before.
            setKeyframe -t ($t - 1) -v 0 -ott "step" $bsAttr;
            setKeyframe -t $t -v 1 -ott "step" $bsAttr;
        }
        else
        {
            // set the next weight's value to 1, and set the previous to 0. 
            string $lastbsAttr = $blendshape + "." + $targets[$weight - 1];
            
            setKeyframe -t ($t - 1) -v 0 -ott "step" $bsAttr;
            setKeyframe -t $t -v 1 -ott "step" $bsAttr;
            
            setKeyframe -t $t -v 0 -ott "step" $lastbsAttr;
        }
        
        $t++;
    }
}
Happy holidays!


Imagination is more important than knowledge.

Last edited by NextDesign; 26-12-2013 at 05:23 AM.
Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads