SMF - 3D skeletal animation - New version available

TheSnidr

Heavy metal viking dentist
GMC Elder

This badass logo was made by @Chris Goodwin

Welcome to the topic about the SMF system. This system is entirely free and will always be free, and provides you with a simple tool for animating 3D models in GameMaker Studio 2. This tool is aimed at people with limited experience with animated 3D models who'd still like for their 3D models to move.
It consists of two parts:
1. The SMF model tool

The SMF model tool is the core of the SMF system. It lets you import .obj model created in a model editor, and exports to the custom .smf format.
2. The SMF import scripts
The SMF import scripts will let you import, animate and draw .smf models. Animations can be changed in real time.


Links
HTML5 demo on itch.io
Download documentation PDF
Download SMF version 0.9.9

Changelog v0.99
The scope of the SMF system has changed drastically for the latest version. It previously came with a collision system, multiple heavy shaders, a level editor and much more. All this has been removed, leaving the Model Tool as a pure animation tool. This makes upkeep a lot easier, since there aren't many systems that all depend on each other in the same project. It also makes it easier to actually import and use the system in a project, especially if you only need parts of the system. The collision system is available as its own download (though the current Marketplace version has an error and asset uploading is currently not working, so I can't fix it).
So, that's what has been removed. But what has otherwise changed?
Well! There are a lot of improvements across the board. The entire animation system has been rewritten into a more robust set of scripts. For those of you who are familiar with the old versions of the tool, I recommend trying to learn how to use the new one from scratch. There are so many changes, and I haven't kept track of them all, but here's a small list anyway:
  • The new tool still uses the same format as the previous tool, but the materials and level information will be removed once the model is imported
  • Undo and redo works, both with buttons and with Ctrl+Z and Ctrl+Y
  • Projects are autosaved to a separate folder when something changes or when you close the tool, so that you won't lose all your work if the power goes out or the program chashes
  • Skinning has been completely revamped. You can now paint bone influence directly to a model in perspective view, instead of having to select vertices and assign bones.
  • The animation tools are vastly improved. Even though there are fewer of them, the tools that are there are more versatile and allow for more operations than ever before. "Move node IK" will for example either let you move a detached node, drag a bone, or perform inverse kinematics on bones whose parents are also bones.
