Home Technical Talk

Why .fbx and .obj meshes are quite different?? (-_-) + bonus problem :)

Hi everyone!

I have began modelling this summer and now baking time has come (Accompanied with a bunch of doubds)
I'm stucked with this two problems rigth now, hope you guys can help me :D

Context:
· Next weird axe is low poly modelled in 3DS Max (Also UV mapped there).
· Sent to ZBrush to work in the high poly.
· Now I wanted to baked it in Substance Painter in order to texture it afterwards.

Problem 1:
I was exporting the low poly axe as a .obj, with an absolutly awful result on Painter.
After spending time thinking why this was happening I tried to just export it in .fbx.
This improved quite much the appearing of the mesh, as can see in the image below.



Now my question is.. why is this happening? I though both formats should get the same mesh. (I didn't actually modify any export parameters).


Problem 2:
After this I decided to carry on with my .fbx model.
Going to bake and this is what I found:



A lot of very sharp borders has suddenly appear. I think they may be because of the borders in the low poly (yellow arrow in image 1). High poly is smother in that areas so they may overlap the high poly...

Isn't there any way to fix it at baking time??

Since the high poly is made in ZBrush I only can export it in .obj ( or at least not in .fbx... ) Could that cause any problem working with the fbx low poly??

Thanks in advance!!

Replies

  • poopipe
    Offline / Send Message
    poopipe grand marshal polycounter
    the problem is Zbrush, not the file formats 

    import and prepare your low poly in a proper modelling package according to the various threads on here / youtube totorials etc.  about baking and you'll be fine
  • cryrid
    Offline / Send Message
    cryrid interpolator
    Since the high poly is made in ZBrush I only can export it in .obj ( or at least not in .fbx... ) Could that cause any problem working with the fbx low poly??

    Zbrush can export FBX files, but in this instance it doesn't matter. There's no real difference in a bake if one model is an obj and the other an fbx. It just looks like that obj has been exported without any smoothing groups / user normals. If that lowpoly was exported by Max, check around the exporter to see if it has this option (it's probably on by default in fbx but not in the obj). If it is exported through zbrush, then open it in Max and rebuild the smoothing groups (zbrush ignores them) then re-export for your bake. 

    As for the lines, do they line up with your UV shell borders, and if so did you add any edge padding to your bakes? 
  • Hayden_Price
    Offline / Send Message
    Hayden_Price polycounter lvl 5
    Okay, so for starters, by the looks of it your .fbx export contains smoothing groups while your .obj does not. This might be a result in Max where you have set up smoothing groups, or in your export settings where the .fbx export might be auto-smoothing the mesh based on angles/UV islands, or the .obj not exporting the smoothing groups at all.

    As for your baking problems and harsh seams, in nearly all circumstances, you need to ensure that each of your UV islands has enough edge padding in your UV map, and each of those islands are their own individual smoothing group. It's also recommended to bake using a cage if you haven't made one, or use a program like Marmoset to bake where you can visualize your cage/projection.
  • rollin
    Offline / Send Message
    rollin polycounter
    You should learn the basics imo. You have to be able to distinguish smoothing groups from file format specifics. 
    The obj did give you the truth. That's what your shading looks like. And if you prefere to bake with smoothing groups you have to understand what that means. 
    The wiki is your friend
  • Eric Chadwick
  • robertomdam
    First of all, thank you guys for taking your time to reply .

    I have been playing around with exported parameters, but it looks like checking on and off the smoothing groups option is not doing quite much:




    In fact, I even tried the next: I cleared smoothing groups completely and exported in fbx. Took it to Painter and result is different than the .obj mesh in the images which are more rounded and smooth:



    cryrid said:

    As for the lines, do they line up with your UV shell borders, and if so did you add any edge padding to your bakes? 

    As for the UVs, this is the axe mapping:



    Should I give it more padding?

    It's also recommended to bake using a cage if you haven't made one, or use a program like Marmoset to bake where you can visualize your cage/projection.
    I have baked some models in 3DS Max before, using the cage of the proyection modifier. But, since high poly is made in ZBrush and it has too much polygons I thought it would be easier to bake in Painter. But I will take a look on Marmoset baking process.

    rollin said:
    You should learn the basics imo. You have to be able to distinguish smoothing groups from file format specifics. 
    The obj did give you the truth. That's what your shading looks like. And if you prefere to bake with smoothing groups you have to understand what that means. 
    The wiki is your friend
    Yeah, i will also have a look there.

    Perfect  =)


    Thanks!
  • rollin
    Offline / Send Message
    rollin polycounter
    The screens you show are from substance painter?

    If so try to re-import the files into max and check there how the smoothing groups are set up.

    I'm not sure what's happening but I guess it's an import or export issue in max or substance or a combination of both.
    It should work as you except
    But note that you can export with smoothing groups but the importer is ignoring them (just as an example)
  • robertomdam
    Yeah, those pictures are from Substance.

    Ok, here is what i tried now:

    * 3ds Max: Imported .fbx and everything  was fine.
    * 3ds Max: Imported .obj (With smoothing groups) and:



    · If "Import from file": mesh was exact ugly as in Painter.
    · If "From SM group": mesh is good like in .fbx.


    So I though that maybe Substance just ignores smoothing groups in .obj files...
    But then I realized to try in other software:

    * Blender: Imported .fbx and everying was fine.
    * Blender: Imported .obj and, like Substance, mesh is weirdly smoothed (I even checked on the option for getting smoothing groups in Blender importer)

    And for the last:
    * Blender: Took the .fbx and exported as an .obj with smoothing groups option unchecked:



    And now this .obj I exported from Blender is shown perfectly fine in Substance Painter...
  • Bojito
    You basically can't go wrong if you bake your maps in Marmoset. Best way to go in my opinion!
  • rollin
    Offline / Send Message
    rollin polycounter
    Good idea using other software to check. I use this also to find strange issues I have with files on import.

    But really: there is nothing like "ugly" shaded. It is exactly shaded as the mesh forces the shading to look like. If you want people to understand you you should say something like: "has smoothing groups applied" or "has no smoothing groups applied".

    There are some cases where the normals of a mesh are altered in a way that they don't reflect the actual geometry they are usually retrieved from. This can be tricky to spot.
    But in your case the blade is simply not correctly flat at the junction with this horn-spike-thing. 
  • robertomdam
    Bojito said:
    You basically can't go wrong if you bake your maps in Marmoset. Best way to go in my opinion!
    Have finally been spending some time on this and yeah, I think is a little bit nicer and more visual than Painter.

    rollin said:
    Good idea using other software to check. I use this also to find strange issues I have with files on import.

    But really: there is nothing like "ugly" shaded. It is exactly shaded as the mesh forces the shading to look like. If you want people to understand you you should say something like: "has smoothing groups applied" or "has no smoothing groups applied".

    There are some cases where the normals of a mesh are altered in a way that they don't reflect the actual geometry they are usually retrieved from. This can be tricky to spot.
    But in your case the blade is simply not correctly flat at the junction with this horn-spike-thing. 
    I think I'm not understanding something on this..



    1 is axe with smoothing groups.
    2 is axe without smoothing groups.
    so.. if 3 has no smoothing groups, shouldn't it be showing exactly as 2?
  • rollin
    Offline / Send Message
    rollin polycounter
    It is not that simple. You have still an importer and exporter in between.

    And smoothing groups is not a standardized term. The end result is usually just edited normals. Max is using smoothing groups, other package use 'hard edges'.

    What max does is when you don't assign a smoothing group it doesn't smooth at all. This is the equivalent to give each poly it's own smoothing group. If you assign one smoothing group to the entire mesh its in fact the default smoothed result you would see in other apps. 

    Max's smoothing groups are handy but they make it for newcomers difficult to understand the underlying principles.

    Just add an Edit Normals modifier and you can see it yourself:


  • robertomdam
    Cool, thanks so much for the answers!
  • robertomdam
  • robertomdam
  • Ghogiel
    Offline / Send Message
    Ghogiel greentooth
    I quickly scanned over that, I can't see what the smoothing groups you have specifically set up on purpose actually are. Only time that is apparent you have intentionally set up the smoothing on the mesh is when you removed the smoothing and have a completely faceted model.

    Unless you want a completely smooth shaded model to bake to, which is the only option you presented so far that would bake correctly with the UV you made, what does the face smoothing you set up on your mesh look like? I can tell you the FBX/auto smoothing by angle you have shown is going to break at every hard edge that also isn't split in the UV, and just glancing at the UV I can seen several spots that are going to fuck up at those hard edges due to projection errors during the bake. Marmoset won't help you unless you understand face smoothing/normals/hard soft edges and UVs, so read the wiki links posted above above, (basically normal maps use the mesh normals to know what color pixel to write to the map and to use mesh normals in the  transform to figure out which direction it's going to bend light off the meshes surface, they work in tandem in creation and usage)

    Anyway, to fix your problem with smoothing, get TexTools or grab a script that will do a UV islands to smoothing groups. run that function. Then call it a day for your smoothing set up. Move on to export with either FBX or obj, they will both work in this case, (I would triangulate personally, tho FBX should carry hidden edges, and hopefully whatever app you import into reads and uses those. anyway it just shuts down topology issues breaking your bake at that stage of things) Then try the bake again.


    edit oh: and this is only for the low poly. (the high poly you will (usually almost always) want to be smooth shaded, and directly exported from ZB as an OBJ will give you that.

  • robertomdam
    Ghogiel said:
    I quickly scanned over that, I can't see what the smoothing groups you have specifically set up on purpose actually are. Only time that is apparent you have intentionally set up the smoothing on the mesh is when you removed the smoothing and have a completely faceted model.

    Unless you want a completely smooth shaded model to bake to, which is the only option you presented so far that would bake correctly with the UV you made, what does the face smoothing you set up on your mesh look like? I can tell you the FBX/auto smoothing by angle you have shown is going to break at every hard edge that also isn't split in the UV, and just glancing at the UV I can seen several spots that are going to fuck up at those hard edges due to projection errors during the bake. Marmoset won't help you unless you understand face smoothing/normals/hard soft edges and UVs, so read the wiki links posted above above, (basically normal maps use the mesh normals to know what color pixel to write to the map and to use mesh normals in the  transform to figure out which direction it's going to bend light off the meshes surface, they work in tandem in creation and usage)

    Anyway, to fix your problem with smoothing, get TexTools or grab a script that will do a UV islands to smoothing groups. run that function. Then call it a day for your smoothing set up. Move on to export with either FBX or obj, they will both work in this case, (I would triangulate personally, tho FBX should carry hidden edges, and hopefully whatever app you import into reads and uses those. anyway it just shuts down topology issues breaking your bake at that stage of things) Then try the bake again.


    edit oh: and this is only for the low poly. (the high poly you will (usually almost always) want to be smooth shaded, and directly exported from ZB as an OBJ will give you that.


    Yeah, I have started reading about baking in the wiki, watching some tutorials and doing some small test projects to see how it works in an easier mesh.

    Didn't take much attention on baking and UVs until I wanted to texturing so It's time to spend some time with that before.

    Thansk for the reply.
  • Mark Dygert
    So... the obj export/importer in max hasn't been updated in years and the last time they did, they grabbed a popular plug-in (http://www.guruware.at/main/index.html) that people where using because their own obj im/exporter had fallen so far behind that it was causing these same kinds of issues. Autodesk just incorporated it and didn't do jack after that.

    Most of the software that obj talks to, has changed but the im-exporter hasn't, that is bad... The presets in the 3dsmax obj exporter don't reflect anything relevant and it is not reliable at all, you shouldn't use it if there is any other format available.

    The sad part is that it's one of the only file formats to shuttle files in and out of zBrush. Pixelogic hasn't done any work to their obj im/exporter either so it's just as bad and relies on other apps to rebuild normals and smoothing. 

    Speaking of rebuilding, a lot of what you might be running into is with particular programs rebuilding normals and smoothing info on import. Especially substance, it probably takes one look at an obj and deems it trash and rebuilds it. At that point you can flip whatever export settings you like if the importer is rebuilding it, then it doesn't matter.

    TLDR: OBJ is outdated and unreliable. Only use it as a last resort and even then you'll probably want to rebuild the normals/smoothing before you bake and re-export it to whatever engine you're working in. 
  • robertomdam
    So... the obj export/importer in max hasn't been updated in years and the last time they did, they grabbed a popular plug-in (http://www.guruware.at/main/index.html) that people where using because their own obj im/exporter had fallen so far behind that it was causing these same kinds of issues. Autodesk just incorporated it and didn't do jack after that.

    Most of the software that obj talks to, has changed but the im-exporter hasn't, that is bad... The presets in the 3dsmax obj exporter don't reflect anything relevant and it is not reliable at all, you shouldn't use it if there is any other format available.

    The sad part is that it's one of the only file formats to shuttle files in and out of zBrush. Pixelogic hasn't done any work to their obj im/exporter either so it's just as bad and relies on other apps to rebuild normals and smoothing. 

    Speaking of rebuilding, a lot of what you might be running into is with particular programs rebuilding normals and smoothing info on import. Especially substance, it probably takes one look at an obj and deems it trash and rebuilds it. At that point you can flip whatever export settings you like if the importer is rebuilding it, then it doesn't matter.

    TLDR: OBJ is outdated and unreliable. Only use it as a last resort and even then you'll probably want to rebuild the normals/smoothing before you bake and re-export it to whatever engine you're working in. 
    I had thought .obj was a better decision, just because it seems all programs support that format. But now, i think all the software I'm learning to use do support .fbx, apart from ZBrush, but I heard this one last has a plugin for this.
  • rollin
    Offline / Send Message
    rollin polycounter
    I have to admit I like obj bc it's more wysiwyg. In fbx with all the intern data there are more ways to fail - esp. on such a basic level as scale or axis orientation. The more the importer can decide what to do the more complicate it gets (happy scaling)
Sign In or Register to comment.