Zbmaya Disp 2005 Nov 10

37
 ZBrush To Maya 32-Bit Displacement Guide Scott Spencer November 10, 2005 © 2005 Pixologic, Inc. All rights reserved. Pixologic and the Pixologic logo, and  ZBrush and the ZBrush logo, are registered trademarks of Pixologic, Inc. Photoshop is a registered trademark of Adobe Systems, Inc. Maya is a registered trademark of Alias, Inc. All other trademarks are the property of their respective owners. Please mail comments or suggestions about this document to [email protected].

Transcript of Zbmaya Disp 2005 Nov 10

8/8/2019 Zbmaya Disp 2005 Nov 10

http://slidepdf.com/reader/full/zbmaya-disp-2005-nov-10 1/37

ZBrush To Maya 32-BitDisplacement Guide

Scott Spencer

November 10, 2005

© 2005 Pixologic, Inc.All rights reserved.

Pixologic and the Pixologic logo, and ZBrush and the ZBrush logo, are registeredtrademarks of Pixologic, Inc.

Photoshop is a registered trademark of Adobe Systems, Inc.

Maya is a registered trademark of Alias, Inc.All other trademarks are the property of their respective owners.

Please mail comments or suggestions about this document to [email protected] .

8/8/2019 Zbmaya Disp 2005 Nov 10

http://slidepdf.com/reader/full/zbmaya-disp-2005-nov-10 2/37

2

1. INTRODUCTION ....................................................................................................................................... 3 2. MAYA MODEL PREP............................................................................................................................... 3

2.1. MODEL R EQUIREMENTS FOR ZB RUSH .................................................................................................. 4 2.1.1. Fixing Overlapping UVs ............................................................................................................... 4 2.1.2. Cleaning the Mesh Topology ........................................................................................................ 6

2.2. EXPORTING FROM MAYA ....................................................................................................................... 6 3. SCULPTING IN ZBRUSH ........................................................................................................................ 7

3.1. UV R EGIONS AND POLYGROUPS .........................................................................................................10 3.2. F INAL UV A DJUSTMENTS AND VERTEX O RDER ................................................................................ 12

4. DISPLACEMENT MAPS AND THE ZBRUSH ALPHA DISPLACEMENT EXPORTER ....... 13

4.1. GENERATING A D ISPLACEMENT MAP ................................................................................................. 14 4.1.1. Creating a comparison Image to check your Maya Renders ...................................................17

5. BACK TO MAYA ..................................................................................................................................... 19

5.1. MAYA SETUP FOR R ENDERING ............................................................................................................19 5.2. CREATE .MAP F ILES .............................................................................................................................21 5.3. R ENDERING WITH A S INGLE MAP ........................................................................................................ 21

5.3.1. Lighting and Test renders...........................................................................................................24 6. MULTIPLE DISPLACEMENT MAPS................................................................................................. 27

6.1. SETTING UP UV R EGIONS IN MAYA .................................................................................................... 27 6.2. MAKING THE D ISPLACEMENT MAPS IN ZB RUSH ................................................................................ 29 6.3. APPLYING MULTIPLE D ISPLACEMENT MAPS IN MAYA ......................................................................30

7. BUMP AND DIFFUSE MAPS ................................................................................................................32

7.1. USING THE BUMP V IEWER MATERIAL . ............................................................................................... 32 7.2. APPLYING BUMP MAPS IN MAYA .........................................................................................................34 7.3. CAVITY MAPS AND THE D IFFUSE CHANNEL .......................................................................................35

8/8/2019 Zbmaya Disp 2005 Nov 10

http://slidepdf.com/reader/full/zbmaya-disp-2005-nov-10 3/37

3

1. IntroductionWelcome to the ZPipeline ZBrush to Maya guide. In this manual Scott Spencer willguide your through a process of exporting your sculpt in ZBrush, for use in Maya withMental Ray. Scott illustrates the processes he uses to work seamlessly between the twoapplications. This guide will focus on 32-bit displacement maps which enable real worlddisplacement (no arbitrary scaling factors necessary) and produce the best possible resultsin achieving the look of your original ZBrush model.

2. Maya Model PrepIf your model started as a mesh in Maya, begin by loading your model in the Mayaworkspace. We will need to export the geometry as a generic 3D format that ZBrush canread. Maya will export OBJ files for this purpose. The OBJ exporter is a plug-in whichmust be loaded. The mental Ray renderer is also a plug-in we will load at this stage so it

will be available when needed.Figure 1. Model Loaded Into Maya

To load the object exporter and the Mental Ray renderer go to Window>Settings andPreferences> Plug-in Manager . This will load the Plug-in Manager window as seenbelow. The OBJ plug-in is called objExport.mll and the Mental Ray plug-in is called

8/8/2019 Zbmaya Disp 2005 Nov 10

http://slidepdf.com/reader/full/zbmaya-disp-2005-nov-10 4/37

4

Mayatomr.mll. Click the loaded checkbox next to each to load them now, you may alsowant to click auto load so they are available every time Maya starts.

Figure 2. Plugin Manager Window

2.1. Model Requirements for ZBrush There are two requirements your model and UV map must require before they can beused in ZBrush:

The mesh may only have one UV set and the UVs may not overlap at all.Overlapping UVs will cause unexpected crashes when you are extracting yourdisplacement map and they are easy to miss.

and

The model should consist of just quads and tris, with the tris being in well-hiddenregions.

2.1.1. Fixing Overlapping UVsIt is entirely possible to use ZBrush AUV tiles or other automatic options for ourmapping but as you will see having UVs laid out in Maya will open up several workflowpossibilities not otherwise available.

Here is an example of overlapping UVs in the toes of this model. This must be correctedbefore the displacement map may be extracted. Otherwise this small overlap could causea crash.

