SMF - 3D skeletal animation - Now with a custom Blender exporter!

DukeSoft

Member
If you make a gm 1.4 port with such light effects that, you will be remembered in prayers of full asses who still use 1.4 :p. It would be the greatest thing ever happened to the half assed programmers who are waiting for a humble bundle of gm 2.0 for $15.:D
Yeah, but GMS1.4 differs way too much - you don't have proper vertex buffers and its still HLSL9. Port from 1.4 to 2 is much easier than 2 to 1.4, so I'm quite sure this is not going to happen. Ever :p
 

DukeSoft

Member
what do you mean by proper vertex buffers? Vertex buffers and formats where already there in 1.4.
I thought there were only the d3d functions? Or is it the just d3d functions that have been removed (and the draw_set replaced with gpu_)?
Am I maybe thinking about matrixes?
 

TheSnidr

Heavy metal viking dentist
GMC Elder
GMS 1.4 has everything it needs to run this. The reason I don't keep it updated is because it takes a lot of time to rewrite the scripts to work in 1.4, and since it's a dying program I honestly don't think it's worth the hassle. The people still using it will have to upgrade at some point anyway.

im adding new metarials but cant change

############################################################################################
FATAL ERROR in
action number 1
of Step Event0
for object oRigSystem:

Unable to find any instance for object index '100184' name '<undefined>'
at gml_Script_press_buttons
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Script_press_buttons (line -1)
gml_Object_oRigSystem_Step_0
Thank you for the error report, I will look into this!
 

GMWolf

aka fel666
GMS 1.4 has everything it needs to run this. The reason I don't keep it updated is because it takes a lot of time to rewrite the scripts to work in 1.4, and since it's a dying program I honestly don't think it's worth the hassle. The people still using it will have to upgrade at some point anyway.


Thank you for the error report, I will look into this!
Yeah, I wouldn't bother porting either.
 
D

dc321321

Guest
And my android (7.1.1) device didnt show the models. I look forward to updating. Many thanks for the application!
 

Morendral

Member
I started a little project trying to use this, and I've run into a snag. I can't quite figure out how to put an object in the hand of a character, specifically holding a weapon. I know the bone number of the rig I want to attach it to, but I don't know how to reference the bone and it's information to draw it in the correct place. I had this working with the previous versions, but it looks like that functionality has been removed. Is there any chance you could bring that back?

The previous code involved making a frame and getting a sample from that, then setting some matrices.

EDIT:
I'm still unable to make it work after trying with it. The "smf_sample_get_bone_orientation"script that is supposed to get the dual quats for the bone from the model says that "S" isn't recognized as a valid array. I'm not sure why though as it looks ok to me. Here is the code for reference:

Code:
var armLocalMatrix = smf_matrix_create_from_dualquat(smf_sample_get_bone_orientation(sample, 14));
var gunLocalMatrix = matrix_multiply(matrix_build(0, 0, 0, 90, 0, 0, 1, 1, 1), armLocalMatrix);
var gunWorldMatrix = matrix_multiply(gunLocalMatrix, oMat);
matrix_set(matrix_world, gunWorldMatrix);
smf_model_draw(modRifleM16);
matrix_set(matrix_world, matrix_build_identity());
 
Last edited:

TheSnidr

Heavy metal viking dentist
GMC Elder
I started a little project trying to use this, and I've run into a snag. I can't quite figure out how to put an object in the hand of a character, specifically holding a weapon. I know the bone number of the rig I want to attach it to, but I don't know how to reference the bone and it's information to draw it in the correct place. I had this working with the previous versions, but it looks like that functionality has been removed. Is there any chance you could bring that back?

The previous code involved making a frame and getting a sample from that, then setting some matrices.

EDIT:
I'm still unable to make it work after trying with it. The "smf_sample_get_bone_orientation"script that is supposed to get the dual quats for the bone from the model says that "S" isn't recognized as a valid array. I'm not sure why though as it looks ok to me. Here is the code for reference:

Code:
var armLocalMatrix = smf_matrix_create_from_dualquat(smf_sample_get_bone_orientation(sample, 14));
var gunLocalMatrix = matrix_multiply(matrix_build(0, 0, 0, 90, 0, 0, 1, 1, 1), armLocalMatrix);
var gunWorldMatrix = matrix_multiply(gunLocalMatrix, oMat);
matrix_set(matrix_world, gunWorldMatrix);
smf_model_draw(modRifleM16);
matrix_set(matrix_world, matrix_build_identity());
Hey! Sorry for late answer, I will look into this as soon as possible! Your code looks good to me, so the error must be on my part...

EDIT:
The code works for me though o.o Are you sure the rig has 14 bones? In the model tool, you can enable "Show bone indices" to see the index of each bone, use this index in the script to reference your desired bone. I should make the script produce an informative error when trying to access a bone that's not in the skeleton, thanks for the headsup!
If the rig does have a 14th bone however, I'd like to know the contents of the bindPose list! Try putting this piece of code in the smf_sample_get_bone_orientation script and paste the results:
Code:
var str = "";
for (var i = 0; i < ds_list_size(bindPose); i ++)
{
    str += string(bindPose[| i]) + "\n";
}
clipboard_set_text(str)
 
Last edited:
C

Chris Goodwin

Guest
Is this suppose to be compatible with HTML5?
FYI: If I do an export of the example project file and upload it I get this: VIEW LINK
HTML5 (if possible) would be wonderful considering the new addition to Facebook Instant Games :)
 

