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.
    • bagateloB Offline
      bagatelo
      last edited by

      The inverse option, for export obj files from SU is possible?
      Thanks anyway....

      While the cat's away, the mice will play

      1 Reply Last reply Reply Quote 0
      • S Offline
        sketchorro
        last edited by

        Hi,

        Let me start by saying thanks for this plugin, it's great.

        I've started using it to import models from Structure Sensor.

        I decided to do a little hacking to make my life easier; basically setting the units to default to metres and taking a look at how to bulk import mesh models (todo). I also discovered that when the models were loading in the background/covered by another window, they loaded much faster (I'm on OSX/'14 Make).

        The reason for this is because the UI is getting hammered with several tens/hundreds of thousands of repaints (1 per obj file line) to updated the status bar from this:

        	 Sketchup.set_status_text("Processing line #{line_cnt} of #{lines.length}")
        

        I took a crack at fixing this by making the status line update on a change in percentage. I obviously screwed it up not being a ruby coder, but in the process discovered my 40K+ line (991kb) models loaded in about 2 seconds.

        It still slows down when you get really big models; I have a 13.2MB file that starts to grind after about 90%, but I suspect this is a memory/swap bottleneck.

        Anyway, I fixed my update code and it looks like this:

        Initialize the percentage variables before the looping starts

        
         old_percentage=-1
         new_percentage=0
        
         ### trap in case of a missing 'g'
         lines=["g OBJ\n"]+lines
        
        

        Update the status and force sketchup to repaint once per percentage point.

        
         # Sketchup.set_status_text("Processing line #{line_cnt} of #{lines.length}")
         new_percentage = ((line_cnt * 100.0)/lines.length).round;
         if old_percentage != new_percentage
           Sketchup.set_status_text("Importing Model - #{new_percentage}% (#{line_cnt} of #{lines.length})")
         end#if
         old_percentage = new_percentage
        
        

        Probably something that would help others enjoy this plugin a little more.

        -G

        1 Reply Last reply Reply Quote 0
        • E Offline
          enuminous
          last edited by

          I've just installed Import OBJ with Materials 2.1 and am running into the same problem, with materials being replaced with white/grey. I'm exporting from Poser, and the .obj and .mtl files are in a folder, with a Textures subfolder containing the generated PNG files. I've also tried it with the PNG materials in the same folder at the .obj and .mtl files. Neither works. I'm running Sketchup2015 64 in Yosemite on a 5K Retina iMac if that helps. Any suggestions?

          1 Reply Last reply Reply Quote 0
          • S Offline
            storm2000
            last edited by

            @enuminous said:

            I've just installed Import OBJ with Materials 2.1 and am running into the same problem, with materials being replaced with white/grey. I'm exporting from Poser, and the .obj and .mtl files are in a folder, with a Textures subfolder containing the generated PNG files. I've also tried it with the PNG materials in the same folder at the .obj and .mtl files. Neither works. I'm running Sketchup2015 64 in Yosemite on a 5K Retina iMac if that helps. Any suggestions?

            Same for me here, on SketchUp 2014 on Windows, OBJ + MTL textures. All textures are gray. Any solution to make it working welcome 😃

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

              Please make a ZIP of the OBJ, MTL and textures-subfolder [including its image-files].
              Then either attach it to a post here, or onto a Private Message sent to me.

              Any messages in the Ruby Console ?
              If the OBJ refers to the MTL, and that MTL refers to the texture image files then it should work... 😕

              TIG

              1 Reply Last reply Reply Quote 0
              • A Offline
                aclark
                last edited by

                Will this plugin work with SU2015? I have a large .obj with 219 different UV textures, and so far this hasn't worked (fails to import). Or do I need to be using 2013 in order for the importing and mapping to work appropriately? I get this file to import correctly using SimLab's plugin, but the materials are all wonky because the mapping is incorrect. Any help would be appreciated.

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

                  It works in all currently available SketchUp versions.

                  Without the OBJ/MTL/Textures it's difficult to say what your issue is.
                  Sometimes OBJ files do not follow the prescribed format and are awkward to parse [e.g. -ve vertex referencing] - although those main variants are catered for already in its code...
                  If it ZIPs to <= ~4Mb you can attach it to a Post or a Private-Message...
                  Or use a Dropdown etc and PM me a link...

                  BUT alternatively you could think about getting Blender [free], importing the OBJ into that, exporting from that as a DAE and finally importing that into your SKP using the native Collada Importer ??
                  See if that helps.
                  But if that OBJ/MTL/Tetxures is inherently flaky - as your SimLab experience suggests - then perhaps it's inevitable ?

                  TIG

                  1 Reply Last reply Reply Quote 0
                  • F Offline
                    fluid
                    last edited by

                    We just released FluidImporter 3.1.0. You can get it here.

                    Here's what's new:

                    • Faster import
                    • FluidImporter is now a full .rbz extension, with a single file for Windows/OSX
                    • You can access FluidImporter funtionality through the menu Extensions -> FluidImporter
                    • Added edge smooth option
                    • Options are now saved so you don't lose your settings when closing SkechUp
                    1 Reply Last reply Reply Quote 0
                    • Mike AmosM Offline
                      Mike Amos
                      last edited by

                      I have tried with obj files this week, the import with materials fails to bring all the geometry across and import as geometry loses faces but at least keeps the lines for the geometry. Is there something I can do to get all the geometry?

                      Link to models. http://www.colacola.se
                      Link to topic http://sketchucation.com/forums/viewtopic.php?f=81%26amp;t=62675

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

                        I've only looked at one downloadable model.
                        The most recently added OBJ [bazze...] is poorly set up.
                        There is no units 'clue' in its header.
                        There is no call to an MTL file inside the OBJ.
                        There is no MTL file - which would be used to define Materials.
                        The two images are not referenced, as there is no MTL file to call them - also they typically go inside a subfolder with the OBJ and MTL files...

                        So using that you will never get materials included.
                        If you guess the units to be 'meters' then all of the geometry might get made...
                        With smaller units, any tiny edges will not get created, and any reliant faces will also no make it through...

                        TIG

                        1 Reply Last reply Reply Quote 0
                        • Mike AmosM Offline
                          Mike Amos
                          last edited by

                          Thanks TIG, I am guessing that as the modeller is European that metres is the correct scale, especially as the subject is reasonably large. I have SOME of the models translated with Turbocad but the older aircraft tend to be more complex and that is where the problems lie.

                          1 Reply Last reply Reply Quote 0
                          • Mike AmosM Offline
                            Mike Amos
                            last edited by

                            It worked after a few attempts, very slow but that is understandable with all the detail. I will have to work out how to wrap the textures next. Thanks againTIG, I appreciate your quick response.

                            1 Reply Last reply Reply Quote 0
                            • erkanE Offline
                              erkan
                              last edited by

                              Hi TIG,

                              I've been using this wonderful plugin for quite a long time, apparently it wouldn't work nicely in 2016 Make (I haven't tested in 2016 Pro) but it's working like a charm in 2015 Pro. So is there a plan to make it work under 2016 Make?

                              When I say it wouldn't work it's not bringing all the geometry, just some random faces from the whole model.

                              Cheers
                              erkan

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

                                I'm unsure why you are having issues with v2016...
                                It should be compatible, even though its RBZ hasn't yet been signed to run in all v2016's security-policies...
                                I haven't tested it though !
                                So, is the exact same OBJ working differently in v2015 and v2016 ?
                                Can you ZIP the OBJ etc, and PM it to me, so I can test it here...

                                TIG

                                1 Reply Last reply Reply Quote 0
                                • faBcnF Offline
                                  faBcn
                                  last edited by

                                  Hi TIG!
                                  Thank you so much for the plugin.
                                  I finally installed old frecle Tree[D] that I had downloaded when still available... I think it's great and easy to use to generate 3d trees, so your plugin is perfect to be able to import OBJ + Material into my sketchup 2016.
                                  Tree[D] is still a MUST HAVE in 2016 or there´s new stuff? vs 3D Tree Maker? Free is better...

                                  1 Reply Last reply Reply Quote 0
                                  • Bob JamesB Offline
                                    Bob James
                                    last edited by

                                    I purchased a model in .obj format from Turbosquid. Within the OBJ folder are .obj files and .mtl files. In addition to the OBJ folder there is a TEXTURES folder containing .tif files.
                                    I've tried several ways to import the model into SU. The only time anything was actually imported was when I used "Import as Mesh", but some of the model was missing (size=feet) and there were no textures or materials.
                                    OBJ folder content

                                    The Cortaderia_variant1.obj file contains identification of the .mtl file:

                                    ==========================================================================

                                    Wavefront OBJ format exported by Red-i Productions' "Riptide Pro"

                                    (a commercial plugin for Cinema 4D PC & Mac, R9.6 or later)

                                    Red-i Productions

                                    http://skinprops.com

                                    ==========================================================================

                                    mtllib Cortaderia_variant1.mtl
                                    o si3d_0031_leaf01
                                    v -0.00283137 0.010224 0.114454
                                    v -0.000566467 0.00851267 0.116015
                                    v 0.00263311 0.00845039 0.116518
                                    v -0.0110162 0.0498717 0.168671
                                    v -0.00835776 0.0478127 0.170411
                                    v -0.00461871 0.0477404 0.171001
                                    v -0.0204793 0.0850494.....................

                                    The mtllib Cortaderia_variant1.mtl file contains:

                                    ==========================================================================

                                    Wavefront Material file

                                    Exported by Red-i Productions' "Riptide Pro"

                                    (a commercial plugin for Cinema 4D PC & Mac, R9.6 or later)

                                    Red-i Productions

                                    http://skinprops.com

                                    ==========================================================================

                                    newmtl default_Mat
                                    illum 2
                                    Kd 0.800000 0.800000 0.800000

                                    newmtl si3d_0031_leaf01
                                    Ns 50.781250
                                    illum 2
                                    Kd 0.800000 0.800000 0.800000
                                    map_Kd si3d_0031_leaf01.tif
                                    bump si3d_0031_leaf01_rel.tif
                                    map_d si3d_0031_leaf01_a.tif

                                    newmtl si3d_0031_leaf02
                                    Ns 50.781250
                                    illum 2
                                    Kd 0.800000 0.800000 0.800000
                                    map_Kd si3d_0031_leaf02.tif
                                    bump si3d_0031_leaf01_rel.tif
                                    map_d si3d_0031_leaf01_a.tif

                                    etc,
                                    .
                                    .
                                    .
                                    .
                                    .

                                    The textures folder contains:
                                    Pampas textures.PNG

                                    i7-4930K 3.4Ghz, 2x GTX780 6GB, 32GB DDR3-1600 ECC, OCZ Vertex 4 500GB, WD Black 3TB, 32TB NAS, 4x 27" Monitors, SpaceMouse Pro, X-keys XK-60

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

                                      @Bob

                                      Have you also tried the [faster] Fluid OBJ Importer ?

                                      I suspect the OBJ's units are meters ?
                                      The vertex spacings seem very small otherwise.

                                      Any Ruby Console error messages when importing it ?

                                      In my version the mesh option ignores textures - so that's expected.
                                      At first glance the MTL materials seem to be defined OK, although the bumps images etc will be ignored.
                                      However, the map_Kd si3d_0031_leaf01.tif does NOT include the actual path to the ' textures' folder.
                                      I suggest you copy that folders' image files into the main folder with the OBJ and MTL files...
                                      Then retry, using meters as the units...

                                      Have you tried importing the OBJ into Blender and then exporting it as a DAE.
                                      That DAE might then import into a SKP...

                                      TIG

                                      1 Reply Last reply Reply Quote 0
                                      • Bob JamesB Offline
                                        Bob James
                                        last edited by

                                        @TIG

                                        See this which discusses what I did with your suggestions/comments in mind:

                                        Link Preview Image
                                        Page not found - Thea Render

                                        favicon

                                        Thea Render (www.thearender.com)

                                        i7-4930K 3.4Ghz, 2x GTX780 6GB, 32GB DDR3-1600 ECC, OCZ Vertex 4 500GB, WD Black 3TB, 32TB NAS, 4x 27" Monitors, SpaceMouse Pro, X-keys XK-60

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

                                          Sorry @Bob I can't access that forum.
                                          Can you précis it ?

                                          Did it work ?

                                          TIG

                                          1 Reply Last reply Reply Quote 0
                                          • romboutR Offline
                                            rombout
                                            last edited by

                                            I got another question about this importer. If im correct it would show vertices or some sort of count in the bottom left corner. It doesnt no more for me on mac, but im not sure if it was with this script 😄🙂

                                            Ive used this script before and always sort of worked. Now i got this model which is in Meters. WHen i import it in Meters nothing happens, at least on mac SU becomes non responding. But thats normal i believe for this script. When i use Inch, it does work only a lot of the mesh is cut off and not showing.

                                            Im using SU8 on osx 10.11.2

                                            EDIT
                                            after checking on using inches again. It does show some progress in the bottom left. It seems with meters some errors apear.

                                            Ive zipped the part with the textures, perhaps you can check or see. If you like
                                            https://www.dropbox.com/s/ihpnays8veufcpm/plant%20part.zip?dl=0

                                            EDIT2
                                            When i use inch it also goed much faster. I did let it go now for 20min orso and than it did the meters. Not sure why the difference in time??? Also centimeters go much faster than meter.

                                            1 Reply Last reply Reply Quote 0
                                            • 1
                                            • 2
                                            • 10
                                            • 11
                                            • 12
                                            • 13
                                            • 14
                                            • 12 / 14
                                            • First post
                                              Last post
                                            Buy SketchPlus
                                            Buy SUbD
                                            Buy WrapR
                                            Buy eBook
                                            Buy Modelur
                                            Buy Vertex Tools
                                            Buy SketchCuisine
                                            Buy FormFonts

                                            Advertisement