View Full Version : Blender export to M15 file format
Michael Hartlef
17-02-2007, 13:18
Hi folks,
attached is the first version of a M15 export script for Blender (2.43 and up) .
The zip file includes a converted fighter model from PSIONIC3D. I don't call the script done, but the first test were very successful and I want you to give the opportunity to play with it. So far it supports material color and material texture. Later only the first material texture.
Let me know what you think.
Cheers
Michael
Edit: If your blender texture is a JPG, the export script renames it automatically, but the texture has to be renamed manually. Also you have to copy the texture by hand too. Sorry for the inconvenience.
Petr Schreiber
17-02-2007, 17:35
Hi Mike,
congratulations !
Could you please for us, not-native Blenderians :), describe how to install your script properly ?
Attached m15 model ( very nice ! ) loads ok in thinEdge.
Thanks a lot,
Petr
Michael Hartlef
17-02-2007, 17:41
Hi Petr,
look for this path in your blender installation:
.Blender\scripts
On my computer it is c:\programme\Blender Foundation\Blender\.Blender\scripts
There you should find allready a bunch of python scripts, all ending with .py.
Just copy the script over there. To export in Blender, select you mesh, click on
menu File\Export... and there down the end you should see the thinEdge M15 entry.
Michael Hartlef
17-02-2007, 17:48
Like I said, this is the first version. I want to add the following stuff over time:
1. Variable rotation for all axes
2. Variable Scaling for all directions
3. More materials than just the first one can have a texture
4. If a scene has more than 1 mesh, they all could be exported on different
layers
5. Maybe by able to chose that each material's vertices can be on a different layer
6. Not sure if possible, but automatic conversion of JPG and PNG textures to BMP files
7. If 6 is possible, automatic copying of the texture file
I still have to get my head around the difference in Blender of FACE.UV's and VERT.UV's. I have to read a lot I guess. ;)
Once I have these things in it, I will try to make some suggestions about animation/bone data inside the M15 file format.
Michael
Mike, WOW!!!
Thanks, so much. I am amazed by how fast you did all of this. FANTASTIC!!
Asking about rotating on the x90, what a nice touch! Super Duper!!!
Thanks again, I guess my c++ studying for today will be worked on later, now to play with blender and this new awesome script!!
I got an error, just posting here in case anyone else runs into it. It comes from not having python installed and says something about only built in modules will work. This is probably a unique problem to me as I install and uninstall languages all the time. Just wanted to mention it in case anyone else runs into it.
Ok, got it working. I went through and made sure I uninstalled all past python installs. I downloaded and installed python. I uninstalled blender and installed the latest release candidate, I rebooted windows and all is working fine. Very exciting to be able to export straight to m15, great job Mike.
Petr Schreiber
18-02-2007, 00:04
Hi Mike,
thanks a lot. I made it the way you described it but it did not show up, but I think it is possible I have too old Blender version. I will try tommorow with newer.
Thanks a lot!,
Petr
I just tried the latest release candidate for blender. It does not have texture baking in there at the moment, or it has been moved somewhere else I couldn't find it. I uninstalled and reinstalled 2.42a and all is fine.
Wait till you see this fighter model in Mike's zip Petr, it is neat :)
ErosOlmi
18-02-2007, 01:30
bYiiAZNrH7U
http://www.youtube.com/watch?v=bYiiAZNrH7U
:D
Eros, really nice!! Here is a thought if you are in a testing mood. Petr has that flying through space demo, where the stars go by, but with red shifting effect for speed. It would be neat to use this demo with the stars in the background and as you rotated the stars zipping by would reflect the viewing angle as if actually going around the fighter in flight.
Why am I asking this? I have been thinking of doing something like that since I came across thinbasic and that demo. Just don't have the skills yet and now that I focusing on learning c++, it is getting harder and harder for me to go back and forth between languages.
That is really neat, some sound effects from any sci-fi show of a ship flying and it will be perfect. I had made such a sound a few years back but lost it. It was recording many hours of deeps space nine and going through fly by videos and compositing the sounds to make a unique sound based on the underlying tracks.
Anyways sorry to get off topic. Awesome to see the fighter in 3d moving around.
Another note, here is a video I found today on new texture baking in the new blender, I didn't see this when I downloaded that version and as I wrote before back to 2.42a, but wow, looks really cool and I realize I am a caveman with my blender skills at the moment when I see this:)
http://www.sweb.cz/devros/T5.mov
ErosOlmi
18-02-2007, 02:26
Unfortunately I'm not at high level too. I'm just able to see the work of others and try to add little changes.
In this case I just take exampe from Mike file and used general script ModelViewer from Petr to view M15 model.
Sorry ;)
Nothing to be sorry about Eros, love the examples you have been doing with tbgl lately. Lots of cool stuff. Thanks for the zip file to view the model!!
I got the stars, fighter and some intro sound in there. I will hand it off to the next one of you talented guys to add to it. This is lots of fun!!
Michael Hartlef
18-02-2007, 10:58
Hi guys,
I think you have to have Python 2.4 installed to run the scripts.
Michael Hartlef
18-02-2007, 11:52
Hi folks,
here is a little flash video about where the script has to be located and who to fire it up :)
Michael
Petr Schreiber
18-02-2007, 12:06
Hi,
nice scripts!
I can see in my head idea for game where you fly with this vehicle in hell of some megagalactic battle, like in Star Wars :). Just flying forward with possiblity to "strafe" left-right and up-down. Extension of TopDown to 3 dimensions, controlled with mouse...
Mike - great video. Problem is that I did all as in video, and the thinEdge script does not appear in Export menu.
I will reinstall now and see if it will be ok. My Blender is 2.42a.
Bye,
Petr
Petr Schreiber
18-02-2007, 12:15
Hi Mike,
after reinstalling it it displays ok in Export menu :)
But when I try to run the script it says error ocurred and throws following to console:
Traceback (most recent call last):
File "<string>", line 201, in FileSelectorCB
File "<string>", line 183, in ExportToM15
AttributeError: objects
I have Python 2.4.1 installed.
Any ideas :'( ?
Thanks,
Petr
Michael Hartlef
18-02-2007, 12:36
Mmmh, I have 2.43 RC3 installed. Can you try this?
Michael Hartlef
18-02-2007, 12:36
Plus do you have Python 2.4 installed on your computer?
Petr Schreiber
18-02-2007, 12:56
Hi Mike,
sure, Python 2.4.1 is installed and running.
I have not tried the RC 3, I will try to get it soon !
Thanks a lot,
Petr
Michael Hartlef
18-02-2007, 15:14
Ok, I tested it myself, with 2.42a it doesn't work, but with 2.43. Get the release canidate 3 or the actual release. IT surpose to come out soon i think.
Petr Schreiber
18-02-2007, 15:26
Hi Mike,
in 2.43 it works without any troubles!
Just little suggestion - would it be possible to type in console "Export completed" or something like that ?
Now I can see just that lamps and cameras are not supported.
Very nice work, still amazes me how fast done ;)
Thanks,
Petr
Michael Hartlef
18-02-2007, 16:06
Just little suggestion - would it be possible to type in console "Export completed" or something like that ?
I see what I can do. I don't know the Blender API that well. What I did was studying the other export scripts, and read the manual. Also my own editor gave me more trouble than needed so I switched to Programmers Notepad and from then it went smoothly.
Now I can see just that lamps and cameras are not supported.
It can be, if the M15 file format will support it one day ;)
Very nice work, still amazes me how fast done ;)
I didn't reinvent the wheel, just put 1+1 together. And as you see, that script isn't that big. Most of the time I was struggling to got the info at the point when I needed it. Most file format have seperate chunks of faces, vertices, uv-coords, etc etc. The M15 fileformat stores each vertex of a face, also redundant vertices that were allready stored from a face that used it before.
So next update will have hopefully that Finished Export Message. :)
Petr Schreiber
18-02-2007, 21:40
No problem Mike,
I just had to find some problems in your working product ;D
Looking forward to new versions,
Petr
Thanks again Mike, really nice what you have and are doing!!
Glad it is working now for you Petr.
Michael Hartlef
18-02-2007, 22:40
I just had to find some problems..
To me problems/bugs/etc. are just unwanted features ;D
Blender and Python: Ok even with Release 2.43 Blender, you need Python 2.44 and not 2.5
I just spend my whole afternoon and most of my evening trying to figure that out. I guess I should have started reading sooner than thinking I was missing a step from the other day :) Just wanted to save anyone else from headaches.
So if you see Blender complaining about no python installed and you do have it installed, it is the version problem.
Michael Hartlef
21-02-2007, 08:08
Yeah, there are topics about this on the blender forums. They say that you can change the required version inside the blender sources to 2.5 and then compile it. Should work then with 2.5 too.
Thanks Mike for the info. I am not at a point to compile my own Blender from source yet :)
The Texture Baking Example appeared tonight on blender's site. So I downloaded the example.
Using the scripts from the menus doesn't work, even in their version, but using the shortcut Keys, CTRL+ALT B seems to work, at least on their example.
So here is Cornelius the Blender Monkey Example Texture Baked and Exported out with Mike's handy dandy m15 exporter for blender.
Just put the untitled.bmp into your texture folder and the m15 file into your model folder and have a look in thinEdge or I guess could be loaded into thinBasic too.
Now to see if I can get it to bake a simple cube on my own, then I can get back to modeling. Wasted the whole day trying to get baking to work. At least I know it does work in a strange way and now will try again.
In my frustration with Blender earlier, I tinkered with wings3d, wow you can really model quickly in that. I guess then export into Blender and do the other stuff. It should be faster for low poly modeling and things like ships. So something else to consider. It has lots of nice shorcut keys too and also everything is right mouse click available, really neat interface.
Hope the monkey appears nicely for you guys too.
Michael Hartlef
21-02-2007, 09:56
I will look at it tonight as I'm at work now. Yes, use the tools that fit the job the most and where you are
the most comfortable with. I modelled in Hexagon, layed out the UV map un Unwrap3D, painted the texture in Photoshop and import/exported with Blender. I'm not familiar with Blenders material concept and so far were not
successfull with it. I'm interested in this texturebacking stuff too, as I can imagine that you can get nice results
from it. But for this I have to understand it first, how to set different materials to different faces.
Wings3D seems to be great for polygon modeling. I never touched it but I hear good things about it. Hexagon is the
first modeling app that I felt really comfortable with. And I spent a fortune on graphic stuff.
On my harddrive sits
Animation Master 2003, TrueSpace 6.6, Carrara Pro 5, Hexagon 2, Silo 1.4, Photoshop 6, Corel Draw 10,
Anime Studio Pro 5, Manga Studio 3 EX,
Same goes for Music apps, but not that many. When you think about it, there are so many free alternatives,
and really good ones. These ones I use sometimes:
Blender, Inkscape, Artweaver, Paint.NET, Audacity, Krystal Audio Engine
What I learned is, you can go on searching all your life. But if you do wanna get something done, then
try to stick with a tool or two and try to learn it. Same goes for programming languages. A friend of mine
and I were searching for the holy grail game engine. We wasted so much time jumping from engine
to engine that we never got to finish our game. Use the tools you have, learn them and use them.
Michael
What you say is true Mike, but I think those of use curious will always keep looking and trying. The problem is each app seems to have advantages and disadvantages, the same with languages. But with a good workflow to do what you want with a set of tools is my goal now as I realize the one holy grail app like you said will never be.
I had truespace long time ago, actually started with it. I really enjoyed it. Then from that met a friend who got me into Lightwave. He let me use his apps as he didn't have time. He had a zillion lightwave magazines too, So that was lots of fun. Then I did some graphics work and ran into this guy at a tv station and he told me about 3dsmax. How he dreamed of owning that. Well he eventually did and has been using it since. He let me borrow one of his Max's as the station had some too. So I used that and really learned that pretty well, not expert, but enough to model and texture bake. But I had to send his copy back. Anyways make a long story short, was thinking of buying gamespace, truespace again, I wrote to them, my version I had owned was too old to quality for any upgrade.
Wings3d makes modeling really fun and is really fast interface. And now Blender has good texture baking and with your export program we have a great way to get it into our programs and of course the rock solid coding by the thinBasic team of Eros, Roberto and Petr.
Well, off to sleep. Can't wait to see what tomorrow brings. Have good day guys!!
ErosOlmi
21-02-2007, 12:56
What I learned is, you can go on searching all your life. But if you do wanna get something done, then
try to stick with a tool or two and try to learn it. Same goes for programming languages. A friend of mine
and I were searching for the holy grail game engine. We wasted so much time jumping from engine
to engine that we never got to finish our game. Use the tools you have, learn them and use them.
I could not agree more !
It is like real life. If you want to have good friends you must accept pro and cons of them. At long terms, pro will be much much higher than cons only if you stay with them!
One of the foundation of science is curiosity but at some point some of the tools must be mastered as "friends" and stay with them even if other are more smart or clever in some aspects.
Ciao
Eros
Mike, as you know I love the blender exporter you wrote.
Now that you are working with your poser program, I am trying to figure out somethings.
1. Will all animation and exporting be done from your program?
or
2. Can we export animations from Blender directly and use your program to tweak?
What are your thoughts so far on this?
If you are going to support exporting animations from Blender, maybe you could start with exporting Lights and the main Camera.
This way we could import the same scheme in our projects, basically use Blender as our level development tool?
Just thinking and trying to get a feel for which way things will head.
My current feeling comes down to the fact the Blender has all the tools we need in one free package.
We can setup lights, animations, model, make levels you name it, it is all there.
So if we could use that, it would be the only tool we need, then it is a matter of exporting it so we can use it in our games and projects.
Anyways just some thoughts and looking for ideas from you guys.
If you agree that would be the tool to use, then perhaps we should look at how to use blend files, since it contains all we could ever need.
Michael Hartlef
29-06-2007, 08:36
Hi Kryton,
indeed, this is an idea I was playing myself with. Using a blend file may be a little to much as it contains everything, from models to Blender UI customizing. But maybe I should conzentrate on Blender export scripts. A toolset that would export in a way we need it. Let me think 2-3 days aboput it. Right now I'm setting up my computer again. My USB didn't detect anything new anymore, so a complete reinstall had to be made. It will take me a while to get everything in place again.
But if you allready have ideas for a scene file format and an animation fileformat that can be used be animation routines, then let the info rolling.
TBGL doesn't support the filefomats so we have to build TB routines to use the output of the blender export scrippts to be build.
The idea about my posing program was to load a M15 file, draw visiually the bounding boxes for the bones, and then let the user rotate these bones. Keyframes would be stored. To export and reuse this animation I would have saved it in a certain format and also export general animation routines for TB that could then be called. But again, this could be doen from Blender too I think.
Petr Schreiber
29-06-2007, 19:04
Mike,
good luck with recovery of your PC !
Bye,
Petr
Michael Hartlef
29-06-2007, 20:10
Thanks Petr, so far I was lucky. But as allways, I forget to backup stuff. This time I was a load of pictures.
Sorry you lost some pictures Mike. I have been tinkering so much the last 2 weeks that I had just reinstalled my system completely, but things are all over the place again with all the tests. I might do another wipe and reinstall next week after the weekend.
I think your idea to work with m15 is a good one with own format. I will post more about why in the other thread where I asked about formats. But basically I read last night that fbx and collada, the all encompassing formats are used for moving files from app to app, but then a loader is made for games and then the games convert the info they need into the game format to speed things up. Seems like overkill as you mentioned.
As you know I used ini files now for he model viewer and it works great. Easy to go change something by hand in notepad if need be and so easy to read and write to.
What is neat is that we can have different sections, so it is really a great format. I think a lot easier to use than xml, but ini is only for one line at a time, xml allows text blocks. I would say either xml or ini files depending on the complexity. Right now if single line entries are all we ever need, then ini files are the way to go.
Michael Hartlef
29-06-2007, 22:02
I think I have to loose something. Sometimes it the favorites of IE, then some pics, then some sources. I think I also lost now the project file for the TopDown Intro theme :( Oh well.
Petr Schreiber
29-06-2007, 22:08
Hi Mike,
I am sorry to hear that :( Especially intro theme for topDown hit me :(
Long time ago, when my disk crashed I lost all photos and data on it. Before month I mounted this disk to old machine, and could see it is ok. Thanks to BIOS benevolency I could even boot from it and recover all I wanted. Hope something similar is possible in your case.
Bye,
Petr
Sorry you lost your theme project file Mike. At least we have the nice theme with us!!
Michael Hartlef
01-07-2007, 07:31
@Kent: As you don't like to use XML files, please post a sample ini file that includes all the info of a scene. I askyou to do this because when something is totally unlogical for me, I have that blockage in my head that prevents me with comming up with a solution. Please also include lines that show the usage where you would normally use multiple lines for the info.
Mike, it is late my time, I will work on something when I get up today. You will probably get it by Monday your time :)
I just think ini is really simple. XML is popular for a reason, so I won't say I am against it. But it will be fun to a script for ini scene.
Maybe if you just give me simple specs, so the code I write will look like something you could use with tweaks then.
If not I will just make up stuff that I think a scene would contain.
Michael Hartlef
01-07-2007, 11:54
yeah, make up something that you would think would be needed for a scene description.
Mike here is an ini example I wrote tonight.
It is straightforward. It is just long because I assign and then print back the data to the console window.
There are no error checks or anything.
But it will assign values to the variables,
Save them to an ini file in the app path
Read back the data from the ini file
and display it on the screen.
To see how it works in tbgl, you can look at my last modelviewer code.
I used ini files to write out that data and to load it the next time a user uses the app again.
It worked well and that is what really sold me on ini.
If you want to write a comparison xml version it would be neat to see the difference.
And if any benefits.
Anyways here is the script attached. It is a console application for simplicity.
Michael Hartlef
02-07-2007, 14:19
Thanks Kent.