Results 1 to 12 of 12

Thread: Question about .obj and .mtl

  1. #1
    AeroAnimator 4dartist's Avatar
    Join Date
    Feb 2003
    Location
    Chattanooga, TN
    Posts
    1,066

    Question about .obj and .mtl

    I purchases a boat from turbosquid and it has a .obj and .mtl. The model is all one surface sadly and I can't figure out how to apply this .mtl if it's even possible. I got Dodgy's import script but one of the two import scripts didn't work and the one that ran gave me errors when trying to open the file. So I'm stuck. The model has a UV map and I used that in the script.

    Any ideas?

    Error on script is: Line 319, illegal arithmetic operation on data type.

    Same error in 10.1 and 9.6. Maybe it's because I'm on a mac..
    Last edited by 4dartist; 12-13-2011 at 02:50 PM.

  2. #2
    AeroAnimator 4dartist's Avatar
    Join Date
    Feb 2003
    Location
    Chattanooga, TN
    Posts
    1,066
    Nevermind, forget about it. I should have known better than to buy something as .obj

  3. #3
    Super Member nickdigital's Avatar
    Join Date
    Nov 2006
    Location
    Burbank, California USA
    Posts
    4,576
    I normally load an obj as I would a lwo file. Is it not loading in properly?
    My opinions and comments do not represent those of my employer.
    Profile piece
    2010 Reel
    'The X's' Reel

  4. #4
    Unsqueezable Sponge xxiii's Avatar
    Join Date
    Nov 2007
    Location
    Ogden, UT
    Posts
    793
    Same here. I have two other applications that write out .obj/.mtl, At least one of them also uses UV maps, and the output from both load (as if it were an .lwo) fine -- including the UV map -- into Lightwave (though they sometimes need scaled).

    If you've tried a normal load, and it still doesn't work, perhaps the .mtl of your object is doing something more complex that isn't supported by the importer. I think its just a text file if you wanted to open it in an editor and take a look around.

    Does the object have any images with it?

    MTL format
    <*> -- Know Future

    Zap: Magnify that death sphere. ... Why is it still blurry?
    Kif: That's all the resolution we have. Making it bigger doesn't make it clearer.
    Zap: It does on CSI: Miami.

  5. #5
    AeroAnimator 4dartist's Avatar
    Join Date
    Feb 2003
    Location
    Chattanooga, TN
    Posts
    1,066
    The object loads ok (although it's orientation is all messed up and it's all in lovely triangles, like they baked out the subD version.. so annoying). So the geometry is fine, it just has no surface information. It's all one surface called Default. It came with a .mtl file and one jpeg texture that would match up with the UV (i hope).

    I think maybe my problem is that I separate images and objects into different folders and the .mtl is with the image instead of the object. Tomorrow when I'm back at it, I'll try to toss it all together and open it.

    Just to be clear are you saying that when opening a .obj file lightwave looks for an associated .mtl? Does it require a certain naming convention? Obviously if it doesn't see the .mtl file it doesn't query to find it.

    I'll give this a shot tomorrow. Thanks for the responses.

  6. #6
    Unsqueezable Sponge xxiii's Avatar
    Join Date
    Nov 2007
    Location
    Ogden, UT
    Posts
    793
    The obj contains a reference to the mtl. If that reference does not contain a path then its expecting it to be in the same place as the obj.

    In turn the mtl contains references to textures, and if they don't have a path, they in turn need to be in the same place.

    One of my applications writes this in the obj:
    Code:
    mtllib basic city.mtl
    So its expecting the mtl to be in the same place as the obj. Then within the mtl it writes:
    Code:
    map_Kd textures/road.png
    So its expecting a textures folder in the same place as the mtl, and road.png to be inside that textures folder.

    Apparently, the Lightwave obj loader isn't prepared for these files to be anywhere different than the obj and mtl say they are (unlike .lwo, which will ask you to find any missing parts). Or maybe it only needs the mtl to be in the "right" place and will ask about textures it can't find.

    So, as you say, try loading it exactly as it came from turbosquid and see if that works.

    Quote Originally Posted by 4dartist View Post
    ...it's orientation is all messed up and it's all in lovely triangles,
    Oh, yes, I forgot to mention, I usually have to rotate OBJ +90 on X after loading. Lightwave uses a Y-UP left-handed coordinate system, but a lot of other applications use a Z-UP right-handed. OBJs also have no concept of units, so objs may come in disoriented and fat-headed . (If whoever modeled your boat decided that "1" was a cubit, you'll have to scale accordingly).

    The triangles isn't necessarily a bad thing, and turbosquid has been pushing for models to be either tris or quads (there are good reasons to avoid ngons, especially in models that are meant to work in multiple applications).
    <*> -- Know Future

    Zap: Magnify that death sphere. ... Why is it still blurry?
    Kif: That's all the resolution we have. Making it bigger doesn't make it clearer.
    Zap: It does on CSI: Miami.

  7. #7
    Open the obj in modeler.
    Go to Surface Editor
    Press the T button next to Color
    Set Projection to UV
    Check the UVMap pulldown to see if there is an UV map. Select it if there is.
    Set the texture map you got to the Image.

    This works most of the time for me. I never do anything with the mtl-file.

  8. #8
    .mtl just saves you from manually assigning the UV and texture, it's a big help when there are a lot of textures. When importing Objs I often get vertex normal maps that I have to deactivate in the Surface Editor. They usually look odd and they don't allow you to control the smoothness. Check other surface parameters carefully, some imported objects will have weird things turned on, like reflection bluring or luminosity when they are not supposed to.


    On the triangles thing, Triangles are messy and besides making the object hard to see it's hard to edit it. So I usually try to remove them using TrigonX, some objects "de-triangulate" fine and others don't.

    A link to TrigonX here
    http://forums.newtek.com/showthread....s+64bit&page=5
    Last edited by Danner; 12-14-2011 at 09:48 AM.

  9. #9
    World's Tallest Dwarf safetyman's Avatar
    Join Date
    Aug 2003
    Location
    Maryland, USA
    Posts
    1,343
    With LW 9.6, you could just load the .obj and it would use the .mtl file to automatically assign all the textures. In LW 10, this is broken (at least for me). Anyone know how to make it work?

  10. #10
    AeroAnimator 4dartist's Avatar
    Join Date
    Feb 2003
    Location
    Chattanooga, TN
    Posts
    1,066
    Quote Originally Posted by xxiii View Post
    The triangles isn't necessarily a bad thing, and turbosquid has been pushing for models to be either tris or quads (there are good reasons to avoid ngons, especially in models that are meant to work in multiple applications).
    I just don't understand taking a model that you most likely created with clean poly flow and using Sub-D then basically baking out the Sub-D version and selling that smoothed triangle version. Why not also add in the unsmoothed original mesh? Is it because they are afraid people will rip them off? Is it because they don't realize people want to sub-d the model in their own application? Is it because they think people don't know what a sub-d is? Is it because when modeling in max they just use a tessellating smooth option at the end? I've spend thousands of dollars on turbosquid models because a lot of times they save me time, but they could be even better if they were more manageable and editable. Even models that are '.lwo' listed are basically just ported from Max as triangles. There are a rare few gems out there that are quads.. rare.

    Ok done ranting. On a positive note keeping the .mtl file with the .obj worked just fine! The model has surfacing and the texture applied. Thanks so much for the help!

  11. #11
    Unsqueezable Sponge xxiii's Avatar
    Join Date
    Nov 2007
    Location
    Ogden, UT
    Posts
    793
    Quote Originally Posted by 4dartist View Post
    I just don't understand taking a model that you most likely created with clean poly flow [...] There are a rare few gems out there that are quads.. rare.
    I wish I'd mentioned in my prior post that turbosquid was pushing for models to be mostly quads with tris where necessary, but what I wrote implies differently. I didn't research it enough, but I hope they're pushing for those quads to be planar. (non-planar quads, at least beyond a certain point, are not clean in my opinion).
    <*> -- Know Future

    Zap: Magnify that death sphere. ... Why is it still blurry?
    Kif: That's all the resolution we have. Making it bigger doesn't make it clearer.
    Zap: It does on CSI: Miami.

  12. #12
    AeroAnimator 4dartist's Avatar
    Join Date
    Feb 2003
    Location
    Chattanooga, TN
    Posts
    1,066
    Quote Originally Posted by xxiii View Post
    I wish I'd mentioned in my prior post that turbosquid was pushing for models to be mostly quads with tris where necessary, but what I wrote implies differently. I didn't research it enough, but I hope they're pushing for those quads to be planar. (non-planar quads, at least beyond a certain point, are not clean in my opinion).
    Ah ok. I'm glad for any push turbosquid is doing to steer artists into posting quad based meshes that the purchaser can subdivide. It would increase the value of the product by a lot because I would be able to edit the model to fit my needs. Right now they are basically so dense you can't make changes.

    Right now I'm fixing tons of flipped surfaces and missing triangles in this 4 wheeler model I downloaded. Also pipes for the vehicle are splines and not actual geometry. Bummer.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •