Animating Voxels and Sketchfab Stop Motion

Back to overview

We’re building a new feature called ‘stop motion animation’. You can use it to upload multiple models at once and then control when to display them with a simple text file. It’s still early days and the feature is likely to evolve – if that happens we’ll keep it backward compatible and make sure your existing models don’t break.

Animators are already having a lot of fun with it and we’d like you to try it out too, so we’ve found Christoph Schoch (who is part of our Sketchfab Master program) willing to explain how to create your own with MagicaVoxel.

Hey guys! With the introduction of Sketchfab’s new stop motion feature I thought I’d talk about creating voxel animations using a sprite-like method. In the past I’ve seen a lot of voxel animations using regular rigs; letting the voxels float anywhere in space. Whilst this does give a nice look I thought it would be fun to have animations that are constrained to the grid. Much like classic pixel animations. To do this I used the voxel tool called MagicaVoxel.

image01

In this demonstration I’m going to show one of the hero characters for a game I’m working on with Harold Mintah of Mintah Games called VQuest.

This is a walk cycle so to get an understanding of the frames that need to be created here’s an image of a generic walk cycle.

With regular 3d animation I would normally use these as key poses and create inbetweens but to get a nice retro or pixel-like look we will only need to create one voxel model for each pose. Another important thing to consider is that there isn’t a lot of resolution to work with so the motions will have to be simple and fairly exaggerated to read well. Here’s a quick look of the side view of the animation to get an idea of how I emphasized each frame of the animation (the images are captured from Maya since it was the easiest way to get a perfect orthographic with a stroke)

image03

Matching the frames of a basic walk cycle is pretty straightforward but there are a few points I want to make. The first is that I was willing to let the legs shrink and extend. This was due to the lack of resolution. If I kept the legs the same length all the time the poses would be hard to read. When in motion the leg extension isn’t that noticeable in my opinion (although now that I pointed it out, it probably is). The other thing to note is that I tried to include the principles of animation where I could. The biggest thing for me was overlapping action. One example is with the hand. When it reaches the peak point (far left or right) it stays there for two frames to give a slight delay between the arm swings. This gives a bit of of an overlap impression where the legs and torso move before the arms that follow slightly after.

So that’s it. Pretty simple. The next question to tackle though is previewing. Unfortunately, as far as I know, there isn’t a voxel tool which will simply play through multiple voxel (model) files. What I did was simply name them in a way that would make them show up in order within Magica Voxel. For instance walk1, walk2, walk3, etc. Then I simply clicked through them quickly for a basic preview. In this case it worked well enough for me. If I wanted to view from a different angle I would have to rotate all the model files since the camera snaps to a default position when flipping between frames.

image04

Once I felt comfortable with the motion I threw it in Maya for a more accurate look. I used Magica Voxels’ obj export to bring it over. When I did this though I noticed that some of my models were slightly offset since the exporter seems to center the origin on the model. I manually repositioned the models.

Uploading

Now for the Sketchfab part. with my model in maya I went ahead and reported the meshes since I had them nicely lined up now. The name of the exported models is based on their names in the scene.

string $sel[] = `ls -sl -fl`;
select -clear; //-all -deselect;
//directory
string $directory = `file -q -sn`;
string $subDir = `file -q -sn -shn`;
$directory = startString($directory,(size($directory)-size($subDir)));
print $directory;
print ("exporting following files: \n");
for ($obj in $sel){
 print ($obj + "\n");
select -add $obj;
string $file = $directory+$obj+".fbx";
 file -force -options "v=0" -typ "FBX export" -pr -es $file;
 
 select - clear;
}

I put all those files into a folder and then created a txt file which looked like this:

0.2 chr_heroWalk1_Mesh.fbx
0.2 chr_heroWalk2_Mesh.fbx
0.2 chr_heroWalk3_Mesh.fbx
0.2 chr_heroWalk4_Mesh.fbx
0.2 chr_heroWalk5_Mesh.fbx
0.2 chr_heroWalk6_Mesh.fbx
0.2 chr_heroWalk7_Mesh.fbx
0.2 chr_heroWalk8_Mesh.fbx

The number represents the duration (in seconds) of each frame. Pretty simple right?

Once the txt file was complete I renamed the file. I changed .txt to .timeframe. Make sure the file is called sketchfab.timeframe. Lastly, I selected all the model files, textures and .timeframe file and zipped them up. The zip gets uploaded normally, like any other model and you’re good to go! Don’t forget you can also rename your animation once the model is uploaded in the animation tab.

image00

Bonus: Waterfall

For fun I want to show you all another example of voxel animation, waterfalls. This probably looks more complex than it is. When I first tried to tackle animating a waterfall I had a bunch of vertical light streaks and was thinking about animating the streaks of light in the water from the top of the waterfall to the bottom.

image07

I then did some research and realized I needed to design the waterfall a little differently by creating horizontal stripes to create a reflective look. This allowed me to simplify things immensely. Now I was able to just transition each streak to the one below it. I used only four frames of animation to make the transition. You could add more or less depending on how smooth you wanted it.

image05

Final Result

With that this tutorial is concluded. I hope it was helpful! If you have any questions don’t be afraid to leave a comment :).

Also, if you’re interested in VQuest you can find updates on Twitter or Facebook.

About the author

Christoph Schoch

I am a 3D character artist based in Toronto, Ontario. My greatest interest is to work on games. I have experience in all aspects of the game development process from programming to design. I am a member of the Sketchfab Masters program.



No Comments

    Related articles