SMF - 3D skeletal animation - New version available

TheSnidr

Heavy metal viking dentist
GMC Elder
Yeah, I already have a culling method based on view angle and distance but considering how resource intensive generating new frames was, I had to seek other alternatives like throttling the frame creation rates and using a single frame shared among all distant models.
Generating a new sample entails two dual quaternion multiplications and a dq normalization per bone, so it's doomed to be slow. Interpolating between two precomputed samples however is very very fast, and with this method, you actually don't have to create new samples in real time at all. This is the best alternative for distant object if you don't want them to play the same animation.

Hello, First of all I want to say that this is AMAZING! TheSnidr, you are Amazing hahahaha, Todo un mago! I've been reading a lot of how to create shaders like you told me and the more I learn, the more amazed I get when I see these type of things. I tested the last update that you did to see if it was possible to load a Collada .Dae file, but it crashed. It seems that the files that I export using Blender and Maya are not working.
Thank you! The .dae import script isn't entirely stable yet, and will probably never work properly. There are so many variations on how the information is stored, I don't feel it's feasible to make a general collada importer in straight gml. Reading large text files in GMS takes a lot of time as well. So the best option is to import .obj models into the model tool, and rig and animate them from scratch.

Instead of a .Dae, export your models into .Obj models. I use blender myself

[Edit]
On a side note. I have come across a bug with doing rotation animations involving the root bone. If you apply a global rotation (it could be any rotation but I usually use globals) in an animation to the root bone, sometimes the model thinks it rotated a full 360 degrees or more in a certain direction. I have to try and spin it back to normal, which it may spin again and again during the process which could take quite a fair bit of time to re-correct.
Oh, seems like the global rotation of the root bone is completely messed up! How could I have missed that. Try this version:
https://dl.dropboxusercontent.com/u/41252865/GamemakerExamples/Snidrs Model Format v0.8.1.zip
 
E

Esteban Devia

Guest
TheSnidr, Do you think is it possible to show us the specification of the format .SMF?
It'll be amazing to understand how it works.

Thanks!
 

TheSnidr

Heavy metal viking dentist
GMC Elder
TheSnidr, Do you think is it possible to show us the specification of the format .SMF?
It'll be amazing to understand how it works.

Thanks!
Absolutely!
It's almost like the built-in format, except it has an extra colour attribute:
Code:
globalvar SMF_format, SMF_format_bytes;
SMF_format_bytes = 0;
vertex_format_begin();
vertex_format_add_position_3d();    SMF_format_bytes += 3 * 4; //Adds three f32
vertex_format_add_normal();         SMF_format_bytes += 3 * 4; //Adds three f32
vertex_format_add_texcoord();       SMF_format_bytes += 2 * 4; //Adds two f32
vertex_format_add_color();          SMF_format_bytes += 1 * 4; //Adds four u8
vertex_format_add_color();          SMF_format_bytes += 1 * 4; //Adds four u8
SMF_format = vertex_format_end();
One of the colours stores bone indices, the other stores bone weights.

The bones themselves are stored in the animation format. This is a buffer containing the following information:
Code:
//Header
- Number of bones, buffer_u8
- Number of frames, buffer_u8
//Bind pose
for each bone
{
  - Bind dual quaterion, eight buffer_f32
  - Parent index, buffer_u8
  - Whether or not the bone is attached to its parent, buffer_u8
}
//Animation
for each frame
{
  - Time of frame, buffer_f32
  for each bone
  {
     - Local delta orientation within parent's orientation, dual quaternion, eight buffer_f32
  }
}
The collision format is more complex, as it has a header and a two-part body. The first half of the body stores all the triangles in the model as "vertex, vertex, vertex, normal, vertex, vertex, vertex, normal". The second half stores the octree.
Code:
///Header
- Buffer position of octree part of the buffer, buffer_s32
- Minimal x-value of the model in object-space, buffer_f32
- Minimal y-value of the model in object-space, buffer_f32
- Minimal z-value of the model in object-space, buffer_f32
- Size of the model, buffer_f32
- Bleed-over value, buffer_f32
- Recursive depth of the octree, buffer_u32
- Three empty placeholders, buffer_f32
//Vertex buffer
for each triangle
{
   - Vertex position, three buffer_u16
   - Vertex position, three buffer_u16
   - Vertex position, three buffer_u16
   - Triangle normal, three buffer_s16
}
//Octree
if this is not a leaf node
{
  for all eight child regions
  {
    - Buffer position of child region, buffer_s32 <-- This is positive if the child region is split, and negative if it is a leaf node
  }
}
else
{
  - Number of triangles within this region, buffer_u16
  for each triangle in this region
  {
    - Buffer position of this triangle, buffer_u16
  }
  if the number of triangles in this region is 0
  {
    - Buffer position of the nearest region that contains any triangles, buffer_u32
  }
}
I hope this gave some clarity!
 
