How do I export OBJ/FBX with multi/sub-object materials

How do I export OBJ/FBX with multi/sub-object materials

Anonymous
Not applicable
16,972 Views
12 Replies
Message 1 of 13

How do I export OBJ/FBX with multi/sub-object materials

Anonymous
Not applicable

I have models of buildings I've mad that I thought would be handy to condense into just one editable mesh each so if I'm importing them into other software like C4D or Blender, I can just pull in one object and have it be textured and UV'd.

 

But when I do that with OBJ it seems to get stripped of all it's sub-object materials, even if I select 'export materials' and 'create mat-library'. Also it appears to collapse all the elements so you can no longer access them when importing.

 

FBX is slightly more successful, I get one object, separate elements and a texture per ID but... some UVs are messed up. 

 

0 Likes
Accepted solutions (1)
16,973 Views
12 Replies
Replies (12)
Message 2 of 13

10DSpace
Advisor
Advisor

.fbx is definitely superior to .obj for what you want to do. What exactly is getting messed up with the uvs?

0 Likes
Message 3 of 13

Anonymous
Not applicable

Here's an example of bringing it into Blender. It's weird though, I import OBJs that I've downloaded from various web sites all the time and sometimes they're collapsed with multi/sub-objects. Unless you have to NOT collapse them and instead group them, and when you export 3ds collpases those neatly on the way out. But that's a wild guess.

 

Capture_3dsexport.JPG

 

0 Likes
Message 4 of 13

10DSpace
Advisor
Advisor

I don't get these issues with .fbx export/import, but obviously you are getting rotation and scaling of the texture maps assigned to parts of the geometry, which brings to mind the following questions:

 

What does the UV layout look like of the multi-element mesh object before export?

Was there any scaling or rotation  of the texture maps to begin with? 

