Author Topic: Adding new items to m&b using Wings 3d (now with pictures!)  (Read 85474 times)

0 Members and 1 Guest are viewing this topic.

Yoshiboy

  • Master baiter
  • Grandmaster Knight
  • *
  • - Everything is a metaphor -
    • View Profile
    • My Website
  • Faction: Neutral
  • MP nick: irc://yoshiboy
  • M&BWB
Adding new items to m&b using Wings 3d (now with pictures!)
« on: December 01, 2005, 07:19:13 PM »
Some quick things to check if you're having problems:

1. Check the mesh is triangulated on export.

2. In your BRF containing the mesh, make sure BRFedit didn't import any extra materials or texture references. Take a look in the material and texture tabs and delete any entries.

3. If you get a "get object failed" error what it means is that it is looking for either a material, a texture reference or a texture file which does not exist. Likely causes of this are - misspelling things, typos, BRFedit adding materials/texture references you don't want, forgetting to press the "set" button once finished editing materials or texture references and not having module.ini load the right files. Spelling is case sensitive.

4. If you're getting a "attempt to reregister" error it means that its trying to load a material or texture reference twice. Common causes of this are - Using a material/texture reference name which already is used by M&B, Spellings/ Typos, BRFedit adding new materials you don't want/need and loading a BRF twice in module.ini .

5. Double check the your module.ini - if you have texture references, materials or meshes in the wrong order it will cause an error. Also if you have duplicated entries it will cause an error. Sometimes BRFedit will ask if you want it to add the module.ini entries for you. This can cause duplicated entries for your BRFs.

6. You can't modify: heads (requires vertex animation), hair (complicated shaders), hands (vertex animation), bodys/armors/clothes (must be rigged to mesh), horses (rigging), animated bows (vertex animation), props (requires collision meshes), buildings (collision meshes), interiors (collision meshes), animated map icons (vertex animation) ... with this technique. Those all require extra knowledge. This means you can edit things like swords (other weapons), shields, hats/helmets, etc..

If you want a tool for creating meshes that need rigging (Armour, horses, etc) you can look here.

7. Check the texture references; do they have numbers like 875435646 as a flag? That's wrong, replace with 000AA000

8. Make sure you haven't added the extra lines:


Code: [Select]
load_resource = textures
load_resource = materials
load_resource = materials_face_gen

to module.ini . If (and only if) you have duplicates of these lines of code in the file then delete one set of duplicates.

9. If you don't get any errors but your mesh doesn't seem to appear in game then you probably have referenced the mesh wrong in the python files. Double check spelling and capitals and also remember that you should be using the name of the mesh inside the brf, not the name of the actual brf file itself.




Last Update: 19/04/09

This tutorial will take you through the process of adding new items to mount and blade using wings 3d, although many of the techniques discussed can be applied to other programs. Wings 3d is a free modelling program, it can be acquired here. For information on learning how to use wings3d you can look at the official forums tutorial center: found here. Although many of the links are broken there are many good tutorials if you have a little more of a browse. The other most most essential wings3d site is PPs wings3d center. That can be found here. In all honesty, sometimes it can simply be best to learn wings3d by spending lots of time messing around and learning about 3d modelling theory.


Wings3d is the program I use for all my 3d modelling and I find it extremely useful. Although a prior knowledge of the program will help you greatly, it is not completely needed. I will try to give as many hints and tips as I can if your not familiar with the program. The UI is pretty easy to work out, which again is a plus when starting out.

Feel free to ignore this and skip ahead if it isn't relevant.

Lets give a run down on the camera, as people seem to have trouble.

Press down the middle mouse button to go into tumble mod. Scroll the middle mouse to zoom in and out. While in tumble mode, press Q to switch to pan mode. With a selection, press the A key to center your view on the selection, this one is incredibly useful. Space is the shortcut for deselect all. Not related to the camera, but still hugely useful.

If you have two mouse buttons and are missing a scroller ball then go "edit > preferences" Select the camera tab and change the number of mouse button to two. When in this mode holding ctrl and pressing the right mouse button will put you into tumble mode, and while in this you can zoom by holding down the right mouse key and pulling the mouse back and forward.

Anyway:

For texturing my meshes I use Adobe Photoshop, paint can be used but any more advanced program is much better. Gimp is also a good program to use, and free. http://www.gimp.org/