8/8/2019 Zbmaya Disp 2005 Nov 10

http://slidepdf.com/reader/full/zbmaya-disp-2005-nov-10 5/37

5

Figure 3. Overlapping UVs in the Maya UV Editor Window

It is important to note that unless you are painting color maps ZBrush is not concernedwith UV coordinates until you extract the displacement map. This leaves you free tomodel in ZBrush then lay out UVs later or change your UV layout without losing all thework you applied to your model. ZBrush also offers a tool to check for overlapping UVsunder the tools palette, Tools:Texture:UV Check . Clicking this button will highlight in redon your model any overlapping UVs so you know where to look for errors back in Maya.When performing an inspection like this in ZBrush, make sure to rotate your model toview all surfaces.

It is also possible at this phase to place your UVs outside the 0 to 1 texture space. Thiswill allow you to map your mesh in ZBrush for easy masking and hiding as well as allow

you to maximize texture space and extract maps for each body part instead of a singlemap for the entire model. This is discussed in section 6.

Again, remember you are never locked into a UV set with ZBrush if you are justsculpting. You can import your OBJ at level one with any UV layout as long as the vertexorder of the mesh remains unchanged. (Generally, this means that you can move points inthe level one OBJ, but cannot add or remove points or edges, otherwise change thegeometry of the model.) More information on vertex order can be found below.

Below is an acceptable layout, using the mesh with automatic mapping. The UV shellsare all in the dark gray square, the 0 to 1 range. This will generate a single map in ZBrush

that applies to the entire mesh. Later we’ll talk about how to spread the mapping acrossmultiple meshes by mapping out side the 0 to 1 UV coordinate range.

8/8/2019 Zbmaya Disp 2005 Nov 10

http://slidepdf.com/reader/full/zbmaya-disp-2005-nov-10 6/37

6

Figure 4. UV Map with U and V Coordinates Each From 0 to 1

2.1.2. Cleaning the Mesh TopologyThe mesh needs to be clean. By clean I mean it should be all quads or at least nearly allquads. Avoid tris, poles (points where 5 edges or more meet) and n-gons (faces withmore than 4 edges). If you find you must have a tri, hide it in an inconspicuous area.Leaving in any of the above elements may cause artifacts at render time. You also wantto ensure your vertices are all welded and there are no nonmanifold or lamina faces. Allof these mesh issues can be resolved with the cleanup tool. Go to the Polygons menu inthe modeling subset and select the cleanup option box.

Figure 5. Opening the Cleanup Menu

This will open the Cleanup menu. If you set to Select and check only the 4-sided facesoption box, Maya will select all the quads in your mesh. You can then use Edit>InvertSelection to select the non-quad faces. Often I will assign another color to these faces tokeep them visible and keep working with the topology until I have an all quad mesh.

In the same cleanup menu choose the Select and Cleanup option and select NonmanifoldGeometry and Lamina faces. Click Cleanup and this will resolve any of these issueswhich often arise when modeling with the extrude tool. Cleaning up your mesh now cansave a lot of headaches later on.

2.2. Exporting from Maya With the UVs and the topology ready you can now export the mesh from Maya. Toexport go to the File>Export selection option box and select the OBJ option from the drop

8/8/2019 Zbmaya Disp 2005 Nov 10

http://slidepdf.com/reader/full/zbmaya-disp-2005-nov-10 7/37

7

down menu. Click Export Selection and save the model. You are now ready to import themesh into ZBrush as a Ztool.

Figure 6. Export Options

3. Sculpting in ZBrushLet’s begin by opening your Ztool in ZBrush. Models in ZBrush are defined as tools. If you are beginning with a mesh that was initially modeled in another application, import itas an OBJ file by using the Import button under the Tool menu.

Figure 7. Import Model Button In ZBrush

Now, click and drag on the canvas to draw your tool. Immediately go into edit mode toallow the tool to be edited as a 3D object; right click on the canvas to open the contextualmenu and select the edit button or press the ‘t’ key on the keyboard or press the Editbutton on the top part of the shelf.

With the tool in edit mode you are now able to tumble, add subdivision levels, and useany of ZBrush’s sculpting tools to detail your mesh.

8/8/2019 Zbmaya Disp 2005 Nov 10

http://slidepdf.com/reader/full/zbmaya-disp-2005-nov-10 8/37

8

ZBrush is a multi resolution editing tool, meaning that changes you make at thehigher subdivision levels will telegraph back down to the lowest subdivisionlevel, somewhat changing the shape of the original mesh. In some cases you maywant to access your original mesh shape again; for example, you may want togenerate a displacement map against the shape built in Maya, as opposed to the

somewhat different level 1 shape that will result after sculpting in ZBrush. To dothis, follow the instructions below.

On the other hand, after sculpting you can simply export the reshaped level 1mesh from ZBrush and use that. Its geometry will be unchanged, only the shapewill have been somewhat altered (and since that shape will be closer to the finalsculpted shape, this may well be what you want to do).

To ensure you can return to the original Maya shape in ZBrush, after sculpting, store amorph target before you begin sculpting. Simply press Tool:Morph Target:StoreMT beforeyou start modifying your model. After sculpting, you can use Tool:Morph Target:StoreMT to switch back to the original shape.

Figure 8. ‘StoreMT’ button in the Morph Target Subpalette

An alternative way of returning to the original Maya shape, which does not requirestoring a morph target, is simply to reload the Maya model after sculpting, as the level 1mesh of your sculpted model. This will work as long as vertex ordering has not changed,which should be the case so long as you have not added or removed points or edges. Themorph target method is generally preferred because some programs can, on occasion,

8/8/2019 Zbmaya Disp 2005 Nov 10

http://slidepdf.com/reader/full/zbmaya-disp-2005-nov-10 9/37

