ZMapper Projection

From ZBrush Info

Jump to: navigation, search

Contents

Projecting Normal Maps Onto New Topology

Once you've created a normal map for an object, you may find you need to change the base topology of your original low-resolution mesh, in order to allow better deformation during animation, or for some similar reason. However, the new base mesh will of course not have any of the sculpted detail applied to the original mesh with ZBrush, so a normal map cannot be generated for it in the same way. In order to allow reuse of the original sculpted model, ZMapper provides the Projection tab.

Figure: The Projection Tab

Simply put, these controls allow you to make use of the detail from the original mesh by fitting it over the new mesh, and projecting that detail onto the new mesh as the normal map is being built.

Conceptually, the process is fairly simple. It consists of the following steps.

  1. Build and sculpt the initial model--call it model A.
  2. Build and import the new base mesh--call it model B.
  3. Ensure the two meshes are properly aligned and scaled within ZBrush's coordinate space.
  4. Choose the original mesh (A), go into ZMapper, and click Capture Current Mesh in the panel above. This will remember model A as the mesh from which detail is being projected. Then leave ZMapper.
  5. Choose model B, ensure UV coordinates have been assigned to it (if not assigned before importation into ZBrush), enter ZMapper, and click Create Projected NormalMap. This creates a new normal map for B by raycasting the details of A onto it.

There are various settings you can use to affect the quality of the final result, but the most important thing is just to make sure that the original low-resolution mesh and the new low-resolution mesh fit together as closely as possible; you're not going to be able to transfer the detail from a duck's head into a normal map for a robin. If your new mesh ends up being differently shaped in some places than the previous mesh, you can try resculpting the original in ZBrush to better fit the new; this should keep most of the high-resolution details.

The remainder of this chapter discusses some of the concepts and details you'll need to understand to make working with raycasting easy. A full example is presented in ZMapper Examples, and the controls are detailed in ZMapper Reference.

Aligning the Initial and New Base Meshes

Aside from being as identical in shape as possible, the base meshes also need to be identically aligned with respect to global location, scaling, and rotation, to obtain the ideal result. If they are not aligned, the mismatches will show up when you go into ZMapper, and you can correct them using the techniques described below.

There are a couple of things that can affect whether or not you need to deal with alignment problems. Controls described below can have an effect; more importantly, certain workflows can require dealing with scale issues. These are also discussed below. The simple case, where the settings below are left at their default values and the models being worked with are single-piece models built in an external program, should not cause any alignment mismatches.

ZBrush Settings to Check

You should be aware of two controls in ZBrush that might affect scaling, and one set that can affect rotation. These are the Preferences:Importexport:Unify Scale setting, the Tool:Export:Scale setting, and various of the 'flip' settings in Preferences:Importexport. If you encounter unexpected alignment problems, check these controls to ensure they are set at reasonable values. The default values are reasonable for almost all cases.

Tool:Export:Scale does what you might think from the name; it scales the mesh up or down on export. For example, if you import a 1x1x1 cube, set Tool:Export:Scale to 2, and then export the cube, you'll get a 2x2x2 cube. The default for this setting is 1, and you should normally leave it at that.

The other scaling setting, Unify Scale, affects the scale factor that is used to change from external coordinates to ZBrush internal coordinates when a model is imported or exported, and the simplest thing to do with it is just not change it. Regardless of what this control is set at (the default is 4), if you import an object, sculpt it, and then export it without changing Unify Scale and with ToolExport:Scale = 1, the exported object will have the same size as the imported object, and you won't encounter scaling issues.

The flip settings in Preferences:Importexport are all off by default, and should normally left that way when using ZMapper. If you do find a model is flipped when it is imported, you can activate the appropriate ones of these switches and import the model again.

Workflow Issues

There are all sorts of different workflows that might be employed when building an original mesh and then a similar mesh with a new topology. For example, you might sculpt the original mesh from a ZBrush primitive, export the base level, use an external program to produce a new topology, and then import that new topology. Or you might produce both the original topology and the new topology in a single program, and import both into ZMapper. Or, conceivably, one artist might produce the original mesh in one program, sculpt it in ZBrush, and then somehow transfer the original base mesh to another artist who uses another program to produce another mesh with a different topology but the same shape. Regardless of workflow, the end goal is to project normal maps in ZMapper, and to do that the models need to be as closely aligned in ZMapper as possible.

Let's discuss a few common workflows, and some of the things you might need to think about with each of them.

Workflow; Original and New Model from External Program

In this instance, you build the initial head in your favorite modeling package, import into ZBrush, and sculpt. Then, it turns out that the original head topology isn't satisfactory, so you go back to the modeling package, and build the new topology exactly over the old topology; eyes are in the same place, nostrils in the same place, etc. Most particularly, the width, height, depth, and origin of the models are the same. When that's done, you import the new topology into ZBrush.

In this case, you shouldn't encounter any problems whatsoever. Since the dimensions and origins of each model are the same, they'll undergo identical scaling in ZBrush, and should line up just as well in ZBrush as they do in the external modeler.

Workflow; Original Model in ZBrush, New Model Externally