If you are wondering how to unwrap in wings 3d, take a look at my unwrapping tutorial here

another useful unwrapping tutorial in wings is this

Another one you can find here although that one refers to using an existing M&B texture and therefore material, our tut is set up for making a new texture and material.

You will need only one more tool to complete this tutorial apart from wings3d and some kind of texturing program:

Thors BRFEdit model importer/exported, which can be found here (thank you Thorgrim :) )

you will also need some kind of *.DDS conversion tool or plugin for your 2D graphics program. This is so that M&B can read the texture files.

here is the .dds converter

here are the tools for adobe Photoshop

Step 1 - Setting up your own mod file

Before you start you need to make your own mod file. To do this go into the "modules" folder, located in the mount and blade program files and duplicate the "native" folder. Re name it whatever you want your mod to be called.

Now, in this file you want to look for a file called "module.ini" this file basically tells mount and blade what files to load for your mod. You want to make sure the line:

Code: [Select]
scan_module_textures = 0
looks like this, with a 1 at the end.

Code: [Select]
scan_module_textures = 1
This tells mount and blade to look for new mod-specific textures.

After you have done this look in your mod folder, there should be some folders. Look for one called "Resource" and one called "Textures" . The "Resource" folder is for all your new meshes and materials and the "textures" folder is obviously for all of your new textures.



There are 3 main types of .brfs you will need in this "resource" folder.  You will need a material BRF for all of your new materials, a textures BRF for a reference to all your new textures and the final type of BRF is simply to store all of your mesh data. Once you get proficient at modding you will realize that you can in fact have materials, textures and meshes all in the same BRF, but for now, to stop you from getting too confused we will separate them out.

At this point, you should have set up the basics of your new mod and should be ready to start making your mesh!

Step 2 - Importing a mesh into wings3d

This step is primarily for getting a sense of scale of the M&B items compared to yours. It can also be useful to export M&B items for other things you are working on.

First you have to work out what kind of new item you are going to add. For the sake of this we are going to be adding a new hand held weapon to the game, like a sword. :)

Load up Thorgrims BRF editor.

Click on the 'open' button at the top left and go into mount and blades program files and find the folder in it called "commonres". This folder is full of all of the normal M&B BRFs. In here you select the group of meshes you want to get reference from. The one for weapons is called 'weapon_meshes1' . So we will go ahead and open that.



You should see a list of the meshes on the left with a preview of what the mesh looks like in the window to the right. Find a sword or weapon that looks appropriate or is similar to what you want to make.

You then want to select it from the list and click on the "export" button. Make sure you are exporting as an .obj file and find a suitable directory to export it into.



Close Thorgrim's BRF editor for now and go and open up wings3d.

Click on File > import and select the little box next to the 'wavefront (.obj)' option. This should open a little importing options menu.



Keep the swap Y and X axes box ticked but change the import export scales to:

Code: [Select]
Import Scale: 10.0

Export Scale: 0.1

Click ok

This will keep the objects to the correct scale when importing/exporting them and is very important.

Browse to your mesh file that you just exported and double click it - it should appear in the wings viewpoint.

Step 3 - Getting your new mesh set up in wings3d

Now that you have a mesh in wings3d and to scale, you want to get your new mesh which you want to add to M&B into wings as well.

It is important that you take notice of the center point of the scene, this is where the hand of the player will appear on the mesh for swords and most other items, this might be different for other items, but it will always be important.

If you want to make your own model now to import into M&B here are a few tips ;)

if you go "window > geometry graph" a new little window should appear with all the objects in the scene. There are a few little icons next to the objects. The padlock icon and the eye icons are the ones that interest you here. If you want to make sure you dont mess around with the imported mesh or a referance pic you are working off make sure you click the padlock. This will stop you from being able to select the mesh or manipulate it. Clicking the eye will make whichever object it is next to not visible. This is also useful when making a new mesh or cleaning up an imported one.

Which leads us onto the next technique. You can import a mesh from most programs. Wings 3d has quite a few import options.

If you have imported your model from another program you will want to look for any import/export problems that occured:

If you see any blue faces these faces have been set to "hidden" (or are assigned the "_hole_" material) and will not show when rendered. If you dont want these faces to be hidden simply click on them, right click, go 'material' and set their material to 'default'. These faces are important because in other modelling programs and in M&B they will not be shown at all.