A small gif showing how vertex painting works (and no, it makes no sense for the arm bone to influence the torso and face, it's just for demonstration!!)

Here's a gif showing what happens if you lock all the feet of a spider in place, and try to move its body:

Moving nodes using inverse kinematics is easier than ever:

Inverse kinematics can be used to, for example, move the feet of a spider in real time:


Both the tool and the formats are still in progress, and there may be changes to the format while it's still being worked on.
I'd love feedback! What do you think of the tool? What do you think about the difficulty level? Is there anything you'd like me to improve? Tell me here in the topic!

Old download links:
Download SMF version 0.9.751
Version 0.8.6 (Compatible with GMS 1.4)

The collision system
When creating a colision buffer in the SMF model tool, the model is split into a structure called an octree. Splitting up the model is necessary to perform efficient collision calculations, since you only really need to check the nearest geometry. An octree splits the model up based on geometric density, and so the size of the subdivisions can change throughout the model. Performing sphere-model collision checks is a fast and simple approximation for most applications, and the system also allows for ray casting onto the level model for more advanced collisions. Sphere-model collisions are currently the only available collision check/response.
Here's an example of what a collision buffer looks like:


The animation system
The animation system is very fast when used correctly! Bones are stored as dual quaternions, which are efficient and less memory-consuming than matrices, but are limited in that they don't allow scaling. Interpolating between frames can be done with linear interpolation or quadratic interpolation. Animations can be changed in real time, as you can see below. You can pre-calculate your animations for even faster processing, but then you can't modify them in real time.

Both the tool and the formats are still in progress, and there may be changes to the format while it's still being worked on.
I'd love feedback! What do you think of the tool? What do you think about the difficulty level? Is there anything you'd like me to improve? Tell me here in the topic!


Gallery:
 
Last edited:

GMWolf

aka fel666
Oh, very cool!
I remember doing things in a grid like you described before, and did think of using octrees but never got to it... Very cool that you did.
I did also make a quadtree system to improve sprite collision, but turns out its slower than the built in system if you want any accuracy.

Aside from that, I haven't really seen any use of octrees in GM, for much at all, actually.

I'll be more than happy to look at your code!
 

Bingdom

Googledom
Runs really well on a low-end laptop. I set it to unlimited FPS and got around 120-150. Usability in performance, so far YES!

Specs:
1.5Ghz
4GB Ram
Integrated GPU

After a while, the screen would go completely blank. Could this be some sort of GPU issue?
 

TheSnidr

Heavy metal viking dentist
GMC Elder
Thanks for testing :D
After a while, the screen would go completely blank. Could this be some sort of GPU issue?
Yeah, I've run into this problem as well. It only happens when using the YYC, and seems to be because the player's coordinates somehow become NaN (which I assume means Not a Number). I'm currently looking into this!

EDIT:
Found the problem. There was a division by 0 in the player's collision script! D: Fixed it and reuploaded :D
 
Last edited:

GMWolf

aka fel666
Very impressive performance, Got ~580 FPS on a i74710HQ @2.5GHz. Both with YYC and VM. So i presume its GPU bound! (was running on IGPU, will have to export to try on dedicated card).

having a look at the code now, will edit if i can find anything substatial.
[edit]
Well, there is a lot of code to go through, so as far as logic goes, i cant really comment.
But I notice you use a lot of buffers. Did you know arrays tend to be around 2x faster or more? even with YYC. (or at least, they where in 1.4).
So if you are up to the task, thats one way to speed things up.

Though i guess if memeory usage is important to you, then buffers are the way to go.
 
Last edited:

TheSnidr

Heavy metal viking dentist
GMC Elder
But I notice you use a lot of buffers. Did you know arrays tend to be around 2x faster or more? even with YYC. (or at least, they where in 1.4).
Whaaat, really? I've never heard about this! I thought buffers were supposed to be the most efficient way of writing and reading data. At least it gives more control over memory usage!
 

GMWolf

aka fel666
Whaaat, really? I've never heard about this! I thought buffers were supposed to be the most efficient way of writing and reading data. At least it gives more control over memory usage!
Yes, i was supprised too.
But they can be far more efficient that arrays, as you are only storing the data you need. (without all the wrapping GM does internally).
 
M

Multimagyar

Guest
Can I just stop for a moment and say that I love the art style? Love the painted textures.

I unfortunately cannot really look into the GMS2 code myself, but throw some statistics at you.

(desktop computer)
{
NVIDIA GeForce GTX 750 Ti GPU
CPU Intel I5-4570 CPU 3.20GHz
Windows 10 64-bit
6gb RAM
{
unleashed FPS 1905
real FPS 2052

Limited FPS 30
Real FPS 2103
}
}
(Laptop)
{
AMD Radeon HD 8670M
4 gb memory
2.30GHZ intel i5 CPU
Windows 10 64-bit
{
Unleashed FPS 173
Real FPS 612

Limited FPS 23
Real FPS 723
}
}
 

Apapappa

Member
I get around 3900 fps when running unlimited.
So performance doesn't seem to be a problem here! (I'm running the executable version)

Specs:
Intel i7-6700k 4.0 GHz
Nvidia GTX1060 3GB
16GB 2133MHz RAM
 

slayer 64

Member
Looks great. Ran fine for me. I'm still using Studio 1.4 so I can't see the implementation. I bet it's really good.
 

TheSnidr

Heavy metal viking dentist
GMC Elder
Can I just stop for a moment and say that I love the art style? Love the painted textures.

I unfortunately cannot really look into the GMS2 code myself, but throw some statistics at you.

(desktop computer)
{
NVIDIA GeForce GTX 750 Ti GPU
CPU Intel I5-4570 CPU 3.20GHz
Windows 10 64-bit
6gb RAM
{
unleashed FPS 1905
real FPS 2052

Limited FPS 30
Real FPS 2103
}
}
(Laptop)
{
AMD Radeon HD 8670M
4 gb memory
2.30GHZ intel i5 CPU
Windows 10 64-bit
{
Unleashed FPS 173
Real FPS 612

Limited FPS 23
Real FPS 723
}
}
Hey, it ran at 23fps when set on 30 on my laptop too! I wonder what's causing that, when it has no problem running above 100 when the fps is unlimited..?