Last edited:
E

Esteban Devia

Guest
Absolutely!
It's almost like the buil-tin format, except it has an extra colour attribute:
Code:
globalvar SMF_format, SMF_format_bytes;
SMF_format_bytes = 0;
vertex_format_begin();
vertex_format_add_position_3d();    SMF_format_bytes += 3 * 4; //Adds three f32
vertex_format_add_normal();         SMF_format_bytes += 3 * 4; //Adds three f32
vertex_format_add_texcoord();       SMF_format_bytes += 2 * 4; //Adds two f32
vertex_format_add_color();          SMF_format_bytes += 1 * 4; //Adds four u8
vertex_format_add_color();          SMF_format_bytes += 1 * 4; //Adds four u8
SMF_format = vertex_format_end();
One of the colours stores bone indices, the other stores bone weights.

The bones themselves are stored in the animation format. This is a buffer containing the following information:
Code:
//Header
- Number of bones, buffer_u8
- Number of frames, buffer_u8
//Bind pose
for each bone
{
  - Bind dual quaterion, eight buffer_f32
  - Parent index, buffer_u8
  - Whether or not the bone is attached to its parent, buffer_u8
}
//Animation
for each frame
{
  - Time of frame, buffer_f32
  for each bone
  {
     - Local delta orientation within parent's orientation, dual quaternion, eight buffer_f32
  }
}
The collision format is more complex, as it has a header and two distinct bodies. The first half of the body stores all the triangles in the model as "vertex, vertex, vertex, normal, vertex, vertex, vertex, normal". The second half stores the octree.
Code:
///Header
- Buffer position of octree part of the buffer, buffer_s32
- Minimal x-value of the model in object-space, buffer_f32
- Minimal y-value of the model in object-space, buffer_f32
- Minimal z-value of the model in object-space, buffer_f32
- Size of the model, buffer_f32
- Bleed-over value, buffer_f32
- Recursive depth of the octree, buffer_u32
- Three empty placeholders, buffer_f32
//Vertex buffer
for each triangle
{
   - Vertex position, three buffer_u16
   - Vertex position, three buffer_u16
   - Vertex position, three buffer_u16
   - Triangle normal, three buffer_s16
}
//Octree
if this is not a leaf node
{
  for all eight child regions
  {
    - Buffer position of child region, buffer_s32 <-- This is positive if the child region is split, and negative if it is a leaf node
  }
}
else
{
  - Number of triangles within this region, buffer_u16
  for each triangle in this region
  {
    - Buffer position of this triangle, buffer_u16
  }
  if the number of triangles in this region is 0
  {
    - Buffer position of the nearest region that contains any triangles, buffer_u32
  }
}
I hope this gave some clarity!

Thank you very much! It is very useful! :D
 

MrPr1993

Member
Goodness this is wonderful! I'm glad ya made this! This'll be so great for my Shaundi game~

Already tested it out with models I worked for other projects (SM64 hackin~) and it works like a charm~

I'm getting the little hang on the rigging, but I'm doing good so far.

Question! Will it be possible that in the next update for the program, you could make a function that selects vectors that are separate from the model?

Somethin' like this here, for example.
 

Sidorakh

Member
Holy hell man, this is great! Been using it for about two months near flawlessly. Much better than the other model loading solutions I've seen.
Hell, the example project works at a nice FPS on my crap Android phone.
I've found only one problem with it as of late, the OBJ importer script crashes if it encounters an OBJ file with MTL files/data attached. Easy enough to remove the data in Blender, so it's no big deal, but it's soemthign you may want to look into.
 

MrPr1993