9

alter the order in which they write model vertices on export, even when the model has notchanged at all.

Having a morph target stored is also helpful as it allows you use the morph brush atsubdivision level 1 ( Tool:Geometry:SDiv = 1) to dial back changes to the original form.

It is also important to note that using tools like the Transform:Nudge and Transform:Pinch brush will make changes to the mesh that will not necessarily translate well into the mapscreated when setting a DPSubPix value as opposed to those generated using Adaptive mode (these settings will be discussed in detail later). This is why, in many cases whenusing these tools on your mesh, it is beneficial to use the slightly shape-modified level 1mesh for your base in Maya as opposed to the original morph target. The little vertexchanges the multi-resolution editing makes at level one makes it easier to render theireffects in Maya with a DPSubPix map. You may also use adaptive mode to create yourmap but as you will see later in the guide, DPSubPix mode and the level 1 mesh is apreferable approach. In any case always apply your displacement map to the geometryyou generated it from in ZBrush 1.

If your base mesh is already rigged and cannot be changed in Maya, export theZBrush level 1 mesh as an OBJ import into your Maya scene, and add it as aparallel blendshape to reshape the original mesh to the Level 1 form exportedfrom ZBrush.

Some workflow tips I use in ZBrush to help the sculpting process:

• Often I set the background of the document to black (using Document:Back ,with black selected in the color palette). This helps me read silhouette as wellas see shadows better.

• It also helps to choose Material:BasicMaterial as the material used to displaythe object, and turn down the Specular component of that material a bit. Thisgives a better idea of surface changes and helps call attention to errors in formthat may be easier to miss in the flat fast shader.

1 It’ s worth repeating what we said just a bit ago; if your displacement map must be generated forexactly the shape of the model as it came from Maya, return the level 1 ZBrush model to thatshape either by restoring a level 1 morph target, or by reimporting the Maya mesh for the level 1model, before generating the displacement map.

However, given that your sculpting presumably brought the shape of the model closer to the idealshape, it is worth considering using the modified level 1 shape back in Maya.

8/8/2019 Zbmaya Disp 2005 Nov 10

http://slidepdf.com/reader/full/zbmaya-disp-2005-nov-10 10/37

10

Figure 9. Material Settings for a Clearer View of the Model

3.1. UV Regions and Polygroups If you laid out your UVs in Maya in regions, you can turn on polymesh groups andinteractively hide parts of the mesh. Click Tools:Polygroups:Uv Groups , and then turn onframe mode by activating the Frame button in the shelf (or press Shift-F on the keyboard,or the Frame button in the Transform menu).

8/8/2019 Zbmaya Disp 2005 Nov 10

http://slidepdf.com/reader/full/zbmaya-disp-2005-nov-10 11/37

11

The areas of the mesh that are in separate UV coordinates will now have different colorsassigned to them.

You can Ctrl-Shift-Click on these areas to hide or show them, allowing you easier accessto tighter areas on the model, and increased performance at higher subdivision levels(since less of the mesh needs to be drawn).

TIP: Be aware that sculpting across the seam where the model is hidden willcause artifacts in your sculpture, since sculpting is only applied to the visibleportion of the model. Use caution here. You may also group the meshinteractively in ZBrush by using the Group Visible button for use as simply amodeling and masking tool but UV groups offer better control over the groupsand are easier to maintain.

Figure 10. Body fully visible, and then hidden by ctrl clicking on UV

grouped regions

8/8/2019 Zbmaya Disp 2005 Nov 10

http://slidepdf.com/reader/full/zbmaya-disp-2005-nov-10 12/37

12

3.2. Final UV Adjustments and Vertex Order

When your sculpting is complete you are now ready to export displacement maps. If youneed to change your UVs this is the last chance to do so. The process to transfer a modelfrom ZBrush to Maya and back to ZBrush seamlessly is as follows. The OBJ file may bemoved endlessly between applications as long as the vertex order remains unchanged.(Vertex order is changed by cutting new faces, deleting faces, or reordering on import.)You may change UVs and vertex position without destroying your sculpture. This evenincludes reposing your mesh! Use the following process any time you transfer yourmodel between Maya and ZBrush.

1. In ZBrush set Tool:Geometry:SDiv to 1. Export using Tool:Export .

2. Save the mesh as an OBJ file.

3. In Maya go to the File>Import option box and select OBJ for file type.Make sure that Create Multiple Objects is set to False on this screen. If thisis checked Maya will not preserve the point order and your model will notreimport into your ZBrush.

8/8/2019 Zbmaya Disp 2005 Nov 10

http://slidepdf.com/reader/full/zbmaya-disp-2005-nov-10 13/37

13

Figure 11. Maya Import Options

4. Make any positional or UV changes you want and export the OBJ again.

5. In ZBrush at Tool:Geometry:SDiv = 1, and with the tool corresponding toyour model selected, go to Tool:Import and select the new OBJ file. TheUVs will automatically update to the ones in your new OBJ file.

4. Displacement Maps and the ZBrush AlphaDisplacement Exporter

The new Alpha Displacement Exporter 2 (abbeviation: ADE) plug-in permits exportingdisplacement maps in many formats. In addition, the Multi Displacement 2

(abbreviation:MD2) plugin, which is part of the ADE package, provides two importantextra capabilities:

• When exporting 32-bit displacement maps with MD2, scaling will be ‘bakedinto’ the exported displacement maps, so you no longer need to record analpha depth factor.

• And, MD2 allows the generation of multiple displacement maps,corresponding to multiple external objects, in a single pass.

