SMF - 3D skeletal animation - New version available

JaimitoEs

Member
I have not had time to try your editor, but it shows that it is a titanic work. This is worthy of great merits. Not even a great company has been able to implement something like that in its editor. In short, you have done the work of several engineers of the time being only one person. My utmost respect and I hope you get to show the new tools of your editor, I see nothing wrong with the animation tool implemented! Consider selling the second version of your editor, I am sure that many users (including me) would support you to promote this great tool. Best regards and happy new year!
 

Morendral

Member
Perhaps some people would like to collaborate with you on this, to ease the workload. As was already said, this is a tremendous effort, and truly impressive that it was done by one person. Unless you plan on selling all or part of it, maybe even consider open sourcing?

I wish i had the technical ability to contribute, but i remember others posting in here who do have that and are willing to help.
 

TheSnidr

Heavy metal viking dentist
GMC Elder
Thank you for your kinds words! It is much appreciated <3

Here's a teeny tiny update: I've axed the shaders for the time being, and plan to release the next version completely without materials and the material editor. It's all just bloat on what was initially intended to be an animation system. I've gone back to that goal, and want to make this a simple-to-use animation engine that anyone can pick up without much prior experience with 3D animation.
I've put together a little demo showing some of the new features of the animation system:
  • There's a new resource called "animation instance" or just "instance". This lets you start animations and automatically inteprolate smoothly between animations, without having to keep track of time yourself. You can just say "Okay, now I want to smoothly transition to this animation", and it handles the details for you.
  • Real-time sample editing (without having to go through the extra "frame" step that you had to in older versions). This lets you yaw, pitch and roll bones, and can even do very simple inverse kinematics, directly on a sample. This is much faster than the old system.
  • An animation instance can also have "fast sampling" enabled. This takes practically no toll on the CPU, since the samples are only generated once and then stored. When fast sampling, you must not edit the sample, as this can ruin the sample strip itself!
  • Oh, and SMF models from the latest public version of the Model Tool are still compatible with the new system!
Download executable here: Download
Download GMS2 project file here: Download

 

MoisesWS

Member
It´s very good to see this topic being ressurected with news. I will use this opportunity to see if @TheSnidr can give me an insight how to do something using his system. I have been using SMF version 0.96 to test things with the demos there. I tried to create the "Pre Rendered Background effect" (games like FF7,FF8,FF9 , Resident Evil 1-2 etc) setting a fixed camera creating a lowpoly environment and making it invisible to use as collision. But I just didn´t not find a way to set the background in the camera view beneath the models to be able to replicate that effect. Tried using Draw Gui but it seems the camera controls don´t work there. So I want to know if it is possible to do that using the SMF.
 

Morendral

Member
This runs really smoothly on my laptop, but I'm not gonna lie. It looks like I'm in the middle of some Scandinavian Techno Rave
 

Attachments

Last edited:

TheSnidr

Heavy metal viking dentist
GMC Elder
@MoisesWS So you basically want to draw a sprite to the screen, and then draw the 3D models on top of that? You can do this by either setting an orthographic projection and a top-down view matrix before drawing, and then setting the 3D camera, or you can manipulate the world matrix to draw the sprite directly in front of the camera. Here's a way to do the latter by reading the necessary info directly from the view and projection matrices:
Code:
//Draw underlay
gpu_set_cullmode(cull_noculling);
var V = matrix_get(matrix_view);
var P = matrix_get(matrix_projection);
var far = - P[14] / (P[10] - 1) - 1;
var sw = far / P[0];
var sh = far / P[5];
matrix_set(matrix_world, [
    V[0], V[4], V[8], 0,
    V[1], V[5], V[9], 0,
    V[2], V[6], V[10], 0,
    - V[12] * V[0] - V[13] * V[1] - V[14] * V[2] + V[2] * far,
    - V[12] * V[4] - V[13] * V[5] - V[14] * V[6] + V[6] * far,
    - V[12] * V[8] - V[13] * V[9] - V[14] * V[10] + V[10] * far,
    1]);
