Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

[FREE] Scene OBJ Exporter (New Version 2.0!)

Discussion in 'Assets and Asset Store' started by aaro4130, Sep 24, 2014.

  1. aaro4130

    aaro4130

    Joined:
    Jul 15, 2010
    Posts:
    431
    upload_2015-12-10_5-22-55.png
    Hi! This is an asset I created for exporting Unity scenes to Wavefront OBJ files.

    Features:


    upload_2015-12-10_5-29-7.png


    Usage:
    Click File>Export>Wavefront OBJ

    NOTE : Does not work in builds!

    Feedback and bug reports, as well as constructive criticism and suggestions are appreciated and welcomed! :)

    DOWNLOAD: https://www.assetstore.unity3d.com/en/#!/content/22250
     
    Last edited: Dec 28, 2015
    SAOTA, Gozdek, twobob and 1 other person like this.
  2. Wavinator

    Wavinator

    Joined:
    Dec 24, 2013
    Posts:
    79
    Thanks for this! Definitely useful!
     
    aaro4130 likes this.
  3. crag

    crag

    Joined:
    Dec 13, 2013
    Posts:
    145
    Thanks!
     
    aaro4130 likes this.
  4. DrewMedina

    DrewMedina

    Joined:
    Apr 1, 2013
    Posts:
    418
    Thank you for this! Really useful. Is there a way to export selected?
     
    aaro4130 likes this.
  5. Play_Edu

    Play_Edu

    Joined:
    Jun 10, 2012
    Posts:
    720
    Thanks for sharing.
     
    aaro4130 likes this.
  6. aaro4130

    aaro4130

    Joined:
    Jul 15, 2010
    Posts:
    431
    Glad this is useful! Both to you guys and to me haha.

    Not yet. I plan on adding it though :).

    Changes since release, new version coming soon
    - Material Instances are now named by instance ID (Material Instance Percautions option)
    - Material colors are now added into the .mtl file
    - Materials can now be named by texture (useful if all your materials are named Diffuse somehow)
     

    Attached Files:

    Last edited: Sep 24, 2014
  7. kurotatsu

    kurotatsu

    Joined:
    May 10, 2012
    Posts:
    588
    Excellent, this will come in handy, seems to be the statement made by most, but what can ya say.

    I'd really love the export selected option as well.

    well done!

     
    aaro4130 likes this.
  8. aaro4130

    aaro4130

    Joined:
    Jul 15, 2010
    Posts:
    431
    New version uploaded

    Added features :
    -Use texture name as material name
    -Material instance precautions
    -Material specular and diffuse colors

    Download in first post :)
    Feedback as always is appreciated
     
  9. zugsoft

    zugsoft

    Joined:
    Apr 23, 2014
    Posts:
    451
    Thank you,

    If you add 2 lines, everybody could use it on all platform.

    #if UNITY_EDITOR

    #endif
     
    twobob, kurotatsu and aaro4130 like this.
  10. aaro4130

    aaro4130

    Joined:
    Jul 15, 2010
    Posts:
    431
    Where exactly would these be added?
     
  11. zugsoft

    zugsoft

    Joined:
    Apr 23, 2014
    Posts:
    451
    #if UNITY_EDITOR
    using UnityEngine;
    using UnityEditor;
    using System.Collections;
    using System.Collections.Generic;

    ........

    System.IO.File.WriteAllText (exportFolder + "/" + exportName + ".obj",sb.ToString ());
    System.IO.File.WriteAllText (exportFolder + "/" + exportName + ".mtl",sb2.ToString ());
    }

    }
    #endif
     
    aaro4130 likes this.
  12. aaro4130

    aaro4130

    Joined:
    Jul 15, 2010
    Posts:
    431
    Thank you :). This has now been added.

    NEW UPDATE
    -Fixed mirroring
    -Added menfou's suggestion

    ANOTHER NEW UPDATE
    -Added split modes : None, By Material, By Mesh, By Submesh (None is kind of weird at the moment, works in 3dsmax if "Import As Single Mesh" is checked)
    -Added a check to see if "_Color" property exists
    -Added version number on the wizard

    Download in first post as always
     

    Attached Files:

    Last edited: Sep 24, 2014
    twobob and SAOTA like this.
  13. aaro4130

    aaro4130

    Joined:
    Jul 15, 2010
    Posts:
    431
    ANOTHER UPDATE
    -OBJ Comment line, to add a comment at the beginning of the file
    -Export Selected [finally? :p] has been added
    -Added texture scale (-s) in materials files for supported modelers
    -Added the clamp parameter if a texture is clamped (-clamp on)

    TIP : Want to export one object and have it centered when you import it to your 3D application? Untick "Apply Position"

    TIP : Creating materials programatically and they all end up being named "Diffuse", or similar? Use "Mat Name From Texture Name" option

    Download is in first post as always :)
     

    Attached Files:

    Last edited: Sep 24, 2014
  14. softwizz

    softwizz

    Joined:
    Mar 12, 2011
    Posts:
    793
    This is relevant to my interests :)
     
    aaro4130 likes this.
  15. carking1996

    carking1996

    Joined:
    Jun 15, 2010
    Posts:
    2,563
    Interesting.
     
    aaro4130 likes this.
  16. aaro4130

    aaro4130

    Joined:
    Jul 15, 2010
    Posts:
    431
    NEW UPDATE
    -Added progress bar. It's helpful on large exports if you are to switch to another process

    -Added a save file dialog when you click 'Export', No more manual path typing in! :)
    -Moved around parameters order.

    FIRST POST CHANGES
    -Added documentation of parameter names

    In first post, as always :)
     
    Last edited: Sep 25, 2014
  17. aaro4130

    aaro4130

    Joined:
    Jul 15, 2010
    Posts:
    431
    There was a order of transform operations error that was causing the bug with warped objects. This has now been fixed!

    This is when I realized it was a major issue:
    >Exported scene : http://i.imgur.com/AUZO292.png
    >Scene in unity : http://i.imgur.com/WOauYlw.png

    New feature as well : Transparency is now extracted from the material color!

    The first post has now been updated with the fix :)
     
  18. aaro4130

    aaro4130

    Joined:
    Jul 15, 2010
    Posts:
    431
    This will be on the asset store soon. Free of charge.

    Does anybody have any suggestions before I upload it there?
     
    MikeTon likes this.
  19. softwizz

    softwizz

    Joined:
    Mar 12, 2011
    Posts:
    793
    Yes, dont make me have to get unity 4.6

    Thanks for working on this its very useful
     
  20. aaro4130

    aaro4130

    Joined:
    Jul 15, 2010
    Posts:
    431
    Well I just realized the progress bar is broken. Gah :p
     
  21. softwizz

    softwizz

    Joined:
    Mar 12, 2011
    Posts:
    793
    I just realised I have to have 4.6 to get it from the asset store. NOOOOOOOOOOOooooooooooooooo!
     
  22. aaro4130

    aaro4130

    Joined:
    Jul 15, 2010
    Posts:
    431
    It's not me who sets that unfortunately. =c
     
  23. softwizz

    softwizz

    Joined:
    Mar 12, 2011
    Posts:
    793
    I thought it was based on the version of unity you use to package and submit it to the asset store with, NVM when its out of beta I will upgrade unity anyway in the meantime I can use the supllied script.

    Good work.
     
  24. aaro4130

    aaro4130

    Joined:
    Jul 15, 2010
    Posts:
    431
    Soon I will do an update anyways and put it on the thread here as a unitypackage and script :)
     
  25. eskiland

    eskiland

    Joined:
    Oct 27, 2014
    Posts:
    1
    Hey! This looks great, but I am not able to find the "export" under file. Is it anything i have missed? I downloaded and imported via Asset Store.
     
  26. aaro4130

    aaro4130

    Joined:
    Jul 15, 2010
    Posts:
    431
    Fresh download and import for me shows it in the File section. You may want to try reimporting the folder the script is in or refreshing it.
     
  27. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,646
    Thanks for this. :cool:
     
    aaro4130 likes this.
  28. aaro4130

    aaro4130

    Joined:
    Jul 15, 2010
    Posts:
    431
    Working on another update with skinned meshes included this time. As well as a nicer UI and most likely some more parameters for MTL

     
  29. carking1996

    carking1996

    Joined:
    Jun 15, 2010
    Posts:
    2,563
    Great work.
     
    aaro4130 likes this.
  30. kurotatsu

    kurotatsu

    Joined:
    May 10, 2012
    Posts:
    588
    Awesome. Can't wait.
     
    aaro4130 likes this.
  31. mrmdesign

    mrmdesign

    Joined:
    Apr 18, 2013
    Posts:
    239
    Forgive me for my stupidity if this has already been answered. Can this be made to work at runtime? It seems like it could be extremely useful for a number of applications.
     
  32. aaro4130

    aaro4130

    Joined:
    Jul 15, 2010
    Posts:
    431
    It can with some code modifications, yes.
     
  33. ataloss

    ataloss

    Joined:
    Jan 2, 2014
    Posts:
    71
    Thank you for giving us something that works with Unity 5.
     
    aaro4130 and carking1996 like this.
  34. carking1996

    carking1996

    Joined:
    Jun 15, 2010
    Posts:
    2,563
    I've found tons of usage for this, and it's fantastic!
     
  35. aaro4130

    aaro4130

    Joined:
    Jul 15, 2010
    Posts:
    431
    Thank you all for your comments! I will try to update/improve this soon :)
     
    carking1996 likes this.
  36. Gordinho

    Gordinho

    Joined:
    Feb 10, 2013
    Posts:
    7
    Hello,
    This tool only exports objects correct?.
    Does anybody knows on how to export prefabs, so that it can be worked on blender for example?.
    Thanks.
     
  37. aaro4130

    aaro4130

    Joined:
    Jul 15, 2010
    Posts:
    431
    This can export the entire scene at once. You could load in a prefab, select it, export selected only, then re-import the needed things.
     
  38. sam61580

    sam61580

    Joined:
    Sep 21, 2015
    Posts:
    2
    I can't export the textures
    it only exports the obj and mtl files
     
  39. aaro4130

    aaro4130

    Joined:
    Jul 15, 2010
    Posts:
    431
    What is the texture format of these texture files?
     
  40. sam61580

    sam61580

    Joined:
    Sep 21, 2015
    Posts:
    2
    jpeg and png
     
  41. MaDDoX

    MaDDoX

    Joined:
    Nov 10, 2009
    Posts:
    759
    Can it export UV1 and UV2? Could be great to export the Unity-generated UVs and bake lightmaps externally in Modo or Maya :D
     
  42. aaro4130

    aaro4130

    Joined:
    Jul 15, 2010
    Posts:
    431
    Unfortunately the OBJ format only supports 1 UV channel due to it's design. :(
     
  43. Kikirex

    Kikirex

    Joined:
    Nov 25, 2015
    Posts:
    2
    I tried your script because we have a lot of work which requires to export Prefabs from Unity and unfortunatly it doesn't work: the OBJ comes empty in 3dsMax, it just says "nothing found to import". I got the same result either I try with or without textures.

    Is there something I'm missing? Can you help me about it? It would save me and my teammates a lot of hours of work and we'll be infinitely grateful, and as I'm a graphic artist my knowledge of scripting is below the absolute zero...

    The objects are mostly FBX or Prefabs and textures are TGA. I'm using unity 5.1.1f1 if it helps.
     
  44. aaro4130

    aaro4130

    Joined:
    Jul 15, 2010
    Posts:
    431
    Hmm maybe something broke with Unity 5, seeing as how others are saying the same thing D: . I'll take a look and see if something's up with the script.
     
    Kikirex and SAOTA like this.
  45. alelordelo

    alelordelo

    Joined:
    Aug 3, 2015
    Posts:
    17
    The export worked (image 1), but I lost the control the "control points" (image 2) I had on the file. I

    s there any way to preserve it on the export?


    Screen Shot 2015-12-04 at 1.55.44 PM.png Screen Shot 2015-10-28 at 4.26.23 PM 6.46.41 PM.png
     
  46. aaro4130

    aaro4130

    Joined:
    Jul 15, 2010
    Posts:
    431
    OBJ is a fairly basic format, which doesn't support custom things like control points.

    Hi, since i wouldn't touch the current code with a 20ft pole, and, since I've had an interest in updating this project, I am hereby providing Version 2.0. Could you please make an export attempt with this? :)
    (NOTE : Not compatible with version 1.0!)
     
    Last edited: Dec 10, 2015
  47. Kikirex

    Kikirex

    Joined:
    Nov 25, 2015
    Posts:
    2
    Great, I'm gonna try this!
     
  48. aaro4130

    aaro4130

    Joined:
    Jul 15, 2010
    Posts:
    431
    Just updated the first post with version 2.0, enjoy! :) Also submitted to asset store for review.
     
  49. aaro4130

    aaro4130

    Joined:
    Jul 15, 2010
    Posts:
    431
    Version 2.01 has been released:
    Added the ability to export bump maps / specular maps. General fixes and improvements.
     
    softwizz likes this.
  50. SpAiK

    SpAiK

    Joined:
    Dec 4, 2012
    Posts:
    10
    Wow, I was looking for the ObjExporter from the wiki and have found this, which is great. Thank you!
     
    aaro4130 likes this.
unityunity