Since we are rendering in Mental Ray for Maya, which supports 32 bit floating pointdisplacements, we’ll use MD2 all the way. There is no reason to use 16 bits since thequality is lower than what we will achieve with 32 bits. However, there are some timeswhen you might not want to use MD2, and below is a brief summary of the ways inwhich displacement maps may be generated in exported from ZBrush, and the advantagesand disadvantages of each.

2 Available at www.ZBrushCentral.com .

8/8/2019 Zbmaya Disp 2005 Nov 10

http://slidepdf.com/reader/full/zbmaya-disp-2005-nov-10 14/37

14

Basically, you could choose any of the following methods for generating yourdisplacement maps:

• Use MD2, as we’re doing here. This lets you generate multiple displacementmaps in a single pass. Also, if your pipeline can make use of 32-bit

displacement maps, using MD2 allows you to forget about using the alphadepth factor from ZBrush; you’ll always enter 2.2 for the Alpha Gain inMaya.

On the other hand, if you don’t need those abilities, using MD2 is a little morecomplicated, and it also doesn’t place generated displacement maps in thealpha inventory.

• The original method of generating displacement maps is to use theTool:Displacement subpalette to generate the map and place it in the alphainventory, then export that map and use it along with the alpha depth factor inyour render. This doesn’t permit the higher-quality 32-bit maps, does require

you to use the alpha depth factor, doesn’t permit multiple map generation inone go, and (with some external programs) may require converting theexported map into another format.

But, if you don’t want to or can’t use 32-bit maps, and generating maps one ata time is OK, then this is probably the simplest way to go.

• Finally, you can use the ADE without using MD2. This is very similar to the‘classic’ method of making displacement maps (you’ll still use the controls inTool:Displacement to generate them), except that you have a wide range of options as to the precise TIFF format in which they are exported, plus anumber of other options.

Complete documentation on the ADE (and MD2) is included as a PDF in theADE package.

As we go through the map generation, we’ll give the steps for using MD2, but mention afew points that apply if you don’t use MD2 in your pipeline.

4.1. Generating a Displacement Map First, let’s go back to our knowledge of the ‘old’ way of generating displacement maps,and take note of the following:

Maps generated with MD2 will be affected by the various settings inTool:Displacement . In fact, some of the controls that appear in Tool:Displacement also appear in the Multi Displacement 2 controls. In particular, theTool:Displacement:Adaptive setting (on or off) also affects displacement mapsgenerated with Multi Displacement 2. If Adaptive is off, you should set theDpSubPix level in the MD2 menu, not in the Tool:Displacement menu. For mywork, I use Adaptive off and DpSubPix = 2. Tool:Geometry:SmoothUV will alsoaffect the final result.

8/8/2019 Zbmaya Disp 2005 Nov 10

http://slidepdf.com/reader/full/zbmaya-disp-2005-nov-10 15/37

15

OK, our model is all done in ZBrush and we’re ready to generate a displacement map.The Multi Displacement 2 plugin is found under the Zplugin menu, as shown below:

Figure 12. Multi Displacement 2 Plugin

Here’s how to use it.

1. First, adjust the settings according to the following (this is to generate a singledisplacement map, but we note how the controls apply to multiple mapgeneration; this will make sense later):

UDim is the number of additional regions in U (left to right). Leave this as 0.

InitialFileIndex is the number assigned to the first map generated. Leave this as1001. It will increment as each file is generating giving them unique names.The last digit will correspond to the UV region in which the shell lies startingfrom left to right.

MaxMapSize is your map resolution. Set this to 4096 or 2048. Lower numberswill be faster but lower quality.

MapSizeAdjust should be set to 0.

DpSubPix governs the number of times the mesh is subdivided as thedisplacement map is generated. Set this to a value above 0. 1 subdivides once,2 twice and so on. Be aware that this will be memory intensive the higher it isset.

Border thickness (overpaint in the generated map) can be left at 8.

Export Options opens the Alpha Displacement Exporter window.

8/8/2019 Zbmaya Disp 2005 Nov 10

http://slidepdf.com/reader/full/zbmaya-disp-2005-nov-10 16/37

16

2. Just to be sure, press GetMeshInfo and make sure your model has just 1 UVregion. The number of UV regions corresponds to the number of maps that will begenerated. A single UV region (UVs laid out in 0 to 1) will generate only one mapand only one tile will be shown when you click this button. If you have more thanone UV region, you need to jump ahead to section 6 on generating multiple

displacement maps :-)3. Now, press the Export Options button. This brings up the ADE window, shown

below.

Figure 13. Displacement Exporter Options

4. Select the R32 option and enter the DE-LBEK-EAEAEA-R32 Quick Code to setthe 32-bit export options that are ideal for Maya, or set them manually as shownabove. Click Close .

5. You may now switch to your original morph target and generate your mesh basedon subdivision level 1.

6. Click the Create All button in the MD2 menu and ZBrush will ask you for adestination folder and base file name, and automatically export the map based onthese settings as it works.

7. All done!

A few notes if you’re not using MD2, or are using MD2 but aren’t using 32-bitdisplacement maps. In these cases, you will need to record Alpha:Alpha Depth Factor , touse it later as the Alpha Gain in Maya. If you generated a displacement map with

Tool:Displacement:Create DispMap , no problem; the displacement map shows up in thealpha inventory, so just select it and make a note of Alpha:Alpha Depth Factor . If you’reusing MD2 to generate multiple displacement maps, it’s a bit trickier, because then themaps are written directly to disk. In that case, you’ll also need to generate a singledisplacement map into the alpha inventory, to get the alpha depth factor. This is coveredin the PDF that comes with the ADE.

8/8/2019 Zbmaya Disp 2005 Nov 10

http://slidepdf.com/reader/full/zbmaya-disp-2005-nov-10 17/37

17

