ZBrushCentral

Production issue - import and export of OBJ's

Hello fellow ZBrushers,

I have a problem that’s been bugging me for a while. I thought the new version would have fixed it, and to some extent it does.

You may recall reading a post about Texture Master not working correctly with other 3D applications such as Maya, Max, Lightwave and co.

Then Pixolator did what he does best, and in version 1.55b we received Adaptive UV tiles. He even posted some example .obj and texture files to see if the new version was going to work in these other 3D apps. To our delight they did!!

The problem I have now is this: if I want to take a model from my 3D app (in my case, Maya), import it into ZBrush for texturing, and export it out again, the export process from ZBrush seems to reshuffle the ordering of the polygons.

Even though the object and texture exported from ZBrush looks fine when imported into Maya, if you copy the UV information and texture to the original Maya object, it looks incorrect.

I have taken the time to show you what I mean.

  1. Here is my complex 3D object in the Maya viewport:

  1. I exported the object in 1. above as an OBJ file, then imported it into ZBrush for texturing. Here is my textured .OBJ in ZBrush after I created the texture, applied Adaptive UV tiles and painted with TextureMaster revision G:

  1. I exported the object in 2. above as another OBJ file, then imported it back into Maya. Here is a view in the Maya viewport of my original (un-textured) object, with the imported (textured) model next to it. It all looks fine at first sight:

  1. Maya has a feature which enables you to see the individual point and face numbering used on a polygon. Here, I have switched wireframe view and turned on ‘face numbering’ and ‘point numbering’ for both objects. Now here in-lies the problem: If you look carefully, you will see that the numbering of my points and faces has changed slightly. As an example, look at faces 6 and 8. They are swapped when imported back into Maya. I believe that ZBrush may be swapping the face and point numbering, and hence, the TYPOLOGY of the face. Here’s the screenshot in Maya:

  1. Maya, like most 3D apps, can copy a UV layout from one polygon object to the next as long as the number of faces is the same. Here’s a screenshot of Maya’s UV editor, which show’s my original 3D object which has received the UV layout from the imported model which was UV tile’d in ZBrush:

  1. Now, when I apply my texture to the original object, it should look the same as the model textured in ZBrush, Wrong! Here’s how it looks:

Basically, this is a production pipeline issue. We need to be able to continue working and animating a model in Maya, whilst someone can continue working on the texturing in ZBrush, without the precise topology of the model changing between imports and exports betweek applications.

Anyone got any ideas???

ZBrush is an amazing program and I thank the authors for making it available, but I would love to get this issue resolved.

Best regards,

Zendoftheworld…

could you invert or flip out of zbrush and then import back into maya and still get the same result.