Member
Somethin' I forgot to mention; what ya do if you need to make a collision against an enemy? As in, I want the enemy block the player's way and push the player around, if ya get my idea.
 
Somethin' I forgot to mention; what ya do if you need to make a collision against an enemy? As in, I want the enemy block the player's way and push the player around, if ya get my idea.
Unless the type of collision you want has a lot of intricacy to it, just do it the traditional way. Rejecting two colliding rectangles doesn't need to be complicated.
 
G

GproKaru

Guest
I know I've asked about this feature suggestion before but I think I might of discovered a method on how to make it work.
- Would it be possible to offset the x/y/z position of bones in game maker for things like manual offsets?

I found out that separating a bone creates a new root bone for the set of bones connected to it. I was wondering if we could possibly apply a positional offset to each of the bone roots?
You can offset each root individually from the main root bone, so I was just wondering if there could be a way to add offsets onto each root selectively.
I'm just curious as it would be useful for more mechanical movements done in real time rather than having to pre-animate the movements.
 
I

Insanebrio

Guest
I love your model tool and i looked at your wolf example project and i like it since its very simple. I tried using my model and animation, but i get an error when it tries to make the sampler, at line 58 it says variable index is out of range. Am i using an old version of something or theres aomething wrong (i made a simple character with2 bones wave his arm)
 
G

GproKaru

Guest
I love your model tool and i looked at your wolf example project and i like it since its very simple. I tried using my model and animation, but i get an error when it tries to make the sampler, at line 58 it says variable index is out of range. Am i using an old version of something or theres aomething wrong (i made a simple character with2 bones wave his arm)
I noticed this may happen if you export a model that has more than one separate part to it. You can either join all the parts together and then export it, or export each piece individually.
 
I

Insanebrio

Guest
I noticed this may happen if you export a model that has more than one separate part to it. You can either join all the parts together and then export it, or export each piece individually.
Whatching snidr videos i noticed that his animation program was a little different fronte mine. I fond the (probably) right one and with his already inserted link model it workshop. Tomorrow ill test my own model
and see
 
Last edited by a moderator:
D

Deleted User

Guest
Does this tool work with gamemaker1.4? What file formats are supported for importing? Can I load up my textured and animated Maya/LightWave models? Or do they need to be textured / animated in this tool?
 

TheSnidr

Heavy metal viking dentist
GMC Elder
Goodness this is wonderful! I'm glad ya made this! This'll be so great for my Shaundi game~

Already tested it out with models I worked for other projects (SM64 hackin~) and it works like a charm~

I'm getting the little hang on the rigging, but I'm doing good so far.

Question! Will it be possible that in the next update for the program, you could make a function that selects vectors that are separate from the model?

Somethin' like this here, for example.
Awesome! I've seen some screens of your game, looking forward to testing it out!
Holy hell man, this is great! Been using it for about two months near flawlessly. Much better than the other model loading solutions I've seen.
Hell, the example project works at a nice FPS on my crap Android phone.
I've found only one problem with it as of late, the OBJ importer script crashes if it encounters an OBJ file with MTL files/data attached. Easy enough to remove the data in Blender, so it's no big deal, but it's soemthign you may want to look into.
Oh, gonna have to look into that! Could you post the error message? It worked before, maybe I've changed something that broke it. I plan to make a new importer though, one that allows models with multiple materials.
Somethin' I forgot to mention; what ya do if you need to make a collision against an enemy? As in, I want the enemy block the player's way and push the player around, if ya get my idea.
You can check for collisions the same way you usually do! If 2D collisions are good enough you can even use the built-in collision system. For 3D collisions I usually just do point_distance_3d and see if the objects are closer than a given distance.
I know I've asked about this feature suggestion before but I think I might of discovered a method on how to make it work.
- Would it be possible to offset the x/y/z position of bones in game maker for things like manual offsets?

