MD2 export problem

The interface, modeling, 3d editing tools, import/export, feature requests, etc

Moderators: jesterKing, stiv

surfmasta
Posts: 0
Joined: Mon Jun 26, 2006 12:09 pm

Post by surfmasta » Mon Jun 26, 2006 12:23 pm

Hi, i'm using version 0.17.4 of the md2-exporter in blender 2.41 and it destroys my simple model. Can you take a look on it? I have a UV-mapped version where the same problem happens, but the main problem is, that some of the vertex-points are in the wrong position.
Blender-Model -> http://netster.de/public/rupee.blend

scourage
Posts: 0
Joined: Wed Jan 07, 2004 12:54 pm

Post by scourage » Mon Jun 26, 2006 6:54 pm

The problem is that your object is scaled, press the N key in the 3d view window when in object mode and look a the size. To fix this simply change the size of the object to 1.0 for x, y, and z. I have added a check for this in the new script.

cheers,

Bob
Halfway down the trail to hell....

arkdm
Posts: 0
Joined: Thu Sep 15, 2005 7:56 pm

It works!

Post by arkdm » Sun Jul 02, 2006 2:26 am

I just exported a model and it worked! No messed up geometry or anything! Still have to test it on a few more mod's but I think it's gonna work this time.

Thanks so much Bob!

arkdm
Posts: 0
Joined: Thu Sep 15, 2005 7:56 pm

Post by arkdm » Mon Jul 03, 2006 5:42 am

Ok - I was wrong. The exporter is messing up a model I'm trying to export: http://arkfamily.org/MZ/Animated_man.blend.

Any ideas?

scourage
Posts: 0
Joined: Wed Jan 07, 2004 12:54 pm

Post by scourage » Thu Jul 06, 2006 10:17 pm

I'm assuming you want to export the first model (however all of them have the same issues). There are several problems with it, it is not centred, the object (not the mesh verts) are scaled and rotated. The new script moves the model, and since the armature is not moved with the model, it screws it all up. You need to select your model (not the armature) and go into it's modifier stack. You need to press the "make real" button for the parent armature since this is an old blender file. Since the model and the armature are not at the same location or at the origin, plus the model isn't animated, you need to press the "apply" button in the armature modifier (which will remove it-keeping the model). Then you need to press the "N" key in the 3d window and change all the location/rotation to 0.0 and all the size values to 1.0. Then try exporting it. It works for me that way.

There is a tutorial in the works for this exporter, but it may be a while.

Cheers,

Bob
Halfway down the trail to hell....

arkdm
Posts: 0
Joined: Thu Sep 15, 2005 7:56 pm

Post by arkdm » Fri Jul 07, 2006 7:56 pm

I followed your instructions, and it's still coming up a little weird. Could you maybe send the blend with the changes you made?

I'd also like to thank you for all the help you've provided with this issue. Has made things a TON easier.

I.C.
Posts: 0
Joined: Mon Jul 10, 2006 9:52 pm

Post by I.C. » Mon Jul 10, 2006 10:18 pm

i hope somebody can help me...

my mesh getting destroyed after exporting...

klick for an before/after-image

i used the Armature Modifer and Bones for an 80 Frames Animation...

The Games Convention came near and i have to export some more models so i hope somebody can help me soon :wink:

scourage
Posts: 0
Joined: Wed Jan 07, 2004 12:54 pm

Post by scourage » Wed Jul 12, 2006 4:11 pm

arkdm,

I'll send you the blend with the changes this afternoon.

I.C.,
can you send me your blend to see why it's failing?

Cheers,

Bob
Halfway down the trail to hell....

I.C.
Posts: 0
Joined: Mon Jul 10, 2006 9:52 pm

Post by I.C. » Thu Jul 13, 2006 3:53 pm

scourage,

this is the blend:

RamrodMD2.blend

thanks for your help :)

scourage
Posts: 0
Joined: Wed Jan 07, 2004 12:54 pm

Post by scourage » Fri Jul 14, 2006 9:53 pm

Nice model. I'm not sure (just yet) why it's not exporting properly. I'll look into this weekend more.

cheers,

Bob
Halfway down the trail to hell....

arkdm
Posts: 0
Joined: Thu Sep 15, 2005 7:56 pm

Post by arkdm » Wed Jul 19, 2006 5:55 am

Any luck with the blend Bob?

schmidti
Posts: 0
Joined: Wed Jul 19, 2006 4:49 pm

Post by schmidti » Wed Jul 19, 2006 5:56 pm

i also got some problems with the export. it seems the bounding-box stuff doesn't work. the min- and max-values are wrong so the translate and scale values for each frame.
replacing the bounding-box code from line 844 to 860 works for me.

Code: Select all

		frame_min_x=mesh.verts[0].co[1]
		frame_max_x=mesh.verts[0].co[1]
		frame_min_y=mesh.verts[0].co[0]
		frame_max_y=mesh.verts[0].co[0]
		frame_min_z=mesh.verts[0].co[2]
		frame_max_z=mesh.verts[0].co[2]

		for vert_counter in range(0, md2.num_vertices):
			if frame_min_x>mesh.verts[vert_counter].co[1]: frame_min_x=mesh.verts[vert_counter].co[1]
			if frame_max_x<mesh.verts[vert_counter].co[1]: frame_max_x=mesh.verts[vert_counter].co[1]
			if frame_min_y>mesh.verts[vert_counter].co[0]: frame_min_y=mesh.verts[vert_counter].co[0]
			if frame_max_y<mesh.verts[vert_counter].co[0]: frame_max_y=mesh.verts[vert_counter].co[0]
			if frame_min_z>mesh.verts[vert_counter].co[2]: frame_min_z=mesh.verts[vert_counter].co[2]
			if frame_max_z<mesh.verts[vert_counter].co[2]: frame_max_z=mesh.verts[vert_counter].co[2]	
there is one more bug in line 1190 and 1191: a casting to float is required otherwise the pure integer division will return an integer. it would be always 0.

Code: Select all

				cmd.s=float(s)/md2.skin_width
				cmd.t=float(t)/md2.skin_height
Peter

I.C.
Posts: 0
Joined: Mon Jul 10, 2006 9:52 pm

Post by I.C. » Thu Jul 20, 2006 1:05 pm

thanks a lot for your help :D

(Shame on me) i don`t unstand the changes that i have to make...

can you show me the complete fixed code, pleaaaaaaaaaaase :oops: :D

schmidti
Posts: 0
Joined: Wed Jul 19, 2006 4:49 pm

Post by schmidti » Thu Jul 20, 2006 1:28 pm

EDIT:
the code won't work
Last edited by schmidti on Fri Jul 21, 2006 8:44 am, edited 2 times in total.

I.C.
Posts: 0
Joined: Mon Jul 10, 2006 9:52 pm

Post by I.C. » Thu Jul 20, 2006 4:49 pm

with the fixed code has still the same problem... my mesh is getting destroyed :(

Post Reply