Jump to content


Photo

MD2 with game maker


  • Please log in to reply
27 replies to this topic

#1 orange451

orange451

    GMC Member

  • GMC Member
  • 984 posts
  • Version:GM8

Posted 20 July 2010 - 01:52 AM

The MD2 mesh is an animated mesh, which is also very low in file size (Used in quake)

Thanks:
Getting the MD2:
  • Make your model in Model Creator, and export it to an OBJ mesh
  • Import the OBJ mesh into Misfit Model 3D (check Smoothing MD2 Models)
  • If you know how, you can animate your mesh in it (Misfit Model 3D Animation Documentation)
  • If you animated your mesh, make sure it is Converted to Frame Animation (in case you animated it with Bone animation)
  • Export your mesh to a MD2
Importing MD2 in GM:
3d Importing Example
  • Look at my 3d Importing example.
  • Make sure the normals script is called before importing the MD2
  • run the importMD2 script to import the mesh
---------


Smoothing MD2 Models:
This technique is called gouraud shading, it changes the direction of Vertex Normals to change the polygons shading.

Select all Verticies of your mesh
Posted Image

Posted Image

Edited by orange451, 20 July 2010 - 01:53 AM.

  • 0

#2 faizan 25

faizan 25

    GMC Member

  • GMC Member
  • 140 posts

Posted 20 July 2010 - 07:40 AM

The MD2 mesh is an animated mesh, which is also very low in file size (Used in quake)

Thanks:

Getting the MD2:
  • Make your model in Model Creator, and export it to an OBJ mesh
  • Import the OBJ mesh into Misfit Model 3D (check Smoothing MD2 Models)
  • If you know how, you can animate your mesh in it (Misfit Model 3D Animation Documentation)
  • If you animated your mesh, make sure it is Converted to Frame Animation (in case you animated it with Bone animation)
  • Export your mesh to a MD2
Importing MD2 in GM:
3d Importing Example
  • Look at my 3d Importing example.
  • Make sure the normals script is called before importing the MD2
  • run the importMD2 script to import the mesh
---------


Smoothing MD2 Models:
This technique is called gouraud shading, it changes the direction of Vertex Normals to change the polygons shading.

Select all Verticies of your mesh
Posted Image

Posted Image

Very Nice Info but shouldn't this be in the Tutorials and Examples because you are telling us how to do it and stuff.....
3D Game Techniques Description:
"In this forum people can ask questions regarding the creation of 3D games with the 3D features in GM6, 7, and 8. "

Note:Can GM Also Run the MD2 animations?!
  • 0

#3 Tepi

Tepi

    GMC Member

  • Global Moderators
  • 4201 posts
  • Version:GM8.1

Posted 20 July 2010 - 11:34 AM

Apparently Blender can export MD2 files too, so no need to download misfit model 3D, right?

I've got no animation to test with now so I'm asking whether there is some speed advantage to using this method rather than self built frame animation?
  • 0

#4 orange451

orange451

    GMC Member

  • GMC Member
  • 984 posts
  • Version:GM8

Posted 20 July 2010 - 06:23 PM

Apparently Blender can export MD2 files too, so no need to download misfit model 3D, right?

I've got no animation to test with now so I'm asking whether there is some speed advantage to using this method rather than self built frame animation?


I'm not sure if there are any speed advantages to using this, but I just find it useful because it stores all the animations inside one file, and it's smaller than multiple OBJ models.

I just like to use Misfit Model 3D, because it feels a lot smoother to me than blender.

Also, I can't fix my models' sharp edges with blender.


@faizan 25 "Note:Can GM Also Run the MD2 animations?!"

Yes, they can. If you looked at the example I provided, you can set the max frame, minimum frame, and frame speed.

Edited by orange451, 20 July 2010 - 06:24 PM.

  • 0

#5 Tepi

Tepi

    GMC Member

  • Global Moderators
  • 4201 posts
  • Version:GM8.1

Posted 20 July 2010 - 06:48 PM

Also, I can't fix my models' sharp edges with blender.

Yes you can: select the model, go to the edit menu and click set smooth.

There's not much Blender can't do, but it's not as easy to learn as some other programs.