Another way to look for mesh problems is to press tab (render or smooth view) and see if any faces appear totally black or stand out to the normal mesh. These areas need sorting out although going into how to sort out messy meshes could take all day ;)

Messy meshes can be very bad and will probably turn out even worse on export and at worse crash M&B or BRFedit.

At this point it is best to save your wings scene with your new model to export in and close wings3d.

If you want to learn some basics of modelling there is an excellent video tutorial series here:


Step 4 - Setting up a texture

Ok, at this point I am taking into account that you have already UV mapped your mesh and put it onto a new texture you have somewhere and all that is fine and dandy. If you don't have a clue what I'm talking about you will want to look for a link near the top for my tutorial on UV mapping and unwrapping. You can also check out the video tutorials in a link a few lines above this.

Now we need to set up the material and reference for the new mesh. Lets look at those other two BRF types i talked about.

You need to get your texture file in .DDS format and place it in your "textures" folder in your new mod folder. Take note of the name of it.

Open Thorgrim's BRF edit again and near the top you will see a series of tabs named "mesh", "mat", "tex", "col", "skel" and "shader". These are essentially the different types of BRF files that there are. The only ones you need to worry about at the moment are "mesh", "mat" and "tex" as these are your mesh, material and texture BRFs respectively

Now you need to create your new texture references. Click on the "tex" tab and press the add button near the bottom. This will create a new entry called "default_texture.dds". In the name box you will want to change this to the name of your new texture file you added to the textures folder (keeping the .dds at the end). Don't worry about the flags box, leave this as it is. You now have your texture reference, so like before go "save" and browse to your module resource folder (the current location might well be in the native resource folder, you don't want to be there) and save the BRF like you did before, for example: "new_sword_tex_brf".



This may pop up a box asking if you want to add the brf to module.ini - you can do this, as it will save time later on down the line, but if you think it will confuse you then don't. This tutorial will continue as if you have not added it.

Next we need a new material.

Go "File > New" at the top of the editor and click on the tab named "mat". Near the bottom press the button named "add". This will add a new material called "default_material" to the list of materials. Click on this material and you will see some of it's properties listed to the right.

In the Name box you will want to put the name of your new material, this can be anything but I would stay away from using spaces or things that will become confusing later on. In the diffuse Box you need to put the name of the texture reference you want for this material (for example: "new_sword_tex"). This will be the texture entry you just added to the Textures BRF. In the shader box just leave it as "tex_mul_color_alpha". The rest of the boxes you can also leave for now. Most of those are used when you want to create more complex materials. Make sure you press the "set" button to save changes. You have now created your new material! Click save, browse to your mod resource folder and save the BRF. Again it can be called anything but its probably good to call it something that wont get confusing and something without spaces. For example: "new_sword_mat_brf".



Again you may get a message about adding to module.ini - do the same as you did for the first time you got the message.

Once you have done this, you have finished making your new materials and texture references! Well done!

Step 5 - getting the mesh into Thors BRF Editor

Open up wings and load up your scene with your new mesh to export in.

Now you want to export the mesh so click: File > export > wavefront (.obj) > click on the little box next to it like you did for importing

here you are presented with a few options -

The first box should be ticked, with the second left un-ticked.

the tesselation should be set to triangulation.

Keep the swap Y and X axes box ticked but change the import export scales to:


Code: [Select]
Import Scale: 10.0

Export Scale: 0.1

sub division steps should be set to 0

the last two tick boxes should be ticked and the last option asking which the default texture export should be set to doesnt matter so leave that how it is.



Click ok and find a directory to export your mesh to.

You now want to close wings 3d and open up Thors mesh editor.

Click on the import button and find your .obj you just exported.

The mesh will appear on the bottom of the list. Scroll down and click on it. You can now set the name of the mesh by typing in the 'name' box and clicking 'set'
In the material box, type in the name of the new material you just made and click 'set'

Here there is a little quirk of BRFedit where by it will sometimes import a material which you had assigned to the mesh in wings3d. We don't want to load this material so browse to the materials tab of BRFedit and if there is a material or two listed there select it and press "delete" to remove them.

Once you have your new mesh in the BRF, click 'save' at the top and browse to your mod's resource directory. Enter the name for your new BRF. For example - "new_sword_mesh_brf.brf"



