Author Topic: Obj file to strategic map converter  (Read 38121 times)

0 Members and 1 Guest are viewing this topic.

Tul

  • Knight
  • *
    • View Profile
  • Faction: Neutral
Obj file to strategic map converter
« on: February 10, 2009, 10:24:17 PM »
Thorgrim's map editor is extremely buggy, even exporting colour map doesn't work for me making using this tool as a main map editor impossible. So that's why I decided to make this very simply converter. It is a totally different way of creating strategy map for M&B. Personally I found it more effective and powerful then using Thorgrim's map editor but it's also more complicated and require vast knowledge of 3d modelling. It allow us to model a map in any 3d modelling program or sculptor, cover it with materials and then to export it into M&B. Thorgrim's editor also can import an obj file but it doesn't import materials so it's not very useful.
I made this converter for myself but maybe some other guys will find it useful (probably not) so here we go.

I tested it only with Wings 3d. Here is a correct workflow:
-a bottom side of the model must have a 'hole' material,
-cover a model with materials provided in 'map.obj' (only their names are important),
-export a map as 'map.obj'. The model must be quadriangulated (not triangulated but it can be triangulated). Converter will triangulate it for you. I made this because triangulation in Wings is around 2000 times slower then mine :) With huge models like a map it can be really annoying. I don't have to remind that modelling with quads is much more effective then with triangles.
-put the file and converter in the same folder, run converter,
-put the output 'map.txt' file in your module folder,
-the program require .NET Framework 2.0

The package includes a sample.

Download link:
http://www.mbrepository.com/file.php?id=1793

This tool works with Warband.

The package includes a referential Wings file and obj file. They are fit to warband so there shouldn't be any positioning problems in warband.

For Wings 3d users: remember to import and export the file with swapped x and y axes.  Scale factor should be set to 1.0.

Below are the names that materials must have:
(click to show/hide)

2009.02.15
I uploaded a new version which fixes one bug. I also checked the compatibility with 3dsMax 9 and it works if you export the file with normal vectors. You can also use Zbrush but in this case you have to convert file in 3dsmax or wings first.

2009.02.16
Another version which fixes another bug. Now program is checking if the model is quadriangulated.

2010.04.15
Added one new material for better Warband compatibility.

Madawg

  • Sergeant
  • *
    • View Profile
  • Faction: Neutral
  • M&B
Re: Obj file to strategic map converter
« Reply #1 on: February 11, 2009, 12:00:44 AM »
Interesing. I'll definitely have a look at it when I have time.
But I'm a 3dsmax user. Any chance to have the materials in an other format? Or if it's only the naming which is important, I guess you could just write it down here..
May I annoy you via PM if I have more specific questions?

Tul

  • Knight
  • *
    • View Profile
  • Faction: Neutral
Re: Obj file to strategic map converter
« Reply #2 on: February 11, 2009, 08:59:56 AM »
I updated first post, you will find answer on your first question there.
Yes, you can annoy me via PM if you have more specific questions :) It's not easy to annoy me.

Tul

  • Knight
  • *
    • View Profile
  • Faction: Neutral
Re: Obj file to strategic map converter
« Reply #3 on: February 15, 2009, 08:53:10 PM »
First post updated.

Another update.

Necklan

  • Regular
  • *
    • View Profile
  • Faction: Swadian
Re: Obj file to strategic map converter
« Reply #4 on: July 10, 2009, 08:44:28 AM »
wow! youve made making maps so much easier. i salute you sir!

jus one tiny problem, when i try to load it i get an error msg saying: unable to position party at (17, 52.5)

is that because the map i made has water in the middle? or is it something else?

amade

  • Grandmaster Knight
  • *
  • Own up and take it like a man
    • View Profile
    • Studio Wossname
  • Faction: Neutral
Re: Obj file to strategic map converter
« Reply #5 on: July 10, 2009, 11:00:13 AM »
Awesome-saucem. Gonna try it out with Blender.

Question:
"a bottom side of the model must have a 'hole' material"
What do you mean by that?

edit: also, is it possible to make a map.txt -> obj converter?
« Last Edit: July 10, 2009, 11:05:17 AM by amade »

Don't you just love herding cattle?
*end.transmission - Studio Wossname*
___________________________________________________________________________________________________________________________

   .

Berserker Pride

  • Grandmaster Knight
  • *
  • Fearless Scripter of the Berserk Mod
    • View Profile
  • Faction: Vaegir
  • MP nick: CoR_Berserker
  • WB
Re: Obj file to strategic map converter
« Reply #6 on: July 10, 2009, 11:08:44 AM »
He means the underside of the map must use that transparent material.  It shows up in wings as a slightly see-through blue colour.  But yea just click on any face or faces right click and choose materials.  Pick material "hole".  Great idea Tul.  This opens up a lot more options when mapmaking.

