Sponsored Adverts

Author Topic: [MD3] HOW TO... export animated MD3 from Blender  (Read 13315 times)

0 Members and 1 Guest are viewing this topic.

Offline kat

  • Administrator
  • Hero Member
  • *
  • Posts: 2113
[MD3] HOW TO... export animated MD3 from Blender
« on: November 10, 2011, 11:55:00 AM »
Please Note: For MD3 script technical support, i.e. help with errors and problems relating to the export script when exporting MD3 files, please refer to the MD3 Export support topic.



Basic prep for MD3 export using Blender

Download
Information
This is NOT yet a definitive guide to exporting valid MD3 files from Blender but it's a starting point. The process is 'agnostic' in that it should be the same to prep a mesh in Blender 2.42 as it would be in 2.60.

Preparing the mesh
The mesh needs to be composed of three sections each of which needs to be a 'closed' mesh (open surfaces should be 'sealed'?) - an often cited way to physically 'treat' the mesh is to duplicate the model for each section, typically one for each 'head', 'torso' and 'legs' section. In Edit mode unwanted vertices are collapsed to a common point and 'merged' (Alt+M). Be mindful of vertex_group relationships when doing this - as all the vertices are merged together doing so also merges vertex_groups which can cause the resulting mesh to deform unexpectedly. To fix, the subsequent vertex may need to be re-parented to a common 'static' point (a bone that doesn't move or moves unobtrusively).

Once the sections have been created name each in Object Mode as follows (note that the prefix, "h_", is a subsection reference so anything that should be associated with the "head" section of the mesh should be prefixed with "h_", the torso, "u_" etc..);
  • head - named "h_head" (upper_head)?
  • torso - named "u_torso" (upper_torso)?
  • legs - named "l_legs" (lower_legs)
The "Point of Origin" (the pink dot) for each section needs to be on Blenders "0,0,0" grid so position the cursor there, then re-position the origin to the cursor (make sure to do this before doing ANY animations if the model is rigged).

Quote
Design note: it's important to note that whilst working in Blender ideally the mesh should be made 'at size', i.e. the size it will be when used. This ensures that should there be any export scaling issues, they can be fixed relatively easily as fractions of "1" (actual size") rather than fraction of a scaled size - e.g. using MD3 export for 2.63a, "Manual Scale:" should be set to "0.99995" instead of "1.00000" for proper Radiant compatible 1:1 sizing - that is .999995 of actual size instead of a pre-scaled size (which would make output larger than actual).

Preparing Armatures
When rigging a character, in order for the legs to "run" at the same time as "firing" a weapon, the rig is split into two separate armature objects, and "upper" and "lower" sections. This enables the characters lower half to do something different to the upper half. These are not exported (the rigs that is, as animation is vertex baked). However it does mean that any animation also needs to be 'split' in similar fashion, so a "run" cycle may only have a 'legs' animation, whereas a "death" animation would have both an 'legs' and 'torso' animation sequence. (Note: the origin point of the armature/s will need to be the same "0,0,0" axis centre otherwise you'll get problems - although you can do the above to a rig it's best to centre the cursor beforehand and then build the rig around that anchor point).

Prepping Materials for MD3
Materials will need to be duplicated depending on their assignment - if a character model uses the same texture applied to the entire model, when the mesh is broken into sub-sections, there should be three (or more) separate materials named as follows (this will likely need to be the texture name ID rather than the bitmap image "Source:" or filename);
  • "l_legs" (material for 'lower' mesh section)
  • "u_torso" (material for upper torso section)
  • "h_head" (material for head section)
Materials need to be referenced from the 'root', i.e. "models/players/character" so it's best to work from within that directory (where "models/" would be a root folder on a hard-drive "D:\models\")

MD3 models use "skin" files (*.skn?) which are simple *.txt docs renamed *.skn. They contain text references to textures (are these actually "shader" references?) similar to;
  • "h_head,models/players/character/head.tga"
Quote
Design note: in Blender, MD3 texture paths can be set as Material and/or Texture "ID" name properties, for example "models/mapsobjects/folder/model/shader" (where 'shader' can be an actual image or shader reference without a file extension) as the Materials or Textures datablock ID name (input field directly under the list preview). This may vary depending on the MD3 script being used.

Assigning 'Tags' to a mesh
"Tags" are Blender "Empty" objects and positioned at centre-points where other objects are to be connected to a mesh - they are position markers in other words; "tag_weapon" for instance is where weapon models 'connect' to the mesh when held by the player. Name the Empty in Object Mode, position and parent to an appropriate bone (depending on what's being 'tagged' you want the object to move with an animation);
  • "tag_weapon" would be parented to a bone called 'hand' - weapons models attach to this
  • "tag_torso" would be parented (and positioned) relative to the 'hip' - allows different 'top' sections to be attached to the 'lower' section of the model
  • "tag_head" would be parented and positioned relative to the neck - allows different heads to connect the mesh
  • (note: doesn't appear to be a need for "tag_legs")

Additional Resources
- Putting New Models in Quake III Arena (original idSoftware documentation).


Offline kat

  • Administrator
  • Hero Member
  • *
  • Posts: 2113
[MD3] adding tag_ markers to models
« Reply #1 on: August 24, 2012, 01:22:19 AM »
When using "tag_" markers they need to be parented to an Armature rather the mesh object. Ideally this should be done before any actual animation is carried out otherwise it may be necessary to manually repositioning the Empty where it needs to be.

Parenting in "Pose" mode
If Parenting when the Armature is in 'Pose' mode, make a new Action (call it "bindpose" for ease of reference) and clear it of any rotation and/or location data using "Alt+R" and/or "Alt+G". With the character reset, insert ("I") some key-frames to create a 'bindpose' animation with a duration of no more than five or so frames. To Parent, select the Empty first then "Shift+RMB" the bone the object is to attach to. Press "P" and select "Bone" from the "Set Parent To" options.

Parenting in "Object" mode
When Parenting in "Object" mode select the Empty first then Armature, press "Ctrl+P" to parent and select "Bone" from the list of options. This may mean the Empty parents to the Armature but not a specific bone (or more likely the last bone active). To make sure parenting is correct, select the Empty and click the "Object" properties button. In the "Relations" sub-section check the "Parent Object" option lists the name of the Armature object. And "Name or parent bone.." lists the actual bone being linked... in the images below that would be "RIGsneaky" and "armlowL" for example.

Additional Notes
Although the Empty can be positioned more accurately when snapped to the 'Head' or 'Tail' end of a bone in Edit mode, this typically means it will be incorrectly positioned relative to Pose mode. For placement in Pose mode, it tends to be best to snap the 3D Cursor to a selected bone, "Shift+S >> Snap Cursor to Selected", then snap the Empty to the cursors location. Additionally, better rotational or positional results may be had when the 3D Manipulator Widget is in "Normal" rather than "Global" (circumstances may differ).

Exporting
When exporting, select the Empty(s) first and Mesh last (Armature selection is not typically necessary). Export as normal (see above).


Select "Bone" from the "Parent To" list of options

Make sure the Empty has been properly parented to the Armature and a specific Bone

 

Sponsored Adverts
RSS Content is copyright © KatsBits™ 2017 unless otherwise stated. All Rights Reserved.
No part of this web site may be reproduced (except for personal use, or otherwise stated) without prior written permission from KatsBits.com. For more infomation on copyright click here.
Web design cpdtAdvertisePrivacy PolicyDMCA (about DMCA) Home Store Workshops Blog Jobs Support About Katsbits Contact Site Search KatsBits Help Site Map RSS feed Forum YouTube FaceBook LinkedIn Twitter IMVU