Looks great. Ran fine for me. I'm still using Studio 1.4 so I can't see the implementation. I bet it's really good.
Whoa, the legend himself tried it! :D Something like this is probably child's play for you
 
M

Multimagyar

Guest
interestingly yes there was no issue running higher in that case, unlimited it ran 173 fps but limited it went looooow. I was assuming it might be window's stupidity of using the integrated GPU instead of the AMD GPU.
 

Misty

Member
Alls I do is use GM Newton for everything. Downside is it only works for windows. Plus side is you can get collision detection with no lag, I assume newton has some sort of bsp octree tech inside which optimizes everything.



Whaaat, really? I've never heard about this! I thought buffers were supposed to be the most efficient way of writing and reading data. At least it gives more control over memory usage!
No buffers are the best way of reading and writing external data. Like savefiles and maps.
 
Last edited:

GMWolf

aka fel666
No buffers are the best way of reading and writing external data. Like savefiles and maps.
Yes, but not internally. I havent spent much time looking at the code, but it does look like the octree is produced at runtime. Would produce better performance by having them be arrays.
 

TheSnidr

Heavy metal viking dentist
GMC Elder
That's a good point though, saving and loading a buffer is much faster than saving and loading an array. The octree should only be created once, and the result can be saved and loaded quickly.
 

slayer 64

Member
Whoa, the legend himself tried it! :D Something like this is probably child's play for you
lol, thanks. I haven't done a whole lot with octrees. If I remember correctly, they're fastest if you only have to set them up once, but if you had some enemies running around, updating their positions means reconstructing the tree.
In other news, I morphed the level into a ball:
How did you morph the level into a ball?
Since the ball has a basic shape, I wonder if another type of structure could store the triangles instead of a rectangular octree. Something with a shape that emitted from the center of the sphere.
 
N

Never Mind

Guest
<snip>
How did you morph the level into a ball?
Since the ball has a basic shape, I wonder if another type of structure could store the triangles instead of a rectangular octree. Something with a shape that emitted from the center of the sphere.
TheSnidr is using a shader he made for that. EDIT see below
So I don't think you'd have access to the output vertex positions right? But that is a cool idea.

TheSnidr thanks for making another cool project open to us!
Oh dang.. looks like you can't import (.yyz) files in the free version of the beta.
 
Last edited by a moderator:

TheSnidr

Heavy metal viking dentist
GMC Elder
If I remember correctly, they're fastest if you only have to set them up once, but if you had some enemies running around, updating their positions means reconstructing the tree.
Oh, I don't plan on updating it in real time, right now it only stores model vertices.
How did you morph the level into a ball?
Since the ball has a basic shape, I wonder if another type of structure could store the triangles instead of a rectangular octree. Something with a shape that emitted from the center of the sphere.
I loaded the vertex coordinates as polar coordinates with the x and y values as angles and the z value as radius :D Perhaps a different structure would be more efficient for a sphere, but that's a convoluted solution to a very specific special case IMO!

TheSnidr is using a shader he made for that.
So I don't think you'd have access to the output vertex positions right? But that is a cool idea.

TheSnidr thanks for making another cool project open to us!
Oh dang.. looks like you can't import (.yyz) files in the beta.
Oh, there's no shader trickery here, it actually takes place on a sphere. Perhaps this puts things more into perspective:

You bought GMS2 just to try this? Maybe I should get paid by YYG for selling their product ;P
It should be able to load .yyz files in its current state. At least I can do that!
 
N

Never Mind

Guest
Ahh that does work differently then I thought. I should probably buy things before I talk about them hehe :rolleyes:
To answer your question, no I haven't bought GMS2 yet (ᴛʜɪɴᴋɪɴɢ ᴀʙᴏᴜᴛ ɪᴛ). I should have clarified that I was referring to the free version of the beta. Sorry about that.

Then the radial octree idea could work! But sounds like it's probably not worth the effort. ᴵ ʷᵒᶰᵈᵉʳ ʷʰᵃᵗ ᵐᵃʳᶤᵒ ᵍᵃˡᵃˣʸ ᵘˢᵉˢˑ

Sooo.. can I please use this in my own projects? I don't know whether I'll be able to contribute too much, but
 
Last edited by a moderator:

TheSnidr

Heavy metal viking dentist
GMC Elder
Feel free to use it! But keep in mind that it's far from finished, there's a reason to why I'm posting in WIP. Also, I won't provide support if you have trouble using it; it's provided as is.
 