var spr = texSky;
draw_sprite_ext(spr, 0, -sw, -sh, 2 * sw / sprite_get_width(spr), 2 * sh / sprite_get_height(spr), 0, c_white, 1);
matrix_set(matrix_world, matrix_build_identity());;
@Morendral Hah, maybe I should give them a few dance moves for the next demo??
 

MoisesWS

Member
Code:
//Draw underlay
gpu_set_cullmode(cull_noculling);
var V = matrix_get(matrix_view);
var P = matrix_get(matrix_projection);
var far = - P[14] / (P[10] - 1) - 1;
var sw = far / P[0];
var sh = far / P[5];
matrix_set(matrix_world, [
    V[0], V[4], V[8], 0,
    V[1], V[5], V[9], 0,
    V[2], V[6], V[10], 0,
    - V[12] * V[0] - V[13] * V[1] - V[14] * V[2] + V[2] * far,
    - V[12] * V[4] - V[13] * V[5] - V[14] * V[6] + V[6] * far,
    - V[12] * V[8] - V[13] * V[9] - V[14] * V[10] + V[10] * far,
    1]);
var spr = texSky;
draw_sprite_ext(spr, 0, -sw, -sh, 2 * sw / sprite_get_width(spr), 2 * sh / sprite_get_height(spr), 0, c_white, 1);
matrix_set(matrix_world, matrix_build_identity());;
@TheSnidr Big thanks =D . Worked like a charm!
 

Morendral

Member
Edit: Here is the relevant script for raycasting from the camera, kindly provided by FrostyCat
Code:
///@func ray_plane_intersect(l0x, l0y, l0z,  lx, ly, lz, p0x, p0y, p0z, nx, ny, nz)
///@param l0x
///@param l0y
///@param l0z
///@param lx
///@param ly
///@param lz
///@param p0x
///@param p0y
///@param p0z
///@param nx
///@param ny
///@param nz
var l0x = argument0,
   l0y = argument1,
   l0z = argument2,
   lx = argument3,
   ly = argument4,
   lz = argument5,
   p0x = argument6,
   p0y = argument7,
   p0z = argument8,
   nx = argument9,
   ny = argument10,
   nz = argument11,
   t = dot_product_3d(p0x-l0x, p0y-l0y, p0z-l0z, nx, ny, nz)/dot_product_3d(lx, ly, lz, nx, ny, nz);
return [l0x+t*lx, l0y+t*ly, l0z+t*lz];
Old post:
Would anyone be able to help me figure this out? I have this script that I used to use to get the 3d coordinate from the mouse position in the game window, and I tried to implement it into the latest upload - the animation test - without luck. I really don't understand the vector math behind this, unfortunately. I've played around with this pretty extensively and have had some limited successes, mostly anything I do will work exclusively when it's top down. That isn't super helpful though!

Here's the relevant code:
Code:
var mousedx = window_mouse_get_x() - window_get_width() / 2;
var mousedy = window_mouse_get_y() - window_get_height() / 2;
window_mouse_set(window_get_width() / 2, window_get_height() / 2);
//Move camera
camYaw += mousedx * .1;
camPitch = clamp(camPitch - mousedy * .1, -89, 89);
var c = dcos(camYaw);
var s = dsin(camYaw);
var d = 64;
camX = x - d * c * dcos(camPitch);
camY = y - d * s * dcos(camPitch);
camZ = z - d * dsin(camPitch);
cam_set_viewmat(view_camera[0], camX, camY, camZ, x, y, z, 0, 0, 1);

vMouseWorld = sMouseto3D(camX, camY, camZ, x, y, z, 0, 0, 1,vFOV,vAspect,window_mouse_get_x(),window_mouse_get_y());
vFOV is set to the demo's default of 60, and vAspect is also the demo default for the aspect ratio as declared in the camera creation
Here is the code for the script, which should return an array of x,y coords on the z=0 plane:

Code:
/// @desc sMouseto3d Converts screen coords to 3D plane coordinates
/// @param xfrom    The x coordinate of the position to look from.
/// @param yfrom    The y coordinate of the position to look from.
/// @param zfrom    The z coordinate of the position to look from.
/// @param xto    The x coordinate of the position to look to.
/// @param yto    The x coordinate of the position to look to.
/// @param zto    The x coordinate of the position to look to.
/// @param xup    The x coordinate of the "up" vector.
/// @param yup    The y coordinate of the "up" vector.
/// @param zup    The z coordinate of the "up" vector.
/// @param angle    The field of view angle.
/// @param aspect    Aspect ratio between horizontal and vertical size of the view.
/// @param mouseX
/// @param mouseY

var mm,dX,dY,dZ,uX,uY,uZ,vX,vY,vZ,mX,mY,mZ, width, height, tFOV,wmx,wmy;
dX = argument3-argument0;
dY = argument4-argument1;
dZ = argument5-argument2;
mm = sqrt(dX*dX+dY*dY+dZ*dZ);
dX /= mm;
dY /= mm;
dZ /= mm;
uX = argument6;
uY = argument7;
uZ = argument8;
mm = uX*dX+uY*dY+uZ*dZ;
uX -= mm*dX;
uY -= mm*dY;
uZ -= mm*dZ
mm = sqrt(uX*uX+uY*uY+uZ*uZ);
uX /= mm;
uY /= mm;
uZ /= mm;
// v = u x d
vX = uY*dZ-dY*uZ;
vY = uZ*dX-dZ*uX;
vZ = uX*dY-dX*uY;
tFOV = tan(argument9*pi/360);
uX *= tFOV;
uY *= tFOV;
uZ *= tFOV;
vX *= tFOV*argument10;
vY *= tFOV*argument10;
vZ *= tFOV*argument10;
width = window_get_width();
height = window_get_height();
wmx = argument11;
wmy = argument12;
mX = dX+uX*(1-2*wmy/height)+vX*(2*wmx/width-1);
mY = dY+uY*(1-2*wmy/height)+vY*(2*wmx/width-1);
mZ = dZ+uZ*(1-2*wmy/height)+vZ*(2*wmx/width-1);
mm = sqrt(mX*mX+mY*mY+mZ*mZ);
var vMouseDX = mX/mm;
var vMouseDY = mY/mm;
var vMouseDZ = mZ/mm;

var dist;
dist = argument2/vMouseDZ;
var mouseXW = x + vMouseDX*dist;
var mouseYW = y + vMouseDY*dist;

var mouseWorld = vect3(mouseXW,mouseYW,0);
return mouseWorld;
 
Last edited:

TheSnidr

Heavy metal viking dentist
GMC Elder
I'm in the finalizing stages of the model tool, and need help testing it!
It is now getting very close to the final version. The major changes from version 0.9.7 are as follows:
  • It can import and export to SMF format v1 and v7. v1 is used by the 1.4 version of SMF, v7 is used by the previous version of the model tool and import scripts, making the new tool backwards compatible
  • Materials are gone. Importing a v7 model with materials will not import materials. When a v7 model is exported, a generic material is created for backwards compatibility.
  • Level editor is gone. It's not worth it for the scope of this editor. The goal of the editor is to allow for simple animated models.
  • Undo and redo works, both with buttons in the upper right-hand side of the UI, and with Ctrl+Z and Ctrl+Y. This needs thorough testing!
  • UI improvements! The submodel-list on the right side of the screen is easier to work with than ever. Load too many models, and you can scroll through the list. Select multiple models at a time with Shift+Left click, either in the list or directly in the perspective view. Changing the order of models is easy with the arrow buttons. Clicking the texture of the model will open a dropdown list, letting you select a different texture.
  • Major improvements to the skinning process! Instead of selecting nodes and assigning bones, you can now paint weights directly onto the model. Select a node, and its influence on the model will be displayed as a red-to-blue gradient.
  • Also major improvements to the animation editing. Select a node, and three rings will show up. You can simply drag this ring in any view to rotate the node.
  • Keyframes can be copied and pasted. Copying a keyframe will actually place it on the clipboard, so you can even copy and paste between different models.
  • Move camera with right or middle mouse button, your choice