Are any of the maps re-used (i.e., assigned to more than 1 material ID? 

 

 

0 Likes
Message 5 of 13

Anonymous
Not applicable

Sorry for late reply, got busy.

1. I'm not quite sure how to answer this question (and that might be part of the problem?). All I did was have the various UVS (which were, I believe almost entirely standard box type) per separate object i.e. roof, bottom windows, walls etc. and collapse the stack, then attach until there was only one object.

 

If I import the FBX I just exported BACK into 3ds max, it comes in with a multi sub with all the materials and the UVs are fine. But if I import that FBX into Blender I get rotations on some parts. 

 

But once collapsed, I'm not actually sure how to view those UVs.

 

2. There may have been scaling but certainly no rotation. Actually that whole middle section comprising of the 6 windows and the single side window on red brick was just one object with one box UV.

 

This image demonstrates it well. Left is max, right is C4D. It seems that it's anything on that X axis. Notice how it distorts differently in C4D than Blender and even the brick texture inside the window is wrong.

 

image.png

 

 

0 Likes
Message 6 of 13

10DSpace
Advisor
Advisor
Accepted solution

Hi @Anonymous 

 

OK, so Max can handle without difficulty collapsed meshes who individually have had just a (Max) UVW Map Box type applied through the export/import .fbx cycle, but Blender and C4D don't handle it correctly.   To be honest, I am not sure of all the technical reasons why this is, but in my experience, you will make a relatively "bullet-proof" export .fbx by UV unwrapping with the Unwrap UVW modifier (see explanation below).  This brings me to your question:

 

But once collapsed, I'm not actually sure how to view those UVs.

 

To  view any objects UV's in Max , apply the Unwrap UVW modifier and open the Editor.  This will display your object's UV Maps.  To help you understand what you are looking at, it helps to understand  that when you attach individual meshes that separately have UV's applied,  Max:

 

1. Makes each previously separate mesh an element of the new combined mesh

2. Assigns a unique material ID for each element (assuming you accept the default settings when attaching each mesh.

3. Places the available UV map for that element in the first UV tile (U1V1). 

4. Creates a mult-SubObject material and assigns it to the mesh.

 

So you can see the UV map for each channel in the UVW Unwrap UV editor window (see below)

 

Unwrap UVW Editor.png

 

The problem is that when you use the standard UVW Map set to box it will superimpose all 4 sides of the box so they are sharing the same exact texture pixels, even if their size is different.   You can verify this in your case by clicking on individual polygons in your mesh and seeing them highlighted in the Unwrap UVW editor window.  In the (ridiculous) example house I created above as separate first story, 2nd story and roof, I applied the UVW Map, selecting "Box" as the type for each, then collapsed the mesh. To the collapsed mesh I applied the UVW Unwrap editor.  

 

I am not sure why Blender or C4D do not translate the Max UVW Map Box type correctly after you have collapsed the mesh, or whether it is affected by the .fbx export/import cycle but I have never had a problem with creating separate UVs for each mesh with the Unwrap UVW editor where you flatten the entire UV map giving each side Unique space on the UV tile with no overlapping UVs.    I believe (but am not absolutely certain) that laying out the entire UVW Map of a mesh with no overlapping areas provides an unambiguous representation of UVs that better survives the export/import into other programs.   

 

The Unwrap UVW modifier is more work intially, but for a very simple mesh like this, and using the "Quick Planar Map tool" you can do this in under 5 minutes once you know your way around the Unwrap UVW Modifier.  The other advantage of learning this is that you have much more precise control of any details you want to add to specific areas of any mesh.  And you can create a UV template (Tools>Make UV Template) and bring it into photoshop and go nuts with all of its painting and image tools, tweaking your maps to your satisfaction. 

 

 Sorry that I do not have a quick fix for you on this, but if you learn the Unwrap UVW Modifier, you will have more control and less aggravation in the long run.   Especially if you plan a lot of exporting and exchange with other apps.   Hope this helps.    Maybe someone else here knows a quicker fix for you.

 

Message 7 of 13

Anonymous
Not applicable

Thanks for the comprehensive answer! That makes sense. I guess you're taking one program's native UVs and expecting other programs to just translate it, whereas an unwrap is universal. 

 

I just always always avoid unwrapping where possible as it's never been something I've gotten to grips with. I can just about do a box, or a cylinder (after many years of working in 3d) but once things go outside that, my brain just fries. Luckily these objects are pretty much just boxes, so should be ok.

 

I want the exported models to be as generically compatible as possible, so looks like the unwrapping is the way to go.

 

Cheers for clearing that up!

 

0 Likes
Message 8 of 13

10DSpace
Advisor
Advisor

You are welcome and thanks for responding (I think well less than half of forum posters bother to follow up and let others know the outcome of their original post) 

 

Regarding UVW Unwrapping, I think it could pretty much be used as a sanity test:   Sanity is inversely proportional to love of UVW unwrapping😁 It's right up there with skinning.  But once you focus on it for a while, it gets easier.  If you have a model that can be easily separated into planes like yours, just click on  "Quick Planar Map" for each flat surface.   And when all flat surfaces have been completed, click on " Pack Custom". Done!  Sometimes you have to rotate the UV islands a little to maximize UV Tile space, but that's as easy as in modeling.   Certainly there are other tools to learn about for more complex models (like "Quick Peel", "Pelt Map", "unfold strip from loop" and "Relax"), but there are plenty of good video tutorials on the subject.

 

Anyway good luck.

0 Likes
Message 9 of 13

Anonymous
Not applicable

No worries! yeah if someone's gonna help me I hate to leave them hanging 🙂

 

Ok, so I tried that out on a basic box and it seems good, except if I have indentations on a face where windows are (like, inset, extrude inwards) then that depth information gets ignored with planar mapping.  Any workflow suggestions for dealing with those types of faces in the unwrap scenario?

 

0 Likes
Message 10 of 13

10DSpace
Advisor
Advisor

Select each window separately and its surrounding inset polys. Try both Quick Peel and Quick Planar map to see which gives you the better result.  Neither will be great but we'll fix that.  You should have 5 polys in an island for each window if I guess right about your topology. Now select each window and use Quick Planar Map.  You should get the window separated from the other polys and it should be good.  If it is still not a perfect rectangle, click Relax (Tools>Relax) and that should make it good.   Now for the insets. Select any 2  opposing polys and click detach. Now you have the 4 inset polys detached.  Select them all and try relax on these.  If that doesn't work try Quick Peel  which can sometimes change the scale, but don't worry, because when you do the Custom pack things should be adjusted.   Obviously as an alternative approach you could just do every poly with a separate quick planar map, but it is worth trying to save some time by pulling out groups of polys as above and you'll learn better what works and what does not.  You can also use Flatten Mapping which would flatten all the  window inset polys for you. 

 

So it is an iterative process with the same tools most of the time and you can always undo when you get a bad result.  That should get you going. Hope this helps.

 

 

0 Likes
Message 11 of 13

10DSpace
Advisor
Advisor

Correction to my above post:

 

"Select any 2  opposing polys and click detach."

 

I meant to say "Break" in the UV editor.  Sorry.  

0 Likes
Message 12 of 13

Anonymous
Not applicable

Sorry, dropped the ball again. I'm sure I'll muddle through and find a way. I'll play with these options. But for me the main take home is to unwrap or make the UVs as universal as possible. Still wish that the industry had a decent way to handle UVs, I mean in 3d coat you're going to paint on the object itself so you have an auto UV option and there's a simple UV option in Blender. It really would be a game changer if there was some AI thing that solved it 😛 

But yeah at least I'm mainly doing boxy things!

 

0 Likes
Message 13 of 13

10DSpace
Advisor
Advisor

It really would be a game changer if there was some AI thing that solved it 

 

Apparently Autodesk agrees.  From their future Roadmap  https://area.autodesk.com/blogs/the-3ds-max-blog/3ds-max-20203-and-public-roadmap/ :

 

NEXT
UV Machine Learning: we are prototyping with machine learning to detect seams and automatically unwrap textures for layout. We hope to offer a fully automatic solution that produces UV mappings similar to those produced manually, or at least offer a good starting point to reach end results more rapidly. This would offer great time saving for artists who could rather spend time on creative tasks. Note that we are also considering improvements to the UV editor per se along the way.

 

 

I guess everyone hope this will be soon.  FYI,  Substance Painter also just included automatic UV creation in version 2019.3. Zbrush has had it for a long time.  It would be great (and somewhat overdue) in max. 

0 Likes