Import OBJ with textures?

grinch2901grinch2901 Posts: 1,247
edited October 2016 in The Commons

I export a scene from DAZ Studio to OBJ. I select either "original maps" or "collect maps", same result either way as you will see. OBJ exports. In the location with the OBJ is a MTL and that MTL has correct references to the texture maps.  Import back into DAZ studio, no textures. Doesn't matter if I use original maps or collect maps, no textures. 

So I've been living with this for a long time and manually applying textures one surface at a time. It's tedious and slow. So the question is: why doesn't export/import keep real textures properly? Or am I doing it wrong?  I'd love to hear it's all user error and a one click fix exists.

 

Post edited by grinch2901 on

Comments

  • WendyLuvsCatzWendyLuvsCatz Posts: 40,063

    it bugs me too

    D|S obj exports load with images in many not all other programs, Carrara being one they don't

    yet conversely the Carrara obj exports load with textures in D|S but not back in Carrara either!!!

    I have tried studying the mtl files in notepad and still clueless

    Poser seems to load both OK

  • MistaraMistara Posts: 38,675

    what about to bryce?

  • grinch2901grinch2901 Posts: 1,247

    My goal is to take a complex scene I have with lots of peices and export as one OBJ so I can pull it in and run texture atlas on it. It's an i13 scene and the original has giant maps for every prop, it's killing the memory on my little NVIDIA card. But as it is made of many small parts I need to run texture atlas on each indivudally and thought the maps are each now small there are still a ton of them.  It's just a background prop, I don't need hi-res on anythign and one big texture map is ideal. Texture atlas would do it IF I could get it out into one people AND have the texture maps still be applied.  Alas, it seems I can't have both!

  • WendyLuvsCatzWendyLuvsCatz Posts: 40,063

    Poser if you have it is prob the best option and save as a pp2

  • mjc1016mjc1016 Posts: 15,001

     

    So I've been living with this for a long time and manually applying textures one surface at a time. It's tedious and slow. So the question is: why doesn't export/import keep real textures properly? Or am I doing it wrong?  I'd love to hear it's all user error and a one click fix exists.

     

    It's not user error and there is no one-click fix...

    Part of the problem is the obj/mtl specification itself...it's ancient.  It does not have everything modern materials use/need/expect.  It comes from the days when absolute paths were the norm.  The exporters/importers all loosely follow the standard but are not uniform enough to actually understand the differences between programs...it's like they all speak English, but some speak the American version and others the British...and some speak the Australian version (and so on).

    Always expect to manually set up the textures in the program you are importing to...you'll never be disappointed.

  • grinch2901grinch2901 Posts: 1,247

    Understood, mjc1016.  Of course I'm trying to export from Daz Studio and import back into Daz Studio so I would have hoped that whatever interpretation of the standard they used would be consistent within the same application but it seems not.  Bummer.

  • grinch2901grinch2901 Posts: 1,247
    edited October 2016

    I discovered that my planned solution (exporting so I would have one object with many textures that I could then texture atlas into one (or a few) textures isn't necessary. If items are grouped, you can texture atlas a group and create one texture for all the items in it.  Cool discovery, I was able to significantly cut my textures down by 50% very easily.  There are still some I missed because I thought it would go down by atl east 75% based on the way I split the scene up.  But bottom line, it works and is a real memory saver!

    On the left is before I texture atlased it, on the right is after.

    EDIT : WHOA HOLD ON! I posted without looking at the scene in my excitement. The textures are all messed up.  Tiling issue?  I need to see if there's anything I can do to get clean textures out of this.  Will post update as available

    Scene - Before TextureAtlas.jpg
    709 x 634 - 67K
    Scene - After TextureAtlas.jpg
    716 x 627 - 74K
    Post edited by grinch2901 on
  • mjc1016mjc1016 Posts: 15,001

    In 3DL shaders you have 1 'master' tiling (most of them at least)...including the Daz default shader.

    In Iray you have the master AND tiling on EACH image slot (click the image and bring up Image Editor <not LIE>, Instance Tiling.  So you have two places you need to set/check the tiling for each image...including control maps (normal, etc).

    And if the maps are tiled it's not going to be easy to reduce them to a single map covering several items.  Your best hope woudl be to group things such that those that don't need any tiling can be run through Texture Atlas and then just reduce size of the ones that need to be tiled.

  • In the location with the OBJ is a MTL and that MTL has correct references to the texture maps.

    When it comes to .mtl files, "correct references" is very much dependent on the exact situation. There are several different ways a program can create texture pointers in a .mtl file; many can be "obviously correct" to an actual person reading the file and tracing the texture files, but only one will work with the program you want to import the obj/mtl pair into.

    Note that this also applies to the .mtl file itself — the .obj file contains a pointer to the .mtl file, and there are two or three different ways to set up this pointer. Until I realised why this was happening, I found far too many otherwise excellent .obj meshes can't find the .mtl so they imported with random colours applied to the different surfaces. It's fixable in a text editor, but you must know exactly what you're doing.

  • MattymanxMattymanx Posts: 6,996

    Between all the star trek and starwars and other models I converted, about 150 or more, I could never figure out why one OBJ would load up with textures and the next would not even when no settings change.

     

    If Texture Atlas is not working for you, try adjusting the Texture Compression in Iray on the Advanced tab.

  • I never had much luck with texture atlas due to proceedural tiling etc.

    I suggest batch resizing all the images in your folder with irfanview, give the new folder you save them to a unique name, saving as a support asset uncompressed, open the duf in notepad and find and replace the original folder name prob ironman13 name of prop, you could find and replace the whole path even.

  • mjc1016mjc1016 Posts: 15,001

    , I found far too many otherwise excellent .obj meshes can't find the .mtl so they imported with random colours applied to the different surfaces. It's fixable in a text editor, but you must know exactly what you're doing.

    Actually, that means the mtl was being read and used, but wasn't able to load/find the image files...if it wasn't it should have been a white or grey surface. I think the default, with nothing changed for diffuse in the Daz Shader is 1 1 1, which is what it should fall back to, if there is nothing assigned.

  • McGyverMcGyver Posts: 7,085

    I'm not trying to be obnoxious, but can't you just look at the MTL file and find out where the textures are being misplaced to?

    Back when I used to be a Mac user, when I'd import my models to Poser, I'd usually have to fix the MTLs... I'd just open and correct the seamless tile names that would get messed up... 

    With one version of Blender, exporting an obj would require fixing the actual OBJ file... Which isn't as bad as it sounds, you'd just have to find one or two of the textures, and see where they were... I'd open the OBJ in TextEdit, which has "find all" and "change all to" feature... So you could easily change all the wrong references to a correct one... Being that I recently moved away from Mac (KMA Apple), I've found Windows text editing apps lack some of the features that I was used to, so maybe that's not as easy in windows if they don't have that.

    Either way, good luck.

  • StonemasonStonemason Posts: 1,222

    try exporting the obj to the same folder the textures are in,that works for the obj's I supply

  • Electro-ElvisElectro-Elvis Posts: 928
    edited July 2019

    @Stonemason: Already some time ago since your entry. But I am extremely glad you posted it here. It helped me very much. Thanks a lot for that.

    Post edited by Electro-Elvis on
  • Mattymanx said:

    Between all the star trek and starwars and other models I converted, about 150 or more, I could never figure out why one OBJ would load up with textures and the next would not even when no settings change.

     

    If Texture Atlas is not working for you, try adjusting the Texture Compression in Iray on the Advanced tab.

    I was on this tread because I had the same problem today. What I realized that if there was spaces in the name of the obj, it would not load up properly. If the obj and mtl had no spaces in the file name, it would load up with materials. I don't think you can edit the obj and mtl name once its created, but now I know to export to obj with no spaces in the file name. Hope it helps.

     

  • Mattymanx said:

    Between all the star trek and starwars and other models I converted, about 150 or more, I could never figure out why one OBJ would load up with textures and the next would not even when no settings change.

     

    If Texture Atlas is not working for you, try adjusting the Texture Compression in Iray on the Advanced tab.

    I was on this tread because I had the same problem today. What I realized that if there was spaces in the name of the obj, it would not load up properly. If the obj and mtl had no spaces in the file name, it would load up with materials. I don't think you can edit the obj and mtl name once its created, but now I know to export to obj with no spaces in the file name. Hope it helps.

     

Sign In or Register to comment.