OpenArena Message Boards

Other projects => Pointless => Topic started by: andrewj on September 02, 2008, 06:48:14 AM



Title: MDL exporter
Post by: andrewj on September 02, 2008, 06:48:14 AM
If you've still got Preach's blender MDL exporter then stick it on speedyshare or commit it to OQ+ svn and I'll try to get it working properly, but no guarantees.


Title: Re: MDL exporter
Post by: fromhell on September 02, 2008, 07:54:47 AM
hard drive search commenced

p.s. You should really base it on the md3 exporter, as the mdl exporter was based off the very broken md2 exporter shipped with Blender. Some specs:
http://tfc.duke.free.fr/coding/mdl-specs-en.html

Current MD3 exporter:
http://openarena.ws/board/index.php?topic=2139.0


Title: Re: MDL exporter
Post by: fromhell on September 02, 2008, 08:37:43 AM
2/12/2008


Title: Re: MDL exporter
Post by: andrewj on September 03, 2008, 12:09:58 AM
Cheers.

Yes I'll base it off the MD3 converter, but having the MDL export code will save A LOT of time.

Does blender let you assign properties (name/value pairs) to a whole model?  This would be useful for various things (model flags, synctype, whether to use fullbright pixels).


Title: Re: MDL exporter
Post by: epicgoo on September 03, 2008, 12:55:26 AM
afaik no
also mdl stores images inside dunno how to do it in python
2-step process might do it
1) export blah.mdl without textures and flags
2) use "mdlBlah.exe blah.mdl blah.cfg" where blah.cfg contains images paths and flags per surface, and mdlBlah.exe pushes them inside the blah.mdl


Title: Re: MDL exporter
Post by: fromhell on September 03, 2008, 04:19:19 AM
skin width and height would need to be explicitly defined in the mdl as well for the uv maps to be consistent


Title: Re: MDL exporter
Post by: andrewj on September 03, 2008, 04:25:12 AM
a 2-step process might do it
1) export blah.mdl without textures and flags
2) use "mdlBlah.exe blah.mdl blah.cfg"
I've been considering that, mainly because processing of the skin texture by Python code is really slow.

But I'd prefer to keep it as simple as the MD3 exporter.


Title: Re: MDL exporter
Post by: andrewj on September 04, 2008, 04:13:13 AM
Does blender let you assign properties (name/value pairs) to a whole model?  This would be useful for various things (model flags, synctype, whether to use fullbright pixels).
I have learned that you add Empty objects to a scene and give them arbitrary names.  So I'll use them to control those niggly little things.


Title: Re: MDL exporter
Post by: epicgoo on September 04, 2008, 06:02:26 AM
Menu -> Help -> ID Property Browser, you can set custom values for objects, materials and other things
then in the python script you can use object.properties or material.properties etc
those give http://www.blender.org/documentation/246PythonDoc/IDProp.IDGroup-class.html


Title: Re: MDL exporter
Post by: andrewj on September 04, 2008, 08:02:05 AM
Menu -> Help -> ID Property Browser
They put this in the Help menu?
WHAT ON EARTH WERE THEY SMOKING???
(That goes for the whole crazy blender UI)

Anyway now I've got that out of my system, thanks f0rqu3!


Title: Re: MDL exporter
Post by: andrewj on September 10, 2008, 05:57:30 AM
Getting there......

