Baking Particles for Sketchfab (Blender Edition)

Back to overview

Hi there everyone! My name is Simon Kratz and in this tutorial I’m going to explain my workflow of baking particle effects for use in models uploaded to Sketchfab.

If you want to add some subtle motion to your scene or enhance other animations with small environmental details like dust and small debris after an explosion, then particle effects are the way to go. You could also keyframe each object individually but if you need lots of individual elements with random motion then particle effects will be the right choice.

At our game studio I’m also the guy who is mainly responsible for the vfx of our games and even though I do most of the stuff inside Unity I needed to find a workflow to exchange particle animations between programs, just in case we need something more complex than Unity can do by itself.

In this tutorial I’m gonna cover a workflow you can use directly with Blender, I’ll derive other software specific tutorials later on. I’m sure some of you will also be able to translate the workflow into different programs by themselves 🙂

Let’s get started!

General approach

I will use Blender here with it’s integrated particle system. You can use any software to your liking since most particle systems share similar functionality. Just keep in mind this tutorial will cover the Blender workflow so things may be different for your case. But as long as you keep in mind we will export the final effect as an animated fbx you should be fine. It helps knowing fbx functionality and Sketchfab’s feature support to get an idea of what can be exported.

As an example:

  • You want each of your particles to be attracted to a single point inside your scene?
    Nice! That’s basically just a position animation, go ahead and do it!
  • You want your particles to change color over lifetime?
    This is a common particle system feature. But I’m afraid there is currently no way to this in an fbx file (or any other file format I know of).

Creating your particle effect

For my example project I just set up a basic shape in Blender to define an Emission shape. Which shape to choose depends on the effect you would like to achieve. After setting up your basic shape add a Particle System component in the respective tab (the one with four fancy yellow sparkles).

image01

I made some changes to the emitter but much of the motion was added later using Force Field objects. Again, all of the settings depend on the effect you’re going for and it needs some experience to get a grip of everything. But don’t let this discourage you if you’re just starting 🙂

You should already be seeing some motion now if you hit the play button. Most particle systems are also directly linked to your software’s physics simulation system. So if you want to incorporate your particles into a larger physics based animation that’s no problem at all.

In this case I set up a couple of Force Fields (found in the Shift + A menu) and blended their contribution to the final effect using their parameters. You can even animate Force Fields to make your effect look more vivid.

image02

Preparing your effect for baking

Once you’re satisfied with your effect we can start baking it! Sadly Blender doesn’t have a baking solution included that keeps the animation so we’ll have to help ourselves with some preparation.

First, we won’t export plain dots as particles. We need to define an object that we’ll use as a particle mesh. If you haven’t already done so, set the rendering of your particle system to “Object” and assign one of the objects in your scene to the respective slot that appears. You should see the final mesh for your particles inside your scene view now.

image00

You can still transform your object or tweak the animation to your liking.

Baking your particles

Once everything is perfect we’ll need some help from Python 😉 Even though Blender itself can’t bake the particles the logic to do so is scriptable. We’ll use a script that creates a duplicate of our particle mesh for each particle and bake the position, rotation and scale each frame for each of those duplicates. I found a very helpful solution here. You can just copy paste this into Blender’s text editor.

image04

It has some handy controls in the top lines. I suggest you set KEYFRAME_VISIBILITY to False since we need all the particles to be visible to export them. Also delete lines 37, 39 and 40. This way all your particles will be visible.
Keep in mind we’re baking a lot of animated objects here to work in realtime later on. I wanted to push Sketchfab a bit and animated a thousand particles in my upper embed. It still runs perfectly fine on Desktop but a bit slow on mobile. One of my other models has 200 baked particles and it still works fine on mobile. This is just my experience and might vary depending on your polycount/number of materials/length of animation/etc.
Maybe it’s a good rule of thumbs to not go too much above 200 particles if you want to give a good user experience to the Sketchfab users on mobile. 🙂

Finally you’ll have to select two objects: first your reference object (in most cases the one you set as particle mesh earlier), and then your particle system. With both of them selected hit the “Run Script” button in Blender’s text editor and let the magic happen! It might take a while, depending on your number of particles.

Aaaaand it’s done!

You should now see many new objects in your hierarchy, one for each of your particles. Now all that’s left to do is deleting or hiding the original particle system and your reference object. You could delete/hide your physics stuff, too just to keep the exported fbx less messy.

That’s it for this lesson in particle fx for Sketchfab. I’ll try to add more specific workflows for other software later on. But I don’t know all the tools out there so if you find a workflow for your software of choice feel free to drop me a line so I’ll mention you and your solution in the next tutorial. Or maybe you’d like to write a tut about your idea yourself? 🙂

Now go ahead and create some amazing particle effects!

About the author

Bart Veldhuizen

Head of Community at Sketchfab. 3D Scanning enthusiast and Blenderhead. Running BlenderNation in my spare time.


Leave a Reply

Your email address will not be published. Required fields are marked *

  • Jakob Baldwin says:

    This is such a nice trick, will have to think of a scene to try it out with! Thanks Simon 😉

  • mind blown.
    have to try now

  • Lee says:

    awesome, I have been trying to do this in Maya since seeing your crystal valley. sadly with little success

  • Jean-Philippe Lafontaine says:

    Hi Essimoon,
    Thank you for sharing this production trick.
    Here is the result of my experiments with this integration technique.
    https://sketchfab.com/models/ef95e9162cce44f0bf0bf30781eee2c8
    :0) Jean-Philippe

  • Sam says:

    thank you for this useful way and i really like the physic section in blender i was wondering if there is another way to control opacity for unborn particles in my case am trying to export the particle system i create to Maya so i was looking for a way to convert the particle system animation into real mesh with animation curve so i can export it (i was surprised how hard it is to find a way for this simple task on the internet ! )
    it works now because of your nice trick here to Maya but the particles opacity i have no clue how to control it cause i want to export it like .abc file is it possible in the first place ?
    any help with this it will be problem solving for a lot of people who trying to integrate blender better in the classic workflows (nuke Maya ) !
    thank you

    • Simon Kratz says:

      Hi Sam, thanks and I’m glad you like it! 🙂
      Sadly I don’t know much about Maya but exporting animated opacity is actually a file format export problem. I don’t know about .abc files but afaik there is no file format able to export per-object opacity animation.
      The only (partially) exception is Autodesk FBX, which offers a “visibility” value, ranging from 0 – 1. But hardly any other program or service support that one.
      So we’ve yet to find a solution for this 😉

  • Rômulo Ferreira says:

    How can I make this work with group instead of a single object reference?

  • Matt says:

    Thanks for the show-all… but- once you bake the animation, you essentially have ‘PLA’ or point-level animation- which Sketchfab does not support, no?

Related articles