How to upload cloth to Sketchfab fom Blender (Tutorial)

I have been really digging Ian Hubert’s Lazy Tutorial series. I made my Nightmare Man but had a heck of a time trying to get it up to Sketchfab so I’m writing the guide I wish had before. If you want to follow along, here’s a link to his tutorial. Useful for Nightmare Men, or non Nightmare Men related projects. Make Nightmare Men in Blender - Lazy Tutorials
Here is my final result.

After you’ve created your cloth and are happy with the sim result, make sure to bake it so that it doesn’t get changed accidentally. Now comes the tricky part.

Sketchfab does not support cloth natively. To get around this, the position of each vertex at each frame of our simulation must be saved. Sketchfab will then play those positions back in the viewer. You might see this referred to elsewhere as morph targets, morphs, shape interpolation or blend shapes. In the context of file formats, it might be referred to as point clouds or vertex deformation data. In Blender, the internal version of this is called Shape Keys. Whatever the terminology, the concept of saving and interpolating between vertex positions is the same.

There are several ways to do this in Blender. Any method you choose, the following caveats apply.

The size of the file will increase dramatically depending on the amount of frames in your animation and the number of vertices in your simulated cloth. It is easy to go over the 50MB limit for non-pro users. Each frame of animation will increase the total file size linearly, where 2x the number of frames means 2x the file size. Subdivision will increase the face count by 4, thus increasing the size by roughly 4x, for each level.
Once your cloth has been turned into vertex data, editing the properties of the cloth sim will have no effect unless you re-bake everything. The two methods described below also have their own specific caveats.

A slight aside here. The real reason I spent hours on this project is that a dense mesh looks good for cloth. However, it requires longer simulation times, may be prone to unwanted artifacts and is more difficult to edit. If you simulate your cloth using fewer polygons, you can add a subdivision modifier below the cloth sim in the modifier stack to get a smoother look without extra simulation time. Unfortunately, you can’t just apply the modifier as it will add vertices to the mesh that will not be animated by the baked data. Exporting to Alembic or .mdd works because the modifier stack is applied in the correct order for each frame.

ClothModifierStack
Here’s my modifier stack for this mesh before exporting.

The first way to upload your cloth sim to Sketchfab is by using the Alembic format.
Benefits
The format is open source, included in base Blender(doesn’t require an add-on) and is well supported by Sketchfab. This method does a good job of creating a 1-1 replica of what you see in the viewport even when dealing with multiple modifiers. The exported model is saved and will not be accidentally modified.
Downsides
There is no way to pack the textures into the exported file for easier uploading. It requires you to save files outside of your .blend, cluttering your working folders. You must upload to Sketchfab using the web interface instead of the exporter add-on. You will have to manually re-apply the textures and material settings once you upload to Sketchfab. If you have a scene with a lot of materials, this may be a non-starter. This method may be best for simpler scenes or single objects.

Step-by-step


Alembic support is built in. No add-ons to enable!


You can choose to export everything, or just selected models. Make sure Subdivisions-Apply is checked if you’re using them.


Packing everything into a zip file is the easiest way to bring the textures into Sketchfab


Alembic files have no material data, so you’ll have to pack your textures into a zip and manually re-apply them.

An alternative method uses the .MDD(Lightwave) file format.
Benefits
You can use the Blender Sketchfab Exporter add-on to upload your file directly to Sketchfab. You also can pack all of your textures into the .blend file and the materials will automatically populate and settings will be preserved. It will give you a mesh with a Shape Key for each frame which will allow you to modify the animation timing and start/stop points in the dopesheet.
Downsides
It takes more setup and requires that you remove or apply the modifiers, so you will have to make a copy of your object if you want to edit the original settings. This will clutter up your scene and potentially cause you to edit or upload the incorrect mesh. It requires that you activate the import-export .mdd add-on. I have nothing against add-ons but I worry about being dependent on something that may stop receiving support. This method might be best for a scene with many objects and materials.

Step-by-step

MDDEnable
Search for and enable the add-on. It’s included in Blender.


Make sure to select your model before clicking export. Also make sure to set the start and end frames

You will have to apply the modifiers on your mesh before you re-import the .mdd. If you do not, you will not be able to apply subdivision after since it will have shape keys. Note that if your mesh has a different number or order of vertices the shape keys may not work as expected. The .mdd importer seems to have some magic that allows it to work with different amounts of vertices but it’s best to have identical meshes.
MDDApplyModifier1
Make sure the animation is at the starting frame before applying.


Make sure your mesh is selected before importing.


If you want to save a copy of your original mesh for later editing simply make a duplicate and hide the original. Then follow the steps above for the duplicate.


Your mesh will now have a bunch of keyframes and under the vertex panel it will have a bunch of shape keys. Play your animation to check if it worked.


Pack any textures to simplify uploading to Sketchfab

MDDUploadToSketchfab
Check the Selection Only checkbox to upload only what is selected.

Once your model is uploaded, it will show up in your dashboard on the Sketchfab site. The textures and material settings will all be imported automatically.

Have fun getting your cloth up and running on Sketchfab!

P.S.
There are other options for using a low poly simulation to drive a higher poly mesh, such as using the Surface Deform or Mesh Deform(only for closed shapes) modifier but I found the results to be less good for this particular project than simply adding subdivisions after the animation.
The Mesh Cache modifier allows you to use an external point cloud to drive the animation but I didn’t notice any benefit to using it and it requires more work to set up.
One option that I had high hopes for was re-importing the Alembic file. While it does give you a nice animated mesh using the Mesh Sequence Cache modifier, I could not find an easy way to turn it into Shape Keys, which means Sketchfab doesn’t recognize it as animated.
If you have any ideas for a better workflow, please let me know!

P.P.S
Thanks to this forum post about uploading cloth.
Blender to SketchFab Top Tips [Please share yours]

3 Likes