I found out that separating a bone creates a new root bone for the set of bones connected to it. I was wondering if we could possibly apply a positional offset to each of the bone roots?
You can offset each root individually from the main root bone, so I was just wondering if there could be a way to add offsets onto each root selectively.
I'm just curious as it would be useful for more mechanical movements done in real time rather than having to pre-animate the movements.
What do you mean, as in modifying the position of the bone in real time? That shouldn't be difficult to add!
I love your model tool and i looked at your wolf example project and i like it since its very simple. I tried using my model and animation, but i get an error when it tries to make the sampler, at line 58 it says variable index is out of range. Am i using an old version of something or theres aomething wrong (i made a simple character with2 bones wave his arm)
Hi! Could you post the actual error message? Line 58 of which script?
Whatching snidr videos i noticed that his animation program was a little different fronte mine. I fond the (probably) right one and with his already inserted link model it workshop. Tomorrow ill test my own model
and see
You found the one with the Link-model already inserted? That's a very old version! The newest public version is in the link in the first post. I'm probably gonna put up a new version in a couple of days.
Does this tool work with gamemaker1.4? What file formats are supported for importing? Can I load up my textured and animated Maya/LightWave models? Or do they need to be textured / animated in this tool?
It works with 1.4! You can only import .obj and .png files, as well as the custom file formats created by the model tool. I've added a rudimentary collada importer that lets you import a skinned model and a rig, but it has a high chance of failure.
In short, models have to be skinned and animated from scratch within the program.
 
D

Deleted User

Guest
Eek. Whats the skinning like in program? I do my UV maps in Maya.

Is there a way to get a fully textured model into gamemaker without failure or outside SMF system via alternative method?
 

TheSnidr

Heavy metal viking dentist
GMC Elder
Eek. Whats the skinning like in program? I do my UV maps in Maya.

Is there a way to get a fully textured model into gamemaker without failure or outside SMF system via alternative method?
The texture map is stored in the obj file, so you can import textured models with pretty much any importer

Edit: Are you perhaps confusing skinned for textured? Textured models can be imported. Skinning means assigning bones and bone weights to vertices, and is necessary to animatea model.
 
Last edited:

Kentae

Member
Hey :)
just a quick question... how easy or hard, if at all possible, is to add my own shaders onto the animated models? Like say, I have a specular shader that I'd like to use but if I'm not completely mistaken, there's a shader making the actual animation work isn't there? And if so, would I have to combine my specular shader with that in a way or is it an easier way to do it? :p
Haven't been able to test the program to much because of work taking all my time these days so I may be asking a completely irrelevant question here haha xD
 

MrPr1993

Member
Righto! Something else I'm curious about next time ya update...

You could add a function that resizes a polygon rigged to a skeleton part. Liiiiiike...


This, for example. It would be useful if you're gonna give the rigged model either a shrunken head; fists grow in size to attack in their punching animation, or make the head small enough it's invisible so it can be useful for things like having the head blown off; but it's actually resized to small so it can look like the head disappeared.

Oooor maybe make the polygon rigged to the skeleton invisible as well.
 
Last edited:
D

Dalesome

Guest
The link on the first post seems to be broken, I'm getting a "Error 404" from Dropbox
 
D

Deleted User

Guest
The texture map is stored in the obj file, so you can import textured models with pretty much any importer

Edit: Are you perhaps confusing skinned for textured? Textured models can be imported. Skinning means assigning bones and bone weights to vertices, and is necessary to animatea model.
Skinning as in weight painting? Yes. I can do all that in Maya. I am wondering if my animated models can be imported into GMaker without using this program. I'm not a programmer.
 

ZAK!

Member
Hi there, I was wondering if you could explain on how to use the scripts for the 3D modelling tool? Ive used your tool for a bit but I cannot seem to add my own into my project (or the one included for 1.4) It seems to not like adding the Textures I included. Namely the function "sprite_get_texture" function. Is there something Im doing wrong? (All Im doing is just trying to add a box and not any animations at the moment just to test the waters. Thats all.) And was just hoping to inquire if I'm using an outdated example or not?

- Id also like to include that I do add the models in SMF format and Pngs into the Included files section of the Project file.

Any help would be appretiated! And thank you for helping out if you do!
 

TheSnidr

Heavy metal viking dentist
GMC Elder
Righto! Something else I'm curious about next time ya update...

You could add a function that resizes a polygon rigged to a skeleton part. Liiiiiike...


This, for example. It would be useful if you're gonna give the rigged model either a shrunken head; fists grow in size to attack in their punching animation, or make the head small enough it's invisible so it can be useful for things like having the head blown off; but it's actually resized to small so it can look like the head disappeared.

