Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

MD3s and Unity

Discussion in 'Formats & External Tools' started by Precursor13, Jun 25, 2010.

  1. Precursor13

    Precursor13

    Joined:
    Jun 22, 2010
    Posts:
    142
    I have many models in md3 format laying around that I'd like to use in unity. Here's the catch: they all have complex animations and I haven't been able to keep the animations when I convert to another format. The animations are all 130+frames so redoing them by hand isn't really an option. Does anyone know of a way to convert these keeping their animations? Oh BTW also does anyone know about importing .bsp into a useable format for unity? Thanks!
     
  2. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    you can't

    Unity only supports bone animation no pure mesh deformation animation as used in the MDx formats

    Nor can BSP be used cause BSP is no model format at all.
    Its compressed binary space data with additional stuff (not even its precompiled form, map files, are model data but plane equation data with associated UV information etc but at least this raw form can be converted with a few tools to normal model formats though you will lose really all but the pure map)
     
  3. Precursor13

    Precursor13

    Joined:
    Jun 22, 2010
    Posts:
    142
    I was asking for a convertor if anyone knew one, not someone telling me something I allready knew was impossible.
     
  4. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    I'm telling you its impossible because it is.

    MDx models do not contain a skeleton.
    Without a skeleton you can't convert it to skeletal animation, which is the one and only animation supported by unity.

    so whatever you do during conversion: your animation is gone, 100% sure!
     
  5. Precursor13

    Precursor13

    Joined:
    Jun 22, 2010
    Posts:
    142
    And the BSPs? All I need is the model anyway, but whenever I try to convert it I always get the error "BSP version 13xxxxxx" is not supported. Any thoughts?
     
  6. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    Depends on the program you use for conversion.

    Problem is there is not one BSP.
    There are 2 totally distinct branches of BSP (the original Quake BSP and what Valve made out of it in HL BSP) then within those branches there are various versions by now.

    ultimate unwrap 3d might potentially be able to.


    Just be aware that a large part of the things will be lost on the conversion
     
  7. Harry1960

    Harry1960

    Joined:
    May 15, 2007
    Posts:
    136
    Hi Precursor,
    I'm currently working on a bsp to obj converter (PC only). If you still need a bsp-importer contact me.

    Harry
     
  8. Harry1960

    Harry1960

    Joined:
    May 15, 2007
    Posts:
    136
    Preparations:
    * Go to your q3\baseq3 folder and unzip all .pk3 files that contain any necessary texture and level data.

    Running bsp2obj.exe:
    * You have to enter 2 paths:
    Location of Quake3\baseq3 (source folder)
    Location of the target folder (within that folder a subfolder will be created automatically for each bsp file).
    This should be the assets folder of the unity project you want to use
    * Tesselation is used for the subdivision of bezier patches (every value between 5 and 10 should be fine)
    * You can speficify whether the surface textures will be exported or not (uncheck this for subsequent exports)

    Using the objs inside unity:
    * Unity automatically imports the obj/mtl file when you start your project or unity regains the focus
    * The obj file uses the quake3 scale and therefore you have to set the scale of the obj importer to 0.03
    * If you want to have colliders check 'Generate Colliders' in the import dialog (since the collider are not imported from the bsp).
    This will generate colliders for all objects (you can remove the mesh collider for transparent objects later)
    * Drop the imported obj to a level and use the first person controller prefab to walk around.

    Materials:
    * Unity always uses the Diffuse-Shader as default for all imported materials. Use Particle/Additive for transparent meshes
    * Since q3 shaders are pretty special and can't be imported automatically most meshes with shaders we not have a texture (those meshes have names with '_shader' at the end)

    Lightmapping:
    * Since Unity3 lightmapper will lead to much better results no lightmaps are imported (just mark the level object as static)

    PVS:
    * Since Unity3 doesn't allow access to the occlusion mapping no pvs data is imported and you have to use the buildin occlusion culling.


    I hope that tool will help you.

    Harry
     

    Attached Files:

  9. Harry1960

    Harry1960

    Joined:
    May 15, 2007
    Posts:
    136
    A screenshot that shows q3dm11.bsp inside unity3.
     

    Attached Files:

  10. Precursor13

    Precursor13

    Joined:
    Jun 22, 2010
    Posts:
    142
    I am importing from a game called Tremulous. I have semi-adapted the instructions to fit it, but I always get this error: "Error in textures". Does this program only follow the baseq3 directories? if so, what are they?
     
  11. Harry1960

    Harry1960

    Joined:
    May 15, 2007
    Posts:
    136
    Hi Precursor,

    I've successfully tested all Tremulous bsp files that are included in version 1.2 but I had to make some modifications in Bsp2Obj (see the new build below).
    If you still have problems send me the pk3 file that you want to import!


    Preparations (Quake):
    * Go to your q3\baseq3 folder and unzip all .pk3 files that contain any necessary texture and level data.

    Preparations (Tremulous):
    * Go to your Tremulous\base folder and unzip all .pk3 files that contain any necessary texture and level data.

    Running bsp2obj.exe:
    * You have to enter 2 paths:
    a.) Location of Quake3\baseq3 (source folder)
    b.) Location of Tremulous\base (source folder)
    Location of the target folder (within that folder a subfolder will be created automatically for each bsp file).
    This should be the assets folder of the unity project you want to use
    * Tesselation is used for the subdivision of bezier patches (every value between 5 and 10 should be fine)
    * You can speficify whether the surface textures will be exported or not (uncheck this for subsequent exports)


    Harry
     
  12. Harry1960

    Harry1960

    Joined:
    May 15, 2007
    Posts:
    136
    Build 001 - 2010.08.07
    ======================
    * Incorrect usage of src path fixed
    * Increased performance by writting to files instead of strings
    * Meshes > 65000 are splitted now (Unity supports only meshes with less tahn 65K verts)
    * Using qerimage from shader file if specified within shader
    * _ShadersWithErrors.txt contains all shader sources if no querimage is specified
    * Materials without mesh data aren'*t exported now
    * All Tremolous 1.2 bsp files imported w/o errors
     

    Attached Files:

  13. Precursor13

    Precursor13

    Joined:
    Jun 22, 2010
    Posts:
    142
    Wow man thanks!!! It works flawlessly and saves me a TON of time from having to redo the maps! Thanks again!

    [edit#2] nvm It works perfect! Great program man!
     
  14. Precursor13

    Precursor13

    Joined:
    Jun 22, 2010
    Posts:
    142
    It works great, but one problem I've been having I's it imports groups per texture, do you think you could make it so it imports group per group? The prob I'm having is the doors are part of the walls next to them so when you try and open a door the entire wall moves.
     
  15. Harry1960

    Harry1960

    Joined:
    May 15, 2007
    Posts:
    136
    Hi Precursor,
    there aren't any groups in the bsp file just faces with attached materials. But I've forgot to handle model faces (skyboxes, doors, platforms etc) in a special way. I'll upload a new version later this day.

    Harry
     
  16. Harry1960

    Harry1960

    Joined:
    May 15, 2007
    Posts:
    136
    Build 003 - 2010.08.17
    ======================
    * Model faces exported ungrouped

    Build 002 - 2010.08.10
    ======================
    * Bug fixed when trying to load qereditorimage
    * Only shader shaders with errors are now added to _ShadersWithErrors.txt
    * NEW: _ShadersUsed.txt contains the source of all shaders
    * Billboard faces are not longer grouped (makes ist easier to use LookAt() in Unity)
     

    Attached Files:

  17. Precursor13

    Precursor13

    Joined:
    Jun 22, 2010
    Posts:
    142
    What do you mean by ungrouped? No groups at all or it keeps the original groups?
     
  18. Harry1960

    Harry1960

    Joined:
    May 15, 2007
    Posts:
    136
    Each mesh of a model (door etc) is now exported separately and no longer grouped to static geometry like walls.
    You can identify the models by their name (the all start with 'model_' plus the bsp internal model#).
    If a model has more than one texture you'll find some game objects that start with the same model name and you have to organize them manually under one parent inside unity (obj files only support flat hierarchies).

    Example:
    In Tremoulus/Nexus6 you will find model_1_19 and model_1_134. Both meshes represent model#1 and form a door.
    To open/close that door you have to create a parent game object and move both meshes as children under that parent object. If you move the parent object the door opens/closes.

    Harry
     
  19. Precursor13

    Precursor13

    Joined:
    Jun 22, 2010
    Posts:
    142
    Thanks. The doors will really help my game ;) Anywy, whenever I try to convert the tremulous map Ethreal I get a "error with entities" or something like that. Ethreal is my main map (got the devs permission to use it in my game) do do you have any idea what's causing this?
     
  20. Harry1960

    Harry1960

    Joined:
    May 15, 2007
    Posts:
    136
    All my bsp files get converted without any error. If you want you can mail your pak file and I'll check that error.

    Harry
     
  21. Harry1960

    Harry1960

    Joined:
    May 15, 2007
    Posts:
    136
    Fixed a bug when parsing entity values.
     

    Attached Files:

  22. Roundhouse

    Roundhouse

    Joined:
    Aug 29, 2010
    Posts:
    17
    Is your converter compatible with the External Lightmapping Tool?
     
  23. Harry1960

    Harry1960

    Joined:
    May 15, 2007
    Posts:
    136
    Which external lightmapper? I don't import the lightmaps from the bsp file.
     
  24. Roundhouse

    Roundhouse

    Joined:
    Aug 29, 2010
    Posts:
    17
    this one -> http://masteranza.wordpress.com/unity/lightmapping/

    I was able to convert a BSP map to OBJ using your tool then converted to FBX using Autodesk's. Then imported in the textures then ran the external lightmapping tool. I'm not sure if what I did was wrong though. Not sure if I should've ran the tool BEFORE attaching the textures. I'm still figuring out the correct workflow.
     
  25. Harry1960

    Harry1960

    Joined:
    May 15, 2007
    Posts:
    136
    I use the converter to test Unitys new lightmapper and occlusion culling. When using an external lightmapper you only have to store the lightmapper uv's into uv2 and change the shader Inside unity to lightmap.
    Unity 3.0 will simplify the entire lightmapping process so that it's Wörth to weit for it.
     
  26. Roundhouse

    Roundhouse

    Joined:
    Aug 29, 2010
    Posts:
    17
    Yeah, my bad Harry. My workflow was flawed all along.

    I should've just imported the OBJ to 3ds max and prepare the UVs before importing to Unity and using the external lightmap tool. Works now =D

    Thanks Harry for a great tool! Your tool gives me a way to rapidly prototype levels by just reusing existing BSP levels. Cool stuff!
     
  27. bobsworld

    bobsworld

    Joined:
    Mar 2, 2011
    Posts:
    20
    Hi Harry,

    Trying with QuakeLive files I get "wrong header information"...it doesn't work with QL?
     
  28. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    QL has a new modern version of the engine with a new magic number and format likely
     
  29. bobsworld

    bobsworld

    Joined:
    Mar 2, 2011
    Posts:
    20
    magic number? format? It's pretty much Q3 in a browser~ apparently maps made in Q3 can be played in QL.

    "Quake Live also uses PK3 files, but these files have been encoded by means of a bitwise XOR with a string of characters"

    but the .pk3's can still be extracted with some software~ http://img576.imageshack.us/img576/9545/31878736.png

    There's not a newer version of the software that works with QL then?
     
  30. bobsworld

    bobsworld

    Joined:
    Mar 2, 2011
    Posts:
    20
    you can walk through the stairs walls? :f
     
  31. orangeted

    orangeted

    Joined:
    Apr 27, 2011
    Posts:
    2
    Brilliant! Thanks Harry.
     
  32. the_Simian

    the_Simian

    Joined:
    Mar 13, 2011
    Posts:
    37
    bobs, maybe you need to add a collider mesh is all
     
  33. iddqd

    iddqd

    Joined:
    Apr 14, 2012
    Posts:
    501
    Harry this tool is great!

    Is there a way that I can convert the md3 files too?
    Is there an md3 to bsp converter? ;-)
     
    Last edited: Apr 16, 2012
  34. iddqd

    iddqd

    Joined:
    Apr 14, 2012
    Posts:
    501
  35. Nintenjo

    Nintenjo

    Joined:
    Oct 12, 2012
    Posts:
    8
    Dont suppose you support the original Quake BSP formats (i.e. not Quake 3)? I get an incorrect header format..
     
  36. Harry1960

    Harry1960

    Joined:
    May 15, 2007
    Posts:
    136
    Hi Nintenjo,
    I've converted all bsp-files from the original quake iii gold package. Can you send me the bsp-file you arebtryihg to convert?
    Harry
     
  37. BlackRain

    BlackRain

    Joined:
    Jun 26, 2012
    Posts:
    76