DukeSoft

Member
It is, but not yet :p Someone made a custom version of the HTML5 compiler which made it work, so I assume somewhere in the near future it will be supported... As of now - nope :(
 
Last edited:

Morendral

Member
Hey! Sorry for late answer, I will look into this as soon as possible! Your code looks good to me, so the error must be on my part...

EDIT:
The code works for me though o.o Are you sure the rig has 14 bones? In the model tool, you can enable "Show bone indices" to see the index of each bone, use this index in the script to reference your desired bone. I should make the script produce an informative error when trying to access a bone that's not in the skeleton, thanks for the headsup!
If the rig does have a 14th bone however, I'd like to know the contents of the bindPose list! Try putting this piece of code in the smf_sample_get_bone_orientation script and paste the results:
Code:
var str = "";
for (var i = 0; i < ds_list_size(bindPose); i ++)
{
    str += string(bindPose[| i]) + "\n";
}
clipboard_set_text(str)
Thanks for taking a look at this, the math involved is beyond me. The rig has a total of 27 bones, so that shouldn't be a problem. The issue is that inside that script it tells me "illegal array use" or another similar error. I have tracked it to the "S" array, and did a band-aid fix to it to get it to at least run.

Here is the original script for reference:
Code:
/// @description smf_sample_get_bone_orientation(sample, boneIndex)
/// @param sample
/// @param boneIndex
/*
Returns the dual quaternion of the given bone
*/
var bindPose, modelIndex, bone, sample, R, S, Q, i;
sample = argument0;
bone = argument1;
modelIndex = sample[array_length_1d(sample) - 1];
bindPose = modelIndex[| SMF_model.BindPose];
S = bindPose[| bone];
i = 8;
while i--{R[i] = sample[bone * 8 + i];}
Q[0] = R[3] * S[0] + R[0] * S[3] + R[1] * S[2] - R[2] * S[1];
Q[1] = R[3] * S[1] + R[1] * S[3] + R[2] * S[0] - R[0] * S[2];
Q[2] = R[3] * S[2] + R[2] * S[3] + R[0] * S[1] - R[1] * S[0];
Q[3] = R[3] * S[3] - R[0] * S[0] - R[1] * S[1] - R[2] * S[2];
Q[4] = R[3] * S[4] + R[0] * S[7] + R[1] * S[6] - R[2] * S[5] + R[7] * S[0] + R[4] * S[3] + R[5] * S[2] - R[6] * S[1];
Q[5] = R[3] * S[5] + R[1] * S[7] + R[2] * S[4] - R[0] * S[6] + R[7] * S[1] + R[5] * S[3] + R[6] * S[0] - R[4] * S[2];
Q[6] = R[3] * S[6] + R[2] * S[7] + R[0] * S[5] - R[1] * S[4] + R[7] * S[2] + R[6] * S[3] + R[4] * S[1] - R[5] * S[0];
Q[7] = R[3] * S[7] - R[0] * S[4] - R[1] * S[5] - R[2] * S[6] + R[7] * S[3] - R[4] * S[0] - R[5] * S[1] - R[6] * S[2];
return smf_dualquat_normalize(Q);
The program throws an error on the Q[0]= line when trying to access the S[0].

I replaced S = bindPose[| bone]; with for (i=0;i<=9;i++) { S = real(bindPose[| i]); }

It kind of works now, as the gun model moves in a fashion consistent with how that bone moves relative to the rest of the rig, but is no where near correct.

Here is the result of the code you requested, showing the matrices of all 27 bones.
{ { 0,0,-0.71,0.71,-0.11,-0.11,1.68,1.68,0,0 }, }

{ { 0.50,-0.50,0.50,0.50,1.44,1.59,1.59,-1.44,0,1 }, }

{ { -0.11,-0.14,-0.73,0.65,0.40,-0.58,1.61,1.76,0,1 }, }

{ { 0.53,0.28,-0.63,0.49,-0.05,0.35,0.98,1.11,2,1 }, }

{ { 0.55,0.40,-0.62,0.40,0.29,-0.34,0.34,0.47,3,1 }, }

{ { 0.62,0.03,-0.03,0.78,0.14,-0.48,0.51,-0.07,4,1 }, }

{ { 0.11,-0.14,0.73,0.66,0.41,0.57,1.62,-1.75,0,1 }, }

{ { 0.65,0.43,-0.54,0.31,-0.90,0.99,0.05,0.61,6,1 }, }

{ { 0.61,0.41,-0.60,0.32,-0.50,0.17,-0.44,-0.08,7,1 }, }

{ { 0.89,0.02,-0.04,0.45,0.06,0.39,-0.54,-0.18,8,1 }, }

{ { 0.51,-0.49,0.49,0.51,2.01,2.20,2.20,-2.01,1,1 }, }

{ { 0.44,-0.46,-0.54,0.55,2.13,1.53,2.61,2.11,10,1 }, }

{ { -0.49,-0.51,0.49,0.51,2.34,-1.76,2.47,-1.89,10,1 }, }

{ { 0.53,-0.47,0.47,0.53,2.12,2.44,2.44,-2.12,10,1 }, }

{ { 0.56,-0.43,0.43,0.56,2.16,2.79,2.79,-2.16,13,1 }, }

{ { -0.61,-0.34,0.62,0.34,2.02,-1.83,2.08,-2.01,12,1 }, }

{ { -0.75,-0.25,0.49,0.37,1.80,-1.91,2.55,-1.05,15,1 }, }

{ { -0.60,-0.45,0.55,0.38,2.67,-1.26,2.39,-0.72,16,1 }, }

{ { -0.71,-0.28,0.65,0.04,2.28,-2.24,1.60,-1.30,17,1 }, }

{ { 0.71,0.01,-0.51,0.49,-0.96,3.30,-0.01,1.35,18,1 }, }

{ { 0.58,-0.29,-0.65,0.40,1.87,1.57,2.27,2.14,11,1 }, }

{ { 0.70,-0.21,-0.51,0.45,1.69,1.64,2.76,1.23,20,1 }, }

{ { 0.62,-0.31,-0.55,0.47,2.25,1.14,2.75,1.03,21,1 }, }

{ { 0.66,-0.13,-0.61,0.43,1.84,1.29,2.76,1.47,22,1 }, }

{ { -0.69,-0.11,0.62,0.35,-0.87,-3.00,-0.42,-1.93,23,1 }, }

{ { 0.66,0.04,-0.11,0.74,0.40,-0.46,0.52,-0.25,5,1 }, }

{ { 0.67,0.15,-0.04,0.73,0.26,0.54,-0.37,-0.37,9,1 }, }
 

Attachments

TheSnidr

Heavy metal viking dentist
GMC Elder
Is this suppose to be compatible with HTML5?
FYI: If I do an export of the example project file and upload it I get this: VIEW LINK
HTML5 (if possible) would be wonderful considering the new addition to Facebook Instant Games :)
I'm still waiting for the next update for GMS2... It's been so long o.o
I got some help from someone who shall remain unnamed to make it work in HTML5, but this individual had to modify the source of GMS2 to make it work. I'm hoping this will make it to the next version!