4.1.1. Creating a comparison Image to check your Maya RendersWhen comparing your Maya renders with the ZBrush view port it is important to notethat in ZBrush the diffuse channel of the material is governed by a curve. This helpscreate gorgeous renders and it is also not something that is the default in Maya. To helpapproximate the look of your final render from Maya we can make some material

adjustments in ZBrush. To use ZBrush’s perspective and get a reference image that youcan use to judge your Mental Ray render against, I do the following. You can customizethe steps to your liking.

1. In Document : Set size to 2048 x 2048, click Resize .

2. Draw your object on the canvas.

3. Press “t” to enter edit mode.

4. Position the model to best reflect the detail of your model or the area of interest.

5. In Material : select the Basic Material. In the options that become visible for that

material in the Material palette, set Ambient to 0 and Specular to 0, then click theDiffuseCurve box to open the curve and click Reset to flatten the curve out.

6. Increase the resolution to the highest level.

7. Press “t” to exit edit mode.

8. In Draw : Press Perspective and set the Distortion slider to 18.

9. Press “w” to enter Gyro mode and activate perspective.

10. Press “q” to drop your model to the canvas.

11. Set the color to black.

12. Document : Press Back (makes the back of canvas black).

13. In Light : Turn off all lights but the first one to the right of the light positioningcontrol. Set Ambient to 0. Position your light to give you the best view of yourdisplacements

14. In Render : Press Shadow and Best .

15. Press AAHalf on the shelf to the right of the canvas to anti-alias the image.

16. Use Document:Save As to save a ZBrush document for later adjustments.

17. Use Document:Export to export a TIFF file. (This will be used to compare againstthe rendered Maya image).

8/8/2019 Zbmaya Disp 2005 Nov 10

http://slidepdf.com/reader/full/zbmaya-disp-2005-nov-10 18/37

18

Figure 14. ZBrush Settings for Generating the Triceratops, and theResulting Image.

.

8/8/2019 Zbmaya Disp 2005 Nov 10

http://slidepdf.com/reader/full/zbmaya-disp-2005-nov-10 19/37

19

5. Back to Maya

5.1. Maya Setup for Rendering Back in Maya re-import the ZBrush level 1 mesh, or if in ZBrush you generated your

maps from a stored morph target, use the original model you exported from Maya. If youare importing a mesh back into Maya remember to go to File>Import and select OBJ forfile type. Make sure that Create Multiple Objects is set to false on this screen. Always beaware of vertex order and the importance of maintaining it between applications.

With the mesh selected press Ctrl-a to open the attribute editor. Under Displacement Map in the shape node uncheck feature displacement.

Figure 15. Turning Off Feature Displacement

We now need to add a Subdivision Approximation to the mesh to tell Mental Ray how tosubdivide at render time so there is enough geometry to support the displacement detailwe need.

To do this we use the Approximation editor. Go to Window>Rendering Editors>MentalRay>Approximation Editor .

8/8/2019 Zbmaya Disp 2005 Nov 10

http://slidepdf.com/reader/full/zbmaya-disp-2005-nov-10 20/37

20

Figure 16. Mental Ray Approximation Editor

With the mesh selected, click the Create button to the right of the Subdivision Approx setting. The Edit button will now become active, click this to open the options in theattribute editor.

Figure 17. Subdivision Approx Attribute Editor

Change the Approx Method To Spatial , set the min and max settings to 3 and 5 and lengthto 0.100. The subdivision approximation will smooth the base mesh at render time andinsure there is enough geometry to support your displacement map. These settings areflexible and work as a good start.

The settings above were selected to provide good results while not demanding too manyresources. If your machine can support it, you could set max to 6 and length to 0.01 or

even 0.001. The min and max settings tell Mental Ray the minimum and maximumnumber of tris to subdivide your model into at render time. The length value tells MentalRay the longest any triangle edge can be and helps insure large protrusions and areas of high displacement render well; the lower this number is the smaller the tris in the mesh.Be careful, because Mental Ray will overrun RAM and crash if these settings are toohigh.

8/8/2019 Zbmaya Disp 2005 Nov 10

http://slidepdf.com/reader/full/zbmaya-disp-2005-nov-10 21/37

21

You may also wish to experiment with the Parametric setting. It has only one slider tocontrol Approximation making it simpler but offering less control over the final output.

5.2. Create .map Files Your displacement maps from ZBrush will perform far better, faster, and with more

stability in Mental Ray, if you convert them to the Mental Ray .map format. This isespecially apparent with higher resolution maps. Mental Ray comes with a command lineutility called imf_copy, which will allow us to convert the TIF files to .map format.

For the sake of safety you may want to perform this on copies of your originalfiles. You can also find batch files to automate this process online atwww.ZBrushcentral.com

Open a command window in the folder where your tiff files are located and use thefollowing command line to convert to .map format.

Imf_copy –p originalfile.tif newfilename.map

This creates a map file optimized for Mental Ray and readable as 32-bit floating point.Perform this on all displacement maps you plan to use.

To check details on your maps, Maya provides a nice utility in the Maya/bin directorycalled imf_info.exe . You can use this program at the command line to read detailedinformation about your displacement map.

Also, imf_disp.exe is another utility that will display maps and offer info on them, butwith a graphic interface.

5.3. Rendering with a Single Map This example uses the single map we generated using MD2 with the displacement scalebaked in.

First, Open Hypershade by going to Window>Rendering Editors>Hypershade.

Then, Create a Lambert material by dragging it to the workspace from the left sidewindow. Middle-mouse-button drag a displacement node over it. Select DisplacementMap from the connection editor window that appears. You will now double click thedisplacement node to open the attributes.

8/8/2019 Zbmaya Disp 2005 Nov 10

http://slidepdf.com/reader/full/zbmaya-disp-2005-nov-10 22/37

22

Figure 18. Maya Hypershade with Lambert shader and displacement nodevisible