Oooor maybe make the polygon rigged to the skeleton invisible as well.
Lovely idea to let the bones give special properties to the influenced vertices! Maybe it could work if I make a separate system from the skeleton? Scaling is not straight forward to add when using dual quaternions, as they only allow for rigid transformations. That said, I'm considering adding the option to use matrices instead. They're slower, but allow for different types of transformations like scaling and shearing.

The link on the first post seems to be broken, I'm getting a "Error 404" from Dropbox
Hmm, dunno why the link broke, but here's a functional one:
https://dl.dropboxusercontent.com/u/41252865/GamemakerExamples/Snidrs Model Format v0.8.1.zip

Skinning as in weight painting? Yes. I can do all that in Maya. I am wondering if my animated models can be imported into GMaker without using this program. I'm not a programmer.
There are very few alternatives to this when it comes to animation, and none of them import files directly from Maya. @Lewa made a Morph-target shader that works with Blender. If you can import your animations into Blender, you can export them to his custom format.

Hi there, I was wondering if you could explain on how to use the scripts for the 3D modelling tool? Ive used your tool for a bit but I cannot seem to add my own into my project (or the one included for 1.4) It seems to not like adding the Textures I included. Namely the function "sprite_get_texture" function. Is there something Im doing wrong? (All Im doing is just trying to add a box and not any animations at the moment just to test the waters. Thats all.) And was just hoping to inquire if I'm using an outdated example or not?

- Id also like to include that I do add the models in SMF format and Pngs into the Included files section of the Project file.

Any help would be appretiated! And thank you for helping out if you do!
If you add textures in the included files section, you also need to import them into the game with sprite_add before you can use sprite_get_texture! :)
The code in the demo project is extensively commented, I've tried to explain how to use the scripts in there! But if you have any specific questions, feel free to ask them here!
 

ZAK!

Member
Hey thanks for quickly replying!

I figured out it was me being stupid and trying to figure out that the directories were being weird so I managed to fix that part of the issue. (I seriously thought it was a GMS2 thing rather than GMS 1.4 lol)

However the models & textures won't show up, I was wondering if the shaders have to be working with it to make it show up hence why they were included? (Never worked with shaders til now. So Im slowly learning how to do it lol) Thanks again!
 
D

Dalesome

Guest
Hey there, this is looking great :D
but is there a way you could add an error message or have a pop up message when doing something like accidentally pressing the "insert bone" or "Delete bone" and crashing because there are no bones.

Thanks ^^
 
S

Squisher

Guest
....This is probably the most amazing thing I've ever seen in all 12 years of game making. Well done, sir!
By the way, any chance we could get a look at the Skinning Tool source code(hopefully for GMS1.4)? I'd like to know how it saves/loads files(potentially for a Blender exporter, perhaps).
 

TheSnidr

Heavy metal viking dentist
GMC Elder
New version with slight changes:
Download v0.8.2
Not many new functions, but the existing functions are more optimized. Bug fixes here and there. No changes to the formats.

I know I've asked about this feature suggestion before but I think I might of discovered a method on how to make it work.
- Would it be possible to offset the x/y/z position of bones in game maker for things like manual offsets?

I found out that separating a bone creates a new root bone for the set of bones connected to it. I was wondering if we could possibly apply a positional offset to each of the bone roots?
You can offset each root individually from the main root bone, so I was just wondering if there could be a way to add offsets onto each root selectively.
I'm just curious as it would be useful for more mechanical movements done in real time rather than having to pre-animate the movements.
Sorry it's taken so long for a proper reply! I'm in the process of selling my apartment and moving to a different city, so my computer's been unavailable for a while.
Anyway, I made a short script that lets you multiply a bone with a dual quaternion:
Code:
/// @description smf_frame_transform_bone(frame, boneIndex, ax, ay, az, angle)
/// @param frame
/// @param boneIndex
/// @param ax
/// @param ay
/// @param az
/// @param angle
//This script can be optimized a lot
var frame, bone, ax, ay, az, angle, bindPose, i, R, S, l, bind, animationIndex;
frame = argument0;
bone = argument1;
ax = argument2;
ay = argument3;
az = argument4;
angle = argument5;
animationIndex = SMF_bindList[| frame[array_length_1d(frame) - 1]];