Thanks for taking a look at this, the math involved is beyond me. The rig has a total of 27 bones, so that shouldn't be a problem. The issue is that inside that script it tells me "illegal array use" or another similar error. I have tracked it to the "S" array, and did a band-aid fix to it to get it to at least run.

Here is the original script for reference:
Code:
/// @description smf_sample_get_bone_orientation(sample, boneIndex)
/// @param sample
/// @param boneIndex
/*
Returns the dual quaternion of the given bone
*/
var bindPose, modelIndex, bone, sample, R, S, Q, i;
sample = argument0;
bone = argument1;
modelIndex = sample[array_length_1d(sample) - 1];
bindPose = modelIndex[| SMF_model.BindPose];
S = bindPose[| bone];
i = 8;
while i--{R[i] = sample[bone * 8 + i];}
Q[0] = R[3] * S[0] + R[0] * S[3] + R[1] * S[2] - R[2] * S[1];
Q[1] = R[3] * S[1] + R[1] * S[3] + R[2] * S[0] - R[0] * S[2];
Q[2] = R[3] * S[2] + R[2] * S[3] + R[0] * S[1] - R[1] * S[0];
Q[3] = R[3] * S[3] - R[0] * S[0] - R[1] * S[1] - R[2] * S[2];
Q[4] = R[3] * S[4] + R[0] * S[7] + R[1] * S[6] - R[2] * S[5] + R[7] * S[0] + R[4] * S[3] + R[5] * S[2] - R[6] * S[1];
Q[5] = R[3] * S[5] + R[1] * S[7] + R[2] * S[4] - R[0] * S[6] + R[7] * S[1] + R[5] * S[3] + R[6] * S[0] - R[4] * S[2];
Q[6] = R[3] * S[6] + R[2] * S[7] + R[0] * S[5] - R[1] * S[4] + R[7] * S[2] + R[6] * S[3] + R[4] * S[1] - R[5] * S[0];
Q[7] = R[3] * S[7] - R[0] * S[4] - R[1] * S[5] - R[2] * S[6] + R[7] * S[3] - R[4] * S[0] - R[5] * S[1] - R[6] * S[2];
return smf_dualquat_normalize(Q);
The program throws an error on the Q[0]= line when trying to access the S[0].

I replaced S = bindPose[| bone]; with for (i=0;i<=9;i++) { S = real(bindPose[| i]); }

It kind of works now, as the gun model moves in a fashion consistent with how that bone moves relative to the rest of the rig, but is no where near correct.

Here is the result of the code you requested, showing the matrices of all 27 bones.
{ { 0,0,-0.71,0.71,-0.11,-0.11,1.68,1.68,0,0 }, }

{ { 0.50,-0.50,0.50,0.50,1.44,1.59,1.59,-1.44,0,1 }, }

{ { -0.11,-0.14,-0.73,0.65,0.40,-0.58,1.61,1.76,0,1 }, }

{ { 0.53,0.28,-0.63,0.49,-0.05,0.35,0.98,1.11,2,1 }, }

{ { 0.55,0.40,-0.62,0.40,0.29,-0.34,0.34,0.47,3,1 }, }

{ { 0.62,0.03,-0.03,0.78,0.14,-0.48,0.51,-0.07,4,1 }, }

{ { 0.11,-0.14,0.73,0.66,0.41,0.57,1.62,-1.75,0,1 }, }

{ { 0.65,0.43,-0.54,0.31,-0.90,0.99,0.05,0.61,6,1 }, }

{ { 0.61,0.41,-0.60,0.32,-0.50,0.17,-0.44,-0.08,7,1 }, }

