sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    [Plugin] Import OBJ with Materials v2.1 20131118

    Scheduled Pinned Locked Moved Plugins
    279 Posts 87 Posters 378.6k Views 87 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B Offline
      Birner
      last edited by

      Hello
      Yes, I created a folder that I have 3D tree gennnt since I have the OBJ file and MTL file the two images so inserted the bark and the leaves.
      Well hope it's the right thing?
      greeting

      Tobi

      1 Reply Last reply Reply Quote 0
      • Z Offline
        Zacchia
        last edited by

        Hi
        I tryed to import in SU 2013. Nothing happends, the obj seams not to import. Not working on SU 2013?

        1 Reply Last reply Reply Quote 0
        • TIGT Offline
          TIG Moderator
          last edited by

          It works in v2013 just as it did in v8. 😕

          Do you mean you can import the file in v8 but it fails in v2013 ??
          If that is the case, what other plugins do you have in v2013 compared to v8?

          Alternatively...
          What is this OBJ file you are importing?
          Can you open it in alternative apps like Blender?
          Any errors in the Ruby Console?

          Can you get this very simple test OBJ to work in v2013?
          Extract the obj & mtl from the attached ZIP.
          For simplicity there are no textures, only colors defined in the mtl
          It's a 1m cube, units are Meters with YZ flipped.
          Its RGB colored faces are on the axes.
          I just retested it in v2013 and it worked fine.

          PS: Please update your User-Profile with OS, Version etc - it helps us help you...


          test.zip

          TIG

          1 Reply Last reply Reply Quote 0
          • Z Offline
            Zacchia
            last edited by

            Thanks TIG
            It works. I found out the problem on my files: It was a path with an bad letter: ö! I correct this and now your importer works fine!!
            Thanks and sorry for trouble.

            1 Reply Last reply Reply Quote 0
            • TIGT Offline
              TIG Moderator
              last edited by

              That is an important point. ☀
              SketchUp's older version of Ruby on PCs doesn't care for non-ASCII characters in folder/file-paths...
              Making it return an incorrect 'false' when testing that such a file exist?...
              Many plugins can fail because of this. 😒

              TIG

              1 Reply Last reply Reply Quote 0
              • Z Offline
                Zacchia
                last edited by

                ...mmmh. Not finished yet... I corrected the path but still not loading, here the path, whats wrong?: F:\Bruno_Zacchia_Kopie_H\Designmoebel_Objekte\Eigenes\Pflanzen
                Loading it from desktop it works.

                1 Reply Last reply Reply Quote 0
                • TIGT Offline
                  TIG Moderator
                  last edited by

                  In the Ruby Console, test this code:
                  File.exist?('F:\Bruno_Zacchia_Kopie_H\Designmoebel_Objekte\Eigenes\Pflanzen')
                  ???
                  Perhaps add the OBJ file name on the end and retest !?
                  It should return 'true' if the file exists.
                  Test it with a non-existent name and you get 'false' ?

                  Are you sure there are not any non-ASCII characters in this path [including the file names themselves].
                  I guess you are German ?
                  So the the 'oe' can't be a œ, o+umlaut [ö] etc
                  Also watch out for ß etc...
                  If it works from your Desktop it suggests so character issue still exists in this new path...

                  Also check for texture names [subfolder with OBJ/MTL] these can't have non-ASCII characters in them and the MTL specified file paths must match the .png/.jpg names exactly...

                  TIG

                  1 Reply Last reply Reply Quote 0
                  • Z Offline
                    Zacchia
                    last edited by

                    Hi TIG
                    I think your importer is OK, It works today, maybe it was something wrong with material folders or the original files. Sorry about trouble and thanks fpr feedback.

                    1 Reply Last reply Reply Quote 0
                    • DDrockD Offline
                      DDrock
                      last edited by

                      Hi TID.. to where i can download your plugin FixtreeD ?? i still cant fix empty texture on my mesh from treeD.. thanks

                      1 Reply Last reply Reply Quote 0
                      • TIGT Offline
                        TIG Moderator
                        last edited by

                        My FixTreeD.rb is in this post: http://sketchucation.com/forums/viewtopic.php?p=306529#p306529

                        TIG

                        1 Reply Last reply Reply Quote 0
                        • J Offline
                          jackwatson
                          last edited by

                          Hi there,

                          I'm having trouble getting the materials to import with the model. The mtl file is in the same folder as the obj file, but it seems to replace the materials with random colours. I did tests with free models, but they're from designconnected which seems like a reputable site so I'm not sure what's stopping the import correctly. This is the chest which is supposed to be wood/iron.

                          skittles.JPG

                          Any ideas what might be causing this?

                          Regards

                          Jack

                          1 Reply Last reply Reply Quote 0
                          • TIGT Offline
                            TIG Moderator
                            last edited by

                            Without seeing the relevant OBJ and MTL how could I say 😒
                            Can you ZIP them and attach them to a post or PM them ?

                            It's likely something wrong with the MTL etc - both files are human-readable so you should be able to see issues ?
                            😕

                            TIG

                            1 Reply Last reply Reply Quote 0
                            • Z Offline
                              Zylescozar19
                              last edited by

                              Hi TIG, this is a AWESOME PLUG-IN!
                              But when i try to import this simple cube (see image)
                              there is no object that have been imported.

                              Thanks.


                              CUBE.png


                              1.png


                              2.png


                              3.png


                              4.png

                              1 Reply Last reply Reply Quote 0
                              • Z Offline
                                Zylescozar19
                                last edited by

                                Hi TIG. this is a AWESOME PLUG-IN!

                                1 Reply Last reply Reply Quote 0
                                • TIGT Offline
                                  TIG Moderator
                                  last edited by

                                  What units are you using?
                                  If the imported object is very tiny geometry can't be created.
                                  So a number like 0.1 might be very tiny in mm but x1000 using m !
                                  The radiused edges look very faceted ?
                                  Try using meters ?
                                  The imported object might then be enormous, but can be scaled.
                                  Can you attach the OBJ/MTL to a post or a PM ?

                                  TIG

                                  1 Reply Last reply Reply Quote 0
                                  • Z Offline
                                    Zylescozar19
                                    last edited by

                                    I did try all of the units.

                                    Ok ill send you the copy of obj. file.
                                    BTW im using WINDOWS 7 ULTIMATE - 32 BIT

                                    Thanks TIG! 😛

                                    1 Reply Last reply Reply Quote 0
                                    • TIGT Offline
                                      TIG Moderator
                                      last edited by

                                      OK

                                      I now have your ZIP file by PM for this OBJ.

                                      I note that there are no materials specified in the OBJ, by referencing an associated MTL file ?

                                      Also the 'object' seems to have some tiny facets.
                                      I think it was exported in 'mm' - but there's no units info in the header !
                                      It does now import OK in 'mm'.

                                      There are 68,000 lines of code in the OBJ file - which seems a lot for such a simple thing !

                                      BUT... you have discovered a typo in my script's code.

                                      This typo causes a failure - with a message in Ruby Console - but only when a particular rare combination of definitions in the OBJ file occur - that is when there are negative [-ve] values for 'f' face vertices specification: most OBJ's make +ve values to count the vertices when referring to v/vt/vn down the list etc... but -ve ones are allowed to count up the list... and my code did try to trap for that possibility... however, with certain combos of v/vt/vn it does fail because of this typo with the 'vn' counter...
                                      However, your OBJ file's format is odder still in that it makes 26 subgroups [one for each external cube] and it restarts the vertex negative count back up the file for each subgroup it defines, rather than counting through the the whole file - making it awkward to 'reverse-engineer' it to the more normal [logical] downward count which always runs from the top and is always ignoring any subgroups - so '1' is always the very first vertex defined and any grouping is ignored - but it is trappable...

                                      Also I note that many faces are 'reversed' in this OBJ's code.
                                      These need fixing manually...

                                      Frankly you could more easily make and assemble these cubes in SketchUp - there are only 3 variants for corners, centrally and mid-side, with 3d rotation etc and suitable face coloring [which is entirely missing from this OBJ anyway]...

                                      However, you reported issue has made me make the script work better for these -ve values 😉

                                      I have fixed the script and an update will be published shortly... 🤓


                                      Capture.PNG

                                      TIG

                                      1 Reply Last reply Reply Quote 0
                                      • TIGT Offline
                                        TIG Moderator
                                        last edited by

                                        There is an update available: http://sketchucation.com/forums/viewtopic.php?p=172790#p172790
                                        or http://sketchucation.com/resources/pluginstore?pln=obj_importer
                                        Previously unpublished:
                                        v2.0 20130321 'Blender-quads' now import as two tri-facets. The OBJ file must contain header-text "# Blender" or similar.
                                        Recently fixed:
                                        v2.1 20131118 Import of OBJ files using a -ve counter for 'f' vertices within sub-groups fixed. View now refreshes with each group completion.

                                        TIG

                                        1 Reply Last reply Reply Quote 0
                                        • M Offline
                                          Mill29
                                          last edited by

                                          Hi,

                                          Thanks for your job, really apreciate.

                                          there is something i missunderstood.

                                          1/ I open a .vray.mat in 3DS
                                          2/ I export in obj format, wih mat as you can see on the picture.

                                          http://img600.imageshack.us/img600/38/jmqm.jpg

                                          3/ i put in the export folder, the map furnished with the .vray.max.

                                          4/ i import in SU using your plugin, i choose cm

                                          The problem is i don't have any mat with the model.

                                          Could you help me?

                                          1 Reply Last reply Reply Quote 0
                                          • TIGT Offline
                                            TIG Moderator
                                            last edited by

                                            When you make a .OBJ file it should also make a similarly named .MTL file which defines the materials.
                                            These materials are referenced in the header of the OBJ and can be plain colors with optional transparency or with mapped textures.
                                            The textures are defined with a reference to an imgae file.
                                            Most OBJ exporters put these in a folder - named something like Textures or OBJName_Textures...

                                            The normal rule is that the OBJ and MTL files go in a common folder - the OBJ's code typically looks for the MTL file 'by name only' [with no 'path'] and therefore expects it to be in the same folder as the OBJ... The 'Texture' folder goes in the same folder as the OBJ and MTL because the MTL's code looks for "Textures/ImageName.png" etc.

                                            If the OBJ can find the MTL then no materials are made/used.
                                            If the MTL can't find an image file then the a plain-color is used instead.

                                            You can read an OBj or MTL file with a plain-text-editor...

                                            So see what the OBJ and MTL files are expecting and ensure that you keep all of the exported parts together: that is - the matching OBJ + MTL + ImageFilesInsideTextureFolder

                                            TIG

                                            1 Reply Last reply Reply Quote 0
                                            • 1
                                            • 2
                                            • 3
                                            • 4
                                            • 5
                                            • 13
                                            • 14
                                            • 1 / 14
                                            • First post
                                              Last post
                                            Buy SketchPlus
                                            Buy SUbD
                                            Buy WrapR
                                            Buy eBook
                                            Buy Modelur
                                            Buy Vertex Tools
                                            Buy SketchCuisine
                                            Buy FormFonts

                                            Advertisement