bind = animationIndex[| bone];
pBind = animationIndex[| bind[8]];

i = 8;
while i--{R[i] = frame[bone * 8 + i];}

rotationDQ = smf_dualquat_create(angle, ax, ay, az, 0, 0, 0);

worldDQ = smf_dualquat_multiply(pBind, R);
T = smf_dualquat_get_translation(worldDQ);
pT = smf_dualquat_get_translation(pBind);
worldDQ = smf_dualquat_set_translation(worldDQ, T[0] - pT[0], T[1] - pT[1], T[2] - pT[2]);
worldDQ = smf_dualquat_multiply(rotationDQ, worldDQ);
T = smf_dualquat_get_translation(worldDQ);
worldDQ = smf_dualquat_set_translation(worldDQ, T[0] + pT[0], T[1] + pT[1], T[2] + pT[2]);
worldDQ = smf_dualquat_normalize(worldDQ);
Q = smf_dualquat_multiply(smf_dualquat_get_conjugate(pBind), worldDQ);

i = 8;
while i--{frame[@ bone * 8 + i] = Q[i];}
It's very very unoptimized, and could probably be made to run many times faster, but I haven't had the time to optimize it!
You can create a dual quaternion with the smf_dualquat_create script. It lets you input both rotation and translation, letting you rigidly transform the bone in object space as you please.

Hey there, this is looking great :D
but is there a way you could add an error message or have a pop up message when doing something like accidentally pressing the "insert bone" or "Delete bone" and crashing because there are no bones.

Thanks ^^
Oops, that fell through the cracks! It's fixed in this version :D

....This is probably the most amazing thing I've ever seen in all 12 years of game making. Well done, sir!
By the way, any chance we could get a look at the Skinning Tool source code(hopefully for GMS1.4)? I'd like to know how it saves/loads files(potentially for a Blender exporter, perhaps).
Thank you! :D The model tool isn't open source at the moment, but it might be in the future. It's for GMS 2 :) See my post further up if you want to know how the file formats work! Also, the scripts for saving and loading into the model tool are pretty much the same as the ones in the open source part of the engine.
 
Last edited:
S

Squisher

Guest
Thank you! :D The model tool isn't open source at the moment, but it might be in the future. It's for GMS 2 :) See my post further up if you want to know how the file formats work! Also, the scripts for saving and loading into the model tool are pretty much the same as the ones in the open source part of the engine.
Oh sweet, thanks :D
And thank you again for making this amazing thing. I have a decade's worth of backed up game ideas that need to be made, and now I can finally make them!
 
A

Anoghastra

Guest
This seems really cool, but the links to the source of the import scripts are broken. :(
 

TheSnidr

Heavy metal viking dentist
GMC Elder
This seems really cool, but the links to the source of the import scripts are broken. :(
Oops, sorry about that! I'm at a conference, I will fix it as soon as I get home tomorrow.
EDIT:
Okay, link's back up! First post.
 
Last edited:
L

LuckyCassette

Guest
Tested this out, it's quite neat. I was mostly interested in seeing how the collisions were handled, but did some other exploring.

I found two bugs.
1) In Model tool, if you left click the 3D viewports, the program will crash.
2)The following block in sh_smf_animate_interpolate gives a compile error.

Code:
vec4 dualquat_normalize(vec4 dqReal, vec4 dqDual)
{   
    float l = length(dqReal);
    if (l > 0.0)
    {
        l = 1.0 / l;
        dqReal *= l;
        d = dot(dqReal, dqDual);
        dqDual = (dqDual - dqReal * dot(dqReal, dqDual)) * l;
    }
}
Vertex Shader: sh_smf_animate_interpolate at line 56 : 'd'
Vertex Shader: sh_smf_animate_interpolate at line 49 : ''
Commenting out the block allows the program to compile and run unscathed as far as I can see, but I dunno what this does exactly, you will have a better idea.
 

Kentae

Member
Hey, I decided to finally test this out a little bit but I have encountered kind of a big problem with it.
Whenever I leftclick the rigging tab or anywhere else that isn't a menu or button of some sort the program crashes.
There are no GM errors though, just windows telling me the program stopped working. (I use windows 7)
I have only tested it on one computer so far though so the problem might be with that but I figured I'd inform you about it anyway.
 