{ { 0.89,0.02,-0.04,0.45,0.06,0.39,-0.54,-0.18,8,1 }, }

{ { 0.51,-0.49,0.49,0.51,2.01,2.20,2.20,-2.01,1,1 }, }

{ { 0.44,-0.46,-0.54,0.55,2.13,1.53,2.61,2.11,10,1 }, }

{ { -0.49,-0.51,0.49,0.51,2.34,-1.76,2.47,-1.89,10,1 }, }

{ { 0.53,-0.47,0.47,0.53,2.12,2.44,2.44,-2.12,10,1 }, }

{ { 0.56,-0.43,0.43,0.56,2.16,2.79,2.79,-2.16,13,1 }, }

{ { -0.61,-0.34,0.62,0.34,2.02,-1.83,2.08,-2.01,12,1 }, }

{ { -0.75,-0.25,0.49,0.37,1.80,-1.91,2.55,-1.05,15,1 }, }

{ { -0.60,-0.45,0.55,0.38,2.67,-1.26,2.39,-0.72,16,1 }, }

{ { -0.71,-0.28,0.65,0.04,2.28,-2.24,1.60,-1.30,17,1 }, }

{ { 0.71,0.01,-0.51,0.49,-0.96,3.30,-0.01,1.35,18,1 }, }

{ { 0.58,-0.29,-0.65,0.40,1.87,1.57,2.27,2.14,11,1 }, }

{ { 0.70,-0.21,-0.51,0.45,1.69,1.64,2.76,1.23,20,1 }, }

{ { 0.62,-0.31,-0.55,0.47,2.25,1.14,2.75,1.03,21,1 }, }

{ { 0.66,-0.13,-0.61,0.43,1.84,1.29,2.76,1.47,22,1 }, }

{ { -0.69,-0.11,0.62,0.35,-0.87,-3.00,-0.42,-1.93,23,1 }, }

{ { 0.66,0.04,-0.11,0.74,0.40,-0.46,0.52,-0.25,5,1 }, }

{ { 0.67,0.15,-0.04,0.73,0.26,0.54,-0.37,-0.37,9,1 }, }
Thank you for posting that, looks like the bind pose doesn't contain any undefined values. I do have a theory as to why the gun appears at the wrong location: You multiply oMat with another matrix before drawing the player, but don't do this for the gun.
Using my code as a reference, here's how I'd write it:
Code:
var playerWorldMatrix = matrix_multiply(matrix_build(0, 0, -radius, 0, 0, 0, scale, scale, scale), oMat); //<-- This is changed
matrix_set(matrix_world, playerWorldMatrix);
smf_model_draw(modPlayer, sample);
matrix_set(matrix_world, matrix_build_identity());

var armLocalMatrix = smf_matrix_create_from_dualquat(smf_sample_get_bone_orientation(sample, 4));
var gunLocalMatrix = matrix_multiply(matrix_build(0, 0, 0, 0, 0, 0, 1, 1, 1), armLocalMatrix);
var gunWorldMatrix = matrix_multiply(gunLocalMatrix, playerWorldMatrix); //<-- Notice I use the player's world matrix, not oMat directly
matrix_set(matrix_world, gunWorldMatrix);
smf_model_draw(modGun);
matrix_set(matrix_world, matrix_build_identity());
Give this a try and see how it goes!
 
Last edited:

Morendral

Member
I'm still waiting for the next update for GMS2... It's been so long o.o
I got some help from someone who shall remain unnamed to make it work in HTML5, but this individual had to modify the source of GMS2 to make it work. I'm hoping this will make it to the next version!


Thank you for posting that, looks like the bind pose doesn't contain any undefined values. I do have a theory as to why the gun appears at the wrong location: You multiply oMat with another matrix before drawing the player, but don't do this for the gun.
Using my code as a reference, here's how I'd write it:
Code:
var playerWorldMatrix = matrix_multiply(matrix_build(0, 0, -radius, 0, 0, 0, scale, scale, scale), oMat); //<-- This is changed
matrix_set(matrix_world, playerWorldMatrix);
smf_model_draw(modPlayer, sample);
matrix_set(matrix_world, matrix_build_identity());

var armLocalMatrix = smf_matrix_create_from_dualquat(smf_sample_get_bone_orientation(sample, 4));
var gunLocalMatrix = matrix_multiply(matrix_build(0, 0, 0, 0, 0, 0, 1, 1, 1), armLocalMatrix);
var gunWorldMatrix = matrix_multiply(gunLocalMatrix, playerWorldMatrix); //<-- Notice I use the player's world matrix, not oMat directly
matrix_set(matrix_world, gunWorldMatrix);
smf_model_draw(modGun);
matrix_set(matrix_world, matrix_build_identity());
Give this a try and see how it goes!
Still not working properly, unfortunately. The rifle has shifted down to the ground, much more of the orientation in which it was laid out in the editor. It also does something odd, in which at points during the animation the rifle will spontaneously jump to another spot for a second, then return to the regular movement it had.
 

EMPixed