We need to tell the shader it will use a file for displacement. Click the checker box (to theright of the Displacement entry box) and select the file from the popup window.

Figure 19. Displacement Node

Figure 20. Choose File Option Window

8/8/2019 Zbmaya Disp 2005 Nov 10

http://slidepdf.com/reader/full/zbmaya-disp-2005-nov-10 23/37

23

This creates a file node in which we can place our displacement map. You can graph yourshader by selecting Lambert and then in the Graph menu select Input and Output connections.

Your shader graph will now appear like the image below:

Figure 21. Network for a displacement shader.

In the file node we will add our displacement map. It should open automatically whenyou click the file button but if not double click the node in the hypergraph (the onepictured as black above)

Figure 22. Attribute Editor

Click the folder icon to the right of Image Name to browse to the .map file we want to usefor this map.

8/8/2019 Zbmaya Disp 2005 Nov 10

http://slidepdf.com/reader/full/zbmaya-disp-2005-nov-10 24/37

24

For all 32-bit maps exported from ZBrush using Multi Displacement 2, the alpha gain inMaya will be the same; just set it to 2.2. However, if you didn’t go through MD2, you’llstill need to set the alpha gain based on the alpha depth factor from ZBrush

So, assuming a 32-bit map exported with MD2, open Color Balance on this screen and set

Alpha Gain to 2.2 and Alpha Offset to -1.1. The latter setting accounts for the factZBrush creates a map where 50% gray is no displacement, but Maya sees black as nodisplacement. We need to shift that value to allow the mesh to be pushed in and pulledout by the map, so the alpha offset will always be (- ½ *alpha gain).

Figure 23. Setting Alpha Gain and Alpha Offset

If you get unexpected results from your rendered surface, you may also want to turn off filtering at the top of the screen. It defaults to Gaussian and in some rare instances thismay cause artifacts. It’s also helpful to lighten the color of your shader to be closer to thesurface color of the model in your comparison image.

5.3.1. Lighting and Test renders

5.3.1.1. Setting up Test Render Lighting

I find it beneficial to set up a single spotlight or direction light raking across the surfaceof the model to help spot details that tend to be lost in flat lighting. If you have acomparison image from ZBrush, try to approximate the same lighting setup in Maya asyou had with the single light in ZBrush.

Figure 24. Test Render Lighting

8/8/2019 Zbmaya Disp 2005 Nov 10

http://slidepdf.com/reader/full/zbmaya-disp-2005-nov-10 25/37

25

In some cases you might even want to change your shader to a Blinn and dial down thespecular color to a dark gray to nearly black. The subtle specular highlight in the renderhelps pick out tiny details that might otherwise be overlooked and considered lost.

Figure 25. Highlighting Details

Specular color set to dark gray will give us subtle highlights to accentuate finer details onthe render that might otherwise be overlooked or lost.

5.3.1.2. Render GlobalsGo to Window>Rendering Editors>Render Globals to open your render globals window. If it is not already set, choose Mental Ray from the dropdown box.

Figure 26. Maya's Render Globals window

Under the Mental Ray tab there is a rollout option called Translation . Open this and setExport Verbosity to Progress Messages . This will tell Mental Ray to report usefulinformation to the output window when it renders. This includes the final triangle count,which when divided by two is the face count of your subdivided model at render time.Compare this to the final face count in ZBrush to determine how close to the ZBrushsubdivision you are getting with you Approximation settings. You may adjust them asneeded.

8/8/2019 Zbmaya Disp 2005 Nov 10

http://slidepdf.com/reader/full/zbmaya-disp-2005-nov-10 26/37

26

Figure 27. Maya Output Window with Progress Messages

Memory and Performance is another menu of interest here. As you start rendering moremaps you may want to research BSP optimization especially when ray tracing shadows.

Using the .map file format will also increase your speed at render time because they useMental Ray’s memory caching features. This speed increase is only apparent when

rendering locally. If you are on a renderfarm with your scene folder on a remote machinefrom the nodes this advantage is negated.

Taking care with how Mental Ray handles memory will speed up renders and make forfar better performance.

5.3.1.3. Test Renders Open the render view and start a render. You may keep the image in the render view forreal-time comparisons.

Your initial renders will most likely not be sufficient and you will need to adjust settings

in the approximation editor. Check your output window to make sure you are gettingenough geometry at render time.

If you see bloating in your render then there is a mistake with the alpha gain and offset.Usually you have forgotten to set one or both, or the offset is not set to - ½ of alpha gain.

Figure 28. Displaced mesh rendered in Maya using Mental Ray.

8/8/2019 Zbmaya Disp 2005 Nov 10

http://slidepdf.com/reader/full/zbmaya-disp-2005-nov-10 27/37

27

5.3.1.4. Troubleshooting Renders and Artifacts In some cases you may see artifacts in your renders. Small spikes on UV seams can beremedied by using the SmoothUV option in ZBrush under Tool:Displacement .

Pinches in the mesh are apparent where you have tris, poles, or faces with more than 4

vertices. These should be hidden in inconspicuous places during the modeling process orremoved completely. If you find such an artifact on your render applying a smooth to themesh before rendering can help. This will increase render time and you may want tolower your Approximation settings as a result.

6. Multiple Displacement MapsZBrush’s Multi Displacement 2 (part of the Alpha Displacement Exporter plugin) allowsyou to generate, in one pass and with consistent scaling, displacement maps for a set of models that are used as a unit externally. In our example, we’ll be doing this with a dogthat actually consists of four separate meshes in Maya. Before MD2, each model wouldhave to be processed individually in ZBrush, which was not only more work, but alsogenerated different alpha depth factors for each map.

Let’s say we’re working with models A, B, and C, which together make up some largerobject. The basic workflow for processing all of these in MD2 is:

