Hey there everyone! This is Simon Kratz with another particle baking tutorial, designed for a workflow from Maya to Sketchfab. You can also find the Blender and 3ds Max edition on the Sketchfab blog, in case you missed it 🙂
My approach for this particle baking tutorial is still a bit experimental. If you have any suggestions about how to optimise my workflow, please add your thoughts in the comments and I’ll update this tutorial accordingly 🙂
As an example project for this tutorial I created a spinning, hot roundabout of doom, the Infernado!
For this tutorial you don’t really need any special geometry, apart from one mesh that you’ll be using as a particle mesh. In my case this was a mesh with three quads placed perpendicularly into each other. I also had the Infernado base mesh but that’s not needed since it was only important for this specific type of effect I wanted to create.
Similarly to my last tutorial for Blender we’ll use a script to bake our particle’s position, rotation and scale into keyframes to get our particle effect on Sketchfab.
Please keep in mind, any particle-specific parameters that differ from regular mesh objects (like “color over lifetime”) will be very difficult to get into another software since they are not meant to be exported (.fbx and most other currently available file formats don’t even save those when exporting your file). Also, don’t go too crazy, we’re working in real-time and each particle will be a separate object, so we’ll be baking probably ~1000 animated objects. Try to stick to this number to keep your model running smoothly on older hardware and mobile. The Blender tutorial covers a bit more theory so if you’re interested in certain features and limitations feel free to check it out to understand the basic concepts behind the baking workflow.
Creating your particle effect
I started with setting my UI in Maya to FX in the top-left dropdown to get access to all the nice particle effect tools.
Then I added a basic emitter, found under nParticles -> Create Emitter. This is a just a single coordinate point which will just start spawning and moving particles away from the source.
The emitter itself has a couple of parameters like lifetime and number of particles to emit but if you want to change the motion of the particles it’s probably the best way to do this using force fields (found in the Fields/Solvers dropdown).
For my Infernado I used four different fields:
- a gravity field with negative Y-direction to push the particles upwards
- a vortex field to push particles outwards over lifetime and have them spin like in a .. well.. vortex
- a radial field placed above the Infernado’s main mesh to dampen the effect of the vortex a bit and drag the particles inward. The vortex just felt too strong during the particle’s end of lifetime.
- last but not least a turbulence field to break up repetitiveness in the overall motion. This is rather important to have the effect feel more natural and chaotic.
This is just what I used though. Feel free to use any combination of force fields to shape your effect 🙂
Baking your particles
While Blender seems a bit more community-driven when it comes to scripting I had a bit of a hard time finding the right solution for the Maya workflow. After a while I found a script called “Convert Instancer to Geometry #2”. You can get it for free from the author here.
As the name suggests, to bake your particles they have to be setup with an Instancer object to be baked. With your particle object selected, create an Instancer from the nParticles dropdown and assign a mesh that should be used as instance.
Your particle mesh should now have replaced the tiny particle dots that Maya displays by default.
After installing the script into the Maya scripts folder, execute the following command in the python command line.:
from ark_instToGeo import *; ark_instToGeo()
It’s possible the command line shows “MEL” instead of “Python”. In that case just click on the letters once to switch to Python. Since we’re using a Python script it only works when the command line is set to Python. In case you can’t see a command line window at all, enable it by right-clicking on one of the handles of any UI element.
You should now see a newly opened window to control some of the available baking options:
Apart from selecting the frame range for your baked animation you can also select what type of object Maya generates for the particles. Be aware that baking as Instance takes quite a lot of performance and time. My computer once froze when I overdid it with particle count.
If you really need a lot of particles as Instances I suggest you split them into multiple particle systems to bake them in smaller clusters for performance reasons.
Aaaaand it’s done!
After waiting for a bit (depending on the mode and range you choose) you should see your baked particles in your Maya scene. Now all that’s left is to delete the old particle object for cleanup purposes. Be sure to save your scene in a new file if you want to keep the original. Apart from that, your scene is now ready to be uploaded.
Hope this tutorial helps to get your Maya effects exported properly.
Also feel free to tag your creations with #particles so we can get a nice selection of baked particle effects on Sketchfab! 🙂