ZBrushCentral

Zbrush3 to Maya 16bit Displacement map workaround

This method will give similar results as “multi displacement 2”, when rendered in maya with mental ray. I developed this method while in the middle of a production and it worked on several charcter elements (models) perfectly.

Warning! If you try this method on the models which come with Z3 (Demo head etc…) without first preparing it in maya it won’t work. So follow the steps below.

So far I have found this method will work with any basemesh that comes from maya or created in Z3, provided that it has been properly prepared in maya prior to generating displacement.

*Note: You will need convertfile.bat, which automatically converts tif/targa/image files to .map files for mental ray, which can be found here:
[http://www.datafilehost.com/download.php?file=3ec7a97e](http://www.datafilehost.com/download.php?file=3ec7a97e)

**Model must have UVs assigned to it and normals must be set to face so that they are perpendicular to the surface pointing outward,
   this process must be done in maya prior to creating displacement map in Z3. 
   
*** If the model poly count isn't too high export the hi-rez from Z3 to prepare in maya, then re-import and reconstruct the subdiv levels. 
     Otherwise export the lo-rez obj, prepare in maya, re-import into Z3 and transfer the hi-rez details from the original model to the new model, using whichever technique suits the model (these techniques are covered in great detail on the pixologic site).

1. Prepare lowpoly model in maya, position model Yaxis up and Zaxis forward, assign UVs, freeze transformations,set normals to face, delete history and export.

2. Create displacement in zbrush3 and take note of the "Alpha Depth Factor"

3. Export the displacement Alpha and convert to .map file using "convertfile"
    (drag and drop the displacement map file onto the convertfile and it will automatically place the .map file in the same folder)    
   
4. In Maya set up displacement shader and mentalray approximation for Lowpoly model

5. Take the "Alpha Depth factor" number and divde by 10, then divide it by 3, then multiply by 2 this will give you the Alpha Gain
    Take this number and divide it by -2 to give you the Alpha Offset (half and in negative)

    e.g   Alhpa Depth Factor = 4.455
         4.455  / 10   =  0.4455
                0.4455 /   3   =  0.1485 
                0.1485 *   2   =  0.297 
        
        0.297 /  2  =  0.1485
    
    Alpha Gain =  0.297
    Alpha Offset =  -0.1485
    
    Note:    Make sure to turn on Alpha Is Luminance.
    
6. Alpha Gain acts as a multiplier for the displacement height. If the model needs to be scaled you can enter the scale factor to adjust the maps accordingly.
    Multiply the Alpha Gain and Alpha Offset by the scale factor of the model.

     for example, lets say the model is scaled by 13.745%
     take the Alpha Gain and Alpha Offset and multiply it by the scale percentage
    
     0.297  *   13.745     = 4.082
    -0.1485  * 13.745  4   = -2.041

    The new values are as follows    
    Alpha Gain =  4.082
    Alpha Offset =  -2.041


Zbrush3 settings for exporting lowest subdiv model 

Preferences palette>Importexport
Turn off iFlipY and eFlipY
(do this step if the model is flipped in the Y axis when imported into maya)

Tool palette>Export
Make sure only Obj, Qud, Txr, and Mrg are on
(by default Grp is on instead of Mrg, switch them)

Zbrush3 settings for Displacement 

Tool palette>Displacement
DPRes = (what you like,keep in mind a multiple of two will work best)
Turn on Adaptive, leave smoothUV off
Turn on Mode and then hit Create DispMap

Alpha palette
Select the alpha which is the displacement just created
Flip it in V, and export as filename.tiff

Maya settings for mental ray

In the Attribute Editor under File Attributes for the file texture node set Filter Type to Mipmap

Turn off Feature Displacement in the lowpoly models' shape node

Under the mentalraySubdivApprox node in the attribute editor select Spatial for the Approx Method,
set the Min Subdivions to 3 and the Max Subdivisions to 5 

Set Length to 0.010 (a length of 0.10 will work as well)

Render!

I hope this is clear enough for all Z3 users to follow. I will eventually post a step by step tut with images, until then I will try to answer any questions that may arise. :+1:

Hello, Can U show us some final renders of Yours with this method ??

Thanks DeusEx !
Sound very good that you say.
Nice job!

Ok I will post renders, using the same settings in maya but displacements from Z2 multi displacement and Z3 for comparision.

that would be great :slight_smile:

Here are the renders

Attachments

Z3_Lorez_MDL.jpg

The model after it was taken into Z2, had its subdiv level reconstructed, then rendered in maya with Alpha Gain = 2.2 and Alpha Offset = -1.1

A few things occured to me while doing the renders;

-The model from Z2 would not retain the exactly the same detail as in Z3.

-Multidisplacement exports RGB.tif and the default displacement from Z3 is indexed (which I could of changed in photoshop but I chose not to because the models I used originally had indexed maps)

-I am using the Demohead which I took into maya at its lowest level, gave it automatic UVs, postioned it, then exported to Z3 and subdivided it up to 6subdiv levels and applied a few simply stamps to.

When I get around to making a tut I will use one of my models. I posted the method because it worked for me and was a more organic (non linear) approach to using Z3 in a production environment.
I hope this helps you in acheving similar results.
:smiley:

Attachments

Z2toMaya_RND.jpg

I can’t import into Maya .tif file after dragging and dropping onto convertfile.bat. What da dilly yo?

I’ve tried exporting the displacement map as Tif, PSD, BMP now and none of which has any effect on the filebatconverter. when it comes to creating a .map file.

For what it’s worth, I just set my object from sub lvl 4 to 1, hit Cage, went into displacement settings, set the resolution to 2048*, put on adaptive, left intensity at zero and Mid Mode to 50.

Did i forget anything? =)

“I’ve tried exporting the displacement map as Tif, PSD, BMP now and none of which has any effect on the filebatconverter. when it comes to creating a .map file.”

I use the .tif format Z3 exports (I also flip in V). The filebatconverter should be on your desktop (as an icon), open a window then go to where your displacement.tif file is and drag’n’drop, if everything is working automatically a displacement.map file will appear below your original file in the same location.

If this isn’t the case try re-instaling the filebatconverter, or simply go to the webpage and ask its creator. So far its worked for me straight off the bat (pun intended)
If you like you can always convert the .tif file the old way through a dos prompt. (before you ask I’m not going to post that method)

“I can’t import into Maya .tif file after dragging and dropping onto convertfile.bat. What da dilly yo?”

In (maya) the settings for the displacement file change the type to Mipmap, that is if you are using the converted .map file.
Personally as a rule of thumb I prefer using .tga (targa) in maya when I’m using mental ray instead of .tif because I find them faster and of a high quality (whether mental ray in maya prefers them over tifs’ is debatable), but when exporting from Z3 I always use .tif and convert to .map files along with mental ray approximation (settings as above, I never use featured displacement in maya).
Sometimes I come across a scene where the approximation doesn’t want to take, maybe to do with animation blend shapes or a dodgy scene or there being a fullmoon. For those problems I just dig through the scene until I solve it or import all references or make a new scene.

The settings I gave above in all of my tests in maya have worked on characters (with animation) and static objects.

If you want to send me the Z3 hi rez obj I will take a look at it and try to get it workn’ in maya.

Cheers

Thanks to Aceala, I finally got the converting from .tif to .map working.

Im just wondering why the drag’n drop onto the fileconverter, only works for some people, where others have to go through this hack.

Anyway follow this linked thread, and go to the buttom of the page, download the zip then follow the instructions from there.

http://www.zbrushcentral.com/zbc/showthread.php?t=41980&highlight=convertfile.bat

DeuEx, thank you very much for replying, and also for posting this tutorial, it has been very helpfull.

DeusEx

So, I have a couple of quick questions.