1. In Maya, set up a single map coordinate space for all models, where each modelhas it’s own 1x1 block of the coordinate space. For example, A might get thespace where U goes from 0 to 1 and V goes from 0 to 1; B would get the rangewhere U goes from 0 to 1 but V goes from 1 to 2; and so forth.

2. Then, combine those models into a single OBJ and take that into ZBrush. You’llstill retain your original models for use when you’re done with ZBrush

3. Go ahead and sculpt.

4. Now you can use MD2 as previously, but when it sees vertices outside thestandard 1x1 UV range, it will process those areas individually and generate aseparate displacement map for each.

5. Finally, the separate displacement maps can be applied to your original meshesback in Maya.

6.1. Setting up UV Regions in Maya To generate multiple maps with Multi Displacement 2, it is necessary to place yourdifferent models into different UV regions in Maya. UV regions simply mean your UVsare outside the standard 0 to 1 range that is displayed in Maya by the gray box in the UVTexture Editor.

To display beyond just 0 to 1, go to the View>Grid option box and raise the Length andWidth value to 5. This value may be higher or lower as needed. You may also want to setGrid Lines to 1 to visually clarify where each region begins and ends.

8/8/2019 Zbmaya Disp 2005 Nov 10

http://slidepdf.com/reader/full/zbmaya-disp-2005-nov-10 28/37

28

Figure 29. Setting Grid Options

To shift UVs from 0 to 1 select a shell and in the Maya command line or the script editorenter the following MEL command (note the capital letters)

polyEditUV -u 1 -v 0

This moves the shell one unit to the right and 0 vertically. You may repeat for each shellyou want as a separate map or UV Group, placing each in its own quadrant. Incrementthe U number for the number of quadrants to move in each direction.

In this example the dog’s body mesh (model by Dan Fine), teeth, upper gum, and lowergum, are separate objects. We can however combine them and import into ZBrush as asingle object with UV Groups active.

Figure 30. Dog Model with Four Separate Mesh Parts (model by Dan J.Fine)

8/8/2019 Zbmaya Disp 2005 Nov 10

http://slidepdf.com/reader/full/zbmaya-disp-2005-nov-10 29/37

29

6.2. Making the Displacement Maps in ZBrush Once you’ve layed out UVs as described above, the steps to generate displacement mapsusing ZBrush are as follows.

1. Save the new Maya scene (with the maps separated into UV regions) separately

from your original, as it will be used only by ZBrush. The generated maps willthen be applied to your original multiple mesh Maya geometry.

2. Now we will create a combined object file to use in ZBrush. Select each separateobject and click Polygons>Combine to create a single mesh from these objects.Your UVs will be intact and still in separate regions (see image).

Figure 31. Combined Objects and UVs

Note: The figure below shows just the mouth parts combined, to make more visible thefact that these parts are combined into a single mesh.

3. In ZBrush import the combined mesh and activate Uv Groups under

Tool:Polygroups . Turn on Frame mode to view your grouping. If the colorsZBrush chooses are too similar to distinguish from each other, Ctrl-Click toisolate the group you want to change color for and then clickTools:Polygroups:Group Visible to cycle through other options. You may alsowant to enable Tool:Display Options:Double to display geometry double sided inthe view.

4. Ctrl-Click the body polygroup to hide it and render the teeth visible for sculpting.Detail your mesh as normal. You may want to turn off Tool:Geometry:Smt (Subdivide Smooth) to prevent your mesh parts from shrinking as you sculpt.

8/8/2019 Zbmaya Disp 2005 Nov 10

http://slidepdf.com/reader/full/zbmaya-disp-2005-nov-10 30/37

30

Figure 32. Dog Teeth Parts of Model with Polygroups Assigned (Body ishidden)

5. Finally, use the Create All button in the MD2 menu to create the displacementmaps. Details are found in section 4.1.

6.3. Applying Multiple Displacement Maps in Maya

In the previous sections we created a separate map per body part to increase quality in thefinal product by allowing more texture space per body part and the use of multiple high-resolution maps. To assign the maps we need to create a displacement shader for eachmap we will apply to the model.

Be sure to check the place2DTexture node attached to your displacement map and be surethat Wrap U and Wrap V are checked. This will tile the maps outside 0 to 1.

8/8/2019 Zbmaya Disp 2005 Nov 10

http://slidepdf.com/reader/full/zbmaya-disp-2005-nov-10 31/37

31

This model has 8 UV regions so 8 maps are generated. The resulting 32-bit TIF files willbe ready to apply to the mesh in Maya and should render exactly as seen in ZBrush. Tomake sure each map is applied to the correct region of the creature open the UV TextureEditor as seen above.

Drag-select one quadrant of UVs and go to Select>Convert>Faces (or Ctrl-F10 on thekeyboard). You can select a few UVs from one shell then use Select>Select Shell toenlarge the selection to the whole UV shell. Now in Hypershade apply the shader withthe corresponding map to the set of faces. You can quickly assign shaders to selectedfaces by right-clicking on your shader in Hypershade and selecting Assign To Selection from the marking menu that appears

You can determine which map is for which quadrant by looking at the filename indexnumber for each map; 1001 is for quadrant one, 1002 for 2 and so on. It helps to nameshaders descriptively as you create them.

And that’s it! With the displacement maps all generated and attached back to the originalmeshes in the dog project, you should be able to on with your rendering or other work asusual.

8/8/2019 Zbmaya Disp 2005 Nov 10

http://slidepdf.com/reader/full/zbmaya-disp-2005-nov-10 32/37

32

