"Save/Read Mesh" function for blend cache use?


#1

Hello all,
I’m new to Syflex and have been learning how to tweak simulations to acheive more desirable results. Lately I have been experimenting with the Blend Cache functionality and have been unable to figure out how to implement the Save/Read Mesh function. The doc states:

“If you want a simulation to end on a specific shape, you can model this shape, save it in a cache file. Then use a blend cache node to blend the simulation with this shape.”

Sounds great, however I have yet to make this work. Without a cache for every corresponding frame of this saved mesh to blend with the other cache(s) in the SyCache node, how is this saved mesh supposed to tweak your simulation to the desired mesh?

Thanks for any help you can give to clear up my confusion!


#2

I use blend cache alot.
I blend a little bit of one sim with alot of another, etc…

sometimes I need to add some deformer to the result of a blendCache node mesh
at this point the blendCache does not know that history, so I have to use syCacheWrite
to save the the mesh with history to a syflex cache,

I use syflex cache outside of maya , so I need to bake out the cloth mesh with history

then of course I could use that cache again with another blend cache node and mimic a syCloth mesh verts to parts of the blendcache.

here is a mel blurb that is part of my syflexBake script

string $listSyCacheNodes[]= `ls -typ syCache`;
for ($frame = ($start); $frame <= ($end + 1); $frame++){
    
    $sy_timer = `timerX`;
    currentTime -e $frame;

    for($solver in $listSyCacheNodes){
    
    //hack to get the right shape name
        string $buffer[];
        tokenize $solver "_" $buffer;
        string $top;
        if(1== `size($buffer)`){
        $top=$buffer[0];
        $shape= ($buffer[0]+"Shape");
        }
        if(2== `size($buffer)`){
        $top=$buffer[1];
        $shape= ($buffer[1]+"Shape");
        }
        if(3== `size($buffer)`){
        $top=($buffer[1]+"_"+$buffer[2]);
        $shape= ($top+"Shape");
        }
    //print $shape;
    getAttr  ($shape+".boundingBoxMinX");
    string $ffs = `currentTime -q`;
    int $ss= size($ffs);
    string $pad=("000"+$ffs);
    int $s = `size($pad)`;
    string $padd =  (substring($pad,$ss,$s));
    select $top;
    string $cmd =  ("syCacheWrite \""+$top+"\" \""+$filePath+$solver+"_"+$padd+"\"");
    print ($cmd);print "

";
eval ($cmd);
select -clear;

    }        int $sy_roundTime = `timerX -st $sy_timer`;
    print ($sceneBaseName+": frame " + $frame + " took syflex " + ($sy_roundTime) + " seconds.

");
}


#3

Thanks for the reply jmartin. So using syCacheWrite to create your final, deformed blendCache result - you’re actually slipping a deformer in between the blendCache simulation and the blended mesh result? How do you manage to do that without destroying the simulation, since it would affect the vertex placement of your mesh and pretty much invalidate the cache information? I suppose that’s why you’ve crafted that slick script :slight_smile:

Can you mimic constrain a blendCache simulation, or is that not a feasible option?


#4

the deformers are after the blended result.

an example work flow is this…

run a couple of sims with different properties(no blendcaches)
gather those results into a blendcache,
maybe add a defomer or poly sculpts to tweek parts of the blendedcache meshes
syCacheWrite those blended/deformer tweeked meshes

then you could take the cache from syCacheWrite results,
feed them to a new solver/syCache in a one of the first sim files(lock the cache attr),
and use it for mimic targerts to one of the original solvers…

How do you manage to do that without destroying the simulation, since it would affect the vertex placement of your mesh and pretty much invalidate the cache information?

the above steps don’t effect vertex placement.

I’ve attached an updated syClothBacth.mel that will bake out syCache meshes with history


#5

the deformers are after the blended result.

Ah, so you are actually using your deformed result as a mimic target. I think I understand what you’re doing with syWriteCache and your blendcache simulations now - I thought you were deforming vertices frame-to-frame before it had actually written your cache(s). I really need to dig into the blendcache functionality more to arrive at tricks like you’ve developed. Very cool! :applause: Thank you for sharing your script and clearing up my confusion! Much appreciated


#6

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.