(http://glbsp.sourceforge.net/shots/ajmdl_boss.jpg)


Title: Re: MDL exporter
Post by: epicgoo on September 10, 2008, 06:28:07 AM
lol
is it gargoyle?


Title: Re: MDL exporter
Post by: andrewj on September 10, 2008, 06:43:02 AM
He's a CHTHON replacement in the OQ+ tree.

His face got messed up by poly reducer (too many verts in the original).


Title: Re: MDL exporter
Post by: fromhell on September 10, 2008, 08:37:27 AM
MDL should support lots of verts
you could also test a model that doesn't have a fullbright skin, like a weapon model


Title: Re: MDL exporter
Post by: andrewj on September 10, 2008, 07:40:15 PM
MDL should support lots of verts
No more than 1024 in id's GLQuake.


Title: Re: MDL exporter
Post by: andrewj on September 11, 2008, 10:13:06 PM
Weapons seem OK:

(http://glbsp.sourceforge.net/shots/ajmdl_vrock2.jpg)


Title: Re: MDL exporter
Post by: fromhell on September 12, 2008, 07:56:55 AM
that is cool, i can see goraud shading (!!!!)

How does it look in software though? Software is a target too


Title: Re: MDL exporter
Post by: andrewj on September 12, 2008, 10:10:01 PM
Try it yourself, here is pak2.pak with progs/boss.mdl and progs/v_rock2.mdl:
http://glbsp.sourceforge.net/files/pak2.zip (http://glbsp.sourceforge.net/files/pak2.zip)

There's a rocket launcher near the start of E1M5, and CHTHON is E1M7.

Also included is the unfinished export script.
Target gamma is hard-coded as 0.5, and fullbrights are OFF.
Works just like the MD3 exporter.



Title: Re: MDL exporter
Post by: fromhell on September 16, 2008, 06:15:34 AM
holy crap this script saves a lot of time
is it possible to make it read a palette from a palette.lmp file, if available in the same folder of the model or so?


Title: Re: MDL exporter
Post by: andrewj on September 17, 2008, 07:09:30 AM
is it possible to make it read a palette from a palette.lmp file, if available in the same folder of the model or so?
Which palette?  If just Hexen II then I'll add it directly into the script.

BTW I think the normals are not right, when I find a good way to test them I can fix it.


Title: Re: MDL exporter
Post by: epicgoo on September 17, 2008, 08:56:00 AM
I think fromhell mean a generic palette (maybe you can have more than one palette)

Oh and I hate normal packing of q1/q2/q3
it is the worst in q1 You need <float float float> to index[ int ]
(I read your code and it should work. dunno. Check md2 exporter[probably you did ])
I was lucky because there is r_shownormals in q3


Title: Re: MDL exporter
Post by: fromhell on September 17, 2008, 09:34:41 AM
is it possible to make it read a palette from a palette.lmp file, if available in the same folder of the model or so?
Which palette?  If just Hexen II then I'll add it directly into the script.
in the future i might make mini-games on the base engine using completely new palettes from scratch (for competitions) due to the recently reworked pipelines


Title: Re: MDL exporter
Post by: fromhell on October 16, 2008, 05:10:13 PM
A seperate version with the Haktoria palette integrated could be great


Title: Re: MDL exporter
Post by: andrewj on October 16, 2008, 09:00:21 PM
OK will do that soon.

It will only be useful for quick prototyping since I haven't added a
gamma setting yet (still hard-coded at 0.5).


Title: Re: MDL exporter
Post by: andrewj on October 18, 2008, 05:35:21 AM
Haktoria Palette Transplant complete, but not tested in-game.

Edit the script and search for 'DEFAULT' if you want to change
the hard-coded target gamma and/or fullbright mode.


Title: Re: MDL exporter
Post by: fromhell on March 17, 2009, 12:29:15 PM
After re-exporting fired guns weapons I've noticed the UVs shift 1 pixel to the left
this is a bug

anything on the fact its vertically flipped along with the skin? that's unnecessary
the whole gamma thing can go too


Title: Re: MDL exporter
Post by: andrewj on March 17, 2009, 09:13:56 PM
Noted.  I'll be working on the exporter again soon.


Title: Re: MDL exporter
Post by: fromhell on January 21, 2010, 12:35:17 AM
1 pixel to the left
Also one pixel upward too.


Title: Re: MDL exporter
Post by: andrewj on January 24, 2010, 08:25:32 PM
Blender is unusable on my currrent hardware (menus are not drawn).
Time to upgrade heh.


Title: Re: MDL exporter
Post by: Marble of Doom on January 24, 2010, 08:27:27 PM
Time to upgrade heh.

Blender no longer runs on my G4 macs either.


Title: Re: MDL exporter
Post by: fromhell on February 23, 2011, 02:59:20 AM
do you mind if I post this exporter with a page somewhere?


Title: Re: MDL exporter
Post by: andrewj on February 24, 2011, 02:39:47 AM
no prob.


Title: Re: MDL exporter
Post by: andrewj on March 29, 2011, 07:10:04 AM
Try this one, no gamma fiddling, inverted the skin, did something about the off-by-one UV coords (dunno if it worked or not, let know).