This is the case where you're a sculptor who just loves ZBrush, and would never want to start a model any other way. So you begin with a ZBrush sphere, convert it to a polymesh, do all of your sculpting in ZBrush, and export one level (probably the base level) of the polymesh.Tool:Preview subpalette. When opened, it displays the current tool in its current global orientation, with the z-axis going straight into the screen. By dragging anywhere on the image except the small red cross, you can rotate the preview (the dark plane is the xy plane); and by holding down the Shift key as you rotate, you can force the object to rotate in 90 degree increments. Finally, clicking the Store button will reset the rotation of the x, y, and z planes so that the object's new global orientation is visually the same as the last position you'd moved it to. The figure below makes this clearer.

Workflow; Original Model in ZBrush, New Model Externally

This is the case where you're a sculptor who just loves ZBrush, and would never want to start a model any other way. So you begin with a ZBrush sphere, convert it to a polymesh, do all of your sculpting in ZBrush, and export one level (probably the base level) of the polymesh. Then you or someone else builds the desired topology around that exported mesh using a program of choice, and finally the new mesh is imported back into ZBrush for projection of the normal map onto it.

In this case, you may find in ZMapper that the imported model is scaled differently than the original model. (This occurs because by default, ZBrush rescales imported models to fit in an optimal 'working area' of the ZBrush coordinate system.) The fix for this is found later in this page.

Workflow; Original Single Model, New Model Broken into Pieces

Here, an initial model is made, imported into ZBrush, and sculpted. A new model is then made, broken into pieces, and the pieces are imported separately into ZBrush for normal map projection. A naive import of the pieces will result in them having scales different from the sculpted model. The fix here is the same as the fix for the previous workflow case, and is described later in this page.

Aligning Rotations

The fastest tool for aligning mismatched rotations is the Tool:Preview subpalette. When opened, it displays the current tool in its current global orientation, with the z-axis going straight into the screen. By dragging anywhere on the image except the small red cross, you can rotate the preview (the dark plane is the xy plane); and by holding down the Shift key as you rotate, you can force the object to rotate in 90 degree increments. Finally, clicking the Store button will reset the rotation of the x, y, and z planes so that the object's new global orientation is visually the same as the last position youS'd moved it to. The figure below makes this clearer.

Figure: Changing Global Rotations With the Preview Panel
The three images below show (a) the preview of the Polymesh3D star tool, the currently chosen tool; (b) a rotation of the preview image, with the dark xy plane indicating that the rotation of the object in global space has not actually been changed, rather we have just moved our view around in global space; and (c) the same view after clicking the Store button. The xy plane is now face on again, indicating the z-axis is going directly into the screen. We've changed the global orientation of the star so that instead of being flat along the xy plane, it is diagonal to that plane.
(a)
(b)
(c)

This allows you to fix the only rotational problem you're at all likely to encounter, one where the new mesh is flipped or inverted. The follow instructions give both the process and the details of what is going on "behind the scenes":

  1. Choose your original mesh as the current tool, and open the Tool:Preview pane to check the default orientation of the meshDASHthis is not necessarily the rotation that appears onscreen.
  2. Choose the new mesh, and check its orientation in the Preview panel. If it is the same (even if the size is different), nothing more need be done. If it is flipped or rotated by 90 or 180 degrees, hold down the Shift key and drag on the background of the panel to rotate the object until it matches the orientation of the original mesh.
  3. Click the Store button to finalize the rotational alignment.

Aligning Scaling

You may not encounter scaling mismatches, but if you do, the way to fix them is by way of an operation in ZBrush that can be quite useful in other contexts also. When ZBrush imports a model as a new tool, it scales that model to best fit in the ZBrush modeling area. However, when a mesh is imported to replace an existing tool, the mesh is scaled by the same factor that was applied to the tool it is replacing. This can be used to ensure that meshes imported into ZBrush retain their same relative size.

A description of the workflow is the best place to discuss the details:

  1. We begin by assuming that we have a sculpted mesh A with multiple subdivision levels, and an external mesh B that is the same shape as A but with a different topology. If we were to import B directly, we might find that there is a scale mismatch.
  2. Instead, select A and use Tool:Clone to make a copy of A; we'll call this copy C. since C is an exact copy of A, it has the same scale as A.
  3. Now select C, set Tool:Geometry:SDiv to 1, and click Tool:Geometry:Del Higher. This creates a copy of the base mesh of A, with the same scale as A.
  4. With C still selected, use Tool:Import to import B. A new tool will be created from B, replacing C and with the same scaling as C. Since C has the same scaling as A, the new tool will also have the same scaling as A.

In a slightly different scenario, we create the new mesh B, and split it into pieces B1, B2, B3, etc. In this case, we simply create multiple clones C1, C2, and C3 of A, and using the process above, replace C1 with B1, C2 with B2, and C3 with B3.

Settings

There are a number of settings that affect projected normal maps. They are described in the reference section. However, you shouldn't normally need to use them, since ZMapper ships with a large number of predefined configuration files, one of which is likely to be correct for your needs. As of this writing, the files shown below are part of the distribution.

When setting values for projections, note that you cannot incorporate bump maps or cavity shading when creating normal maps via projection. Bump maps can be used when generating the initial normal map, and their effect will then appear in the projection.

Personal tools
Editing ZBrushInfo