7. Bump and Diffuse MapsIn many cases you will want fine details on your mesh like pores and small wrinkles.These can be added into the geometry itself and ultimately the displacement map butdoing so is inefficient and usually not necessary. Finer details can be added in a bumpmap and rendered over the displacement in Mental Ray. This takes a huge load off therenderer since you don’t have to subdivide nearly as high to get finer details to appear. Agood rule of thumb is if your detail will change the silhouette of the model, displace it. If it is not visible in the profile, add it as a bump map detail instead.

Figure 33. ZBrush Sculpt Before Bump Map Applied

Figure 34. Same Mesh with Bump Map (viewed using the Bump MapMaterial)

7.1. Using the Bump Viewer Material.ZBrush has a little known but very helpful method for viewing bump maps directly inZBrush, using a special material called the BumpViewerMaterial , which can be loadedfrom the Zmaterials directory that is part of the ZBrush distribution. Applying thismaterial to your model will then cause it to render in ZBrush using the currently assigned

8/8/2019 Zbmaya Disp 2005 Nov 10

http://slidepdf.com/reader/full/zbmaya-disp-2005-nov-10 33/37

33

texture as a bump map, rather than a normal texture. This allows you to use all the toolsavailable in the Projection Master or elsewhere in ZBrush, and easily see the result.

Here’s the procedure for using this:

1. With your tool open and in 3D Edit mode got to the Material Menu and clickLoad .

2. In the Zmaterials folder of your ZBrush install folder you will find the fileBumpViewerMaterial.zmt. Load this and the material will be applied to themodel.

3. To create a texture for the bump viewer open the system color palette by pressingthe SysPalette button to the left of the workspace…

…and select 50% gray (RGB value 128 128 128). The system color palettewindow may vary, depending on your operating system.

4. Then go to the Texture menu, set width and height to 4096 (or whatever isappropriate to your needs) and click New . A gray texture will be created.

8/8/2019 Zbmaya Disp 2005 Nov 10

http://slidepdf.com/reader/full/zbmaya-disp-2005-nov-10 34/37

34

5. You may now enter Projection Master with only color enabled and paint withblack or white on your model, varying intensity to adjust bumpiness.

6. When you leave Projection Master, the modifications to the texture will appear asbumps on the model’s surface.

Make sure that you enter Projection Master with only theColors

option checked,and your brushes are using RGB only, do not use ZAdd or ZSub . This will ensurethat you do not inadvertently modify geometry as you paint the bump map.

7. Once the map is done, you can export it and use it in Maya.

7.2. Applying bump maps in Maya To apply your bump map in Maya go to the Attribute Editor for the material on yourmesh. Here there is a Bump Mapping slot. Click the checkered box to the right and selectthe bump map file from the popup window.

This will create a bump2D node. Bump Depth is the “volume” control for the level of thebump. The initial value of 1 is usually too high so I start testing with a value of .5

Click the arrow next to Bump Value to access the file node where you will load yourbump map. Remember that, like the displacement map, this is based on 50% graycorresponding to no bump, so be sure to set your alpha gain to 1 and offset to -.5 undercolor balance in the file node.

8/8/2019 Zbmaya Disp 2005 Nov 10

http://slidepdf.com/reader/full/zbmaya-disp-2005-nov-10 35/37

35

Figure 35. Before Applying Bump Map, and After

7.3. Cavity Maps and the Diffuse Channel

Using cavity shading in ZBrush, you can generate diffuse maps which when used inMaya can help support the displacement by accentuating shadows in the recessed areas.

Figure 36. Render Without Diffuse Map, and With

Cavity map generation will soon be automated with future releases but as of ZBrush 2.0you can make cavity maps manually by altering material settings. Begin by creating adisplacement map with Tool:Displacement and selecting it that map in the alphainventory popup.

Next, select Material:BasicMaterial and click Alpha:CropAndFill . This causes the canvasto be erased, resized, and filled with the selected alpha (the displacement map), but with a

8/8/2019 Zbmaya Disp 2005 Nov 10

http://slidepdf.com/reader/full/zbmaya-disp-2005-nov-10 36/37

36

ZBrush twist. The alpha is not applied to the canvas as grayscale intensities, but as depth,which means the contents of the canvas will be sensitive to the lighting conditions.

Turn Ambient all the way up. With Render:Best on, adjust the CavityColorize ,CavityRadius , and CavityIntensity until the wrinkles in your model are shaded as you like.

(CavityIntensity is probably a good one to start with.) You should get a posterized effectdenoting where the areas of the map will be cavity-shaded.

Once you have a diffuse (cavity) map to your liking press Texture:GrabDoc to make thedocument into a texture, and then export using Texture:Export .

The diffuse map can be added in Maya similarly to the bump map. In the attributes foryour shader attach a file node to the diffuse channel. Dark areas will render darker andlight areas will be normal. You may want to adjust the map in a photo editing package if the effect appears too strong or adjust the file node settings.

Figure 37. Example diffuse map.

Thanks for reading this guide! If you have any suggestions or corrections I can be foundat www.scottspencer.com , at ZBrush Central, and the “ZBrush in Production Pipelines”forum at www.highend3d.com. Happy sculpting!

Special thanks to!!:

Pixolator, Jaime, Ryan, Aurick, Ken and the Pixologic team! [Pixologic editor’s note: No, Scott is the person who gets special thanks. This is our job, but his much-appreciated contribution.]

8/8/2019 Zbmaya Disp 2005 Nov 10

http://slidepdf.com/reader/full/zbmaya-disp-2005-nov-10 37/37

Sunit, Ricardo Ariza, Bill Spradlin, Dave Cardwell, Dick Smith, Monstermaker,Aminuts, Zack Petroc, Will at HighEnd3D, Pendulum Studio, Marcus Civis, Antropus,Svengali, and the countless other artists on ZBC who are always inspiring!

All models by Scott Spencer except Bulldog by Dan J Fine.