project-navigation
Personal tools

Author Topic: md2 Problems  (Read 12332 times)

Walle

  • Guest
md2 Problems
« on: August 27, 2006, 06:05:49 pm »
Hello
i tried to make some changes to laserrifle.md2 so heavylaserrifle don´t look exacly the same as laserrifle...

But my first problem is that i don´t now anything about modelling (myfirst try) =) , the first problem is exporting md2 files after i have used them in Wings 3D, so i tried Blender(modell has a face with out... something) and Milkshape (Found vertices with no bone! No animations are exported!), didnot work, then i tried Quick3D and i can now export it as a md2 file, but the file created by Quick3D is a lot bigger than the orginal file and if i try to use "Quake 2 Modeller" to put a skin on the modell i crashes... so is my modell broken or the programs i use to import/export broken? or am i just stupid?

i can upload the modell if anybody want to look at it...

*edit*
I have now remade the model from scratch (just to make sure i had not done something strange when i modyfied the original model), still the same problem =(
* *

/Walle

Offline Bandobras

  • Captain
  • *****
  • Posts: 586
    • View Profile
md2 Problems
« Reply #1 on: August 27, 2006, 11:47:07 pm »
I have no clue, but have you tried reading the wiki sections about md2 importers and exporters, etc.?

Walle

  • Guest
md2 Problems
« Reply #2 on: August 28, 2006, 12:25:21 am »
I have, and i looked how the md2 file works and some other stuff, like how the path to the jpg file should look in the md2 file...  might be that i did something wrong with the first model when i modified it and maybe the other model i made from scratch is not textured right?...

And what is a "tris"? and how can a finde how many my model have ( Wings 3D reports that my model have 195polygons, 409edges and 216vertices ).


/Walle

Offline Bandobras

  • Captain
  • *****
  • Posts: 586
    • View Profile
Re: md2 Problems
« Reply #3 on: August 28, 2006, 12:40:17 am »
Quote from: "Walle"
the file created by Quick3D is a lot bigger than the orginal file


It is usually a symptom of a "broken model", that is one that looks strange in UFO:AI but can be reexported (using some program... is it 3DStudio?) and then is back small and OK. You can verify if you model is "broken" with base/models/find_broken_models.sh. If you have wrong texture path (can be fixed with src/tools/md2.pl), the model should still look OK, only red, or something. This is all I know about these things, but surely others can help you...

Hoehrer

  • Guest
md2 Problems
« Reply #4 on: August 28, 2006, 03:20:08 pm »
I've moved this notes to the wiki: http://ufo.myexp.de/wiki/index.php/Modelling/MD2

In Blender to export the model you first need to
* enter UV-mode (in "3D View"),
* select all faces [A],
* then go to the "UV/Image Editor" view (not the material buttons) and
* load the texture image (Image->Open).

(You can test if this worked by switching to "Draw type"="textured" in "3D View". Now the model should be displayed with the texture.)

EDIT: If you have scaled or rotated the object you want to export you need to apply these changes: [Ctrl]+[A] -> Apply sacle and rotation

EDIT: If the center of your object (small violet circle) isn't located exaclty in the absolute center (coord-grid center) you need to re-place it by first placing the 3D-cursor into the absolute center [Shift]+ -> Cursor -> Grid and the hit the Centre Cursor button in the [F9] panel Mesh

The you should be able to export it with the md2-export menu entry. You can ignore the message about missing texture path (the second path in the export dialog), this needs to be fixed with md2.pl anyway.


Werner

PS: I think i'll make this posting into a wiki-page (maybe with images) soon. I hope i don't forget.
PPS: Also the export-size is around 10 times smaller than the import size ... you need to scale the model correctly before exporting.

Walle

  • Guest
md2 Problems
« Reply #5 on: August 28, 2006, 05:40:45 pm »
ok...
its geting closer, now i can export the file in blender, and it looks right i a md2 viewer, but i cant replace laserrifle.md2 with my file (ufo crashes with out error message in the buymeny) and i didnot find md2.pl, only broken links, problems with sourceforge? (edited the file by hand, so the path to the jpg is right).

So my question now is does md2.pl change more than just where the texture is? and can Ufo crash from a modell thats the wrong size?  the error might be that something broke when i edited the file....


**edit**
I exported the file again in blender (no changes) and the file got a lot larger (like 400K) and now the game is not crashing in the buy meny, but crashes when a mission starts. (and no model is showing for the laserrifle in the buymeny).

****


/Walle

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
md2 Problems
« Reply #6 on: August 28, 2006, 05:47:47 pm »
ufo should not crash due to a broken model - it should report that the model is broken or something like that - could you upload the model somewhere. then i can check.

mattn

Walle

  • Guest
md2 Problems
« Reply #7 on: August 28, 2006, 06:25:53 pm »
I tried my "broken" model again and now the game dont crash but shows the model red(indicating its broken?)? but then i tried to change the path to the texture and the game crached so my editing of the file had broken somehow :roll: ...

but why is the first md2 file i crated with blender 200k and the second one created in blender 400k (created from the same model and texture)?

im going to upload all the files on a server, and where can i get md2.py? (did not work to get it from sourceforge).


**edit**
All the files i have used...
http://wallbing.com/filer/laserrifle.zip

And be nice about my uglymodel... its the first model ive made... =)

**     **

/Walle

Hoehrer

  • Guest
