Importing .obj with .mtl files

I have a model that was made with 3DS (from turboSquid). It came with blender, 3ds, .obj and .mtl files. How do I get the .mtl file to load with the .obj file? I ticked all the "Read ...." buttons in the DS import options window but I only get the object with no uv's. Also generate .obj and .mtl files in blender with same result. Also tried importing an fbx file but only got the object with no materials. 

Comments

  • Charlie JudgeCharlie Judge Posts: 12,732

    Are you trying to import from a compressed file (i.e. zip or rar)? Be sre you have  extracted all the files and imported from there. Be sure that the obj and mtl files are in the same folder.

  • barrieMbarrieM Posts: 292

    Yes, I did extract the files and they are in the same folder.

  • To be clear about your problem, you are asking how to get the .mtl file to load with the object, but then also saying you get the object with no UVs (in DS). 

    Do you see the UV layout in Blender?  If not, it suggests the object has not been UV mapped, though that would be a bit odd as you have an .mtl file.  Alternatively, the UV definitions in the .obj file are broken/corrupted and can't be loaded.

    Do the materials load with the object in Blender?

    If you open the .obj file, you can see the path to the .mtl file.  If there are spaces in the path, try changing it to a path with no spaces (and moving the .mtl file to a matching location).  Also look in the .mtl file for references to image files - you will need those for the materials to load, and they will need to be in the location specified in the .mtl file.  Suggest you remove any spaces in the paths to the image files.

  • AscaniaAscania Posts: 1,849
    barrieM said:

    I have a model that was made with 3DS (from turboSquid). It came with blender, 3ds, .obj and .mtl files. How do I get the .mtl file to load with the .obj file? I ticked all the "Read ...." buttons in the DS import options window but I only get the object with no uv's. Also generate .obj and .mtl files in blender with same result. Also tried importing an fbx file but only got the object with no materials. 

    The UVs are contained with in the .obj file, not in the .mtl. The .mtl only contains the material definitions and maybe links to texture images. But those materials will have to be set up, just like the UVs, in the .obj itself.

  • barrieMbarrieM Posts: 292

    Thank you andya and Ascania for your comments. The .obj file I received does not contain any uv information. The blender file does open wth materials in Blender. I have made a few fruitless attempts of exporting the .obj and .mtl files from Blender but can't get the materials to load with the mesh. In DS I have assumed the model's uv zones should be seen in the Surfaces Tab under uv maps. So far all .obj attempts show a single default uv zone. 

    Does anyone know how to import objects with uv maps from blender?

  • Richard HaseltineRichard Haseltine Posts: 100,842
    edited January 2019

    Are you sure it has UVs in Blender? It may be using projection or soem kind of procedural based on physical coordinates, rather than surface UVs, to apply texturing. UV mapping and dividing an object into surface groups are not related.

    Post edited by Richard Haseltine on
  • EsemwyEsemwy Posts: 578

    It may be that the name of the .mtl file has changed from what’s recorded in .the .obj file. Open the .obj file in a text editor (notepad or equivalent). Find the line that starts with “mtllib” and make sure the filename matches what you have. You can fix it either by renaming the .mtl file or changing the name in the .obj file. 

  • barrieMbarrieM Posts: 292

    Richard, I am not sure but the product info said it is uv mapped. The object is a basic piano with 3 colors. A wood shader and a black and white shader for the keys. See the attached screen shot.

    Esemway, The object file states the correct name of the .mtl file. Both .mtl and .obj have the same name. There are 3 blocks of data labled v, vt and f (what do they mean?).

    Before "v" Text is "mtllib piano.mtl".

    Before "Vt"  no text.

    Before "f" Two lines of text is "g Group0_Group0_piano" and "usemtl piano"

     

    piano in blender.jpeg
    1433 x 748 - 368K
  • Looks like there is a UV map from your Blender screenshot.  What do you see in the UV/Image Editor, and the Materials tab.  I note there are no vertex groups defined, which should be OK.

    What do you see in the UV View in DS?  And are there any surfaces showing up in the Surfaces tab?

    I am wondering if DS just cannot interpret the material definitions in the .mtl file.  If you haven't already tried, what about exporting the model from Blender as OBJ, with 'Include UVs' and 'Write Materials' checked, and try importing that into DS?

  • barrieMbarrieM Posts: 292

    In the Surfaces Tab uv map>uv sets show Default UV's. Can't find a UV view. See attachment for blender uv/immage Editor. I did export with  'Include UVs' and 'Write Materials' but with Polygroups and keep vertex order. 

    image: uv.jpeg
    486 x 788 - 103K
  • andya_b341b7c5f5andya_b341b7c5f5 Posts: 694
    edited January 2019

    Hmm, that's confusing.  Your latest screenshot seems to be of the Textures tab, though it's got a Mapping section below the Image Mapping that doesn't appear to be in my copy of version 2.79.  What I was after is shown in the attached, on the left.  Either open a UV/Image Editor window manually or select the UV Editing layout from the screen layout dropdown in the header at the top of the window (as per screenshot attached).  Not sure how familiar you are with Blender - apologies if I am underestimating your level of knowledge.

    The UV View in DS is the very bottom selection of the view dropdown in the 3D view - the thing with Top, Bottom, Left, Right and the cameras.  Select the object before you choose this.

    I have never come across an image format '.dds'.  Does DS support that?  If it doesn't, whether there's a valid UV map or not won't matter a jot.

    Screenshot (58).png
    1920 x 1080 - 315K
    Post edited by andya_b341b7c5f5 on
  • barrieMbarrieM Posts: 292

    I am a blender novice! Spent 6 weeks about 18 months ago trying to drive it but manage to construct a morphable model that I now use in DS. My blender version is 2.78.

    here is some info on .dds files. 

    "A DDS file is a raster image saved in the DirectDraw Surface (DDS) container format. It can store compressed and uncompressed pixel formats and is often used for texturing video game unit models. DDS files may also be used to store Windows desktop backgrounds or wallpapers."

    Maybe DS does not support .dds and maybe that is why I couldn't get the piano material to load.

    Here is the screen shot.  Does it confirm that the model is uv mapped?

     

    uv editing.jpeg
    1902 x 1057 - 293K
  • That's a 'yes' on the UV map then, so the description of the model as UV mapped is confirmed and we can rule out lack of UV mapping as the cause.  You should see the same layout in DS in the UV view.  If not there must be something off about the UV information in the .obj file that DS cannot handle but Blender can.

    I really don't know whether DS supports the .dds format.  You could ask the helpdesk, or someone else here may know.  Since it was unfamiliar to me, I wondered because if it doesn't then it would go some way to explain the problem.  There is probably at least one way to convert to JPG or PNG.

    After importing the OBJ file into DS, and selecting the piano object, what do you see in the Surfaces tab?  There should be surfaces defined.  I would expect at least one surface to be using that .dds file as a base color. 

    You can also check to see what materials show up in Blender (right hand side in the default layout, little pinkish sphere icon).  There must be some or the wood effect wouldn't be showing in Blender.  Blender materials and DS surfaces are roughly equivalent in this context.

  • barrieMbarrieM Posts: 292

    There is only one surface in DS surfaces tab and an outline drawing (with triangular polygons) of the component parts show up in the uv view.

    I have decided to abandon this Model. TurboSquid will give me a refund. Next time I will check compatibility with DS before I buy.

    Thanks a lot for your help. It wasn't fruitless, I learned a few things about both  DS and Blender.

  • AscaniaAscania Posts: 1,849

    Question, did you try the obj file in Blender or just the .blend? There might be the remote possibility that the creator UV-mapped the model but upon export the UVs were stripped from the model.

  • barrieM said:

    There is only one surface in DS surfaces tab and an outline drawing (with triangular polygons) of the component parts show up in the uv view.

    I have decided to abandon this Model. TurboSquid will give me a refund. Next time I will check compatibility with DS before I buy.

    Thanks a lot for your help. It wasn't fruitless, I learned a few things about both  DS and Blender.

    OK, no problem.  At least you can get a refund.  Sounds to me like DS can read the UV map, and you have a surface (would have expected two or three, but not essential).  Which leaves two possibilities I can think of: either the .dds file format isn't supported in DS, or it is but DS can't find the file from the info provided by the .mtl file.  I guess it will always be a mystery why it's not working, that and what caused the Bronze Age collapse.

Sign In or Register to comment.