FROGANUS

Member
Cool and interesting. Here are some play specs:

System:
windows 7 pro desktop
intel core i7 CPU 920 @2.67 GHz
18 GB ram
64 bit os
NVidia GeForce GTS 250

normal mode seems to run steady around 1200-1400 fps
subdivision mode runs around 93-98 fps

 

TheSnidr

Heavy metal viking dentist
GMC Elder
Bleh, so everything I've made since I uploaded the last example is gone after a hard drive malfunction. Luckily I uploaded this to the forums, otherwise I would have lost everything. Time to make my skeletal animation engine from scratch again I guess...
 

GMWolf

aka fel666
Bleh, so everything I've made since I uploaded the last example is gone after a hard drive malfunction. Luckily I uploaded this to the forums, otherwise I would have lost everything. Time to make my skeletal animation engine from scratch again I guess...
AAAK! So manny HD failures happening recently. I guess the good thing is now you can remake it better :)
 

TheSnidr

Heavy metal viking dentist
GMC Elder
I made a bare bones 3D skeletal animation system:

This is my first attempt at creating a walking animation! The bones are stored as dual quaternions, and the model is deformed in real time with a shader. I have no experience whatsoever with animation from before, so getting it to work is really exciting!

EDIT:
I also made my own custom rigging tool:
 
Last edited:

Zerb Games

Member
I made a bare bones 3D skeletal animation system:

This is my first attempt at creating a walking animation! The bones are stored as dual quaternions, and the model is deformed in real time with a shader. I have no experience whatsoever with animation from before, so getting it to work is really exciting!

EDIT:
I also made my own custom rigging tool:
My god. I wish I had these skills.
 

Lukan

Gay Wizard Freak
It really bothers me that you used OoT/MM Link in Wind Waker's Outset Island...
Why not cute toon Link?

I'm getting
170-225FPS
intel i3
6 gigs ram
Win10-64 Bit
intel 520HD graphics(integrated)

Runs really nice.
 

TheSnidr

Heavy metal viking dentist
GMC Elder
Oops, I better fix that! Maybe if I find a model of toon link :3
Here's another gif showing off the animation editor by the way:
 

TheSnidr

Heavy metal viking dentist
GMC Elder
Nah, I don't use GMS 1.4 anymore, but here's (edit: link removed) the GMS2 source, in case you want to start using that some day!
I just added quadratic frame interpolation:

There currently is no way to manually skin a model, I haven't bothered adding it. The automatic skinning makes Link's tunic spazz out a bit because the arms are too close to the body in the model. That could be avoided by making the model in a "bind pose", ie. with arms and legs straight out.

Edit:
I've removed the download link temporarily. I plan to release the modeller as an executable, and provide the import scripts so that you can import the animations you create into your own project!
 
Last edited:

lolslayer

Member
Nah, I don't use GMS 1.4 anymore, but here's the GMS2 source, in case you want to start using that some day!
I just added quadratic frame interpolation:

There currently is no way to manually skin a model, I haven't bothered adding it. The automatic skinning makes Link's tunic spazz out a bit because the arms are too close to the body in the model. That could be avoided by making the model in a "bind pose", ie. with arms and legs straight out.
Guess I will port it over then :v
 

TheSnidr

Heavy metal viking dentist
GMC Elder
I spent today making manual skinning. The automatic skinning works by checking the distance to the nearest bones, and the closer the bone is, the more influence it has over the vertex. This is good for organic material, but terrible for rigid objects.
Here has Link been automatically skinned. Notice the wobbly shield:

By first using automatic skinning, and then manually modifying the skinned shield and sword, I can easily make the shield rigid:

Also, I've simplified the model format so that each vertex only can be influenced by two bones. It's easy to increase again, but I figured it'll be good enough, since this is a simple, bare bones animation engine anyway!
The rigging tool is almost done. When it's done I'll post it as an .exe, and upload the source to the import scripts so that people can use the animations they create!
 
Last edited:
M

Multimagyar

Guest
I was thinking. Would you be able to attach something to a given bone instead of making it part of the model?
 
T

ThunderZ

Guest
Very impressive work.

Did you think of sharing this ? free or marketplace?
 

TheSnidr

