Home Technical Talk

Baking from ZBrush .obj vs .fbx

greentooth
Offline / Send Message
floon greentooth
When working in ZBrush I like to work iterative when it comes to baking. Because of this I dislike decimating my mesh as well as long export times.
Therefore I did a little benchmark using the same mesh (4.3 million polys). It took ZBrush 50sec to export the mesh as .fbx, while only 15sec when exported as .obj.
Marmoset on the other hand needed 11sec to load the .fbx, while 6sec for the .obj.
On the flip side the .obj is twice the size in disk space.
I assume this speed/size difference has to do with some sort of compression.

So from a speed perspective .objs seem to be superior, the question remains though, is the quality on par as well? I read that .objs don’t store normal information, but this should not be an issue, if working with undecimated meshes anyway.

Replies

  • Ghogiel
  • floon
    Offline / Send Message
    floon greentooth
    Oh yeah! You are absolutely right @Ghogiel, thanks for clearing that up. I did not make clear enough what I meant.

    The issue seems to be that by default .objs are exported from ZBrush with "unsmoothed" normals. Which results in the first cylinder from the screenshot, when imported into Marmoset (It's a decimated mesh).

    I just saw that there is an option to "export with smooth normals", which when imported looks just like an .fbx exported with "Smoothed Normals Amount 100".



    Does .fbx have any other advantages over .obj that you could think of?
  • FourtyNights
    Offline / Send Message
    FourtyNights polycounter

    I never decimate my meshes, unless it's a character going into Marvelous Designer. To speed up simulation performance.

    But for baking I go with the original high poly model to get best possible baking results. Also, I always use .obj for baking. I haven't encountered shading problems when getting an .OBJ (yes, ZBrush writes it with upper case letters, just mentioning for fun) straight from ZBrush to Marmoset for baking.

    But clearly you'll get shading errors if you decimate your meshes in ZBrush. I know original non-decimated high poly .obj files are sometimes huge in their filesizes when exported, but I've got used to live with that fact. I have plenty of space on my SSDs for my projects, so not a problem. Once I'm done with my project, I move it to an external HDD to save it up. Then most likely delete it from my PC to have more space for next projects.

    What do you mean by "unsmoothed normals"? Like flat shading how meshes are in ZBrush's viewport in general, since ZBrush doesn't support smooth shading? To me that far left mesh looks correctly smoothed as it should get imported to Marmoset. It's just that, it's decimated with horrible random triangulation what ZBrush's "Decimation Master" happens to do. :D

    All of those three meshes are the same decimated meshes, right? But with different export settings? So, I wonder what happens to those two on the right, to be that different from the left one. Are the export settings adjusting some vertex normals to achieve that smooth look? It'd be interesting to see some wireframes for that test cylinder. Because I always rely on averaged default vertex normals with HP models, just not to hassle with anything weird. I may or may not use face weighted normals on low poly meshes, but that's another topic.

    Polycount's wiki has a great image for showing the two main vertex normals: hard and soft (averaged):



    ZBrush's .OBJ files imported to Blender are always flat shaded, but I can easily just smooth them right away with "Shade Smooth" operator. But in Marmoset they seem to get smoothing before importing, which is great for baking, so that I don't need to recycle my HP files through Blender. Even though the imported .OBJs from ZBrush to Blender sounds like "a problem", it isn't. It's representing them in their original form (flat shaded). Just checked from your ArtStation Florian, that you use 3ds Max, so maybe you'll also get flat shaded meshes from ZBrush in there too, not sure how Max handles them during the import though.

    But the ultimate point is, maybe you could just use non-decimated HP meshes for baking (if you don't mind the huge filesizes), to get the cleanest possible results, just like how I do it.

    This is interesting topic and I'm curious to know more, especially since I'm bit lost with your cylinder's different shadings, haha.
  • Neox
    Offline / Send Message
    Neox godlike master sticky
    i always use obj, never use fbx, also never decimate. yes the filesizes are bigger but it is a lot more plannable. As you never know which normal shit the decimation master will introduce. it can create weird undercuts creating small dark spots in the highpoly which of course also bake into the low...
    regarding filesize vs speed. thats also one of the reasons why I prefer TGA over PNG, at least in substance painter it takes a lot longer to export PNG vs TGA
  • thomasp
    Offline / Send Message
    thomasp hero character
    OBJ is a 'dumb' and simple file format, in comparison FBX can store so much more and you might encounter version-related issues when using that. Btw. ZBrush stores polypaint data in OBJ as well - but on the receiving end you'll need an importer that is aware of that non-standard part (Marmoset handles it, importer scripts do exist for e.g. Max and Blender).

    Personally, I try to stay away from FBX for as much as I can.

  • FourtyNights
    Offline / Send Message
    FourtyNights polycounter
    Neox said:
    i always use obj, never use fbx, also never decimate. yes the filesizes are bigger but it is a lot more plannable. As you never know which normal shit the decimation master will introduce. it can create weird undercuts creating small dark spots in the highpoly which of course also bake into the low...
    regarding filesize vs speed. thats also one of the reasons why I prefer TGA over PNG, at least in substance painter it takes a lot longer to export PNG vs TGA
    I couldn't agree more. This is EXACTLY how I work too. No decimation and .obj only for baking. I also prefer .tga for final 8-bit textures, nothing else. Have +, my friend. ;)

    Even few years back, with my weaker PC, I still got a couple of dozen millions (up to 50 million) HPs baked in Marmoset.
  • CheeseOnToast
    Offline / Send Message
    CheeseOnToast greentooth
    I use FBX exporting from Zbrush, purely because it preserves my naming convention for baking by name and assigns a material per subtool. I can export all visible subtools at once. Unless I'm missing something, you can't do this with OBJs. I know you can export all from the option in decimation master, but the resulting obj meshes all end up named "subtool1", "subtool2" etc.
  • floon
    Offline / Send Message
    floon greentooth
    Hey @FourtyNights
    thanks for taking the time to answer my question. I think I need to elaborate a bit further exactly what I plan to do.

    What I currently am doing is researching into possibilities to write a ZBrush->Marmoset pipeline plugin for ZBrush. Unfortunately ZBrush only allows to export .OBJS (like you pointed out :D), to be exported via script.
    The reason being that ZBrush only allows to run one plugin at a time, and other then the .obj exporter, the FBX exporter is a plugin on its own. So it can't work together with other scripts/plugins.
    I usually bake from .fbx files exported from ZBrush. Because of the plugin through, I did some research - exported some of my sculpts as .objs and was amazed how much faster they were done.

    Now just like you I usually don't export decimated meshes, but I asked in an other community and concerns were raised, that "...a 200 million poly mesh needs to be decimated, otherwise Marmoset would crash and when baking from decimated .objs they have bad smoothing".

    This of course would be a no go. So I did some tests on my own and in fact the decimated meshes look bad when exported from ZBrush as .objs with the default export settings (represented by first cylinder in the image above).
    I assumed that this must be an issue with the decimation (which it kind of is :D), but while exporting I also saw the "Preferences>ImportExport>Export smoothed normals"-toggle. When exported with the toggle active (second cylinder), the same decimated cylinder looks good and just like the third one(same mesh but exported as .fbx with "Smoothed Normals Amount" set to 100).

    In conclusion, .obj seems to be a legit alternative (if not a better format) to bake from after all. Especially when hearing that @Neox and @thomasp are using it regularly as well (thanks for your insights guys!).

    Just like @CheeseOnToast pointed out, the only thing that seems to be objectively worse, is the fact that ZBrush can only either export all Subtools merged to one mesh, or all as individual files.
    But this is actually something I could solve via script e.g. export all folders/visible/shared prefix/... to separate obj files.
  • Noors
    Offline / Send Message
    Noors greentooth
    What i do prefer with fbx is that it retains the pivot information while obj set the pivot to origin. In fact it probably just completly ignores it but whatever.
    If for some reason, i have a symmetrical object not aligned in zero, i can still sculpt on it with symmetrical tool in zbrush, then import it back at the right place. With obj, i'd have to center my object first or my symmetry axis gets offsetted.
  • FourtyNights
    Offline / Send Message
    FourtyNights polycounter
    I use .fbx only for the final low poly, which is rendered with materials, textures and even has a rig, if it's a character. In Marmoset, UE4, etc.
  • MisterSande
    Offline / Send Message
    MisterSande polycounter lvl 8
    isn't .fbx the only option if you need to do an exploding bake while keeping all the parts as 1 mesh ?
  • Neox
    Offline / Send Message
    Neox godlike master sticky
    I use FBX exporting from Zbrush, purely because it preserves my naming convention for baking by name and assigns a material per subtool. I can export all visible subtools at once. Unless I'm missing something, you can't do this with OBJs. I know you can export all from the option in decimation master, but the resulting obj meshes all end up named "subtool1", "subtool2" etc.
    subtool master exports all your objs with their given names
  • CheeseOnToast
    Offline / Send Message
    CheeseOnToast greentooth
    Never noticed that before, cheers Neox.

    Edit: Just tested that option. It appends the filename in front, breaking the naming convention. It also makes an obj file for every subtool. Personally, I prefer a single file with multiple sub-objects.
  • floon
    Offline / Send Message
    floon greentooth
    I quickly sketched out, what I imagine an .obj exporter could look like:



    Those of you, how regularly export .objs for baking, are there some settings that should be set before exporting? E.g within Tool>Export?
    I could also imagine an option to add a suffix for individual files?
  • CheeseOnToast
    Offline / Send Message
    CheeseOnToast greentooth
    Turning off the txr, mrg and grp options seems to reduce file size. One of them, txr I think, toggles the export with / without UVs.
  • floon
    Offline / Send Message
    floon greentooth
    I just wrapped up the export plugin :)!
    This is how it works (there are a few more context sensitive buttons):


    I attached a pre-release version below and would love to get some feedback. So if you have a minute to spare extract the .zip into
    ...\Pixologic\ZBrush 2019\ZStartup\ZPlugs64 and give it a try!
Sign In or Register to comment.