Member
Huh, I wouldn't of imagined that SMF wouldn't be compatible with HTML5. Natrually I shouldn't assume things, but I DID assume that SMF would work with HTML5. If that's the case and you had to have someone use GMS2's source, then the question on commercial use for any project in the HTML5 format would come up, splitin' hairs at the point though so it'd just be best to stick with a local executable than a web executable for a commercial project, alas though, the question remains if commercial use of SMF with GMS2Web floats around, it'll probably get fixed up as more time elapses. Still, not mandatory but how would one make this work anyway, considered the fact that YoYoGames I really doubt would approve of somethin' like this as it uses their GMS2's source. Any additional information about this that'd help anyone that'd be interested, cause it honestly seems like a nasty hurdle when seen from the surface.

Aaaaaanndd just like that I sound more like I'm interested in money than actual game design, peoples, I have the passion for game design and game development as I have plans to make a 3D horror game usin' SMF in HTML5 if possible, of course!(Just need to be tutored in person it all, I'll cross that bridge when I get to it.) Also have a Space Invaders/Galage/General Classic Space Shooter in a 3D environment in mind here as well to help get a feel for 3D use in GMS2. From what I seen before, it was shown that when bones are to be applied, or for shortened reference; "when rigging", you pick and choose the vertices on the model that you want the bone to manipulate. This rig process would be a snap when you'd use voxel models(tools like Qubicle and MagicaVoxel are designed for craftin' voxel models; Blender seems to use voxels too for when you'd make fire and smoke, so this is why I say all this- just so everyone knows EXACTLY what I mean) as they are based on just literal cubes.

It was mentioned that models made in Blender(as well as other model editors used to make models) can be used in SMF, you just can't transfer bone data over from any common model editor to SMF, correct? I remember that this was spouted out about somewhere previously in the thread. Thankfully I've actually been gettin' into Blender and I only recall seein' this information mentioned, like, once before, but I digress.

I understand it's not inheritably on topic per se, but what if I share a couple of images of I've made, I guess to better illustrate my point; quick side note- none of these were made in SMF hence why I said that it's not exactly on topic 100%. Just a quick heads up!
 

DukeSoft

Member
"considered the fact that YoYoGames I really doubt would approve of somethin' like this as it uses their GMS2's source" ?

Are you saying YoYoGames would not approve of anyone using their engine and compiler to make HTML5 games? :S
 

EMPixed

Member
"considered the fact that YoYoGames I really doubt would approve of somethin' like this as it uses their GMS2's source" ?
Are you saying YoYoGames would not approve of anyone using their engine and compiler to make HTML5 games? :S
Oh no, They've already approved commercial use of Game Maker in general, what I mean is that the use of GMS2's source is used SMF accordin' to Snidr, or that's at least the way I took it.

I'm still waiting for the next update for GMS2... It's been so long o.o
I got some help from someone who shall remain unnamed to make it work in HTML5, but this individual had to modify the source of GMS2 to make it work. I'm hoping this will make it to the next version!
This is what I referenced before @DukeSoft . By the way it sounds, SMF uses the GMS2 source. I would assumed that this wouldn't be legally usable in commercial use if you used SMF in HTML5, possibly because of different legal circumstances that would be for the GMS2 source and wouldn't be the same as GMS2's normal uses, not that HTML5 isn't allowed for commercial use. It feels like I've repeated myself here, but that's probably due to the fact I need to snooze, if this sounds no different to that of what I originally said, then I'll clarify later.

To the point, I assumed the worst on this. Will clarify if needed later.
 
Last edited:

DukeSoft

Member
Oh no, They've already approved commercial use of Game Maker in general, what I mean is that the use of GMS2's source is used SMF accordin' to Snidr, or that's at least the way I took it.


This is what I referenced before @DukeSoft . By the way it sounds, SMF uses the GMS2 source. I would assumed that this wouldn't be legally usable in commercial use if you used SMF in HTML5, possibly because of different legal circumstances that would be for the GMS2 source and wouldn't be the same as GMS2's normal uses, not that HTML5 isn't allowed for commercial use. It feels like I've repeated myself here, but that's probably due to the fact I need to snooze, if this sounds no different to that of what I originally said, then I'll clarify later.

To the point, I assumed the worst on this. Will clarify if needed later.
Oh, no :) TheSnidr told someone at YoYo about the issue, and someone from YoYoGames edited their compiler to make TheSnidr's SMF work in HTML5 :) Its was just quick and dirty so we'll have to wait until this fix is done properly and is included in the actual release of GMS2.
 

EMPixed

Member
Oh, no :) TheSnidr told someone at YoYo about the issue, and someone from YoYoGames edited their compiler to make TheSnidr's SMF work in HTML5 :) Its was just quick and dirty so we'll have to wait until this fix is done properly and is included in the actual release of GMS2.
Aahhh! Okay, now this makes more sense now! I responded givin' a mildly-salty response on my end, but alas we can get this way over bein' tired and such. Thanks for pointin' out that SMF is just usin' a later version of GMS2, honestly, not surprised with myself on how I misunderstood what was actually meant here. Lol, this is what I get for such an assumption! :D
 
Last edited:

TheSnidr

Heavy metal viking dentist
GMC Elder
Update 0.9.5 is out
Rough overview of changes:
- Removed model compiling from the Import scripts and added it to a separate tab in the model tool called "Export". Here you can import models into batches that can be compiled together. There's a short tutorial on how to use it in the tab as well. Compiling a model puts all its textures onto texture pages, and combines its vertex buffers into one. This can give a boost since the game gets slower the more vertex_submits you have, but it can also bloat the file, since triangles with repeating textures have to be tesselated. So use it with care!
- Shadowmaps are now usable, although only through code. Will add proper shadowmap support in the model tool later.
- Included demo on how to move from one level to another.
- Models have to be marked as either static or dynamic. If static is turned on, the level editor is enabled and animation is disabled. If it's off, then the level editor will be disabled while animation is enabled.
- Various bugfixes
Download

 
Last edited:
C