md2 Problems
« Reply #8 on: August 28, 2006, 07:47:25 pm »
The md2.pl script is located here:
http://svn.sourceforge.net/viewvc/ufoai/ufoai/trunk/src/tools/md2.pl?view=log

Usage:
Code: [Select]

./md2.pl triax.md2
IN=OUT= "triax.md2"
1 Skins found
Skin 0 old: ".triax.jpg"
Enter new path (Enter=Skip):models/soldiers/ugv_triax/triax.jpg
Skin 0 new: "models/soldiers/ugv_triax/triax.jpg"


Though recently I've seen some models that use another (relative) path ... gotta ask mattn about that.

Quote from: "Walle"
I tried my "broken" model again and now the game dont crash but shows the model red(indicating its broken?)?

When a texture isn't found it used a default (red/black) texture .. i doN#t know which one though.

Quote
but then i tried to change the path to the texture and the game crached so my editing of the file had broken somehow :roll: ...

Thsi will always crash, becasue the termination of the string is somewhat picky.

Quote
but why is the first md2 file i crated with blender 200k and the second one created in blender 400k (created from the same model and texture)?

That i don't know :-/ but is suspect it's a export-script thing.

Werner

Walle

  • Guest
md2 Problems
« Reply #9 on: August 29, 2006, 05:50:35 pm »
Quote from: "Hoehrer"
The md2.pl script is located here:
http://svn.sourceforge.net/viewvc/ufoai/ufoai/trunk/src/tools/md2.pl?view=log


Can somebody send this file to me?  i get a "404 Repository not found" when i try to download it

And can somebody look at my model (not my md2 files in the zip that dont work but the normal modeling files i have there) and tell me what i need to change, like moore details/ less details, do like this / dont do like this, etc.   right now i now that my model looks to mutch like laserrifle, and if im going to do some other modeling i want to learn how the model should be like, how mutch details and stuff like that...

http://wallbing.com/filer/laserrifle.zip


/Walle

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
md2 Problems
« Reply #10 on: August 29, 2006, 05:56:46 pm »

Walle

  • Guest
md2 Problems
« Reply #11 on: August 29, 2006, 10:46:47 pm »
i have some questions about blender, i want to rotate my model and when i do it in blender (before i export it to md2) i get "Object is rotated - You should rotate the mech verts instead, not the object" so my question is how to rotate the "mesh verts" and what is a "mesh vert"?

Blender rotates my model back to what it was when i imported it, before blender exports the model to md2  (and it doesent mather if i rotate it before i import it to blender it always points in the same direction when i import it to blender).



And thanks Mattn for the link to md2.pl.


** Edit**

The rotating problem is solved, changed format (to .obj) that i export from wings3d and now the object is pointing the right way in blender when i export it to .md2, but i have a new problem now, in UFO the model is beeing renderd with holes in the texture, is this a export problem?
And when i changed witch format to import my model into Blender from .3ds to .obj the md2 file went from 400k to 190k?

**

/Walle

Offline Bandobras

  • Captain
  • *****
  • Posts: 586
    • View Profile
md2 Problems
« Reply #12 on: August 30, 2006, 02:23:29 am »
Yes, I think this is an export problem --- "broken model". See above for instruction how to save the model without holes in it (but without texture path).

Hoehrer

  • Guest
md2 Problems
« Reply #13 on: August 30, 2006, 08:38:47 am »
Quote from: "Walle"
i have some questions about blender, i want to rotate my model and when i do it in blender (before i export it to md2) i get "Object is rotated - You should rotate the mech verts instead, not the object" so my question is how to rotate the "mesh verts" and what is a "mesh vert"?

"Vert" is the short for "Vertices" or "Vertex" .. which means you need to enter edit mode.

What the error means is that means you need to do one of the following things before export:
* Enter edit mode ([Tab] .. this will let you edit vertices) and rotate the model
* OR rotate the object , apply apply the rotation ([Ctrl]+[A] -> Apply Rotation and Scaling) to the model and re-set the center of the object if needed (snap the 3D cursor the the absolute center .. [Shift]+ -> grid) and Press the "Centre Cursor" button in the [F9] Buttons

You can see the (non-applied) 'transformation values' by pressing [N].


Quote
Blender rotates my model back to what it was when i imported it, before blender exports the model to md2  (and it doesent mather if i rotate it before i import it to blender it always points in the same direction when i import it to blender).

So the default behaviour of the script seems to be to reset transformations (see [N])  like scaling/rotation ... I don't know if this is intended by the scripts autor.


Also bleder exports some additional data (i think "normal"-data).. this causes the file to go up in size, but should not change the 'validness' of the model ;)

EDIT: I updated my post above with this info as well:
http://ufo.myexp.de/phpBB2/viewtopic.php?p=2799#2799


Werner

Offline Migel

  • Rookie
  • ***
  • Posts: 95
    • View Profile
Re: md2 Problems
« Reply #14 on: August 28, 2009, 03:17:59 pm »
Well, I have a problem with md2.pl script, but I think this is a right topic to ask.
When I'm using md2.pl I got this message
Quote
IN=OUT= "test.md2"
MD2 file found.
0 Skin(s) found
Enter new skin number:1
Adding skins and updating offsets ...
Can't use an undefined value as an ARRAY reference at d:\ufo\md2.pl line 314.
I'm using Strawberry Perl. Did anyone know how solve problem?