KatsBits Community

[MD3] EXPORT script for Blender 2.5+/2.6+

motorsep · 73 · 158464

0 Members and 1 Guest are viewing this topic.

Offline motorsep

  • Jr. Member
  • *
    • Posts: 75
I have texture applied in the UV editor (that's what I always do, because I need to see it in the viewport) and I have material applied because that is a requirement of IQM exporter.

If someone would ever write about md3shader in the docs or ReadMe, I would probably have that ;) So, no, I don't have that and I am not even sure where to set that and how.

I never applied anything with the name NULL to the mesh.

There is a good model viewer called Noesis, it loads MD3, but it seems like there is no UV map nor there is a shader/texture. It's just a mesh.


Offline kat

  • Administrator
  • Hero Member
  • *
    • Posts: 3138
    • KatsBits
Try the MD3 Model Tool from here (Splash Damage forums) see if that gives you the same issue. If it does then you definitely know it's an issue with the export output from Blender (always worth double checking to make sure).


Offline motorsep

  • Jr. Member
  • *
    • Posts: 75
Thanks, tried it. I see that the surface name is as I named it in Blender (so using skin file would solve the issue of the NULL shader). I see the shader name is NULL and I know that UV is jacked. So it is definitely exporter issue.

I am using Blender 2.59 and I am almost sure that anything UV related should be the same as in 2.60 and 2.61. I will give exporter a shot in Blender 2.61 (as we all know 2.60 is really buggy and thus I skipped it) and it I get the same results, I would appreciate if the author will take a second look and fixes the issue.


Offline dmc2143

  • Defunct
  • Newbie
    • Posts: 9
In object mode. Under propereties menu (yellow cube icon). Very last menu selection is custom property. You need to assign the custom property name "md3shader" set value to YOUR_SKIN_NAME.EXTENSION (eg. my_cube_skin.tga)
I assumed this was known because it has been this way since Xembies original exporter for 2.5. I will have to write something up one of these days.


Offline motorsep

  • Jr. Member
  • *
    • Posts: 75
\o/

It worked, thank you. Now I have another question.

http://farm8.staticflickr.com/7005/6488319119_15b02c07a8_b.jpg

The left cube is IQM, the right cube is MD3. They both use the same shader:

models/flag/flag_joint
{
   {
      map models/flag/flag_joint.tga
      rgbGen lightingDiffuse      
   }
}

However, as you can see, shading is messed up on MD3 model (both models are spawned dynamically, as if those were weapon models for example). Even if I don't apply the shader listed above, and both models use the texture directly, I still have that shading issue.

Any clues? Any idea if that can be fixed?

Thank you.


Offline kat

  • Administrator
  • Hero Member
  • *
    • Posts: 3138
    • KatsBits
Can you copy/paste the data from each file, or post them for inspection?



Offline dmc2143

  • Defunct
  • Newbie
    • Posts: 9
Quote
rgbGen lightingDiffuse
This is some feature of the engine you use??? I would be checking with the developers to see is you can control the diffuse or other values. I know nothing about the IQM format, this may just be another shortcoming of the very old md3 format. Look to other games from your engine to see if this works correctly for any md3s. Might be someone else has found ways to fix it.


Offline kat

  • Administrator
  • Hero Member
  • *
    • Posts: 3138
    • KatsBits
MD3 are usually 'vertex lit' (they're are 'shaded' meshes).

@motosep: This looks like it could be a problem with mesh smoothing. Might be that IQM support vertex splits for that purpose, iirc MD3 applies a single grouping value to everything so it'll weld vertices together where it finds them co-incidental to each other, breaking any 'groupings' ('Sharp' marked edges for us Blender users).

Did you use or apply edge-split and/or apply the modifier before export? You might need to 'force' splits into place using the "Separate" function (select and press "Y").


Offline motorsep

  • Jr. Member
  • *
    • Posts: 75
This is a standard shading language of Quake 3. Darkplaces engine support almost all of Quake 3 shaders functions. As I actually work with MD3, I'll see if the issue will persist or will be too much noticeable on actual models.

Do you have a sample .blend file with a flag that you exported successfully into MD3? Could you share it please?

I am also wondering if there is a way to loop cloth sim in Blender..


Offline motorsep

  • Jr. Member
  • *
    • Posts: 75
@kat: no, I don't use edge split on my models unless I am making "hard" surfaces. IQM supports smoothing, so if I have surfaces as "flat" in Blender, it will split them on export automatically.

This cube is actually just a test cube. We are prototyping dynamic cloth sim for Darkplaces and we use old Quake MDL format for physics joins. MDL is ... old :) IQM model doesn't work with ODE engine for some reason, so I needed to try MD3 in lieu of MDL.


Offline motorsep

  • Jr. Member
  • *
    • Posts: 75
Btw, I spoke to the programmer of Darkplaces engine and he said that limitation for number of the shape keys is the exporters issue. There is no such limitations in MD3 format as it can have numerous morph targets.

The reason to use shape keys is to be able to loop cloth seamlessly. It's impossible with cloth sim afaik.


Offline dmc2143

  • Defunct
  • Newbie
    • Posts: 9
Ok, so exporting physics to md3 will bake the shapekeys needed to the timeline in the md3 itself. Import the md3 back into blender (stuck with the old 2.4 import script for now)with shapekeys all set. You can duplicate and reverse for a seamless animation.

About shape keys, the limits are on the number of shape keys in blender that you can use to alter any specific mesh at one time. Using md3s every animated frame is treated like a shape key of its own, either off(0) or on(1) where each frame has one key on all others off.

Here is my test work on this. And the necessary import script for 2.4
http://www.mediafire.com/?82wgbh0cg3y0y6c

I use md3s in a different engine, for Duke Nukem. I've never even played Quake 3 ;)


Offline motorsep

  • Jr. Member
  • *
    • Posts: 75
Alright, got things going :) Flag, animated with Cloth and exported into MD3, not looped (in-game footage):

http://www.youtube.com/watch?v=OwHNGCL8etA

Its .blend file (after exporting to md3, importing in 2.49 and saving it in 2.59):

http://www.pasteall.org/blend/10246

Since I don't get how to work with these evil shape keys, can you please explain how can I loop this particular case, using my .blend as example? Thank you.


Offline kat

  • Administrator
  • Hero Member
  • *
    • Posts: 3138
    • KatsBits
Script seems to work in 2.61. I've not done a full export test (proper path set-up etc.), but the initial export I tested (bunneh character) worked OK.

@ motorsep: do you need the animation to be that detailed? That quite a bit of complex movement you've got going on there that if you could simplify, might be able to approximate as a standard shape or keyed animation.