Download v0.99 demo 5 here:
Download


EDIT:
Already fixed a little bug with vertex painting...
 
Last edited:

FoxyOfJungle

Kazan Games
I'm glad you returned to work on the project, but sad to see the project have regressed so much in several things (without materials, level editor, fbx importer and others...)
 

TheSnidr

Heavy metal viking dentist
GMC Elder
It's all in the spirit of keeping things pure! I don't want somebody who only needs animation to have to also import a bunch of shaders and stuff. I'd love to include FBX support, but I have yet to get this to work.

I've added a new demo today, with a better showcase of the real-time inverse kinematics. What better way to do this than with a spder?

This will soon be available for download.
 

EMPixed

Member
I pm'ed the author and he expressed the same. SMF system will have its separate packages. Currently, the particle system is already separated and he's working on the collision system.
  • I believe he'll drop down the shader support. Model editor will no longer have "shader settings" on it. If you wish to apply shader, you'll do it in Game Maker.
  • You'll import the parts of the system that you'd want to use : Animation, Collision etc.
The reason of this is that the all-in-one project system is no good.

I really like this project and wish to see it as a standard for Game Maker. I'm currently on hold, waiting for this project to continue mine :D
I figured I would point this out to you, @FoxyOfJungle , just in case you didn't see it and assuming nothing has changed in Snidr's plans for SMF as a whole. At least, from what I gather, SMF will be more akin to a "tool set" than just one big program, at least based on what Mert said when he PM'd Snidr about it. Hopefully nothing has changed from that, so the 3D Collision, Animations, Materials and Level Editor will all be their own programs, so users won't be required to have all SMF components in their 3D projects when they only NEED like three of the four. So, for example, the materials program is something your project doesn't need, but you need 3D Collision, Animation and Level Editor for your project, so you put all the components in, except for Materials. (And pardon me, I'm not trying to explain this as if anyone's dumb. Just wanted to point this out, right quick!)

If I'm wrong here, by all means, correct me where you see fit! Just being hopeful here that SMF as a whole is going to be what is originally intended to be and being hopeful it's not changing into a 3D model animation editor and that's it.
 
Last edited:

FoxyOfJungle

Kazan Games
I figured I would point this out to you, @FoxyOfJungle , just in case you didn't see it and assuming nothing has changed in Snidr's plans for SMF as a whole. At least, from what I gather, SMF will be more akin to a "tool set" than just one big program, at least based on what Mert said when he PM'd Snidr about it. Hopefully nothing has changed from that, so the 3D Collision, Animations, Materials and Level Editor will all be their own programs, so users won't be required to have all SMF components in their 3D projects when they only NEED like three of the four. So, for example, the materials program is something your project doesn't need, but you need 3D Collision, Animation and Level Editor for your project, so you put all the components in, except for Materials. (And pardon me, I'm not trying to explain this as if anyone's dumb. Just wanted to point this out, right quick!)

If I'm wrong here, by all means, correct me where you see fit! Just being hopeful here that nothing's changed so that SMF is just going to be a 3D model animation editor and that's it.
I think I miss this part of the publication, but in fact I agree that it is not necessary to have everything in one, if you just need specific things. It will be great if he make separate parts but that work together, for example, just import what you want (colision system, animation system, shaders) as you said, and as in other engines like Unity that can import assets.
But anyways, thank you so much TheSnidr for doing such that big things to us for free, I appreciate this.
 

TheSnidr

Heavy metal viking dentist
GMC Elder
The collisions already are their own separate thing, and materials are coming later. The level editor is scrapped for the time being, but I may make a new one separate from the model tool.
The model tool will be used purely for animating objects, and it's starting to become darn good at it!
Here's an animation I'm working on for the new SMF demos:

This particular demo will show how to attach objects to an animated model. The hammer in this case is not skinned, but simply drawn by setting the world matrix to the transformation of the dwarf's hand node.
 
Last edited:

xenoargh

Member
Hi. This is fascinating work.

1. Are shaders coming back at some point? Do you want a shader that does basic Blinn/Phong specularity with color-channel input, normalmaps and glow? I don't have one for GML and I'm still a bit of a n00b when it comes to integration w/ GMS in general, but I have a HLSL one I wrote for another engine that might be a good starting-place.
2. If we *just* use this for 3D characters and objects... can we use 2D collisions, etc., to keep speeds reasonable?
3. All these characters, etc., are being written to the z-buffer, correct? So post-processing with Surfaces should be possible?
 

TheSnidr

Heavy metal viking dentist
GMC Elder
Hey @xenoargh !
1. I plan for shaders to come back at a later point, yes. I appreciate the offer, but I make my own shaders ;)
2. There's nothing that keeps you from using 2D collisions while drawing SMF models!
3. The z-buffer is indeed turned on while drawing 3D models, otherwise they'll just draw over each other in weird ways. You don't have access to the built-in depth buffer though, so if you want to use a depth buffer for anything you'll have to set up multiple render targets (MRTs). This is outside the scope of the SMF system at the moment.
 

Micah_DS

Member
Possibly a stupid and/or unreasonable
FEATURE REQUEST: Native vertex model import (i.e. importing vertex model data that was saved via buffer_save).

I'm asking because I always make my models natively in GameMaker. My vertex formatting is constructed as follows:
GML:
vertex_format_begin();
vertex_format_add_position_3d();
vertex_format_add_normal();
vertex_format_add_textcoord();
vertex_format_add_colour();
vertex_format_end();
And of course the model file is simply loaded in by first using buffer_load then converting that buffer data to vertex buffer data via vertex_create_buffer_from_buffer.

Is there any possibility of getting the option to import this kind of model data into the SMF Model Tool at some point?

EDIT:
I went looking through the scripts in the latest(?) animation test project to see if I could figure out how to create a conversion script myself. I kind of got a general idea of some of it by looking at the smf_model_save and smf_model_load scripts. Maybe I can figure it out... maybe. Unfortunately, I've got other things to do before digging into it, so I'll have to take a hack at it later. The code is nicely laid out, but there's just so much to get familiar with (for me, anyway).
 
Last edited:

Bart

WiseBart
I've been following this topic for a while and I must say that it is absolutely impressive to see how far it has come in a couple of years time.
I'm a big fan of this project and the many other projects that are pushing the boundaries of 3D in GameMaker nowadays.

I'd like to help out with this in a way. While the maths and logic behind all this are quite a bit out of my league, the file format seems quite comprehensible.
Would there be any interest in a direct exporter from Blender to SMF?
 

TheSnidr

Heavy metal viking dentist
GMC Elder
@Micah_DS Vertex buffers exported with buffer_save don't store any info about the format though, so even if I make an importer that accepts those buffers, it'll only work for that specific format! I guess it's easier to export it as a .obj file and import that into the model tool :p

@Bart Thank you! Yes, there would definitely be an interest in that, I have no experience making exporters from Blender. If this is something you can help with, that would be nothing short of amazing. I'll help any way I can!
 

Micah_DS

Member
@Micah_DS Vertex buffers exported with buffer_save don't store any info about the format though, so even if I make an importer that accepts those buffers, it'll only work for that specific format! I guess it's easier to export it as a .obj file and import that into the model tool :p
Yeah, I'm not the greatest with saying what I mean at times, sorry. I'm aware the vertex format isn't saved. Either there'd have to be a standard format put in place and let the user know what format to follow or the program would have to allow the user to input their format when importing. But anyway, I would export my models to obj format, but I never had any luck finding a means to do that. Thanks for the response though.

EDIT:
I'm not sure if you noticed, but I asked about this feature (importing vertex buffer models) in Warp 3D as well, and it looks like my needs for importing and animation may be met there, hopefully. I know you're doing this all for free, so I really wasn't expecting much, and I appreciate the work you've already done here, as I know it's already being a help to many people in the community.
 