And you have your new mesh stored in the BRF :)

Step 6 - Telling the game to load your mesh

Ok, once you have your texture in the right folder and your 3 new .BRFs in your Resource folder you want to edit that module.ini to make it use all these new files! (don't worry that its a .ini file, it can easily be edited with notepad or any other text editor)

Its quite a simple process really.

First of all you need to tell mount and blade to call your new textures BRF. (its important the order you load the BRFs. Texture references come first, followed by materials, followed by meshes)

simply add the line

Code: [Select]
load_mod_resource = new_sword_tex_brf
(replacing "new_sword_tex_brf" with whatever your textures BRF was called)

Its important you add this  line before the line:

Code: [Select]
load_resource = textures
Once this is done it needs to refer to your new materials file. This is done in a similar way. Add

Code: [Select]
load_mod_resource = new_sword_mat_brf
(replacing "new_sword_mat_brf" with whatever your materials BRF was called)

again its important you add this before the line:

Code: [Select]
load_resource = materials
Ok, now it should know to load your new materials and textures BRFs. You need to tell it to load your new meshes BRF. This one is pretty easy, after the line:

Code: [Select]
load_resource = materials_face_gen
add the line.

Code: [Select]
load_mod_resource = new_sword_mesh_brf
(obviously replacing "new_sword_mesh_brf" with the name of whatever your meshes BRF was called)



Once this is done, save module_info.ini

Ok, your very nearly there! Just one more step!

Step 7 - getting the mesh in game

Before you can see it in game you need to set up a new object with the mesh. For this we are going to use the python scripts. Read this thread for information on how to get started on the python scripts.

Once you have got all of the python scripts set up and referring to your mod you will want to create a new item that uses your mesh. To do this we use module_items.py
there is lots of information on using module_items.py in winters brilliant documentation found here.

There we have lots of information including creating a new item, when you have created this new item. In the part where you enter the mesh name, simply enter the name of your new mesh, as found in it's BRF file.

compile the scripts, and that's it. You're done. All you need to do is start up mount and blade and look around the shops.



Happy modding!

Ending Points

Take note that if you want to add multiple items you still only need the 3 BRFs, you simply add more materials to the materials BRF, more textures to the textures BRF and import more Meshes into your meshes BRF.

After doing this, if you want to try importing new scenes and scene props, take a look at my extension tut here

Please don't post questions asking how to use Wings3d - for that go to a wings3d forum or similar.

If you are having any issues with the tutorial please scroll to the top and take a look over the points in bold. Nearly all common queries regarding the tutorial can be answered with these points.

Please do not add me on MSN. Instead PM me any questions you have and I will be more than happy to answer them. You can also post here, but I can't guarantee I will see it, others will probably help you.

Yoshiboy



Some quick things to check if you're having problems:

1. Check the mesh is triangulated on export.

2. In your BRF containing the mesh, make sure BRFedit didn't import any extra materials or texture references. Take a look in the material and texture tabs and delete any entries.

3. If you get a "get object failed" error what it means is that it is looking for either a material, a texture reference or a texture file which does not exist. Likely causes of this are - misspelling things, typos, BRFedit adding materials/texture references you don't want, forgetting to press the "set" button once finished editing materials or texture references and not having module.ini load the right files. Spelling is case sensitive.

4. If you're getting a "attempt to reregister" error it means that its trying to load a material or texture reference twice. Common causes of this are - Using a material/texture reference name which already is used by M&B, Spellings/ Typos, BRFedit adding new materials you don't want/need and loading a BRF twice in module.ini .

5. Double check the your module.ini - if you have texture references, materials or meshes in the wrong order it will cause an error. Also if you have duplicated entries it will cause an error. Sometimes BRFedit will ask if you want it to add the module.ini entries for you. This can cause duplicated entries for your BRFs.

6. You can't modify: heads (requires vertex animation), hair (complicated shaders), hands (vertex animation), bodys/armors/clothes (must be rigged to mesh), horses (rigging), animated bows (vertex animation), props (requires collision meshes), buildings (collision meshes), interiors (collision meshes), animated map icons (vertex animation) ... with this technique. Those all require extra knowledge. This means you can edit things like swords (other weapons), shields, hats/helmets, etc..

If you want a tool for creating meshes that need rigging (Armour, horses, etc) you can look here.

7. Check the texture references; do they have numbers like 875435646 as a flag? That's wrong, replace with 000AA000

8. Make sure you haven't added the extra lines:


Code: [Select]
load_resource = textures
load_resource = materials
load_resource = materials_face_gen

to module.ini . If (and only if) you have duplicates of these lines of code in the file then delete one set of duplicates.

9. If you don't get any errors but your mesh doesn't seem to appear in game then you probably have referenced the mesh wrong in the python files. Double check spelling and capitals and also remember that you should be using the name of the mesh inside the brf, not the name of the actual brf file itself.

« Last Edit: May 01, 2010, 05:22:37 PM by Yoshiboy »

-GandalfTheGrey

  • ConnĂ©table
  • Squire
  • *
    • View Profile
  • Faction: Neutral
Adding new items to mount and blade using Wings 3d (free)
« Reply #1 on: December 01, 2005, 07:33:28 PM »
Great tutorial. I think I've to learn how to model a bit now...
Nice job.

Blade

  • Recruit
  • *
    • View Profile
Adding new items to mount and blade using Wings 3d (free)
« Reply #2 on: December 01, 2005, 07:44:53 PM »
Great tutorial Yoshi!!

Im thinking the same Gandalf, now ill have to give this a try!! ;)