First: I have been watching several Gnomon videos on the subject of exporting out Displacement maps and Bump maps. According to these DVD once you have exported out your Displacement and Bump maps you should bring them into Photoshop and convert these files from Grayscale Mode to a RGB Color Mode. Is this not the case now with Zbrush 3? Or is the file Mode converted to RGB when using the “Convertible File” plugin? Or doing this manually, using the DOS function?

Second: Also in the Gnomon videos they suggest also adding a Displacement Tesselation with the Mental Ray Approximation Editor? Is this not the case in the tutorial that you outlined?

I wanted to thank you in advanced for your tutorial. I have been pulling out my hair for the past few weeks trying to get my Maps to render out correctly. I have tried day after day and have been having little success getting my maps to render out correctly. My model will either render out completely but will not all of my details, or they will render out and parts of my mesh will be extremely bloated or sunken in. I have not yet tried your method but I am about to give it a shot!

Thanks again.

CC909

cc909

“According to these DVD once you have exported out your Displacement and Bump maps you should bring them into Photoshop and convert these files from Grayscale Mode to a RGB Color Mode. Is this not the case now with Zbrush 3? Or is the file Mode converted to RGB when using the “Convertible File” plugin? Or doing this manually, using the DOS function?”

Converting your maps to RGB is done in order to use three channels (RGB) for 32bit displacements, where as grayscale will only use the red channel. As far as I know Z3 will only export 16bit displacement maps (hopefully that will change once the disp exporter for Z3 is released).
You can however convert the Z3 disp map in photoshop but you must adjust your settings in photoshop otherwise the default photoshop settings will shift the values of your map resulting in “bloating” when you render.
I’ve read you can get more accurate results converting your map in “HDRIshop” (program) but a .map file will read faster in mental ray and I find is more accurate as you have more control over the tesselation.
If you need higher frequency (or as some people say lower frequency, think sound waves) detail use a normal map in conjunction with your displacement.
There is a tutorial on how to create a normal map in Z3 on ZC.

“Also in the Gnomon videos they suggest also adding a Displacement Tesselation with the Mental Ray Approximation Editor? Is this not the case in the tutorial that you outlined?”

Maya settings for mental ray

In the Attribute Editor under File Attributes for the file texture node set Filter Type to Mipmap Turn off Feature Displacement in the lowpoly models' shape node Under the mentalraySubdivApprox node in the attribute editor select Spatial for the Approx Method, set the Min Subdivions to 3 and the Max Subdivisions to 5

(setting Min Subdivions to 4 and Max Subdivisions to 6 also works fine)
Set Length to 0.010 (a length of 0.10 will work as well)
The length setting determines the length of each edge (tessilation) at render time, therefore smaller numbers result in shorter edges and higher poly counts and longer render times.

Tip: in Z3 before you import or export your lowpoly model remember to disable the iFlipY and eFlipY settings underpreferences>import/export.
Also make sure the UVs are done properly (not automatic) and that the models normals are perpendicular to the surface.
I do this in maya.

Ok hope that helps
Cheers

DeusEx,

Thanks for the quick response time. However, I am still wondering. So, yes you need to convert your files over to RGB. Can you tell me how to properly adjust the files so my displacements will not cause any bloating upon my rendering? So, how do you go about this conversion? Do you yourself use Photoshop or HDRI software? So, also you did not mention, If in fact I need to use both Types of Mentalray Subdiv Approx node. Displacement Tesselation and Subdivisions. Or is it only necessary to just use the Subdivision Attribute? Up until now I have been applying both. Is this not the right thing to do? I really appreciate your help and expertise in this matter.

Sincerely,

CC909

Convert a file only works well on RGB documents.
Follow these steps

  1. goto your color setting inside photoshop and put a check mark in the following boxes
    [step-1.jpg](javascript:zb_insimg(‘64768’,‘step-1.jpg’,1,0))
    2.open the document and choose leave color alone
  2. goto Image/Mode/RGB
  3. save as a tif

When you drag it on the convertfile.bat It will now convert correctly.

It worked good in Z2 because the Disp Exporter Plugin exports RGB Not Grayscale;)

Cannedumushrooms:

Thank you very much for the information you provide. I am wondering will this also work well on Displacement maps that are being exported out from Zbrush 3? Is there a plugin for Z3. The same plugin that you mentioned for Z2?

Thanks again.

CC909

Yes the displacement menu under the tool menu will produce the alpha then you save it and do the photoshop trick to it. Then save and drag onto convertfile.bat.
This will work with both Z2 and Z3

Now the Disp Exporter Plugin
Located here
http://www.pixologic.com/zbrush/downloadcenter/#disex
only works with Z2. And it handles 16 and 32 bit disp maps. The only difference is you do not need photoshop in order to convert them to RGB. You can simply click and drag it on convertfile.bat and away you go.
There is a small hack to get it to work with Z3 somwhere on the forum. Please note that it does not work too good.!

Z3 will have the plugin somwhere in the turn of the next century Give or take a few lunar cycles. Until then hope the 16 bit maps will get you by;)

Of course you could always follow this video and use Z2 to make the alpha
http://www.houseoftutorials.net/z3/z3toz2.wmv

If you dont have Z2
Everyone that does not have Z2 and bought Z3, I would be so on the phone saying “I want Z2 I bought Z3” ASAP!!!
Its much better for making all your maps and its easy to convert stuff from Z3

Here is a WIP model I have applied my workaround to using the same settings in Maya (mental ray) but changing the .map file from Grayscale 16bit (straight from Z3) and then converting to .map, and using the photoshop adjusted RGB then convert to .map technique.

The aim was to trial my method using the RGB photoshop trick.
The settings I used in photoshop were as “cannedmushrooms” provided but the results are a severe bloating in the render, where as the grayscale worked fine.

In the spirit of sportsmanship I will venture that my method does work with the RGB converted disp.map files.

However I will add using an RGB file for displacement in maya ( without the equivilant Dispexporter plugin for Z3 which Z2 had) has never in my opinion given satisfactory/accurate results and leads to a painful experience.

I answer to your question;
“So, also you did not mention, If in fact I need to use both Types of Mentalray Subdiv Approx node. Displacement Tesselation and Subdivisions. Or is it only necessary to just use the Subdivision Attribute? Up until now I have been applying both. Is this not the right thing to do?”

You only need to use the Subdiv Approx node, which is what I use.
If you really want to use both you can, which may result in a higher quality displacement (render) but would be overkill considering for such fine detail a normal map would be fine and save you time and optimise CPU performance.

The first image is the Z3 high rez model

The second is a maya render using my method

The third is a maya render using my method but substituting the grayscale for the RGB

Note: The artifacts around the shoulders are due to the sculpt in Z3 (transpose tool) not related to maya, after all its a WIP.

Hope this helps and fuels more debate
Cheers

Attachments

Z3_HighRezMDL.jpg

MR_DISP_usingGrayscale.jpg

MR_DISP_usingRGB.jpg

Also You only have to convert to a MAP if you have a 32bit 16 bit will render as a tif. But when it all comes down to it the less you fiddle with your maps in the conversion process the better they will turn out.
Only reason I had him do the photoshop trick was because he was having trouble with the convertfile.bat
lol guess I should have mentioned that gem huh;)

But I will post a couple really cool sample scenes that you can look at.
This one is sort of my prize collection
Link: Here

And this one has a Grey Scale and RGB 16bit Z3(which isnt the best at making disp) same settings for everything else, you will find no change with the rgb or grey. in the render.
Link: Here

Of course theres like a million factors that make great disp. Scale of model, Uniform Polys, Uv Smoothing, Edges, Texture Resolution. So theres also a million ways to screw them up I guess my point is;)

BTW those are ma files in the zips so if you dont have maya 8.5 open the ma file in notepad and change the version number and it will open in older mayas.
7.0 Sucks really bad compared to 8.0 or 8.5 you will get flustrated very fast with disp testing in 7.0

fornet.jpg

hello der can u plz help me!!
i wanna know how 2 download displacement maps…
i mean where can i find them…
ur erly reply will b Greatful…