Chris Goodwin

Guest
@EMPixed, with the latest update to the GMS2 runner, SMF now works in HTML5! :D All files have to be asynchronously loaded though, so a minor modification of the loading system will be necessary.
This is great news! Do we need to load all included .smf files via the oSystem object > Asynchronous HTTP? What would that call look like? Thanks in advance.
 

TheSnidr

Heavy metal viking dentist
GMC Elder
Hotfix to make SMF work in HTML5:
Download Version 0.9.55
Changes:
The argument for smf_model_load has been changed from a file path, to an already loaded buffer. This is to facilitate asynchronous loading. Asynchronous loading should be used for loading in all exporters, not just HTML5. I've also added the following scripts for easier asynchronous loading:
  • smf_async_load_start(fname): Adds the given .smf model to the async loading queue
  • smf_async_load_update(): When used in Async Save/Load event, checks if the current buffer has been loaded. If it has, load it into SMF and start loading the next buffer.
  • smf_async_finished(): Returns true if there are no models left in the async loading queue
  • smf_get_model(name): Returns the index of a model with the given name. The name can be just the model name, it can be the model name with .smf at the end, or it can be the full path to the model. If the model has not been loaded, -1 is returned.
I've updated the import scripts example so that you can see it in action!
I've also compiled an HTML5 version of it, which is available here:
https://thesnidr.itch.io/smf-demo
Loading models with internal textures is slow, so when making games for HTML5 I'd really recommend making use of the export options in the Export tab!
 
Last edited:
M

MrPr1993

Guest
Look at all that! How much you've done so far ^w^ Can't wait for the next update~
 

TheSnidr

Heavy metal viking dentist
GMC Elder
Okay, time for an update!
Download SMF v0.9.6
Changes to the model tool
  • Improvements to the material creator
  • Models are compressed when exporting and decompressed when loading
  • Fixed a lot of bugs
  • Added a bunch of new bugs
Changes to the import scripts
  • Renamed the async loading scripts and reverted back to having the path to a model file as an argument in smf_model_load
  • Added a limited dynamic model creation system, similar to the vertex_ functions. You can also create a special collision buffer. This collision buffer uses a quad tree instead of an octree, ignoring the z-dimension. This will make it more feasible for use ingame, since most games take place on flat ground with z as up anyway.
  • Bunch of small changes behind the scenes
  • Added a new demo - A level from Mario Kart:

Next thing I'm gonna add is more collision scripts. Collisions with spheres, cubes and other primitives are useful!
 
S

Squisher

Guest
Afternoon!(in my neck of the world as of the time of this writing)
I'm working on a Blender script to be able to export rigged animated Snidr format models and so far it's coming along pretty swell. Should I post information about it here or start a new topic? :eek:
 

CMAllen

Member
Afternoon!(in my neck of the world as of the time of this writing)
I'm working on a Blender script to be able to export rigged animated Snidr format models and so far it's coming along pretty swell. Should I post information about it here or start a new topic? :eek:
Awe. Some.
 

TheSnidr

Heavy metal viking dentist
GMC Elder
Afternoon!(in my neck of the world as of the time of this writing)
I'm working on a Blender script to be able to export rigged animated Snidr format models and so far it's coming along pretty swell. Should I post information about it here or start a new topic? :eek:
Omg, that would be incredible! Give me a holler if you want some help in the process! :D
 
S

Squisher

Guest
Omg, that would be incredible! Give me a holler if you want some help in the process! :D
I will, thanks! :D There's definitely some questions I'll have in the future. I don't have GMS2 so if there's any shift in the format I can't look at it. As of right now, I've managed to get Blender to export rigged models and armatures in a format Game Maker can understand. Albeit in a very simple and unintuitive way. I'm going to try to have Blender export models directly to the Snidr format, but if I can't, I'll provide a go-between program that will convert (and compress, since that's now a thing :D) whatever Blender can export directly into a Snidr-compatible buffer file. Once the models are a go, I'll look into trying to get Blender's material nodes to export to the new material stuff that's been developed recently. So models should be pretty much ready to be implemented into games, materials and all, right at export. That's further down the line, though. But at least for now Blender can get some kind of model, rigging, and animation into Game Maker.
Hope this helps!
 

JaimitoEs

Member
I can see an epic battle with 2 new 3d projects, and you are sharing this piece as open source, you are awesome! I´m very happy to see this kinds of evolution for GMS, thanks to this, probaly YoYoGames are thinking on new
utilities after take a look on this..... Congratulations for your massive work.:)
 

Joe Ellis

Member
I can see an epic battle with 2 new 3d projects, and you are sharing this piece as open source, you are awesome! I´m very happy to see this kinds of evolution for GMS, thanks to this, probaly YoYoGames are thinking on new
utilities after take a look on this..... Congratulations for your massive work.:)
Is the other project you're talking about mine? I don't really see a battle, just two people have come to the same conclusion at the same time, was bound to happen sooner or later, plus, if this project is free, what is there to compete \ battle about?

I just wanna say I'm not competing in any way, hopefully all the people that don't like my software will use Snidr's and vice versa, then everyone will be happy and be able to make 3d games with gamemaker :p
 

