Automatic Sword Generator for Blender 2.49

Hi all!

After about a year of learning and using Blender, I’m proud I can finally contribute with something meaningful - a script for automatic creation of swords. I developed this script as part of my Master’s Thesis at Brno University of Technology, Faculty of Information Technology ( Currently, it works with Blender 2.49 and corresponding Python installed. Version for Blender 2.6 is planned after next stable version of Blender is released.

Here is a link to download ZIP archive with “swordgen.blend” file, readme.txt and brief user manual:

EDIT: the version has been updated to 0.90b (nasty optimisation bug fixed)

This script is still under development (with many bugs no doubt)… There is still a lot to be done and I can think of tons of possible upgrades. Any comments and suggestions will be appreciated.

I beleive the GUI is pretty straight-forward and you won’t have any problems using the generator. I’ve even written a short user manual but it’s far from perfect. If you need some additional info, feel free to contact me.

Here are some renders of actual generator output:

Wow. Nice script. It will be very helpful for game developers, who works on a game with medieval theme (or fantasy perhaps) and require inventory of weapons.

wow, that’s a funny script :slight_smile:

jo a mimochodem jsme bejvali spoluzaci :slight_smile:

Thanks, glad you like it.

2 pildanovak: Svět je malý :slight_smile:

i like this specialiased kind of script

are you planning to port this to 2,5 soone!

keep up the good work

Tanks & happy 2.5

Thanks. As much as I like the new Blender 2.5, I actually don’t plan to upgrade the script until next stable version is released (there are many good reasons for this decision). However there will definitely be a version of sword generator for Blender 2.5+ in the future :wink:

Maybe the mods would forgive a bit of cross posting?

I personally think you should also notify the people in the ‘Game Engine Resources’ thread about your great script.

do u plan on extending it to make other bladed weapons like daggers, shurikens, sai\s

Cool script. Thanks for sharing it.

tin2tin: That’s a good idea, thanks. Will do that.

mcbeth: Extending the generator to acomodate sword-related weapons shouldn’t be too hard, I added your suggestion to my wish list :wink: Right now TODOs are (not necessarily in that order):

  • make hilts more customizable (e.g. disassembly to parts like pommel, cross-guards, ring-guards,…)
  • Add more params for the blade (e.g. dents, drillings, cuts, local widening,…)
  • Add more curves (mostly for unusual blades like “kopesh” etc.)
  • Make the script auto-load prefabricated stuff to enable more convenient way of adding content.
  • Enable material selection for each part of the model.
  • Upgrade to next stable version of Blender (2.5+) and make better GUI
  • Add more weapon types and some exotic types of swords (e.g. double-sided swords, bat’leth,…)

awesome script. the only suggestion i would have is polycount issue

i noticed that for things that require poly count because of the script it still adds those verts anyways…

i guess a idea would be to use if functions to check for settings that are off that would waste verts?

other than that awesome code and script definately great to look at and learn from it

Hi! Thanks for your reply, your suggestion is (and yet it is not) part of the script already :slight_smile: Let me explain:

There is actually quite efficient optimisation of poly count, but you still need periodical grid most of the time, because of curving and non-linear taper. You can set how dense will the vertex grid be using constants called “CONST_ZSTEP” for vertices count in profile-cut and “CONST_YSTEP” for vertices density along the blade (y-axis). I didn’t have time to add this option to the GUI (or to mention this in the manual), so for now you will have to edit them manually in the script (they’re right at the beginning, somewhere around line 30 or so).

But there’s aslo an ugly bug! If you have 0 taper and no curve selected, there shouldn’t be any redundant vertices (thanks to the optimisation), which is not true for the version I published. I removed this function for testing purposes and then forgot to put it back :slight_smile: So thanks for the info, the link has been updated with new, correct version. Try making e.g. the German bastard sword with it, you shold see the polycount is much better now :wink:

P.S. There are few more things you can customise using “constants” at the beginning of the script - check out comments in the code for more info…

Very nice. Thank you.

Thats really awesome! For those game engine users out there, like my self, could you make a low poly/lower poly version?

Too many polygons in the game engine can really slow the game down.

Very cool!

I’ve always wondered what a katana with a viking style hilt would look like…

Yes, it is possible. You just need to make two simple changes in the script. Locate constants called CONST_ZSTEP and CONST_YSTEP (they should be somewhere around line 30) and change values to greater numbers, e.g.:


The bigger the number, the less polygons will be in the model (these values represent in fact a distance between vertices in the mesh). Be carefull though, as there could be a ton of bugs (I haven’t tested this feature very thoroughly yet).

Finally, because hilts are not yet procedurally generated (they are prefabs, but it is likely to change in future versions), setting I described above won’t affect them. If you need to reduce their polycount, use the “Decimate” modifier. It’s quick and easy :wink:

P.S. You could simply use decimate on the blade as well, but I advise against it because you’ll unnecessarily loose more detail that way.

It worked! The hilt isn’t that bad. I can decimate it later if I want to as well.


This is late but what do I do from here? I have no idea what I am doing as I am new to Python and blender. Thanks!

UPDATE: Nevermind I have figured it out.