UFO:Alien Invasion

Development => Artwork => Topic started by: Latino210 on November 04, 2012, 05:48:47 pm

Title: 3D models questions...
Post by: Latino210 on November 04, 2012, 05:48:47 pm
Some questions about 3d modelling...


First, I've just built a ship with Radiant and I would like to export it as an .md2, is that possible?

Second, I am experimenting with Blender. Is there any way to import the animations and models in the /base dir in Blender? I would like to modify them or to use them as a guideline for building something.

Third, is this http://ufoai.org/wiki/index.php/Blender (http://ufoai.org/wiki/index.php/Blender)
up to date? I've tried downloading the md2_export.py and md2_import.py in the scripts dir of Blender2.63, but nothing is happening...
Title: Re: 3D models questions...
Post by: H-Hour on November 04, 2012, 06:42:34 pm
First, I've just built a ship with Radiant and I would like to export it as an .md2, is that possible?
No.

Second, I am experimenting with Blender. Is there any way to import the animations and models in the /base dir in Blender? I would like to modify them or to use them as a guideline for building something.

Third, is this http://ufoai.org/wiki/index.php/Blender (http://ufoai.org/wiki/index.php/Blender)
up to date? I've tried downloading the md2_export.py and md2_import.py in the scripts dir of Blender2.63, but nothing is happening...
You might try an earlier version of Blender or search for another importer. I don't use it so can't advise you, but I know in the past people have used it without any problems.
Title: Re: 3D models questions...
Post by: Sandro on November 04, 2012, 06:53:21 pm
No.
You might try an earlier version of Blender or search for another importer. I don't use it so can't advise you, but I know in the past people have used it without any problems.

1) Writing a .bsp to .md2 converter is possible, but it will be of little use; therefore no one attempted it (to my knowledge).
2) Blender team made some massive changes in Python interface lately, especially in handling meshes, so most old scripts do not work anymore.
Title: Re: 3D models questions...
Post by: Latino210 on November 04, 2012, 07:46:54 pm
Thanks for the replies. I've found a "export selected brushes into .obj" option in Radiant, but Blender cannot open the selected .obj files, it comes out as blank. Too bad.