JaimitoEs

Member
Is the other project you're talking about mine? I don't really see a battle, just two people have come to the same conclusion at the same time, was bound to happen sooner or later, plus, if this project is free, what is there to compete \ battle about?

I just wanna say I'm not competing in any way, hopefully all the people that don't like my software will use Snidr's and vice versa, then everyone will be happy and be able to make 3d games with gamemaker :p
When I say battle, I say it affectionately;), not because of the price of each piece of software, but because you have probably felt curiosity to compare your creations, each one offers unique tools. This is all positive and productive for the Game Maker community.
 

TheSnidr

Heavy metal viking dentist
GMC Elder
Small update - working on FBX format support, currently only loads the bind pose:

Thanks to @dphsw and @Joe Ellis for making this possible! Dphsw made the tool that enables reading the info from an FBX!

I'm learning a lot as I'm trying to interpret the info stored in the FBX file format. This might enable me to improve the SMF format greatly. I'll keep you updated ;)
 
M

Mega_Gamers_Hd

Guest
Does anyone know why this happens and how can I resolve it? It works perfectly on the computer I'm currently on, but in what I have access to 24 hours a day, it happens. I'm using GMS1
https://imgur.com/a/2n8PolS
It should be something very simple, but I'm not a 3d wizard to understand
 

Fredrik

Member
Snidr's Model Format

Welcome to the topic about the SMF system. This system is entirely free and will always be free, and provides you with some of the basic tools you need for 3D games. 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, which can be imported into GMS2.
Before exporting, however, you can do all sorts of things with it. Here you can create many types of materials and apply effects like cel shading, rim lighting, normal maps and parallax mapping. You can rig, skin and animate your model. You can create collision buffers, place lights and add objects and 3D paths in the level editor.
...And the best part? It's all included in a single file. Models, textures, levels, animations, shaders and paths, easily imported into your own game. Once it's in your game, you can of course pick it apart again if you'd like, and even make use of internal sprites instead of loading them externally.
2. The SMF import scripts
The SMF import scripts let you import a .smf model file into your game, as well as so much more. They give you control over how models are animated, and even let you create animations on the fly. The drawing is automated, so that when you call smf_model_draw, the objects are drawn with the shaders and textures you defined in the SMF model tool. They contain scripts for colliding with and casting rays onto level models, and analyzing the result. They enable you to optimize your models and animations as best as possible, so that your games will run smoothly even if they look great.


Downloads:
Version 0.9.6 <-- This one finally contains a proper demo!
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:


I've been working with 3D projects in GM for many years, and this looks honestly amazing. Gonna check this out in abit!
 

TheSnidr

Heavy metal viking dentist
GMC Elder
Does anyone know why this happens and how can I resolve it? It works perfectly on the computer I'm currently on, but in what I have access to 24 hours a day, it happens. I'm using GMS1
https://imgur.com/a/2n8PolS
It should be something very simple, but I'm not a 3d wizard to understand
Haha, wtf is going on there xD Did you do something to make it like that, or is it like that straight outta the box? Could you post your system specs?

I've been working with 3D projects in GM for many years, and this looks honestly amazing. Gonna check this out in abit!
Thank you! :D
 
M

Mega_Gamers_Hd

Guest
Haha, wtf is going on there xD Did you do something to make it like that, or is it like that straight outta the box? Could you post your system specs?
No, I do not make any changes to the original download file

Computer (Okay, it's really bad but it works.:rolleyes:)
{
Windows 7 Ultimate 32-bit
AMD Athlon 64 X2 3800+
1 GB Single-Channel DDR2 @ 251MHz (I had 2 GB but it burned)
512MB NVIDIA GeForce 7300 GT
}

Laptop
{
Windows 7 Ultimate 64-bit
Intel Celeron 1007U @ 1.50GHz
4 GB Single-Channel DDR3 @ 665MHz
Intel HD Graphics
}
 
Holy moly, this is amazing! Great job TheSnidr!
Now my dream to make some nice looking low-poly games might become true after all! :D

All the awesomeness aside, I've noticed that the program have problems with the graphics when scaling the window. Maybe you already know a fix and just haven't implanted it yet but in case not, here is one...

The idea with this fix is that when the window get resized, the program (for 1 frame) go to a dummy room (rmResize), change the settings in the main room (rmMain) and then directly go back to the main room. This will allow the use of the room_set_ functions which (as far as I know) is needed to scale a room well.

If you like to try it, put the following codes in your main object.

Create event:
Code:
if instance_number(objCtrl) > 1 {
    instance_destroy()
    exit
}
screenWidth = window_get_width()
screenHeight = window_get_height()
Step/Draw/"when ever you like" event:
Code:
if screenWidth != window_get_width() || screenHeight != window_get_height() {
    screenWidth = window_get_width()
    screenHeight = window_get_height()
    room_goto(rmResize)
}
Room Start event:
Code:
if (room == rmResize) {
    surface_resize(application_surface, screenWidth, screenHeight)
    room_set_width(rmMain, screenWidth)
    room_set_height(rmMain, screenHeight)
    room_set_viewport(rmMain, 0, true, screenWidth, screenHeight, screenWidth, screenHeight)
    room_goto(rmMain)
}
Note that all objects need to be persistent and your main room can't be persistent for this to work smoothly.
Also, Options->Windows->Graphics->Scaling need to be set to "Full scale" but from the looks of it, it already is.

EDIT:
I know you like this product to be free for a few good reasons but do you accept donations?
 
Last edited:

TheSnidr

Heavy metal viking dentist
GMC Elder
Thank you :D
The text scaling issues are a problem with GMS as far as I can see, they were fixed for a short while, but then they were reintroduced. It's silly. I've reported it as a bug several times. Switching rooms doesn't fix it unfortunately! Text seems to get messed up when you change the size of the application surface.

I appreciate the will to donate! But there's no need, I'm only doing this for fun ^.^
 
Which version of GMS is the exe exported with?
I tried my fix in both 2.1.4.288 and 2.1.4.295 and it worked well.

Also, are only the font affected when you try it? for me it also affect other graphics (noticed the blurry checkbox in the screenshot)

There is one thing that can explain it tho, if you're using interpolation when drawing the UI and elements aren't draw with a rounded (?) position.



This doesn't make the program unusable in any way so it's not really a big deal, just thought it would be nice to fix it if it's possible :D
 

DukeSoft

Member
Room Start event:
Code:
if (room == rmResize) {
    surface_resize(application_surface, screenWidth, screenHeight)
    room_set_width(rmMain, screenWidth)
    room_set_height(rmMain, screenHeight)
    room_set_viewport(rmMain, 0, true, screenWidth, screenHeight, screenWidth, screenHeight)
    room_goto(rmMain)
}
Hey Carl :)
You know you can change the room size and view port in run-time right?
Code:
room_width = screenWidth;
room_height = screenHeight;
view_xport[0] = screenWidth;
view_yport[0] = screenHeight;
 