Heavy metal viking dentist
GMC Elder
I was thinking. Would you be able to attach something to a given bone instead of making it part of the model?
Good idea! I won't add this to the rigging tool, but I'll make it possible to attach rigid objects to single bones through code.

ThunderZ: Yeah, the import scripts will be open source! I haven't decided what I want to do with the rigging tool itself, but I might just post the .exe
 
M

Multimagyar

Guest
Good idea! I won't add this to the rigging tool, but I'll make it possible to attach rigid objects to single bones through code.
I actually just asked out of curiosity. But the more the merrier in abilities and features. The other thing I was thinking about if it's possible to force a direction of a bone? e.g. Making link head facing a targeted enemy at all time without it being on the timeline of the animation.
 

TheSnidr

Heavy metal viking dentist
GMC Elder
I just uploaded the rigging editor itself:
Download .exe
I'd love if you could play around with it and see if you're able to make animations! Make gifs of the animations you create! Are you able to break it? If so, I'd like to know how, so I can fix it!
I will upload the source of the import scripts soon. I also plan to make a video showing how to use the editor!
 
M

Multimagyar

Guest
okay well I tried it so I going to make an honest reply here in hope it helps you.

http://i.imgur.com/iYUU7Fj.gifv

just you so see it. cus you asked for it c:

so one thing I want to point out, is the lack of feed back. everything works as intended as I felt like but for instance when I press a button like select bone or such, the button for instance for toggling bone visibility or others goes blank. It's a more user friendly thing to have some sort of indicator that it's active/inactive

having add bone as your bone move tool is not a great way to communicate that it has multiple functionalities. The tool tips are appropriated but I did not think about it being the move tool as well till I decided to data mine the earlier version of the editor to see if it exists which I assumed it did and then I saw it was attached to the move tool. Long story sort. for the user end it's not user friendly in anyway

Same goes in the skinning tool. having auto skinning is pretty great having the ability to select and attach weight to a bone is also great. but I feel like the lack of weight value communication is kind of an issue. when it threw me the prompt about "how big the auto sampling should be" by default it was 2... but how big is 2? how is my model being effected with it what does a single bone effect? which vertices and how much?

the animation editor is straight forward. I have no much to add to that.

Some suggestion I give here if you accept it accept it if not so be it. don't mind.

-the weighting issue can be easily solved by representing the weights with colours (blue being weak red being strong) and only to the bone being selected. could help with visualization a lot.
-it would be nice if you could rotate some bones around world space directions instead of the previous bone's rotation. would open some possibilities up. (scaling and moving bones too but different story)
-I would suggest a ball like paint tool for weights maybe with different paint weight. certainly would be slightly easier than having to select specific points. tho it might come with some collision detection to handle it in 3D for instance.

