[BETA] Blender MD3 exporter rewrite

Any utility that assists in the creation of mods, assets, etc, go here.
Forum rules
The Projects forums are ONLY for YOUR PROJECTS! If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.

Got a cool project idea but nothing else? Put it in the project ideas thread instead!

Projects for any Doom-based engine (especially 3DGE) are perfectly acceptable here too.

Please read the full rules for more details.

[BETA] Blender MD3 exporter rewrite

Postby Talon1024 » Sat Jul 25, 2020 10:27 am

I wasn't happy with any of the MD3 export plugins available for Blender. All of them were lacking in some way, or frustrating to use in some way, and none of them could tailor the exported MD3 for GZDoom, except Nash's MD3 exporter for Blender.

I decided to partially rewrite Nash's MD3 exporter plugin (which is based on another MD3 exporter) to be easier to use, more accurate, and hopefully, export things faster.

As for the changes:

  • If you have multiple models selected, my MD3 exporter plugin tries to mash them all together into one MD3 model.
  • Only one shader is exported per surface. I don't know of any instance where multiple shaders are applied to one surface, or even where having multiple shaders on one surface would be practical.
  • As a result of that, there is no need to split objects by material any more.
  • Does not use bpy.ops, so it should not damage your work.

Basically, you can select any objects you want to export to an MD3, and leave the rest to the exporter.

You can download the rewritten MD3 export plugin from my Nash's GitHub repo here. EDIT 2020/08/01: Updated GitHub repo URL
Last edited by Talon1024 on Sat Aug 01, 2020 8:27 pm, edited 2 times in total.
Talon1024
 
 
 
Joined: 28 Jun 2016
Github ID: Talon1024
Operating System: Debian-like Linux (Debian, Ubuntu, Kali, Mint, etc) 64-bit
Graphics Processor: nVidia with Vulkan support

Re: [BETA] Blender MD3 exporter rewrite

Postby Nash » Sun Jul 26, 2020 1:27 am



I haven't look at this fully yet but, the circled 3 commits are bad and should not be inherited. The resulting MD3s are usually broken (especially when multiple objects are concerned) because of these 3 commits.

Admittedly this was a very short sighted duct tape to get rid of having to put AngleOffset 90 in the MODELDEFS - the idea is good but the implementation is terrible. :P

I have been meaning to revert them but I just didn't find the time to do so.

The proper way to do this is to apply rotation math to the encoded vertices.

If you did not inherit this part, however, and went with your own solution - then disregard this message.
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: [BETA] Blender MD3 exporter rewrite

Postby Talon1024 » Sun Jul 26, 2020 4:48 am

No need to worry. How I handled that was by creating a transformation matrix that "fixes" the model rotation, scale, and position, and applying it to the meshes with .transform.

The relevant lines are here, here, and here.
Talon1024
 
 
 
Joined: 28 Jun 2016
Github ID: Talon1024
Operating System: Debian-like Linux (Debian, Ubuntu, Kali, Mint, etc) 64-bit
Graphics Processor: nVidia with Vulkan support

Re: [BETA] Blender MD3 exporter rewrite

Postby Nash » Mon Jul 27, 2020 6:29 pm

May I backport the transform matrix fix into mine?

Also, did you figure out how to lift the 512 unit limit?

Actually, how would you like to maintain the mainline script? I can add you as a contributor so you can commit it directly. No sense making several forks if your work fixes a lot of essential issues.
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: [BETA] Blender MD3 exporter rewrite

Postby Talon1024 » Tue Jul 28, 2020 3:05 am

Nash wrote:May I backport the transform matrix fix into mine?

Actually, how would you like to maintain the mainline script? I can add you as a contributor so you can commit it directly. No sense making several forks if your work fixes a lot of essential issues.


Sure. But if you're going to do that, you may as well merge my rewrite branch into your master branch.

Nash wrote:Also, did you figure out how to lift the 512 unit limit?


It's a limitation with the MD3 format, and the fact that it uses 16-bit signed integers for XYZ coordinates. I suppose one workaround could be to set MD3_XYZ_SCALE in the script to a lower value. Another workaround could be to automatically scale the model so that it fits perfectly within the 512 limits.
Talon1024
 
 
 
