Bake cloth to mesh permanently?

Can it be done?

To save on processing power and to increase realism I want to bake a setup of some curtains being affected by wind for use in the BGE.

It seems I can get by if I record certain movements with shape keys but it seems a lot of work with little point if i can bake the mesh.

Hi,

In the Collision Tab of the Cloth Panel there is a Bake button to Bake the simulation to a file. Would that work for what you need? It will bake the cloth simulation to a file.

http://wiki.blender.org/uploads/thumb/f/fa/Manual-Simulation-Cloth-CollisionBake.jpg/200px-Manual-Simulation-Cloth-CollisionBake.jpg

The Cloth wiki here.

It’s a pretty complicated process (that could be automated, I think, by an industrious BPythoneer), but it is possible to convert the baked cloth sim frames to shapekeys that can then be used without the sim info. Depending on the cloth movement, you may be able to get by with every 5th sim frame or so, with occasionally some fill-ins when the action gets more pronounced.

Let me know if that sounds like what you want and I’ll write up a procedure.

Interesting. I do know that if you export out an mdd file (File/Export/VertexKeyframe Animation) and then import that into the mesh when selected (File/Import/Load Mdd to mesh RVKs) it will automatically create a sequence of shape keyes that play back with the animation.

1 Like

Simple. Use the point cache export. :slight_smile: It works similar to the way Richard describes above for MDD.

Will the mdd export recognize and export the mesh as modified by the Cloth sim cache data? That’d be very cool, though you may end up with a shape key for every frame, which seems a bit of overkill. I know some game formats use vertex animations that can interpolate (the Unreal engine can), but I’m not that familiar with mdd except as a sort of intermediate format for getting vertex anims into Unreal levels.

EDIT____
Point cache export? Not familiar with that one. Time to visit the wiki again! :smiley:

mdd did the trick, many thanks. The point cache support looks quite interesting.

Yes it does as far as I understand how it works and yes it creates a shape key for every frame. And point cash export - Just started the Wiki! I’ll have to look at up too. :evilgrin:

I’ll have to try the mdd export trick, sounds a lot faster and more efficient than my process. Maybe fatfinger could clarify the point cache export idea – I didn’t turn anything up in a search of the wiki/Manual.

Here’s one I prepared earlier :slight_smile:

If you open the file, Plane.001 should be selected. Bake the cloth modifier. With this selected, go to File>Export>point cache 2 (*.pc2)

Choose a location and hit export. A dialogue box will pop up, accept defaults, but note, you can change how many frames it exports with the sample rate.

Go back to Plane.001 and remove the cloth modifier. Then, with Plane.001 selected (important), go to file>Import. point cache 2 (*.pc2). You can also adjust sample rate, frames etc in the import dialogue. Hit play. It should play the same as with the cloth modifier

All in all, it seems to be similar to .mdd (which I never noticed, thanks for pointing it out).

Attachments

roope1a.blend (74.8 KB)

Interesting. I only knew about .mdd because that is what LightWave uses and many other apps have developed it as an import/export. I Believe MDD stands for Motion Designer Data File or something of the sort. Motion Desinger is the former name of the dynamics engine in LW.

And as it turns out that is exactly what Point Cashe 2 is for 3DMax. Thread here. with a link to the script.

Point Cache is a simple vertex animation format, that’s used frequently in 3DS Max, and I think it’s used in Maya too. It’s a way of baking animation to a file, in the form of vertex locations, that can then be later streamed off disk, that can help not only for things like speeding up complex rig deformation playback, but also for i/o of animation data.

But I don’t see Point Cashe 2 in my export. I guess it is an external script then?

In any case, I suppose it is just a matter or preference sinse both are basically the same thing only for different apps.

Learned something else cool today!

I was familiar with .mdd as an export for Quake (iirc), but it was also handy as a way to get vertex animations from gmax or Maya PLE to the Unreal engine, using a little 3D app called Milkshape as a translator. Game engine pipelines can be fun!

Yeah. Have you heard of point oven? It uses mdd. too I think.

I found the thread about broken’s pc2 exporter, looks very useful for straight vertex-level animation export and a way to put the Cloth sim into a permanent and un-editable form, but I used the shapekeys approach specifically because they are editable – I needed to correct some major collision errors in my cloth sim work, way beyond what the sim’s tools could provide for. So the .mdd approach looks more promising for my purposes, though removing unneeded shapekeys may be a time-eater, depends on whether they are keyed on import.

Thanks for all the good info, nice to have options!

Wow someone liked a post of mine in this thread. It should be noted. This data is way old.

There are much more modern workflows to cache point animation now in Blender.

Have a look in the current manual.

And here is a video:

Ahah yeah, your post about mdd export just help me to transfer shapekeys from one mesh (using cloth modifier) to another (which have to be exported in glTF for a webGL application, and I’m still on 2.79b for production for now). Internet informations never died!

About the pc2 export addon, it doesn’t allow import, unlike in 2008.

1 Like

Iol… Well alright then. Glad to be of help a decade later.:blush:

Getting old…

1 Like

Is there a way to turn the baked object into a permanently affected object? For example, I’m looking to simulate a hanging shade sail but I need to be able to move it around and scale it after I have created the natural ‘sag’ it needs. I set up some pin vertex groups and now I just need all the cloth data to go away and leave me a nice sagging cloth-like mesh. Any ideas?
Thanks

You can apply the cloth modifier - at the desired frame. Or export it to a file format such as .obj with apply modifiers selected. From the desired frame or all frames as separate objects with Animation selected on the export tab.

You can also save the cache to a file format with the mesh cache modifier. Remove the cloth modifier and load the cache. I believe this gives the option to move and scale the object without dynamics active.

Additionally you can apply the modifier on a frame and then add dynamics to it again. Lets say if you want to have further dynamics on it while in that new shape. And this can be also done using the Mesh Deform modifier to build a cage around it.

All kiids of tricks depending on your need.

Wow thanks for the tips!
So I actually didn’t even know about the cloth modifier. I went and applied physics to my objects making them behave like cloth. What I needed was a piece of fabric (Think thick canvas) that looked like it sagged in the middle. The physics gave me this affect but way too much. So I wanted to scale the ‘sagged’ cloth along the z axis to lessen the affect but obviously it didn’t work since the physics were already applied.


(Before flipping normals)

I eventually got the affect I was looking for by increasing the tension resistance and lowering the weight of the object, and simply rendering at the frame I wanted.

Does the cloth modifier behave similarly to the physics simulation? Is it easier to work with? Right now I’m having some trouble with the normals on my mesh. I tried switching them and it was a disaster.


(flipped normals)

If I use the modifier instead of the simulator would this fix the problem? I’m going for what it looks like in my viewport.

It looks like a wreck when I render but it looks so nice in my viewport. Any suggestions?