Hey Carl :)
You know you can change the room size and view port in run-time right?
Are you kidding me? xD Thanks!
I allways assumed you couldn't becouse you can't use room_set_height() on the current room. I have to check if you can simply skip the room switch now :) Thanks again!
 
Just like to confirm that it did work, same effect as when changing room. Thanks again!

Back on topic:
I've been playing around with the animation tool and it's just keep getting better.
It's easy to learn and easy to use when you get the hang of it.
I specially like that you're able to animate with IK, super handy!

Just a few thinks I noticed:
1) I had a hard time finding the "Static model" button :p, maybe it's just me but I rather have it at the top of the settings or some place more obvious since it's a really impotent setting.

2) I really like that the keybindings use numbers instead of letters. I how ever found that when you select a tool with the mouse the color sticks to that selection, even if I try to change it with the keybindings, is this intentional and if so, what does it mean?

3) Error when pressing any of the "Generate normals" buttons when there is no model loaded, not really a problem since you don't lose any work but should be fixed sometime anyway :)
Code:
FATAL ERROR in
action number 1 
of  Step Event0
for object oRigSystem:
local variable material(100002, -2147483648) not set before reading it.
at gml_Script_press_buttons
stack frame is
gml_Script_press_buttons (line -1)
gml_Object_oRigSystem_Step_0
 

TheSnidr

Heavy metal viking dentist
GMC Elder
Thank you so much for the feedback!
I've actually removed the "static model" setting for the next version, I only found it annoying myself, and there's not really any reason why a model should be just one or the other.
The latter two have been placed on my to-do list!

EDIT:
This is my script for resizing the screen by the way:
Code:
/// @description window_resize()
var w = window_get_width();
var h = window_get_height();
if w <= 0 or h <= 0{exit;}
if (w != surface_get_width(application_surface) or h != surface_get_height(application_surface))
{ 
    surface_resize(application_surface, w, h);
    display_set_gui_size(w, h);
    view_set_wport(0, w);
    view_set_hport(0, h);
 
    //Update the smaller windows
    editWidth = (w - borderX * 2) / 2;
    editHeight = (h - borderY) / 2;
    for (var i = 1; i < 5; i ++)
    {
        view_set_xport(i, borderX + editWidth * (i mod 2));
        view_set_yport(i, borderY + editHeight * ((i - 1) div 2));
        view_set_wport(i, editWidth);
        view_set_hport(i, editHeight);
    }
 
    batchModelWindowSize = editWidth * 0.6;
    move_camera();
    buttons_update();
}
I don't see what's wrong with it or why it'd cause scaling glitches.

Here's an example showing exactly what I mean:
https://www.dropbox.com/s/c13g3ff2x9a0qnd/WindowResizeBug.yyz?dl=0
 
Last edited:

TheSnidr

Heavy metal viking dentist
GMC Elder
Ahahahah!

...

Att... Attach an animated body to the animated body attached to the animated body...
 
Genius!!! :D

https://i.gyazo.com/dd6dd9ae16f217f57cad8ce9e5941b1d.mp4

Here is how it's done if anyone is interested:
Code:
var sample, boneDq, boneMat;

sample = smf_sample_create(modHuman, 0, 0, current_time / 750)
smf_model_draw(modHuman, sample)

boneDq = smf_sample_get_bone_orientation(sample, 7)
boneMat = smf_matrix_create_from_dualquat(boneDq)
matrix_set(matrix_world, boneMat)
smf_model_draw(modHuman, sample)

boneDq = smf_dualquat_multiply(boneDq, boneDq)
boneMat = smf_matrix_create_from_dualquat(boneDq)
matrix_set(matrix_world, boneMat)
smf_model_draw(modHuman, sample)

matrix_set(matrix_world, matrix_build_identity())
 
Last edited:
Top