thadivine

  • Recruit
  • *
    • View Profile
Adding new items to mount and blade using Wings 3d (free)
« Reply #3 on: December 01, 2005, 08:52:05 PM »
nice dude...maybe if ill have the time to read it, ill learn finally how to model  :P

roborob

  • Knight
  • *
  • when did this get here
    • View Profile
    • My L337 photoshop skills!
  • Faction: Neutral
  • MP nick: Roborob or Stelios
  • M&BWB
Adding new items to mount and blade using Wings 3d (free)
« Reply #4 on: December 02, 2005, 01:15:30 AM »
Thankyou sooooo much for thiis tutorial!!!!

look at my foil i put in http://img.photobucket.com/albums/v176/Roborob/FIRSTWEAPON.jpg
Steam Name: Thehunterunseen

TheDrunkenMoron

  • Knight
  • *
    • View Profile
  • Faction: Swadian
Adding new items to mount and blade using Wings 3d (free)
« Reply #5 on: December 02, 2005, 02:37:31 AM »
stickisize this!

i did all your steps, but i need some help with texturing, when i imported the object into the editor, i got the weapons_1 texture on my poll, it did not use the textures i has (i did not UV map several objects however, i know this to be the source of my problems, but i cant UV closed objects)
At least they've got the first expansion for his new game sorted out - Colin McRae's DiRT : Six Feet Under :P

DaBlade

  • Master Knight
  • *
    • View Profile
  • Faction: Neutral
Adding new items to mount and blade using Wings 3d (free)
« Reply #6 on: December 02, 2005, 10:37:10 AM »
Awesome tutorial Yoshi!
Excelent work.

-GandalfTheGrey

  • ConnĂ©table
  • Squire
  • *
    • View Profile
  • Faction: Neutral
Adding new items to mount and blade using Wings 3d (free)
« Reply #7 on: December 02, 2005, 10:44:50 AM »
You could post it there too. :D

phennexion

  • Recruit
  • *
    • View Profile
Adding new items to mount and blade using Wings 3d (free)
« Reply #8 on: December 02, 2005, 04:54:46 PM »
Thanks for the tutorial Yoshi, very helpful.. only problem was that you didnt go into the texturing part into detail that much and it was really confusing... i looked up the help i needed on google and it worked out great!

YOU ROCK THX!

Reverend L. Lamb

  • Vengeance Incarnate
  • Administrator
  • *
    • Skype - lost-lamb
    • View Profile
  • Faction: Neutral
Adding new items to mount and blade using Wings 3d (free)
« Reply #9 on: December 02, 2005, 05:41:59 PM »
*smears the thread with some sticky-stuff from his own private stash*
'We put all our politicians in prison as soon as they're elected. Don't you?'

'Why?'

'It saves time.'

Yoshiboy

  • Master baiter
  • Grandmaster Knight
  • *
  • - Everything is a metaphor -
    • View Profile
    • My Website
  • Faction: Neutral
  • MP nick: irc://yoshiboy
  • M&BWB
