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, check the bottom of the post for link to his video. It’s useful for Nightmare Men, or non Nightmare Men related projects.
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 is the same; saving and interpolating between vertex positions.
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
The real reason I spent hours on this project is that I wanted a dense mesh for this cloth. However, the denser mesh requires longer simulation times, is 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. Using the methods described below, you can work around this because the modifier stack is applied in the correct order for each frame.
The first way to upload your cloth sim to Sketchfab is by using the Alembic format.
- 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.
- 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.
An alternative method using the .MDD(Lightwave) file format has a slightly different set of pros and cons.
- 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.
- 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.
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: 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.
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!
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!
Thanks to this forum post about uploading cloth.
Blender to SketchFab Top Tips [Please share yours]
Ian Hubert’s Nightmare Men tutorial is great