# Thread: A Solution to the ZB to Maya displacement problems

1. ## A Solution to the ZB to Maya displacement problems

Yesterday night I read through a 26 page thread about displacements and I still havent been able to do the displacement right, so I decided to totally understand what is the problem, I saw alot of good formulas to figure out the Alpha Gain etc.. but here and now I want to make it very easy for anyone to be able and get it right, I started doing a little converter just to get the important numbers you need, here is a screen shot.

EDITED

EDITED

What I need is to find out if there is a Perfect formula, and eactly what Option Drives the Maya Options, like the Intensity of Zbrush into the Alpha Gain.

Possible Drivers :

- Zbrush Displacement / Intensity
- Zbrush Displacement / Mid Value
EDITED
- Zbrush Alpha / Alpha Depth Factor
EDITED

Possibly Driven:

- Maya File Attribute / Filter Type
- Maya Color Balance / Color Gain
- Maya Color Balance / Color Offset
- Maya Effects / Filter
- Maya Effects / Filter Offset

I dont know if there is more stats the can Drive or be Driven, but form what I saw those are the main stats to get the right conversion.

- This is not to know what are the displacement stats in Maya, Ex: Spatial, Lenght etc..
- the Filter type, Filter, and Filter Offset is simply a recommendation, and I cant imagine a reason to change them, from whatever is recommended. Like what ive seen, I think Filter Type should be None, Filter should be 0 and Filter Offset 0.001... I think :P.

EDITED
- This is assuming the file was fliped and changed to RGB.
EDITED

2. Here is a Formula for the Alpha Offset when the Mid Value is at 50 if memory serves right.

Alpha Offset = Negative Alpha Gain * 0.5

3. Here is one I found in a thread last night, cant remember which one tho, its for the Alpha Gain.

Alpha Gain = (Alpha Depth Factor from zbrush * 10) * 2

EDITED
I found the Alpha Depth Factor you will see the Value when you select your Displacement texture in the Alpha Menu
EDITED

Example:
Zbrush Alpha Depth Factor = 0.834
Maya Alpha Gain = 16.68
Maya Alpha Offset = -8.34

4. ## Mid Value Theorie

Here are a couple of Diagrams to show what I mean.

As you can see the only reason to change the Mid Value would be to increase the range of detail in a specific Direction ( Positive or Negative Displacement ) as shown in "B" , but if you do that then Maya will read like this...

As you can see "A" reads very nicely, it reads full Positive and full Negative correctly. but look at "B", Maya will see the Neutral value of "B" in the Positive range of "B" and not as the Neutral. Here comes the problem how exactly could I make a Modifer to multiply to the Alpha Gain / Alpha Offset to make it read correctly but without moving the whole values of "B" in the Positive direction as shown with the Green bars, cause that would give inflated values in the Positive direction.

Worst to come I can simply remove the Mid Value option as pretty much nobody would usw something else then 50 for it.

5. I can think of at least 3 simple ways to set up the correct color range values in Maya. Your working to hard this is the easy part.

1. The easiest is to just create 32-bit displacement maps with the MD2 plugin. Then you alpha gain is always: 2.3 and the alpha offset is always: -1.15. Since Mental Ray can use 32-bit, there is no reason to not use it as it has the most resolution and thus greatest quality.

2. If you have to use 16-bit maps, then simply click on the attribute slot for the alpha offset attribute and type the following expression:

- file1.alphaGain / 2;

Now, no matter what you enter into the alpha gain will be automatically adjusted to the correct range in Maya.

3. Use a set-range node to shift Zrush's displacement range to match Maya's: Create a set range utility, conect the alpha’s texture to the setRange.valueX. Modify the set range values of: Min to -1, Max to 1, Old Min to 0 and Old Max to 1. To finalize, conect the set range OutValue X to the displacement attribute of the displacement shader.

In truth you never need to calculate the alpha gain or alpha offset. If you use 32-bit maps, bang your done. If you use the 16-bit maps; then you have to deal with the models scale. Take the alpha depth from Zbrush and enter that for your alpha gain, enter the above expression for the alpha offset. Test render...then adjust the alpha gain value up or down until you get good displacment. Generally you should use multiples of the Zbrush alpha depth factor. But other than that there's nothing difficult about displacement in Maya. Your conversion table is nice but really not necessary.

For detailed information on displacement maps in Maya you'll want to read the Maya Pipeline PDF:

http://206.145.80.237/zbrush/media/ZBMAYA-pipeline.zip

6. WOW!!, that PDF and Alpha Displacement Exporter seem like the right way to go, Thanks a alot, very informative and yeah I agree now, that was alot of work for nothing, :P but I learned alot from it.