TheSnidr

Heavy metal viking dentist
GMC Elder
Thanks for notifying me about the crash. Sometimes the program tries to read from outside the bounds of a ds_list, which normally results in a debug message and nothing else. However, for the last release, I accidentally compiled with the YYC, which crashes if you do just that. And since I'm currently in the process of moving, my computer's inaccessible for a while!
So I'm sorry to say I'm unable to fix it right now. But here's the previous version:
https://www.dropbox.com/s/6cx083t1yr3o7ja/Snidrs Model Format v0.8.1.zip?dl=0
 

Kentae

Member
Ahh well that explains a lot, I had v0.8 on my computer still so I decided to test that version and it works fine. I was about to edit my post here to include that information but then you had already replied with an explaination so I guess it's kind of moot now.

Thanks for the link to the previous version though, can't wait to fiddle around with it :)
(I actually work as an animator profesionally so this is really exciting to me xD and I'm also kind of stuck on the idea of making 3D games with GMS :p)
 

TheSnidr

Heavy metal viking dentist
GMC Elder
I managed to work on it a little on my trusty old laptop, so here's a new version:
https://www.dropbox.com/s/qoq90u0145x1ote/Snidrs Model Format v0.8.4.zip?dl=0
The format is changed to make editing faster; the tool no longer has to generate skinning information, a process that sometimes could take minutes. Instead, the skinning information is loaded straight from the .obj model the first time it's imported, and saved in the .smf format afterwards. This also means the .smf format is changed, but the new loading script supports both the old and the new version of the format! When loading old .smf files now, the skinning information is generated the same way as before, but once you save the model, it won't have to do that again.
Code:
/// @description smf_model_load(fname)
/// @param fname
/*
Load an SMF model

Script made by TheSnidr
www.TheSnidr.com
*/
var path, loadBuff, header, version, size, vertBuff, vBuff, n, vertList;
path = argument0;
if !file_exists(path){return -1;}
loadBuff = buffer_load(path);
header = buffer_read(loadBuff, buffer_u16);
version = buffer_read(loadBuff, buffer_string);

if !string_count("SnidrsModelFormat", version)
{
    //This is an old version of the format
    vBuff = vertex_create_buffer_from_buffer(loadBuff, SMF_format);
}
else if string_count("1.0", version)
{
    //This is the most recent version of the format this importer can read
    size = buffer_read(loadBuff, buffer_u32);
    vertBuff = buffer_create(10, buffer_grow, 1);
    buffer_copy(loadBuff, buffer_tell(loadBuff), size, vertBuff, 0);
    vBuff = vertex_create_buffer_from_buffer(vertBuff, SMF_format);
    buffer_delete(vertBuff);
}
else
{
    show_message("This model was made with a newer version of the SMF format and is not supported");
}
buffer_delete(loadBuff);

return vBuff;
This change is especially nice for working with large models. The engine has also seen many small improvements in speed.
I'm planning a fairly large overhaul of the format by the way, to allow exporting models with multiple textures (basically splitting them up into multiple models within the same .smf file).
 

Misty

Member
Ok, so I finally got enough energy to check this out.

Sad to say the collision engine is very buggy, I have glitched through the map several times, and when I hit the castle arch I just go through it. The raytracing system and also very laggy. I may still use the animation software for something though.

I checked out the new version, and I don't see any GM project files in it.
 

zendraw

Member
so i got this error tryin to play an animation, linear.
Code:
FATAL ERROR in
action number 1
of  Step Event0
for object oRigSystem:

local variable i(100012, -2147483648) not set before reading it.
at gml_Script_rig_create_sample_interpolated
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Script_rig_create_sample_interpolated (line 0)
gml_Object_oRigSystem_Step_0
 

TheSnidr

Heavy metal viking dentist
GMC Elder
Ok, so I finally got enough energy to check this out.

Sad to say the collision engine is very buggy, I have glitched through the map several times, and when I hit the castle arch I just go through it. The raytracing system and also very laggy. I may still use the animation software for something though.

I checked out the new version, and I don't see any GM project files in it.
Did you use an old version? The GMS 1.4 version isn't entirely up to date, the GMS 2 version is fairly stable!

Can't wait for the new update~
Me neither! :D I've been occupied IRL with selling my apartment and moving to a new city, so I haven't been able to use my desktop for a while - and programming on my laptop isn't the same xD

so i got this error tryin to play an animation, linear.
Code:
FATAL ERROR in
action number 1
of  Step Event0
for object oRigSystem:

local variable i(100012, -2147483648) not set before reading it.
at gml_Script_rig_create_sample_interpolated
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Script_rig_create_sample_interpolated (line 0)
gml_Object_oRigSystem_Step_0
Ouch, thank you for the heads up! That bug must've been in there for a loong time, I just haven't found it since I usually only use the quadratic interpolation xD
I've fixed it and uploaded a new version ;)
 

Misty

Member
Did you use an old version? The GMS 1.4 version isn't entirely up to date, the GMS 2 version is fairly stable!


Me neither! :D I've been occupied IRL with selling my apartment and moving to a new city, so I haven't been able to use my desktop for a while - and programming on my laptop isn't the same xD


Ouch, thank you for the heads up! That bug must've been in there for a loong time, I just haven't found it since I usually only use the quadratic interpolation xD
I've fixed it and uploaded a new version ;)
I dont see any gameplay files in any of the new versions, just links to the model editor.
 

TheSnidr

Heavy metal viking dentist
GMC Elder
I'm working on a fairly large update! I'm having some trouble with a bug in gm, but I'll work around it for now.

The next update will let you load multiple textures, and even load material files (to some extent). I'm considering making the smf format save everything about the model. That is, it may include the model(s) itself, its textures, rig, animations and collision buffer, so that you only export and import one file! What are your thoughts on this?
 

Kentae

Member
Sounds awesome! :)

