Friday, April 1, 2016

Getting Started with ZBrush - For Rhino Users

This post contains the basic information you need to know to begin sculpting with ZBrush. This post is specifically for Rhino users who want to import and sculpt models, then export them as meshes back into Rhino. There are a many tutorials online, but sorting through what's important and reviewing the material can be time consuming. This post is a concise subset of the tools to get you going quickly.

If you work your way through this post you'll be able to do quite a bit in ZBrush. At the end I'll point you to more tutorials to further help you develop your skills.

The ZBrush User Interface

When you first look at the ZBrush user interface it may seem different/complex/confusing. It is different. And it may be complex. But it does not need to be confusing. In fact, you can do quite a bit of detailed sculpting with only a few tools. The user interface is tuned for artists and designers. The workflow in using the program is really excellent and once you get comfortable it it fades into the background. You feel you are sculpting clay rather than interacting with a computer program. So don't be put off by the uniqueness of the UI. It is well worth diving into!

Creating a First Object to Sculpt On

When you first start ZBrush a dialog appears across the top of the screen. This is the LightBox. You can think of it as an asset browser. By assets I mean, objects, textures, materials, brushes, etc. You can use LightBox to quickly load an object to sculpt on. Double-click one of the spheres shown - I'd suggest DefaultDynaWax64.

This replaces the current file with a new sphere, at 64,000 polygons, using a wax material. We'll sculpt this very shortly!

For experience CAD users it may seem strange but ZBrush does not deal in conventional drawing units (inches, mm, etc). Everything is visual - you work by eye. When you finish a model you can scale it to size before exporting it. But inside ZBrush forget about units and drawing with typed coordinate precision. Just sculpt visually and enjoy the freedom.

File Opening / Saving

Working with files is pretty much as expected. To save a project use the File > Save As button. To open a project use the File > Open button.

When you need to start a new document use the Document > New Document button. This will clear the canvas and let you start over.

You can also use LightBox to browse for files to open.

Viewport Navigation

The first thing you need to learn to do is manipulate the viewport; Rotate, Pan and Zoom the view of your model.
  • Rotate: Left-click in an open area (where there isn't an object to sculpt), then drag. The view will rotate. Note: You can hold the Shift-key when you rotate the view. Doing so will snap the model into Front, Back, Left Side, Right Side, Top and Bottom alignments. 
  • Pan: Hold the Alt-key and left-click and drag. The view moves laterally. 
  • Zoom: Follow this sequence: 1) Hold the Alt-key, 2) Left-click and hold, 3) Release the Alt-key, 4) Drag. This zooms in and out. You have to keep the left click held as you release the Alt-key. 
These may seem strange at first (especially Zoom!), but once you get used to them they become quite natural and fluid. So spend some time early practicing these and getting comfortable.

You can press the F key to "Zoom Extents". You can press Shift+F to toggle wireframe display on and off. And don't forget using Shift with rotate to lock into the orthogonal views.

Common and Useful Sculpting Tools

The choice of which brushes to use in ZBrush is key to effective sculpting. When you click the Brush icon you are presented with a large palette of loaded brushes:

There are many to choose from but you can do a great deal with just a few. Before you can use the brushes effectively there are a few controls you need to be aware of and adjust as you work the brushes. A convenient way to access these controls is by pressing the Spacebar. This menu appears:

These most important control in here are:
  • Draw Size: Sets the size of all brush strokes or editing actions. The draw size is shown as the outer circle when you hover over your sculpt. Adjust this often - making the brush the proper size is key to getting good results. 
  • Focal Shift: This shifts the affect of the tool closer to the center or away from the center. This size is shown as the inner circle. 
  • Z Intensity: Sets the amount of depth information of the current tool. The higher the intensity the greater the effect of the sculpting tool. If you find the tool is too sensitive (particularly on low resolution models) turn this way down. 
With those settings understood you can get to sculpting. Here are the most common brushes I work with. Try them out on the sphere you loaded as you read about them below. 



Move Topological: Moves vertices on the mesh around without affecting those not directly attached to the brush area. Coupled with sizing the brush and focal shift I use this all the time to adjust the sculpt.


Clay Buildup: Very useful for building up layers of virtual clay. This brush will fill in low areas before it builds up higher area. This is kind of like smoothing clay onto the surface - it'll squish into the recesses first. As you stroke back and forth it'll build up. The alpha channel is used so it gives good control of how the stroke falls off. Note: You can hold the Alt-key to reverse the effect and have the tool push into the surface rather than build out from it.


Smooth: Takes a rough surface and smooths it out by averaging the level of the surface. I usually turn the intensity way down to make the effect more controllable. Important Note: Simply press the Shift-key to activate this mode. You don't need to change tools to do so.