Hi Zendo
Just some suggestions :slight_smile:
(reduce you size of screens 75% for our poor 17 ’ screen :slight_smile:
At the export from Zbrush file “.OBJ” you have an option “Flip face” maybe this help you.
You have some posts on this subject in the
Quick links
section “Import Export”
Have happy exporting
Pilou

Hi,
dr.jjwow,Frenchy pilou: It is indeed ‘flip’ related. Thanks :slight_smile:

Zendoftheworld: Very clear explanation of the problem! :slight_smile:

The problem is likely a result of X-Flipped exported mesh. In 1.55b you need to use the X-Flip Export ZScript.

The next version allows for preferences-controls over import and export X/Y/Z-flip to automatically adjust coordinates for imported and exported 3D objects.

Hope this helps :slight_smile:
-Pixolator

Hi Pixolator,

Thanks for the prompt reply!

I tried the x-Flip Export script you said to try, and it correct the topology of the FACES, but not the VERTICES.

It’s all explained in the below image:

Pixolator - would it be possible to create a script that would invert the needed vertices (noticing that all but two of the vertices are in the wrong position)???

Frenchy Pilou - sorry about the image size. If I reduced it any further, you wouldn’t be able to see the vertex and face numbering which is important when describing this problem. The flip face option simply inverts the normals of a polygon - it doesn’t help with this problem.

He He Zendo
You have a thorny problem :slight_smile:
It’s curious that the topology (the image)is good and the vertex not.
Maybe Pix forget a sign “±” in the code.
Don’t have in Maya a subMenu who permit before the importation some x,y,z manipulations ?
Amapi has this sort of thing .
But maybe if you have now the good “vertex” the topology will be wrong !
Wait and see and wish :slight_smile:
Pilou
Ps May be a tricky solution :slight_smile:
Inverse your object in Maya Before the first Exportation :slight_smile:
Pss From your last diagram it’s seems that is the first vertex who is the knot of the problem !
Psss Are you sure of your original model (not double point or other broken lines)

Zendo, if you have maya…as i do…do this:

Make the Uvs in maya in the o-1 space…then export .obj as usual. Go into Zbrush as usual and texture the object. When you export…only export the texture…its less clicking around and probably more efficient. The AutoUV tiles looks nice…but if you ever have to go into photoshop to hand paint something…its just not possible. If your Uvs are layed out in a way that makes visual sense, you can go in and paint the object. Thats my approach anyways because i have to be flexible enough to go between several apps for my job…and for somethings maya is faster…and for others pshop is faster…but zbrush is really fast and smooth(but crashes a lot!!) for painting models

Zendoftheworld: Here is a test ZScript which contains several export variations…

Click here to download the export-test ZScript

Import your mesh into ZBrush and then export the mesh by pressing each of the export buttons (rename the files accordingly). Import these objects into Maya and check the faces/vertices order. If you get a proper export, let me know which of these options has worked properly. If not, we’ll try another test :slight_smile:

I recommend that you make a test object that is not symmetrical to ease in testing.

2bytes: Are you using the latest version of TextureMaster? If you are using the latest version and still experience difficulties, please email your system specs and as much information as possible to [email protected] for further examination.

-Pixolator

He He Zendo
You are out of danger :slight_smile:
Pix take the problem by the horn :smiley:
Good luck !
Pilou

Hi Pixolator,

First - thank you so much for assisting with this issue. It is very much appreciated.

It will be of benefit to many and hopefully any improvements can make it into the future versions.

I am currently testing your script with symmetrical and asymmetrical objects.

I’ll be as thorough as I can and hopefully we can get this right.

I will let you know the result within shortly (may be tomorrow as it’s getting late here - I live in Australia and it’s 11:30pm at the moment).

Thanks again.

Cheers,
Zendoftheworld…

Dear Pixolator,

Well, here’s the result of my first test:

Basically, ‘method 1’ (the first button in your script" and ‘method 5’ (the last button in your script) were the ones that worked.

Well, sort of.

Let me explain:

Method 1 - this perfectly matches the typology and the original OBJ file, but, the textures seems to be on the wrong side as if it was flipped in X.

Method 5 - this doesn’t match the typology of the original OBJ file, but the texture does appear as it was painted in ZBrush.

For example, here’s both sides of my model in ZBrush being painted:

And here is what happens when these models are exported from ZBrush using your new scripts (method 1 and 5) and the UV co-ordinates and texture are applied to the original Maya object:

Therefore, the perfect export routine would:

a. keep the UV topology like ‘method 1’ AND
b. keep the texture on the correct side like ‘method 5’.

Can it actually be done, Sir General Master Monsignor Pixolator?? (please).

Cheers,
Zendoftheworld…

Hi Zendo
New suggestion :slight_smile:
For helping Pix Maybe you can in Maya try twice a function “Flip” for a sort of unify vertices and facets .
Pilou

At this point, the answer should lie with the Flip/Mirror deformations and the Texture flip buttons (maybe in conjunction with a Rotate). Unfortunately, I do not use Maya , so I have no way to test directly, or what functions Maya has for these kinds of manipulations.

Also, have you considered the possibility of writing a MEL script to take things the rest of the way? That is of course dependant on what Maya’s functions allow.

Hi :slight_smile:
Zendoftheworld: Not all 3D applications are using the same coordinates system. ZBrush coordinates system is designed to fit with the orientation of the canvas (which is facing the viewer) instead of the more common ‘floor’ based 3D system.You may be able to adjust for these differences in ZBrush (or in the other application that you are using) by following these steps…

  1. Create a test mesh in the other application, then assign UV coords and create a texture with easily identified markings (such as the one you did with ‘left’ and ‘right’ markings).

  2. Import the mesh and texture into ZBrush. Draw the object in canvas, enter edit mode and rotate the object to its natural orientation.

  3. If the object does not look as it did in the other application, try using a combination of the following controls to ‘realign’ the object…
    Tool :small_orange_diamond:modifiers :small_orange_diamond:Flip, Tool :small_orange_diamond:modifiers :small_orange_diamond:deformation :small_orange_diamond:Mirror,Tool :small_orange_diamond:modifiers :small_orange_diamond:deformation :small_orange_diamond:Rotate (90 or 180 degrees on any of the axis) and Texture Flips.

If you are able to produce a sequence of transformation to achieve the desired result then it will be easy to write a ZScript which will execute these steps automatically upon import.
4. If you are unable to find a satisfactory transformation, try applying a transformation in the other application, prior to importing it into ZBrush.

If you are still not able to find a solution, please email aurick a sample OBJ file and a texture with images of the object in the other application, for further examination. (In any case, it will be easy to resolve this in the next Z version :slight_smile: )

-Pixolator

Hi Pixolator,

The “Export 1” button/routine in the new script you wrote works perfectly.

It keeps the typology of my original object 100%. The only thing is that it flips my object in X, which is easily handled in Maya by scaling it in X by -1.

Is it possible to create a new script with only the “Export 1” button in it??

I know very little about creating ZScripts…so I am going to have to investigate further…

Thanks for helping resolve this issue. I’ll write a tutorial for all your ZBrush users who utilize Maya in their production pipeline.

I would dearly like to see something like this in the next version.

Thanks again Pixolator.

Regards,
Zendoftheworld…

Hi :slight_smile:

Zendoftheworld: You may click here to download the Export1 ZScript.
I have written two more export-ZScripts, one (or both) may be able to fully resolve the problem (including the X-Flip)…

First, click here and try this ZScript, if it is not working properly then click here to try the other ZScript.

Hope this helps :slight_smile:
-Pixolator

Hi Zendo
You are coddled :slight_smile:
Pilou

Thank you Pixolator!

Frenchy - the man is great for many reasons, not least his generosity and committment to his customers.

Many others should take a leaf (or forest) out of his book.

Pixolator - thank you. I will post results shortly.

Best regards,
Zendoftheworld…

Hi Zendo
“his book” ? The manual or a “real book” ?
I think that everybody will be interested to know !
Pilou

Hi Pixolator,

The first script worked well. The second seems to mess with the texturing a little.

Thanks so much for making these! How else can I show my appreciation!!!

Hey Frenchy - all I mean about taking a leaf out of Pixolator’s book is that others should follow his fine examples.

Cheers and regards,
Zendoftheworld…