The Embed-Mat Plugin for ZBrush 3
The Embed-Mat Plugin presents a simple way to assign or EMBED materials to your models, subtools and texture maps. To put the Embed-Mat Plugin to best use, you should first understand how materials are handled in ZBrush. Here’s a quick and dirty review of the important Material issues.
Models and Texture Maps
Models are made up of polygons where each individual polygon can have one color and one material assigned to it. In a similar fashion, Texture Maps are made up of pixels where each individual pixel can have one color and one material assigned to it.
But what is really being assigned to the polygon or the pixel is just an index number which then references a table with an entry describing the material assigned to it. The render engine looks at each polygon or pixel and, based on the number it finds there, renders the appropriate material from the library onto your screen.
By default, when you create a new model, all its polygons are automatically assigned material index zero. A new texture map will also have material index zero assigned to each of its pixels.
Material Index Zero
Material index zero, named Flat Color, is both unique and a little weird (sometimes difficult to understand).
-
The Flat Color located at material index zero is the only one that cannot be replaced by a custom material. It will always be Flat Color.
-
When you pick any other material from the material table, material index zero temporarily ASSUMES the identity of the chosen material, even though the embedded index number for the model polygons or texture map pixels remains zero.
-
Each time you click on another material, those polygons or pixels embedded with material index zero ASSUME that new material appearance.
In other words, Material Index zero acts like a chamelion and is ALWAYS DYNAMIC OR “LIVE”. (note that two of the buttons on the Embed-Mat menu will cause the model, subtool or the texture map to blink if material index 0 is still assigned to it!)
If you want to permanently assign any other material (above index zero) to a model or texture map you need to EMBED the new material’s index number in the model polygons or texture map pixels.
Normally, to embed a model you first select a material from the table, then press the Draw:M button and finally, press the Fill Object button in the Color Menu.
To embed a texture map by hand is a little more complicated. One quick way is to select Plane3d, convert it to a PolyMesh3d model and display it on canvas in edit mode. Choose the material (you want to embed in the texture map) and embed it in the PolyMesh3d (as explained above). Next, choose the texture map you want to embed so it is displayed on the Plane3d. Click the Draw:M button. And finally, click the Tool>Texture>Col>txr button.
After embedding your model or your texture map with a new material, they will no longer change material appearance when you choose another material.
The Embed-Mat plugin
This plugin makes the embedding process for models and texture maps simple. As a bonus, it makes assigning different materials to different, individual subtools simple as well. The Embed-Mat menu (shown above) offers different options depending on whether the current model has multiple subtools and on whether you have a texture map selected or not. It’s easy to use but some of the extra features need a bit more explaining.
The above menu information is divided into three parts: The dark part at the top tells you what material you’ve chosen. Under that are stats describing which model you’ve chosen and the name of the texture map (if one has been selected). Finally is a set of buttons whose functionality is explained by their labeling.
One of the sub-menus, Embed SubTools - Your Choice, has special buttons as explained below.
[attach=73889]embed your choice2.jpg[/attach]
First you should know that when you install the Embed-Mat plugin you will also be asked to install five custom materials into the ZStartup/Materials folder. The five new materials are named “Custom1” through “Custom5”.
When you choose this menu, you are stepped through all of the subtools, one by one, and offered a choice of what material to embed in each. As a material is chosen, you will see the subtool updated with that material. So, here is what the buttons do:
The Embed Button - this will embed the material named at the top of the menu in white text.
The Skip Button - lets you bypass the current subtool without assigning a material.
The Exit Button - lets you abort the subtool material menu and return to the main Embed-Mat menu.
The five Color Buttons - Each of these buttons represents one of the five custom material slots. The index numbers you see listed on the buttons might be different from what you see here but that doesn’t matter. Each material is unique and, once assigned, any other custom material can be loaded into that index slot and will display on your model’s subtool.
(NOTE: one additional comment on the custom materials: If you have your own favorite materials that you’d like to use for embedding, you can remove the original custom materials, then name and load your own material files as custom01.zmt through custom05.zmt into the ZStartup/Materials folder.)
You can see that the demo-soldier’s subtools have all been assigned different custom materials through this sub-menu.
Installing Embed-Mat
The Embed-Mat.zip file contains six files. Place them in the following folders.
Place this file in the ZStartup/ZPlugs folder
Embed-Mat.zsc
Place these five files in the ZStartup/Materials folder
- custom01.ZMT
- custom02.ZMT
- custom03.ZMT
- custom04.ZMT
- custom05.ZMT
When you restart ZBrush, a new button called Embed-Mat will appear in the ZPlugin menu under the Svengali group. Drag this button to your custom interface and update the interface.
The ZBrush Materials Palette now shows the five new custom materials added for use by Embed-Mat. These five custom material slots can be used any time you need to load some customized material file into an unused slot.
[attach=73890]material select14.jpg[/attach]
I strongly suggest that if you decide to use the Embed-Mat plugin you first experiment with the demo soldier and its subtools to see how it works. If anyone has any questions or problems, please post in this thread. Once again I’d like to thank Marcus_civis for his help in testing and debugging this plugin.
Sven