Other than that I have to say It's pretty great for what it is. It is certainly a great step forward for this community for some more advanced technique in 3D (even if in a 2D engine) and seems way better than the Manta Games bone animation or mine.
I hope these help you in anyway. (fortunately or unfortunately your choice, I can't report direct breaking)
 

TheSnidr

Heavy metal viking dentist
GMC Elder
Thank you so much for the comprehensive review of the tool! Feedback like this is exactly what I need. I completely agree with everything, though I think the skinning paint tool will be a bit overkill in terms of amount of work to get it working! But it's a good idea, *maybe* it'll get added later. I like the idea of colouring the vertices to show bone weights. Right now, bone weights aren't visible before you see how the animation affects the model.
I'll get right to work on improving it, thanks for the feedback!

EDIT:
Regarding the autoskin function, it checks the distance between the vertex and the bone, and weights the vertex accordingly. Raising the distance up to a power lets you define the joints more clearly, as the vertices get weighted more heavily towards the nearest bone and less to the second nearest. Here's a demonstration:
First power:

Second power:

Third power:
 
Last edited:

TheSnidr

Heavy metal viking dentist
GMC Elder

I've uploaded a demo on how to use the animations the rigging tool outputs!
Download the rigging tool
Download animation example source
Download animation example .exe

Multimagyar:
I've edited the tool quite a bit, it should give a bit more feedback now! You can now select bones to see which vertices it has influence over, and the tool buttons are "sticky" so that they always show which tool is currently selected. I haven't added world space rotations yet, though I might later. Next thing to add is the possibility to force the direction of a bone through code!
 
  • Like
Reactions: Xor

GMWolf

aka fel666
This is very, very cool!
Would you consider making exporters for existing tools like blender?
Is this an "open" format you encourage us all to use and modify?
 
M

Multimagyar

Guest
Alright, this time around I managed to break it but I might have done it more than one ways I think .-.

http://i.imgur.com/Fw2dyGj.png

first of my problems is an actually breaking one. I attempted to load a bmp picture for a model it ended up giving me an error message for it.

The second one was a minor one. on the left side if you take close attention to the buttons. I had quite a time to take that image. you can for some reason confuse the software if you select one button with mouse and select another option by keys.

The third is... honestly? you tell me because I have no clue. The auto binding liked the left leg too much and bind most of the body to it. I going to assume you working with quite larger models than I do (personal preference to keep the model small relatively even if the original was not mine) about 30 in height 24 in length and 10 in width. in rest pose (hands down) make it 30 height 8 ish length and 10 width. Can this cause any sort of issue?

The user interface is much more friendlier now btw so is the display of the weights. I appreciate that.

A bit to the formats:

I EXTREMELY appreciate the fact that the skinned model and the animations for it is not stored in the same file. Being able to expand a model's animation list without touching the rest is always nice.
Wolf link example seemed to run relatively well. 400 fps unleashed tho the real_fps still rolling around about 200-400 locked/unlocked.
updating the model every 2nd frame for example did make the unleashed fps go till 600ish (+ - 50)
with 60 fps locked updating every 2nd frame it does still run pretty smooth so over all. yeah it's a great work so far and I personally love it.
 

TheSnidr

Heavy metal viking dentist
GMC Elder
Fel666: The import scripts are open source, so is the collision engine! The editor itself will stay closed source, at least for a little while. The goal for this tool is to provide a simple way to create animations specifically for gamemaker!

Multimagyar: Oops, I assumed GM could import .bmp files, apparently it can not! I've removed the option. The sticky keys issue was an easy fix, should be fixed in the next version. I'm really wondering how you managed to mess your model up that badly though o.o What did you do? xD Could you upload the model so that I can try? Numbers are stored as double precision floats, so there should be no precision errors within the range they can cover!
 

TheSnidr

Heavy metal viking dentist
GMC Elder
sure feel free to have a fiddle
https://www.dropbox.com/s/i7uzf0vj4txtcqo/Angela_cross.rar?dl=0

as for the BMP I think it was in GM7-8 when it allowed it maybe. now as I recall even the manual says something like png, gif and jpg/jpeg is allowed to be loaded.

Also I dunno what I did. I pressed autoskin model and she went drunk ;~;
Ah, found the cause. It's a bit complicated actually, but it was caused by a tiny typo. Autoskinning weighs vertices based on not only their distance from the bones, but also on whether or not the normal faces towards or away from the bone. I figured that adding this check would make it more likely that vertices in one foot aren't influenced by the bones in the other foot. A multiplum of the dot product between the triangle normal and the unit direction vector from bone to vertex is added to the distance calculation.
Now, when you rotate a model in rigging mode, it modifies the buffer right then and there, which is why rotating large models is so slow (I will fix this later). But when rotating, I accidentally overwrote the triangle normals with the vertex position, leading to catastrophal results when getting the dot product when autoskinning :p
The problem's been fixed in this tiiiiny update.
 
M

Multimagyar

Guest
right. seems to work fine now. I'll still want to look into it later if I can use the format I made for myself and pipeline it into this so I can use the already skinned version.... attaching the bones is a different question. I'll look into that myself too. other than that, yay it works! I'll fiddle with it more tomorrow.

Edit.: I realized something while fiddling today.
-Would be nice to have control or something to select multiple points without deselecting previous points on the model for weighting. (and deselecting too)

-You can't delete the first frame. which by default fine, so be it, but for instance what if I want the 2nd frame to become the very first frame? a copy frame or delete frame -> 2nd becomes 1st would be a good idea to implement maybe.

-an in between keyframe would also be useful. Most animators do the "end" positions of some animation and refine the in between frames in 2D it's usually like adding a frame between two frames and get the in between frame by drawing between the lines. in 3D it can be nicely used to fix issues like the legs and such after you have the middle positions.
 
Last edited by a moderator:
Top