Last edited:

BenRK

Member
Any plans on being able to import .fbx files? Or is that already in there and I just haven't found it yet? Ignore me, would help if I read the thread.
 
Last edited:

Bart

WiseBart
@Bart Thank you! Yes, there would definitely be an interest in that, I have no experience making exporters from Blender. If this is something you can help with, that would be nothing short of amazing. I'll help any way I can!
Great! At the moment I have a basic export working of a static model with included texture. It may need some adjustments to account for smooth normals, etc.
Working on the rig and animations now.
It looks like most things can actually be mapped pretty cleanly from Blender to SMF, except for the materials maybe.
Will update when I have the rig and animations working (or when I get stuck somewhere :p)

UPDATE: @TheSnidr As expected, I'm a bit stuck with the export of the rig. Conversions of quaternions from right-handed Blender to left-handed SMF, etc. Not exactly my expertise...
Either I'm exporting the parent hierarchy the wrong way or something goes wrong with the dual quaternions.
How exactly do you store the transforms? One dual quaternion per node, if I'm not mistaken?
Also, does the rigging use a different coordinate system?
 
Last edited:

TheSnidr

Heavy metal viking dentist
GMC Elder
Just published the new Model Tool and import scripts, and updated the first post.
Downloads for the old versions are still available, they're just hidden inside the spoiler.
Here are a few handy download links:
Download documentation PDF for SMF v0.99
Download demo compiled using YYC
Download SMF v0.99 Model Tool
Download SMF v0.99 Import Scripts
Download source for SMF v0.99 Model Tool (warning - it's a bit messy, and contains other projects as well)

There are a few planned changes:
  • I want to add the ability to zoom in on the timeline, for more precise keyframe placement
  • Onion skinning letting you see other keyframes of the same animation, or of a different animation, or even show the keyframes of a separate model altogether
  • Custom rig subdivision to limit number of bones per draw call. Weaker devices don't allow for as many uniforms as modern PCs, and subdividing a rig would let you draw complex animations even with a low uniform count. Rig subdivision is already possible, but you can as of now not manually specify how to subdivide the rig.

Cheers
 
Last edited:
Loving your work and I'm looking into starting a whole project with it. I would also love to implement into the project your 3D particles asset. Is there any incompatibility or repeated code I can merge? It would be cool a whole 3D enviroment for all your assets related to 3d geometry.
 
Thanks for such an awesome tool, downloaded the latest version and is pretty straight forward once you read the documentation.
I figured how to get my animated models working on my project, however, when I have several animations as "state" frames start mixing between animations, everything starts OK but the more states are used the more frames are being mixed between animations.
 

danicrem

Member
If I import my 3d model as OBJ, the texture is all messed up. If I load the model in blender ik looks fine. It uses a 2k texture. So I guess that should work?
I also noticed in the demo that in the disco scene, after pressing spacebar, the animation does not go back to walk. Also in demo 2 the animations are not fluid even after pressing the button. Overal this software looks super! It should be integrated into GMS.
Can it also be used to create 2d bone animations (like in Spine)? Like attaching several planes to bones and just swap the textures by code to change the face expressions.
 

danicrem

Member
OK. Is seems the edititor does not like PNG images. It used one of the colors as alpha and the effect was horrible. Now I used a jpg and it was fine.
 
Wow the new version its very smooth and easy to use I rigged and animate human model in few seconds do you plan to add pbr materials in smf
 

Kahrabaa

Member
Hello.
Awesome work ! Very clear and easy to understand the layout.
Its so fun to play around with bones:banana:

I got an error in the editor.
I used only default assets. I had the Geosphere model loaded, I had added 3 bones, autoskinned then added 3 frames for testing

The last thing I did was adding in the Cube model through "add model". Then I undid that with ctrl-z. Then when I clicked on add model again I got the error
 
Last edited:
Top