Joined: 28 Jun 2016
Github ID: Talon1024
Operating System: Debian-like Linux (Debian, Ubuntu, Kali, Mint, etc) 64-bit
Graphics Processor: nVidia with Vulkan support

Re: [BETA] Blender MD3 exporter rewrite

Postby axredneck » Wed Jul 29, 2020 2:22 pm

Thank You very much for this work!
Is it possible to port it to Blender 2.80 ?
User avatar
axredneck
excuse me for my bad English
 
Joined: 11 Dec 2017
Location: Russia
Github ID: axredneck
Operating System: Other Linux 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: [BETA] Blender MD3 exporter rewrite

Postby Nash » Thu Jul 30, 2020 12:42 am

@Talon1024: I've sent you an invite. I'll merge your master into mine soon; got a little caught up with some work. Perhaps I'll be able to do it this weekend.

I have a question about the custom 'md3shader' property. Looks like you removed its functionality. In the vanilla version of the script (the one inherited from Katsbits), there were 2 ways to assign textures to a mesh group:

1 - naming the material of each object the exact path that's used inside the PK3
2 - adding a custom 'md3shader' property to each object with a string to the exact path

These are both convenient for embedding the texture paths at export-time. I am partial to the latter one because I didn't like how long the material names appeared in the outliner.

May I know what was your motivation for getting rid of the md3shader custom property?
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: [BETA] Blender MD3 exporter rewrite

Postby Talon1024 » Thu Jul 30, 2020 8:46 am

axredneck wrote:Thank You very much for this work!
Is it possible to port it to Blender 2.80 ?


I don't know how hard that will be.

Nash wrote:May I know what was your motivation for getting rid of the md3shader custom property?


I must have forgot about it while I was rewriting the script. Keeping track of each surface and its material was hard enough.
Talon1024
 
 
 
Joined: 28 Jun 2016
Github ID: Talon1024
Operating System: Debian-like Linux (Debian, Ubuntu, Kali, Mint, etc) 64-bit
Graphics Processor: nVidia with Vulkan support

Re: [BETA] Blender MD3 exporter rewrite

Postby Major Cooke » Mon Aug 03, 2020 6:21 pm

Which version of Blender? And if its 2.7x, any chance we can see a 2.8?
User avatar
Major Cooke
QZDoom Maintenance Team
 
Joined: 28 Jan 2007

Re: [BETA] Blender MD3 exporter rewrite

Postby Talon1024 » Mon Aug 03, 2020 7:37 pm

It's currently for Blender 2.79x. I'm doing some research on porting it to Blender 2.8x, however.
Talon1024
 
 
 
Joined: 28 Jun 2016
Github ID: Talon1024
Operating System: Debian-like Linux (Debian, Ubuntu, Kali, Mint, etc) 64-bit
Graphics Processor: nVidia with Vulkan support

Re: [BETA] Blender MD3 exporter rewrite

Postby Nash » Tue Aug 04, 2020 12:02 am

@Talon1024:

As a follow-up to the bugged normals of the DemonStatue in the other thread:

FYI the model was exported with an active armature rig. The neutral pose was a T-pose, I posed it to kneel down and exported it. Granted, I was using my old version of the exporter still (this thread did not exist by the time I made my demo file for Graf).

I can provide a .blend file later but in the mean time maybe you can have a look at how it's exporting normals when armatures are involved.
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: [BETA] Blender MD3 exporter rewrite

Postby Nash » Fri Aug 07, 2020 1:58 am

Image

Question: what's this for (MD3 name)?
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: [BETA] Blender MD3 exporter rewrite

Postby Talon1024 » Fri Aug 07, 2020 5:45 am

That's for the name field of the MD3 header. If you leave it blank, the exporter automatically sets it to the model filename, but without the extension.
Talon1024
 
 
 
Joined: 28 Jun 2016
Github ID: Talon1024
Operating System: Debian-like Linux (Debian, Ubuntu, Kali, Mint, etc) 64-bit
Graphics Processor: nVidia with Vulkan support

Re: [BETA] Blender MD3 exporter rewrite

Postby Nash » Sun Aug 09, 2020 1:36 am

Reported several issues and included an example file. :) https://github.com/nashmuhandes/io_expo ... 3/issues/4
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes


Return to Editors / Asset Manipulation

Who is online

Users browsing this forum: No registered users and 1 guest