Newbie needs help with importing Obj files and their UV maps

Steven-VSteven-V Posts: 727
edited December 1969 in New Users

Hi folks.

I am sure this question has been asked repeatedly, but I have tried doing various Google and forum searches and not turned up anything to answer my question.

I am very new to Daz and have been playing around with it. I've DLed and installed some DAZ-based content (hair for Genesis 2 etc) from the DAZ store with no problem - easy peasy.

However, I found a couple of interesting objects on Sharecg that are .OBJ files. They come with .mtl files and UV maps as .tgas, so everything should work OK. I can import them easily enough as objects into DAZ, but the UV maps don't seem to want to come with them. I suspect there is an option somewhere that will let me tell DAZ "this is the UV map file to use," but I can't find it. The mtl, obj, and tga files are all in the same folder (it's a simple bed, and the folder is called "Bed", shockingly enough).

I tried going into the surfaces (color) tab in DAZ and selecting on some things, but none of the options seem to work. For instance, there is a "UV Maps" item in the list of materials, but when I click on it, I only get the option to use the"default UVs," and no option (as I would have suspected) to choose another map file. I've tried importing with and without the various options like "read surfaces" and "read material library" checked, and the result is always the same - a gray bed which does not have its UV map loaded.

I thought maybe it was the bed, so I tried some other objects, but I get the same problem with those as well... the shapes come in fine, but the UV mapped textures don't seem to.

I'm pretty sure there is something simple I can click on to fix this, but after hours of poking around I haven't found anything, and the only advice I turned up with a search was to "use the surfaces tab" to fix this, and as I say, I can't figure out how to exactly do that.

Any help would be appreciated. Thanks!

Comments

  • AscaniaAscania Posts: 1,850
    edited December 1969

    You don't need to anything about UV maps. They are part of the object.

    Go and add the texture images to the corresponding colour channels in surfaces tab.

  • Steven-VSteven-V Posts: 727
    edited January 2014

    Thanks. I figured out that at least part of the problem is error on the creator's side... file names in the .mtl file that are hardwired with the user's directory structure, e.g. C:/Users/Smith/MyFiles/MyModels/Bed/bedmap.tga. Since I'm not Smith and I don't have these directories, that's part of the issue. I might have expected it with one, but it turns out all 5 of the 5 different models I DLed from Sharecg had the same issue. Which is kind of sloppy, IMO. But when I corrected it by hand in the mtl file, it corrected SOME of the problems. Though not all. I now think these are creator errors though... which means I will have to go in and correct them by hand if I want to use them.

    Just to clarify, when you say adding texture images to the corresponding color channels -- do you mean things like diffuse color, ambient color, etc? I don't know which files to use for that. The bed, for instance, only came with Bedmap.tga, and then bed.mtl and bed.obj. I did manage to get the bed to "respect" the UV Map by setting the .tga file as the "diffuse" color, which brought in the patterns in the right place, but the colors are extremely dark and hard to see (whites look dark grey, etc). I tried playing around with them but I did not find a way to bring out the colors that are clearly present inside the .tga file.

    I suspect I may have been playing around with some files that were not set up quite right, and that is causing my issue.

    Post edited by Steven-V on
  • AscaniaAscania Posts: 1,850
    edited January 2014

    Just to clarify, when you say adding texture images to the corresponding color channels -- do you mean things like diffuse color, ambient color, etc?
    Indeed. I have no idea what object you downloaded and what texture maps come with it.
    Often creators will give indicative names but sometimes you just have to look at the image to see what map it contains.
    Diffuse is the standard channel for any base colour map.
    I don't know which files to use for that. The bed, for instance, only came with Bedmap.tga, and then bed.mtl and bed.obj. I did manage to get the bed to "respect" the UV Map by setting the .tga file as the "diffuse" color, which brought in the patterns in the right place, but the colors are extremely dark and hard to see (whites look dark grey, etc). I tried playing around with them but I did not find a way to bring out the colors that are clearly present inside the .tga file.

    Look at what colour the diffuse channel is set to and what strength. Then turn it to white.
    I suspect I may have been playing around with some files that were not set up quite right, and that is causing my issue.
    Post edited by Ascania on
  • mjc1016mjc1016 Posts: 15,001
    edited December 1969

    That's one of the drawbacks of the mtl file itself. The obj specification was written way back when...so 'hard' path information was not looked upon as 'bad', in fact it was pretty 'normal'.

    The mtl file is just a starting point and only useful for basic things. Once you get the item into Studio, you can ignore it...in fact you have have Studio not even bother with it in the first place. After the item is loaded DS doesn't use the mtl for anything. Use the Surfaces pane and manually load the textures and save a preset, once have the item imported, scaled, positioned and resaved.

    I usually load the item, in a blank scene, scale, position, etc, then export it again (if it's something I'm making, I'll just overwrite the original, because I have a working copy saved as .blend file (I use Blender for modelling)...but if it's downloaded, I'll save a copy in elsewhere), usually to the Geometries folder in my Studio content directory. Then I remove the item or open a new scene, import the saved copy, then manually texture it. After that, I'll resave it and a DS preset for it...this time making sure things are saved in the proper locations.

  • SpottedKittySpottedKitty Posts: 7,232
    edited December 1969

    file names in the .mtl file that are hardwired with the user's directory structure, e.g. C:/Users/Smith/MyFiles/MyModels/Bed/bedmap.tga. Since I'm not Smith and I don't have these directories, that's part of the issue.

    That's a very common problem with .obj files with matching .mtl files and textures*. What I eventually worked out as a (mostly!) reliable fix was to search for and strip out all the path names from the .mtl file leaving only the filename, and place all the files into the same folder in your /Runtime/Textures/ folder This way, when you import the .obj file the textures in the same folder will be automatically found.

    Also, check the first few lines of the .obj file itself to make sure the .mtl file name is actually correct, and it's not looking for it in another hard-coded folder path. This should never happen, but it does sometimes.

    Incidentally, the .tga files are nothing to do with UVmaps, they're just another texture file format — but they're the preferred texture format for some other 3D creation program (possibly Lightwave or 3DSMAX?). I think they're favoured in that program because it's easier to make "transparent background" or animated textures that can be overlaid on top of something else like a procedural or another texture. Nothing to worry about in D|S, as long as you've fixed the file paths they should load OK when you import the .obj file.

    * It also used to be a major problem with freebie items created for Poser by someone with no knowledge of the actual Poser Runtime file structures. Much less common now, fortunately, but it still crops up now and then.

  • Steven-VSteven-V Posts: 727
    edited December 1969

    Thanks everyone for the feedback. Let me first note that I have DLed a bunch more objects and some of them import just fine with all their textures and others don't. The ones that don't all seem to have issues with things like file names. Sometimes when I manually fix them, the textures are fixed, and sometimes they still don't come in.

    The .tga file I am referring to in the case of the simple bed, is one that is a file set up for a UV map, as I understand it. That is, it has the textures all in one single .tga file, as an 'unwrapped" version of the bed (the way it would look if you squashed it flat). These are the only textures provided. This is why I was confused about the suggested actions. I can't load the file for, say, the blanket texture manually, because there isn't (a separate) one. It's part of the same file that contains the textures for the bed frame, the pillow, etc.

    Other objects I have DLed do have separate files, so that each piece has its own texture. I have a book case (2 shelf) with 21 books modeled on it. The folder contains 21 .png files with the 21 book textures, and then separate files for th wood grain texture for the case itself. This one loaded fine but if it hadn't, I could have gone into each chunk of the case manually and specified the texture.

    I just don't see how to do that when I only have one file and everything is lumped into one. I feel like I should be able to tell DAZ "this file here is the UV map file you need to use for this object," but I don't see any option for doing that in any of the menus. This is what had me confused.

    I suspect the bed is just problematic at this point, as the textures also do not load into blender. I've grabbed whole dining room sets now, living rooms, a couple of other (nicer) beds, and an entire bedroom, from different authors, and they all import just fine.

  • mjc1016mjc1016 Posts: 15,001
    edited December 1969

    The tga file is NOT a UV map...

    The UV map is part of the actual obj file. It is a way of saying that these polygons are mapped to take textures with these coordinates.

    Now, with all the textures on one image file, the parts that correspond the to the various parts of the item will actually show up in the correct places if you just point to that file.

    Let's say your model has 5 surfaces defined and there are 5 parts to the single image file. You go under the surface tab and find, for example, the blanket surface and under Diffuse color load the single image file. Then you do the same for the other four parts...and all will be correctly textured.

    In other words, the 'mapping' is defining which part of that single texture file belongs to each surface/part of the overall item.

  • SpottedKittySpottedKitty Posts: 7,232
    edited December 1969

    mjc1016 said:
    Let's say your model has 5 surfaces defined and there are 5 parts to the single image file. You go under the surface tab and find, for example, the blanket surface and under Diffuse color load the single image file. Then you do the same for the other four parts...and all will be correctly textured.

    I'm... a bit doubtful that would actually work in D|S. I didn't realise in this case the .tga image had been set up with the tga format's multi-layer capability; I'm fairly sure D|S can only extract one image (probably the top one) from a multi-layer tga. I suspect this model was originally created using something like LightWave, which can use full multi-layer images as texture maps.

    Easy solution — use an image editor to strip out the individual layers, save them as separate texture images, and load these in D|S into the individual materials parameters.

  • mjc1016mjc1016 Posts: 15,001
    edited December 1969

    Not sure, with layered tga, either...but all other formats will work as described.

    I'm looking for a file with tga images to check, but I'm not having much luck finding one...found a couple with single layer tgas, ButStudio is loading the single layer ones, just fine. And it would be more about the libraries that handle image files (dlls on Windows) system wide, than about the app, I would think.

  • Steven-VSteven-V Posts: 727
    edited December 1969

    Hey guys.

    Thanks for the responses.

    Setting the tga as the map for the diffuse color and then changing the color base to WHITE instead of BLACK as suggested by Ascania worked well.

    The other problem, and I'm still getting used to this with DAZ, is that in the editing window, if there is no spotlight or distant light set up, things look a lot darker than they will look when rendered. So turning the diffuse to white and then putting a distant white light of sufficient intensity in the environment and rendering it turned up a bed that looked more or less the way I expected.

    I'm still getting used to how different things look in the editing window vs. the render, so that's part of what threw me.

  • TjebTjeb Posts: 507
    edited December 1969

    Have you tried this:

    Preview_Lights.jpg
    450 x 424 - 41K
  • SpottedKittySpottedKitty Posts: 7,232
    edited December 1969

    Setting the tga as the map for the diffuse color and then changing the color base to WHITE instead of BLACK as suggested by Ascania worked well.
    This is common in some other modelling programs, and in many items created for Poser — the Diffuse Color setting mixes with the diffuse texture in a very different way. About 95% or more of the time in D|S, the diffuse must be set to white otherwise you'll get an unwanted colour cast on the texture.
    The other problem, and I'm still getting used to this with DAZ, is that in the editing window, if there is no spotlight or distant light set up, things look a lot darker than they will look when rendered.

    You're seeing the phantom "headlight" attached to whichever camera you're looking through. This is usually good enough for a rough idea of what things look like, but it must never be left as your final lighting setup. It vanishes when you add a new light to the scene, but you can get it back as noted above by using "Preview Lights". Remember to switch back to your actual lighting setup before you render.

    Also, note that this light will not illuminate a surface it hits at a very sharp angle — if your camera is looking at a wall or the ground at a sharp angle, it will be very dark if not completely black. This is partly why the pre-render Viewport frequently looks so different, and the main reason why you must not use the headlight in your final render.

Sign In or Register to comment.