EDIT: Hey, with this method I could easily bake myself e.g. a flag blowing in the wind and get it into GM.

Edited by Tepi, 20 July 2010 - 06:50 PM.

  • 0

#6 orange451

orange451

    GMC Member

  • GMC Member
  • 984 posts
  • Version:GM8

Posted 20 July 2010 - 07:05 PM


Also, I can't fix my models' sharp edges with blender.

Yes you can: select the model, go to the edit menu and click set smooth.




I tried that. all it did was separate all the polygons.
  • 0

#7 Tepi

Tepi

    GMC Member

  • Global Moderators
  • 4201 posts
  • Version:GM8.1

Posted 20 July 2010 - 07:25 PM



Also, I can't fix my models' sharp edges with blender.

Yes you can: select the model, go to the edit menu and click set smooth.




I tried that. all it did was separate all the polygons.

What? Separate?

Try it again but first go to edit mode, press A and click Rem Doubles. That will remove the doubles of vertices you might have. That's the only reason that I can imagine for it not working expectedly. Set smooth doesn't really do anything to the geometry so what you're saying is quite ridiculous.
  • 0

#8 orange451

orange451

    GMC Member

  • GMC Member
  • 984 posts
  • Version:GM8

Posted 20 July 2010 - 08:31 PM




Also, I can't fix my models' sharp edges with blender.

Yes you can: select the model, go to the edit menu and click set smooth.




I tried that. all it did was separate all the polygons.

What? Separate?

Try it again but first go to edit mode, press A and click Rem Doubles. That will remove the doubles of vertices you might have. That's the only reason that I can imagine for it not working expectedly. Set smooth doesn't really do anything to the geometry so what you're saying is quite ridiculous.

I'm sorry, I did something else. I tried the Smooth Modifier and that's what separated all the polygons. The Set Smooth button, actually didn't do anything to the model...

I don't now a whole lot about blender, so I don't know how to do what you suggested I do, to fix my model.
  • 0

#9 xpl0xi

xpl0xi

    GMC Member

  • New Member
  • 120 posts

Posted 20 July 2010 - 10:27 PM

Do animations work with belender?
  • 0

#10 orange451

orange451

    GMC Member

  • GMC Member
  • 984 posts
  • Version:GM8

Posted 24 July 2010 - 03:30 PM

Do animations work with belender?


Yes they do.
  • 0

#11 narpas

narpas

    GMC Member

  • New Member
  • 88 posts

Posted 26 July 2010 - 03:46 PM

Yes I would recommend using blender to make them you can write a loader yourself. (I have done this in another language). here is how they do it with opengl it should not be to difficult. normals are a little weird in md2 but other then that you should be good. http://www.videotuto...mation/home.php
pm if you have any problems!
  • 0

#12 orange451

orange451

    GMC Member

  • GMC Member
  • 984 posts
  • Version:GM8

Posted 07 August 2010 - 11:55 AM

[BUMP]

I really want people to know about this, it reduces file sizes so much :D
  • 0

#13 Enewwss

Enewwss

    GMC Member

  • New Member
  • 26 posts

Posted 07 August 2010 - 01:09 PM

I've done it :)

Thaks so much orange :)
  • 0

#14 Enewwss

Enewwss

    GMC Member

  • New Member
  • 26 posts

Posted 08 August 2010 - 08:35 PM

I've a problem...

I have a md2 file that includes many animations and they are named as "stand" "attack" etc...

But I coudnt get them working in game maker... By which script can I work these animations?
  • 0

#15 orange451

orange451

    GMC Member

  • GMC Member
  • 984 posts
  • Version:GM8

Posted 09 August 2010 - 06:23 PM

I've a problem...

I have a md2 file that includes many animations and they are named as "stand" "attack" etc...

But I coudnt get them working in game maker... By which script can I work these animations?


It actually involves a little bit of counting. Here's an example:

You click the button which displays all your animations in Misfit Model 3D:
1)Attack (8 frames)
2)Stand (4 frames)
3)jump (11 frames)

so, if you looked at my example on how to use them, you'll see I gave you a frame min and a frame max variable.

attack animation:
framemin = 0
framemax = 8
This is because it is the first animation (starts at 0) and it is 8 frames long.

stand animation:
frame_min = 8
framemax = 12
This is because the animation before stand was attack (and it was 8 frames long [so you start it at 8]). The framemax is the frame min plus the amount of frames in which the animation is, 4.

Using this, I can conclude that the jump framemin and framemax are:
frame_min = 12
framemax = 23

  • 0

#16 Enewwss

Enewwss

    GMC Member

  • New Member
  • 26 posts

Posted 09 August 2010 - 07:52 PM

I've done this but the models shows only one frame of it min freame... It doesn't loop

I think the problem is in here:

minframe = 16
maxframe = 50
frame = minframe

edit: I cant believe how noob I am...

I just edited the script for "step" event so every step it moves frames and we can see the animation... Thanks so much...

Now Im trying to get speed codes for my animations...

For ex:

if speed = 0
{
minframe = 12
maxframe = 16
}
if speed > 0
{
minframe = 6
maxframe = 11
}


frames between 12 and 16 is the stand animation and frames between 6 and 11 is the run animation.

But its not workin does any one have a solution? :)

Edited by Enewwss, 09 August 2010 - 11:08 PM.

  • 0

#17 Enewwss

Enewwss

    GMC Member

  • New Member
  • 26 posts

Posted 10 August 2010 - 09:48 AM

[bump]

can some one help... :) its an urgent...
  • 0

#18 orange451

orange451

    GMC Member

  • GMC Member
  • 984 posts
  • Version:GM8

Posted 10 August 2010 - 03:46 PM

I've done this but the models shows only one frame of it min freame... It doesn't loop

I think the problem is in here:

minframe = 16
maxframe = 50
frame = minframe

edit: I cant believe how noob I am...

I just edited the script for "step" event so every step it moves frames and we can see the animation... Thanks so much...

Now Im trying to get speed codes for my animations...

For ex:

if speed = 0
{
minframe = 12
maxframe = 16
}
if speed > 0
{
minframe = 6
maxframe = 11
}


frames between 12 and 16 is the stand animation and frames between 6 and 11 is the run animation.

But its not workin does any one have a solution? :)


you need to use a frame_speed. If you looked at my example (it's in the step event) it does all the actual "animating".
in step event:
frame+=framespeed
if frame >maxframe-(framespeed*2){ frame = minframe}

so with your code, you should do something like:
step event:
frame+=framespeed
if frame >maxframe-(framespeed*2){ frame = minframe}
if frame <minframe{ frame = minframe}


if speed = 0
{
minframe = 12
maxframe = 16
framespeed = .1
}
if speed > 0
{
minframe = 6
maxframe = 11
framespeed = .05
}


  • 0

#19 Enewwss

Enewwss

    GMC Member

  • New Member
  • 26 posts

Posted 10 August 2010 - 08:16 PM

Yess problems and problems...

I'm so sory guys to bothering you but I have another problem yet again...

Im tyring to rotate my md2 model but as Im using usual codes for rotation the whole map rotates and object doesnt... md2 object seems unrotateable to me.

As ı looked orange's exaple I saw he was rotatin the camera not the object... So how can I rotate the object along the z axis?
  • 0

#20 orange451

orange451

    GMC Member

  • GMC Member
  • 984 posts
  • Version:GM8

Posted 10 August 2010 - 09:58 PM

Yess problems and problems...

I'm so sory guys to bothering you but I have another problem yet again...

Im tyring to rotate my md2 model but as Im using usual codes for rotation the whole map rotates and object doesnt... md2 object seems unrotateable to me.

As ı looked orange's exaple I saw he was rotatin the camera not the object... So how can I rotate the object along the z axis?




d3d_transform_set_identity()
d3d_transform_set_scaling(-1,1,1)
d3d_transform_add_rotation_z(direction)
d3d_transform_add_translation(x,y,z)
d3d_model_draw(internalFrame[mframe],0,0,0,background_get_texture(background0))
d3d_transform_set_scaling(1,1,1)
d3d_transform_set_identity()

hope that helps.

Edited by orange451, 17 August 2010 - 05:31 PM.

  • 0




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users