Is there any other 3d program that has already been proven as compatible? Everyone is talking about Blender, but when I ask about exporting the resulting file to .md2 nobody ever answers
Title: Re: 3D models questions...
Post by: DarkRain on November 04, 2012, 09:17:21 pm
I think most are using  3DSMax (http://ufoai.org/wiki/index.php/Modelling/3DSMax) for exporting to md2 (regardless of what people use to actually model).
As for blender, as Sandro writes the old scripts won't work in the new versions, here (https://groups.google.com/forum/?fromgroups=#!category-topic/junaio-developer/9NUaSP5V28w) are 2.5 and (at the bottom) 2.62 compatible ones, despite that the last one says it works in 2.63 it will NOT export UV data in 2.63, so I had to fix it* (see the attachment), that's what I use, but it doesn't export tags, so for that you still need to install an older Blender version.


*Note: before someone gets high hopes, No, I won't fix/write an importer/tag exporter/etc. I don't know Python or the Blender API at all, I just had the partially working exporter, the Blender docs and a stubborn idea, so I Hacked the thing Very Hard until it worked  :P.
Title: Re: 3D models questions...
Post by: Latino210 on November 04, 2012, 10:40:23 pm
Thanks again, Dark! I've downloaded and installed Blender 2.62, downloaded the io_export_md2.py.7z file, unpacked it into the scripts dir, I still cannot export anything. May I know what procedure are you using? BTW, I've tried again, if I make a group with all the brushes and export it to .obj via Radiant, then Blender can open it! Now I just need to understand how to transfer from blender to md2 and I will be set.
Title: Re: 3D models questions...
Post by: DarkRain on November 05, 2012, 12:29:12 am
When I said I fixed the attached script, I meant I fixed it to work on 2.63, since that's what I use (and thus the following steps are in 2.63), I installed the exporter using the blender installer addon option (File->User Preferences->Addons Tab->Install Addon), but you should be able to drop it in your scripts/addons dir, either way be sure to mark the checkbox to enable it* in the Addons tab of the User preferences window, then you just select the mesh you want to export (only one) and go to File->Export->Quake 2 (.md2).

*Note: You'll need to enable it each time you open Blender, unless you 'Save User Settings' in the file menu.
Title: Re: 3D models questions...
Post by: Latino210 on November 10, 2012, 02:20:35 pm
Thanks, Rain! Sorry, but I am way more experienced with the Autodesk interface, so I just downloaded a free md2 extractor for 3dsmax and I am experimenting with it. I have managed to make some little models, exported into .obj and used them as "models" in Radiant. It's working fine, now I just need to understand how to properly skin the model. Do you know any good tutorial? I've found this, where the procedure is called "unwrapping".

http://www.tutorialboneyard.com/Pages/50Calunwrap.aspx


By the way, I've exported the .md2 of the static model but the Radiant just crashes whenever I try to open the "create model" menu. Am I missing something?
Title: Re: 3D models questions...
Post by: Latino210 on November 10, 2012, 04:08:51 pm
What the hell? The .obj works fine with Radiant, but as soon as I load the map with UFO the program goes into fatal error. Can somebody tell me what am I doing wrong? .Obj included.

Edit: disregard that, I am an idiot. I was using a script for 3dmax 8 on 3dmax 2012. Now I can save an .md2 and Radiant is able to read it. Too bad that Radiant cannot skin the .md2, even if there is a nice 1024X1024 jpg in the same folder with the same name. See the included pic. By the way, putting this .md2 into a map makes UFO crash when I try to load it.

Title: Re: 3D models questions...
Post by: DarkRain on November 10, 2012, 05:15:55 pm
Don't know, maybe its because the model isn't uv mapped and skinned? But of course the game shouldn't segfault like that...
Title: Re: 3D models questions...
Post by: H-Hour on November 10, 2012, 05:50:14 pm
Each MD2 file points to its own skin file, and this has to be configured when you export the model. We use a system for referencing adjacent files with a "." and no file type extension (jpg, png, etc.). So, your MD2 exporter should allow you to define skins. If you did so for a model that had a skin file in the same directory named "car.jpg", you would set the skin to:

.car

Then the game (and Radiant) should be able to locate the skin. You can even specify multiple skins and in the func_model definition add a skin property pointing to each one (starting with 0).
Title: Re: 3D models questions...
Post by: Latino210 on November 10, 2012, 07:36:10 pm
Dear sirs

I am at my wit's end. The .md2 has been skinned and UVwrapped, but it does appear as covered in nodraws. The .obj works fine, at least in Radiant. Both object cause a fatal error when I try to visualize them during battle. I am including the three different versions of the object, the sample .jpg skin and the error message. Maybe it's because I am playing with a nightly build?  Can somebody smarter than me take a look at that?

Code: [Select]
======start======
Date: 2012-11-10
Windows version 5.2 (Build 3790) Service Pack 2
Win32 DEBUG, cpu: IA-32, version: 2.5-dev

0xb33109e : [unknown module] : [unknown file]
======end========




EDIT: I forgot, all the models in the models dir have an .mdx file included (no mention of that on the wondrous, useful wiki). I tried opening them with a .mdx converter but the format was not valid. Any clue?
Title: Re: 3D models questions...
Post by: DarkRain on November 11, 2012, 12:05:02 am
The skin name defined in the md2 is bad ("SkinBitMap:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::") so that's a problem, I edited the skin name and the model showed just fine both in radiant and in game

As for the obj, I don't know, there's a in the game bug for sure, but I haven't found where, maybe its related to the fact the obj is missing a corresponding .mtl

mdx is not needed to use the models (Its about pre-caching the models IIRC) and I don't think it is a standard format, you can generate it for md2 files using ufomodel anyway
Title: Re: 3D models questions...
Post by: Latino210 on November 11, 2012, 01:02:26 am
Once again, you are saving me from the bottomless depth of my ignorance. Just a little thing more, before going to bed: how exactly have you changed the skin name? I've tried editing with notepad, but it only made the radiant crash. Have you used an hex editor? I had already tried to cancel the "skinbitmap:::::::::::::::::::::::::::::::::" string and writing "motor" in its place, to no avail.
About the .obj, screw them, if I can export an .md2 with that (flawed) script and rename it by hand I am all set.

Thanks again for your help.
Title: Re: 3D models questions...
Post by: DarkRain on November 11, 2012, 02:44:28 pm
For some reason the forum wouldn't let me post, anyway, yes I didn't feel like re-exporting the model so I used an hex editor to write .motor (note the leading dot) and fill the rest of the skin name with null characters, supposedly you can also edit skin names using ufomodel but don't ask me how that works.
Title: Re: 3D models questions...
Post by: krilain on December 10, 2012, 04:10:32 pm
Hello,

can I add some other questions to the Latinos sensitive ones, once it has been answered ?
Mine are very simple for I'm new at char modeling. Here they are.

When I open MD2 taman for instance, I see a serie of small animation sequences (lets give us for clarifying : frame 1 to 5 -> taman falling down, frame 5 to 12 -> taman crouching). My question is :
1- For any char creation do we have to follow the same rigid pattern ? Do we just have to make a serie of animated sequence, and then to define what sequence is for what purpose ? If I'm right, where is the file where those definitions are stocked?
 
2- Second question. Do we absolutely need IK bones for MD2 animating ? Or is it only a powerful helper which have to be deleted at the end of animation process ?

3- Supposing you use Gmax for 3d modeling, how do you prepare to make the texture painting ? Is there a unwrap tool or something I missed ?
Title: Re: 3D models questions...
Post by: geever on December 10, 2012, 06:10:09 pm
Hello,

I'm not a modeller myself but hopefully can serve a bit info here:

1- For any char creation do we have to follow the same rigid pattern ? Do we just have to make a serie of animated sequence, and then to define what sequence is for what purpose ? If I'm right, where is the file where those definitions are stocked?

We have a wiki about Character Animations (http://ufoai.org/wiki/Modelling/Character_Animation)

2- Second question. Do we absolutely need IK bones for MD2 animating ? Or is it only a powerful helper which have to be deleted at the end of animation process ?

MD2 format doesn't support bones, but we suggest creating bones and creating animations with them due to two reasons:
- it is usually easier to create and update animations using the skeleton
- we may change to a newer model format that support bones

-geever
Title: Re: 3D models questions...
Post by: H-Hour on December 10, 2012, 07:06:49 pm
3- Supposing you use Gmax for 3d modeling, how do you prepare to make the texture painting ? Is there a unwrap tool or something I missed ?

Look for the UVWUnwrap modifier. That's what it is in 3DSM, so it must be there in Gmax.
Title: Re: 3D models questions...
Post by: krilain on December 11, 2012, 02:16:30 pm
Hello,
I'm not a modeller myself but hopefully can serve a bit info here:
(...)
Thank you. I'll make some tries and give you feedback later.
Look for the UVWUnwrap modifier. That's what it is in 3DSM, so it must be there in Gmax.
Ok, I found it :)
Title: Re: 3D models questions...
Post by: p0ss on May 26, 2013, 10:44:47 am
Any word on that new model format?  Or perhaps some kind person who understands md2 can update the scripts? Surely requiring an outdated version of Blender is an unviable long term plan to gain contributors?
Title: Re: 3D models questions...
Post by: H-Hour on May 26, 2013, 11:57:15 am
The exporter was updated a while ago by Darkrain. The working one should be in our repository (https://github.com/ufoai/ufoai/tree/master/src/tools/blender).
Title: Re: 3D models questions...
Post by: DarkRain on May 26, 2013, 07:59:25 pm
Specifically you want io_mesh_md2.py for exporting models and io_scene_tag.py for exporting tags, I have only tested with blender 2.63, 2.65 and 2.66