Although I think you should make the collision stuff an option to export, cuz I don't think everyone is up for using it :p
I'm at least using another collision system in my projects so it would be unnecessary info for my part hehe ^^

Also I have a suggestion if it's okay.
Actually I don't know if it's already possible but it would be awesome if we could temporarily load in props, like guns, for making things like reload animations easier :)
 

GMWolf

aka fel666
The next update will let you load multiple textures, and even load material files (to some extent). I'm considering making the smf format save everything about the model. That is, it may include the model(s) itself, its textures, rig, animations and collision buffer, so that you only export and import one file! What are your thoughts on this?
Yes that would be great!
Perhaps develop a modular file format: you could add any kind of inf o you like, wrapped with headers.
That way you can include /exclude the info you need / dont need.
 

TheSnidr

Heavy metal viking dentist
GMC Elder
Forgot to mention I'm making it modular ;) Collision models can't be animated anyway, so storing both would be pointless. Storing textures will be optional, as it's very convenient, but takes up more storage since they're completely uncompressed.

Excellent suggestion Kentae! That will actually inherently be possible with the new model system, you could load a gun model as a "sub-model" and move it to the player's hand and attach it to the hand bone, then when exporting the player, you simply hide the gun!
 

GMWolf

aka fel666
Storing textures will be optional, as it's very convenient, but takes up more storage since they're completely uncompressed.
You could at least go with a targa compression, its really simple, and is what tends to be used in games anyways for non-colour data.

LOD would also be great to have! And perhaps even multiple vertex buffers per model? (leading to eventually separate material/shaders, etc for each?)

regardless of if you get these in, this is shaping up quite good! Like proper 3d support for GM! Amazing work!
 

Morendral

Member
@TheSnidr thank you for making this, it's very nice to have this 3d functionality in gm.

I was wondering if you would be able to add something to your example program that would translate from the 2d screen to 3d coordinates. Much like you already have, but where the mouse isn't tired to the camera so that I could gain functionality as in an RTS type game. The goal is to be able to take the ray and figure out what instance it is touching. I can manage that, but I don't understand the vector math to rework your example so that the vector goes through my mouse to a point in space and it is independent of the camera view.

I've looked online and in the legacy forums where I remembered some examples to do this, but I can't seem to make them work with what you've made. I've also tried reverse engineering what you have in your example, but the best I can figure is that the xFrom starts from a point behind the camera and passes directly through it to figure where the camera is pointing.

Any help you could provide would be greatly appreciated. Again, thanks for making this for the community!
 
Top