amade

  • Grandmaster Knight
  • *
  • Own up and take it like a man
    • View Profile
    • Studio Wossname
  • Faction: Neutral
Re: Obj file to strategic map converter
« Reply #7 on: July 10, 2009, 11:37:53 AM »
He means the underside of the map must use that transparent material.  It shows up in wings as a slightly see-through blue colour.  But yea just click on any face or faces right click and choose materials.  Pick material "hole".  Great idea Tul.  This opens up a lot more options when mapmaking.

Hmm, I use Blender. I understand about naming the materials for everything else so does that mean that the underside of my mesh mush use a material called hole? Also, since the map is basically a sheet of mesh with all the normals pointing up there wouldn't be any underside to give a material in the first place would there?

Don't you just love herding cattle?
*end.transmission - Studio Wossname*
___________________________________________________________________________________________________________________________

   .

Tul

  • Knight
  • *
    • View Profile
  • Faction: Neutral
Re: Obj file to strategic map converter
« Reply #8 on: July 10, 2009, 02:20:52 PM »
Quote
also, is it possible to make a map.txt -> obj converter?
Thorgrim's Map Editor will do it for you.

About the 'hole' material:
Wings 3d doesn't support open structures so if you load a model which is not solid then Wings will fill the hole with 'hole' material. When you export model from Wings then all the faces with 'hole' are ignored. It means that there shouldn't be any underside faces in obj file you export, just delete them. As I know M&B will crash if you give him a closed geometry as a map.

Quote
jus one tiny problem, when i try to load it i get an error msg saying: unable to position party at (17, 52.5)
Water, rock or beyond the border of map. Position all the parties in Thorgrim's Map Editor and start a new game.

There are some slight differences between obj file produced by different applications and I didn't tested this converter with Blender so give me a sign if it works or not.

amade

  • Grandmaster Knight
  • *
  • Own up and take it like a man
    • View Profile
    • Studio Wossname
  • Faction: Neutral
Re: Obj file to strategic map converter
« Reply #9 on: July 10, 2009, 04:55:10 PM »
Thanks, I think I understand it now. In Blender I can ignore the hole material. I never noticed the map editor having the obj exporter, I gave up on it 'cos sculpting the map using it was damn tedious :-P

edit: Ah, damn. The mapeditor's exporter don't export materials along with it :\ what a bummer.
« Last Edit: July 10, 2009, 05:15:01 PM by amade »

Don't you just love herding cattle?
*end.transmission - Studio Wossname*
___________________________________________________________________________________________________________________________

   .

cdvader

  • Guest
Re: Obj file to strategic map converter
« Reply #10 on: August 09, 2009, 10:20:31 PM »
Awesome stuff, but, I tried to put your example into my Test mod and look at it with Map editor, but all I saw was blank, gray space?

Tul

  • Knight
  • *
    • View Profile
  • Faction: Neutral
Re: Obj file to strategic map converter
« Reply #11 on: August 11, 2009, 08:21:51 AM »
Awesome stuff, but, I tried to put your example into my Test mod and look at it with Map editor, but all I saw was blank, gray space?
Could you write step by step what you did?

cdvader

  • Guest
Re: Obj file to strategic map converter
« Reply #12 on: August 11, 2009, 11:00:09 AM »
Um. I downloaded your map conventer, unzipped it, then I did nothing expect click on the "obj to MB map converter.exe", copied the Map.txt to my mod's folder and when I went to look at it with Map Editor, it was all blank, gray space?

cdvader

Tul

  • Knight
  • *
    • View Profile
  • Faction: Neutral
Re: Obj file to strategic map converter
« Reply #13 on: August 11, 2009, 03:13:35 PM »
Well, my Map Editor is not working right now from unknown reasons but I have a nice flat terrain in-game after doing what you did. Try it in-game.

Freddex

  • Squire
  • *
  • Use your brain, so my mind doesn't get bothered.
    • View Profile
  • Faction: Sarranid
  • MP nick: CoR_Freddex
Re: Obj file to strategic map converter
« Reply #14 on: August 29, 2009, 09:59:35 PM »
Short question:
How many faces should a map have?
Then take me disappearin’ through the smoke rings of my mind
Down the foggy ruins of time, far past the frozen leaves
The haunted, frightened trees, out to the windy beach
Far from the twisted reach of crazy sorrow
Yes, to dance beneath the diamond sky with one hand waving free
Silhouetted by the sea, circled by the circus sands
With all memory and fate driven deep beneath the waves
Let me forget about today until tomorrow