Adding new items to mount and blade using Wings 3d (free)
« Reply #10 on: December 02, 2005, 08:03:55 PM »
Quote from: phennexion
Thanks for the tutorial Yoshi, very helpful.. only problem was that you didnt go into the texturing part into detail that much and it was really confusing... i looked up the help i needed on google and it worked out great!

YOU ROCK THX!


yeah, sorry about that, i could add a bit more detail later but it gets kind of complecated. Its where you need some 3d modelling theory :P

TheDrunkenMoron

  • Knight
  • *
    • View Profile
  • Faction: Swadian
Adding new items to mount and blade using Wings 3d (free)
« Reply #11 on: December 02, 2005, 11:32:24 PM »
i still need to do the texturing, but that isnt the point.


Edit: i finished the thing, it is in place, animations correct (just had to rotate it 90 degrees) but texture still off. oh well, im still proud of it (the weapons 1 DDS file is the texture)


Yet Another Edit: i just finished this, the first katana ( i used the hair texture, lawlz)

At least they've got the first expansion for his new game sorted out - Colin McRae's DiRT : Six Feet Under :P

Yoshiboy

  • Master baiter
  • Grandmaster Knight
  • *
  • - Everything is a metaphor -
    • View Profile
    • My Website
  • Faction: Neutral
  • MP nick: irc://yoshiboy
  • M&BWB
Adding new items to mount and blade using Wings 3d (free)
« Reply #12 on: December 03, 2005, 09:48:49 AM »
i added a small tut image for the texturing part, i hope it makes it a bit clearer:

lookie

Lemonfield

  • Knight
  • *
    • View Profile
  • Faction: Neutral
  • MP nick: McGuffin | Lemonfield
Adding new items to mount and blade using Wings 3d (free)
« Reply #13 on: December 05, 2005, 04:22:58 AM »
Well I learned some of the Wings3D basics today and modeled a mediocre barbutte to test in the game. No problems whatsoever. I'm going to try from max -> wings -> BRFview -> ingame now.

Thanks for the tut btw yoshi, I need all the help I can get.

GhostThaxian

  • Recruit
  • *
    • View Profile
Adding new items to mount and blade using Wings 3d (free)
« Reply #14 on: December 08, 2005, 09:09:52 PM »
Alright.
I haef question for you.

I use Milkshape 3D because well.. I know how to hack models with it.
But I don't really have an awsome knowledge about modeling.

Now then, you tutorial confirmed what I figured I had to do, I was just to lazy to do it untill now and had a few inner battles about the texture.

I'm trying to get a sword from Neverwinter Nights into the game (No, it's not illegle, at least I don't think so.. People do it for quake >.>)
Anywho, it's a pain in the rear to get all the parts for certain weapons, because you can use like twelve different types of crossguards, blades, handels and the little end part there.. But it's still a long sword, just looks different, But I managed to get all of the parts of the sword I wanted. I got it all into an .obj file and so forth, with the texture and all that, but, the one thing that confuses me most, is the blob of colors that it manages to figure out which ones to use for the sword.
Because I have no idea.



See the square with all the pretty colors?
The texture is in there. That little 64x64 square contains all the weapons textures in NWN, so the weapons are all mapped on which textures to use.

Well not to long ago I imported this into a Half Life mod and all was happy, it knew which parts to use and soforth, looks good.
BUT, in Mount and Blade it looks like a blob of well everything.
Now I think it's using that square, as part of blade is textured with the right color, but the rest is all screwy. So I believe it knows as much as that square but not what parts to use.
The major difference is one is in a .dds file with other textures and the other is just a BMP, so obviously that could be the problem.
Do I need to figure out what part of the textures it's using and learn how to texture map the thing or .. ?

It turns out that Milkshape CAN use .dds for textures. BUT. It doesn't automaticly apply any of the textures anymore like it used to for me, something happened and it hasn't been right sense.
I have to go to Vertex, then manual edit for it to snap the texture on there.
I have to do this with anything else though, so it's prolly some weird setting somewhere.
Almighty God of truth and love,
To me thy pow'r impart;
The burden from my soul remove,
The hardness from my heart.
O may the least omission pain,
My reawakened soul,
And drive me to that grace again
Which makes the wounded whole.
-Charles Wesley