Inflate: Expands an area of the sculpt by pushing vertices along their normals. Great for adding volume to a feature which is too small. It can also be used to deflate - pushing the sculpt in the opposite direction. The Alt-key works here to invert the effect.


Slash3: This brush is used to cut into a surface to create a tight crease or slash. I find the default intensity too high so consider turning it down. The brush size has an important impact on this brush's effect so experiment with the size as well. As usual you can hold the Alt-key to pull out a "slash" stroke.


Pinch: This brush pulls vertices together effectively pinching the surface along your stroke. The brush optionally allows the verts to be pulled up or pushed down.

You can accomplish a lot of sculpting with just those brushes. I think it's interesting to note that these are the tools available in Sculptris (the simpler, free version of ZBrush).

Alphas

Alphas are grayscale images used to control the deformation of the mesh as you draw out brushstrokes. The brightness of the alpha determines the low areas versus high areas. Dark areas in the image deform the mesh less than bright areas which deform it to the full Z Intensity.

Experiment with a few alphas and you'll quickly get a feel for this.

Stroke

The stroke controls how the mouse or stylus applies the effect of the brush to the sculpt. For example there is a stroke which acts like spray paint. For most use you'll want the Dots or FreeHand stroke active. If you are using alphas to apply detail to your mesh you may want the DragRect stroke. This lets you drag out a rectangular area and the alpha gets applied in that area like a decal.

Experiment with these to test their effect on the mesh.

Note: At times you may find that the back side of a mesh is being deformed by a brush. In thin areas of the sculpt this can happen. Here's an example - the front is sculpted. But the back is pulled forward as well:
 

You can prevent this by enabling the AutoMasking / BackfaceMask button. This is a setting in the Brush menu:

Now when you apply that stroke the faces facing away are unaffected:

Symmetry

It's sometimes desirable to want to work symmetrically. Changes to one side of the objects are mirrored to the other side.

The most common symmetry is easily toggled using the X key. This mirrors about the X axis of the model. For more detailed control of symmetry open the Transform pull-down menu and work with the controls in the Activate Symmetry area:

You can have X, Y, and Z on in any combination. You can also click the (R) button to toggle Radial symmetry and set the RadialCount. Try it - it's lots of fun :)

DynaMesh

This features lets you sculpt away without having to worry about your underlying geometry. You can stretch, pull and manipulate the sculpt in any way you choose. If it becomes too stretched out or low resolution in spots, simply re-dynamesh.

If you started with the DefaultDynaWax64 model then Dynamesh is already on. If not, you can easily turn it on. This feature is in the Geometry panel, in the Dynamesh tab:

Using the Resolution slider you set the number of polygons you desire (in K). So 64 means approximately 64,000 polygons in the regenerated model. If you set the Polish button on the mesh will be smoothed during the remeshing. Then press the DynaMesh button. This will regenerate the model. You only need to press the button once. It stays lit up in orange.

Once DynaMesh is on you simple hold the Ctrl-key then drag downward in an open area of the viewport. This action gives you a newly generated mesh with an even polygon distribution. Do this whenever you feel the mesh is stretched or the topology isn't looking smooth or uniform.

Before - modifications have really stretched the mesh topology:

After - no problem! Ctrl+drag = Fixed:

Masking

Masking is a powerful tool to limit the area of the sculpt that's affected by the brush. To create a mask hold the Ctrl key and "paint" with the brush. The Draw Size and Focal Shift settings apply to masking so set those properly. Masked areas will turn dark gray. If you brush over these areas they remain unaffected by the tool.

The mask usually falls off near the edge so the effect of the mask is softened.

You can hold the Ctrl-key and tap on the mask area to further the softening of the mask. This makes the transition from masked to unmasked even smoother.

You can hold Ctrl+Alt and tap on the mask area to make it tighter:

You can Ctrl+click in an open area of the viewport to invert the mask.

Getting Ready to Export to Rhino

ZBrush supports very high resolution meshes. If you try to export these to Rhino you'll likely overwhelm it! Therefore you need to use the decimation tools to reduce the mesh complexity without dramatically compromising the form. ZBrush has some great tools for this.

Decimation Methods

Decimation refers to rebuilding the mesh with a lower vertex/face count. There are three ways to do this:
  • Dynamesh (discussed above): Nearly instantly regenerate the topology of your mesh with a controlled resolution. But because it is so fast, the topology generated is not as refined as the other methods. For final export use the next two methods. 
  • Decimation Master: This is a plug-in which lets you rapidly experiment with different mesh polygon counts. You pre-process the model once, then you can quickly test out different resolutions of the mesh to get it to your liking. This tool does a remarkably good job. 
  • ZRemesher: This tool lets you create a new polygonal model of your sculpt where you can specify a count of the number of polygons. It quickly retopologizes the model in a manner that follows the surface in a natural way. This method is the slowest, but produces the best results. You also have control over the topology (areas of higher and lower detail) as well as some control over how the edge loops flow. That is not possible in the other methods. So for best results use this method. 

Decimation Master

This is the original plug-in to reduce mesh complexity while maintaining the overall form. It still has advantages, mainly speed in getting results and exploring different mesh resolution settings.

It's available from the pull-down menus: Zplugin > Decimation Master. The interface is shown below:

After you click the UI often disappears. So you have to bring it up repeatedly from the pull-down menus. (Yeah I don't know why either... anyway...)  The process to use it is very simple. First, press the Pre-process All button. This will take a little time as it generates a file to allow you to quickly decimate in the future. A progress bar scrolls across the top of the screen. Once it's done set the number of polygons you desire with the k Polys slider. For example if you want to decimate to 20,000 polygons set the slider to 20. Then press the Decimate All button. ZBrush will rapidly regenerate the model with the desired resolution and the viewport will update. If you are happy with the result you can save the model. If not, bring up the UI again and try a different value and press Decimate All again.

You can also set the % of decimation slider. So 10% will make it much smaller, 90% will only reduce it a little.

It's as easy as that, and the results are really good.

ZRemesher

This is the latest technology from Pixologic. It's easy, fast, and does a amazing job. It's also controllable. You can use Polypaint to control the tesselation adding more detail in areas and less in others. You can also use what are called ZRemesherGuides to control the flow in ZRemesher.

You get to it in the Geometry panel under ZRemesher. Here's the UI:
 

The simplest thing to do is enter a value in the Target Polygons Count slider. 5 is 5,000 polygons. Then press the ZRemesher button. It takes a little time, the progress bar along the top shows the status. When done the model is remeshed.

Extra control is provided by PolyPaint. Enable the Use Polypaint button. Then adjust the ColorDensity slider to paint on specific areas. How PolyPaint affects the density is determined by the color used:

  • Red specifies a higher polygon density within the painted area.
  • Blue specifies a lower polygon density within the painted area.
  • White (no PolyPaint) gives ZRemesher total control over polygon density.

A ColorDensity setting of 2 doubles the polygon density. A a setting of 0.50 halves the density.

You can also use the ZRemesherGuide brush to draw curves on the model which guide the remeshing. This only works if you turn the Curve Strength slider quite high (near 100). Otherwise the normal algorithm takes precedence.

The written documentation is here. Also, this video covers the other controls quite nicely.


Sizing the Model for Export then Exporting

Assuming you have decimated your mesh you are now nearly ready to export. But what about the size of the model? ZBrush doesn't deal with conventional modeling units of feet, meters, etc. However, when you get ready to export your model you can set a size that will be correct on export. You do this Zplugin pull-down menu. Then open the 3D Print Exporter panel:
 

Here you set if you want to export in inches or millimeters. You set one of the X, Y or Z size sliders then press the Update Size Ratios button. This will update the other two to keep the proportions the same. For a sculpt at building scale this notion of inches or mm is kind of small! However, you can easily scale up in Rhino so it's no problem.

Once the size is to your liking you press the STL, VRML, or OBJ buttons to export to that format. Rhino will import all of these formats so you may choose whichever you like.

Importing Rhino Models into ZBrush

Importing into ZBrush means exporting out of Rhino. So let's start there. In Rhino use the File > SaveAs... command.  Use OBJ as the file format. The next image shows the settings to use - underlined are key ones:

You want a polygon mesh, you want the vertices welded, and you want to swap Z and Y. Rhino uses Z up and ZBrush uses Y up. That settings keeps the orientation the same between the two programs.

Inside ZBrush you use the Import button on the Tool palette to bring in your model. After you import you'll have a new tool which is your mesh. You can select that tool and drag it onto the canvas. If you are starting a new document be sure to immediately press the Edit button (or press the T key). This puts you in edit mode so you can use the sculpting brushes to manipulate your model.

Further Learning - Video Tutorials

The following tutorials are also very helpful in developing your ZBrush skills.

First, the ZClassroom has a large library of very well put together, succinct videos.

For hard-edge modeling a fantastic tool is the ZModeler Brush using QMesh. Here's a video on the basics of it's use - be sure to check it out: Poly QMesh. Another video on the ZModeler Brush is more detailed and proceeds at a faster pace. It's really good. If the first one captured your interest be sure to check this one out.